|
|
|
@ -37,7 +37,8 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
|
|
|
|
|
addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) {
|
|
|
|
|
addPrescriptionForm(context, PrescriptionViewModel model,
|
|
|
|
|
PatiantInformtion patient, prescription) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
context: context,
|
|
|
|
@ -62,7 +63,8 @@ postPrescription(
|
|
|
|
|
String icdCode,
|
|
|
|
|
PatiantInformtion patient,
|
|
|
|
|
String patientType}) async {
|
|
|
|
|
PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
|
|
|
|
|
PostPrescriptionReqModel postProcedureReqModel =
|
|
|
|
|
new PostPrescriptionReqModel();
|
|
|
|
|
List<PrescriptionRequestModel> prescriptionList = List();
|
|
|
|
|
|
|
|
|
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
@ -126,7 +128,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
int strengthChar;
|
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
GlobalKey key =
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
|
|
|
|
|
TextEditingController drugIdController = TextEditingController();
|
|
|
|
|
TextEditingController doseController = TextEditingController();
|
|
|
|
@ -170,7 +173,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
onVoiceText() async {
|
|
|
|
|
new SpeechToText(context: context).showAlertDialog(context);
|
|
|
|
|
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
|
|
|
|
|
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
|
|
|
|
|
bool available = await speech.initialize(
|
|
|
|
|
onStatus: statusListener, onError: errorListener);
|
|
|
|
|
if (available) {
|
|
|
|
|
speech.listen(
|
|
|
|
|
onResult: resultListener,
|
|
|
|
@ -213,7 +217,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> initSpeechState() async {
|
|
|
|
|
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
|
|
|
|
|
bool hasSpeech = await speech.initialize(
|
|
|
|
|
onError: errorListener, onStatus: statusListener);
|
|
|
|
|
print(hasSpeech);
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
}
|
|
|
|
@ -259,13 +264,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
initialChildSize: 0.98,
|
|
|
|
|
maxChildSize: 0.98,
|
|
|
|
|
minChildSize: 0.9,
|
|
|
|
|
builder: (BuildContext context, ScrollController scrollController) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, ScrollController scrollController) {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.65,
|
|
|
|
|
color: Color(0xffF8F8F8),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 12.0, vertical: 10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
@ -287,8 +294,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
onTap: () {
|
|
|
|
@ -296,7 +306,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
visbiltySearch = true;
|
|
|
|
|
},
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
hintText: TranslationBase.of(context).searchMedicineNameHere,
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
controller: myController,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
onFieldSubmitted: (value) {
|
|
|
|
@ -322,9 +333,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
// TODO change it secondary button and add loading
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
title: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.search,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
await searchMedicine(context, model);
|
|
|
|
|
await searchMedicine(
|
|
|
|
|
context, model);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -333,23 +347,44 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
),
|
|
|
|
|
if (myController.text != '')
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.5,
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.5,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
top: 20),
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
itemCount: model.allMedicationList == null
|
|
|
|
|
? 0
|
|
|
|
|
: model.allMedicationList.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
itemCount:
|
|
|
|
|
model.allMedicationList ==
|
|
|
|
|
null
|
|
|
|
|
? 0
|
|
|
|
|
: model
|
|
|
|
|
.allMedicationList
|
|
|
|
|
.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context,
|
|
|
|
|
int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: MedicineItemWidget(
|
|
|
|
|
label: model.allMedicationList[index].description),
|
|
|
|
|
label: model
|
|
|
|
|
.allMedicationList[
|
|
|
|
|
index]
|
|
|
|
|
.description),
|
|
|
|
|
onTap: () {
|
|
|
|
|
model.getItem(itemID: model.allMedicationList[index].itemId);
|
|
|
|
|
visbiltyPrescriptionForm = true;
|
|
|
|
|
model.getItem(
|
|
|
|
|
itemID: model
|
|
|
|
|
.allMedicationList[
|
|
|
|
|
index]
|
|
|
|
|
.itemId);
|
|
|
|
|
visbiltyPrescriptionForm =
|
|
|
|
|
true;
|
|
|
|
|
visbiltySearch = false;
|
|
|
|
|
_selectedMedication = model.allMedicationList[index];
|
|
|
|
|
uom = _selectedMedication.uom;
|
|
|
|
|
_selectedMedication =
|
|
|
|
|
model.allMedicationList[
|
|
|
|
|
index];
|
|
|
|
|
uom = _selectedMedication
|
|
|
|
|
.uom;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
@ -368,53 +403,68 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
_selectedMedication?.description ?? "",
|
|
|
|
|
_selectedMedication?.description ??
|
|
|
|
|
"",
|
|
|
|
|
bold: true,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).orderType,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderType,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
Radio(
|
|
|
|
|
activeColor: Color(0xFFB9382C),
|
|
|
|
|
activeColor:
|
|
|
|
|
Color(0xFFB9382C),
|
|
|
|
|
value: 1,
|
|
|
|
|
groupValue: selectedType,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setSelectedType(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(TranslationBase.of(context).regular),
|
|
|
|
|
Text(TranslationBase.of(context)
|
|
|
|
|
.regular),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.35,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
height: 40,
|
|
|
|
|
validationError: strengthError,
|
|
|
|
|
//height: 40,
|
|
|
|
|
validationError:
|
|
|
|
|
strengthError,
|
|
|
|
|
hintText: 'Strength',
|
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
|
enabled: true,
|
|
|
|
|
controller: strengthController,
|
|
|
|
|
controller:
|
|
|
|
|
strengthController,
|
|
|
|
|
onChanged: (String value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
strengthChar = value.length;
|
|
|
|
|
strengthChar =
|
|
|
|
|
value.length;
|
|
|
|
|
});
|
|
|
|
|
if (strengthChar >= 5) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).only5DigitsAllowedForStrength,
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.only5DigitsAllowedForStrength,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
inputType: TextInputType.numberWithOptions(
|
|
|
|
|
inputType: TextInputType
|
|
|
|
|
.numberWithOptions(
|
|
|
|
|
decimal: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -423,15 +473,23 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.517,
|
|
|
|
|
element: model.itemMedicineListUnit.length == 1
|
|
|
|
|
? model.itemMedicineListUnit[0]
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.510,
|
|
|
|
|
element: model
|
|
|
|
|
.itemMedicineListUnit
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model
|
|
|
|
|
.itemMedicineListUnit[0]
|
|
|
|
|
: units,
|
|
|
|
|
elementError: unitError,
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
hintText: 'Select',
|
|
|
|
|
elementList: model.itemMedicineListUnit,
|
|
|
|
|
hintText: 'Unit',
|
|
|
|
|
elementList: model
|
|
|
|
|
.itemMedicineListUnit,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
units = selectedValue;
|
|
|
|
@ -442,10 +500,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
elementList: model.itemMedicineListRoute,
|
|
|
|
|
element: model.itemMedicineListRoute.length == 1
|
|
|
|
|
elementList:
|
|
|
|
|
model.itemMedicineListRoute,
|
|
|
|
|
element: model.itemMedicineListRoute
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model.itemMedicineListRoute[0]
|
|
|
|
|
: route,
|
|
|
|
|
elementError: routeError,
|
|
|
|
@ -457,40 +519,58 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
route['isDefault'] = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
hintText: TranslationBase.of(context).route,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.route,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.frequency,
|
|
|
|
|
elementError: frequencyError,
|
|
|
|
|
element: frequency,
|
|
|
|
|
elementList: model.itemMedicineList,
|
|
|
|
|
elementList:
|
|
|
|
|
model.itemMedicineList,
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
frequency = selectedValue;
|
|
|
|
|
frequency['isDefault'] = true;
|
|
|
|
|
if (_selectedMedication != null &&
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController.text != null) {
|
|
|
|
|
strengthController.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
|
strength: double.parse(strengthController.text));
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration:
|
|
|
|
|
duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context).doseTime,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.doseTime,
|
|
|
|
|
elementError: doseTimeError,
|
|
|
|
|
element: doseTime,
|
|
|
|
|
elementList: model.medicationDoseTimeList,
|
|
|
|
|
elementList:
|
|
|
|
|
model.medicationDoseTimeList,
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
@ -498,8 +578,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
doseTime = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
if (model.patientAssessmentList.isNotEmpty)
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
if (model
|
|
|
|
|
.patientAssessmentList.isNotEmpty)
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
width: double.infinity,
|
|
|
|
@ -507,25 +589,49 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.29,
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.29,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
model.patientAssessmentList[0].icdCode10ID.toString(),
|
|
|
|
|
indication != null ? indication['name'] : null,
|
|
|
|
|
false),
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication[
|
|
|
|
|
'name']
|
|
|
|
|
: null,
|
|
|
|
|
false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.59,
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.57,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: TextField(
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
model.patientAssessmentList[0].asciiDesc.toString(),
|
|
|
|
|
indication != null ? indication['name'] : null,
|
|
|
|
|
false),
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.asciiDesc
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication[
|
|
|
|
|
'name']
|
|
|
|
|
: null,
|
|
|
|
|
false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
@ -533,47 +639,63 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(context, widget.model),
|
|
|
|
|
onTap: () => selectDate(
|
|
|
|
|
context, widget.model),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).date,
|
|
|
|
|
selectedDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.date,
|
|
|
|
|
selectedDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
element: duration,
|
|
|
|
|
elementError: durationError,
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
elementList: model.medicationDurationList,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.duration,
|
|
|
|
|
elementList:
|
|
|
|
|
model.medicationDurationList,
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
if (_selectedMedication != null &&
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController.text != null) {
|
|
|
|
|
strengthController.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
|
strength: double.parse(strengthController.text),
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text),
|
|
|
|
|
);
|
|
|
|
|
box = model.boxQuintity;
|
|
|
|
|
|
|
|
|
@ -582,38 +704,53 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
hintText: "UOM",
|
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
|
dropDownText: uom != null ? uom : null,
|
|
|
|
|
dropDownText:
|
|
|
|
|
uom != null ? uom : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).boxQuantity,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.boxQuantity,
|
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
|
dropDownText: box != null ? model.boxQuintity.toString() : null,
|
|
|
|
|
dropDownText: box != null
|
|
|
|
|
? model.boxQuintity.toString()
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color:
|
|
|
|
|
HexColor("#CCCCCC"))),
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
TextFields(
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
hintText: TranslationBase.of(context).instruction,
|
|
|
|
|
controller: instructionController,
|
|
|
|
|
hintText: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.instruction,
|
|
|
|
|
controller:
|
|
|
|
|
instructionController,
|
|
|
|
|
//keyboardType: TextInputType.number,
|
|
|
|
|
),
|
|
|
|
|
Positioned(
|
|
|
|
@ -626,51 +763,77 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
size: 35,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
initSpeechState().then((value) => {onVoiceText()});
|
|
|
|
|
initSpeechState().then(
|
|
|
|
|
(value) =>
|
|
|
|
|
{onVoiceText()});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
|
SizeConfig.widthMultiplier * 5),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
color: Color(0xff359846),
|
|
|
|
|
title: TranslationBase.of(context).addMedication,
|
|
|
|
|
title: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.addMedication,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
|
eventCategory: "Add Prescription Form",
|
|
|
|
|
eventAction: "Add Prescription",
|
|
|
|
|
await locator<
|
|
|
|
|
AnalyticsService>()
|
|
|
|
|
.logEvent(
|
|
|
|
|
eventCategory:
|
|
|
|
|
"Add Prescription Form",
|
|
|
|
|
eventAction:
|
|
|
|
|
"Add Prescription",
|
|
|
|
|
);
|
|
|
|
|
if (duration != null &&
|
|
|
|
|
doseTime != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
selectedDate != null &&
|
|
|
|
|
strengthController.text != "") {
|
|
|
|
|
if (_selectedMedication.isNarcotic == true) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
|
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
|
strengthController
|
|
|
|
|
.text !=
|
|
|
|
|
"") {
|
|
|
|
|
if (_selectedMedication
|
|
|
|
|
.isNarcotic ==
|
|
|
|
|
true) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (double.parse(strengthController.text) > 1000.0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"1000 is the MAX for the strength");
|
|
|
|
|
if (double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text) >
|
|
|
|
|
1000.0) {
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
"1000 is the MAX for the strength");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (double.parse(strengthController.text) < 0.0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast("strength can't be zero");
|
|
|
|
|
if (double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text) <
|
|
|
|
|
0.0) {
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
"strength can't be zero");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (formKey.currentState.validate()) {
|
|
|
|
|
if (formKey.currentState
|
|
|
|
|
.validate()) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
openDrugToDrug(model);
|
|
|
|
|
{
|
|
|
|
@ -759,32 +922,52 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (duration == null) {
|
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
durationError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
durationError = null;
|
|
|
|
|
}
|
|
|
|
|
if (doseTime == null) {
|
|
|
|
|
doseTimeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
doseTimeError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
doseTimeError = null;
|
|
|
|
|
}
|
|
|
|
|
if (route == null) {
|
|
|
|
|
routeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
routeError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
routeError = null;
|
|
|
|
|
}
|
|
|
|
|
if (frequency == null) {
|
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
frequencyError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
frequencyError = null;
|
|
|
|
|
}
|
|
|
|
|
if (units == null) {
|
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
unitError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
unitError = null;
|
|
|
|
|
}
|
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
if (strengthController
|
|
|
|
|
.text ==
|
|
|
|
|
"") {
|
|
|
|
|
strengthError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
strengthError = null;
|
|
|
|
|
}
|
|
|
|
@ -834,7 +1017,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown,
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(
|
|
|
|
|
String hintText, String selectedText, bool isDropDown,
|
|
|
|
|
{Icon suffixIcon}) {
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
@ -885,7 +1069,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
child: Column(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
DrugToDrug(widget.patient, getPriscriptionforDrug(widget.prescriptionList, model),
|
|
|
|
|
DrugToDrug(
|
|
|
|
|
widget.patient,
|
|
|
|
|
getPriscriptionforDrug(widget.prescriptionList, model),
|
|
|
|
|
model.patientAssessmentList),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
|
|
|
|
@ -896,23 +1082,28 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
|
|
|
|
|
postPrescription(
|
|
|
|
|
icdCode: model.patientAssessmentList.isNotEmpty
|
|
|
|
|
? model.patientAssessmentList[0].icdCode10ID.isEmpty
|
|
|
|
|
? model.patientAssessmentList[0].icdCode10ID
|
|
|
|
|
.isEmpty
|
|
|
|
|
? "test"
|
|
|
|
|
: model.patientAssessmentList[0].icdCode10ID.toString()
|
|
|
|
|
: model.patientAssessmentList[0].icdCode10ID
|
|
|
|
|
.toString()
|
|
|
|
|
: "test",
|
|
|
|
|
dose: strengthController.text,
|
|
|
|
|
doseUnit: model.itemMedicineListUnit.length == 1
|
|
|
|
|
? model.itemMedicineListUnit[0]['parameterCode'].toString()
|
|
|
|
|
? model.itemMedicineListUnit[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: units['parameterCode'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn: doseTime['id'].toString(),
|
|
|
|
|
model: widget.model,
|
|
|
|
|
duration: duration['id'].toString(),
|
|
|
|
|
frequency: model.itemMedicineList.length == 1
|
|
|
|
|
? model.itemMedicineList[0]['parameterCode'].toString()
|
|
|
|
|
? model.itemMedicineList[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: frequency['parameterCode'].toString(),
|
|
|
|
|
route: model.itemMedicineListRoute.length == 1
|
|
|
|
|
? model.itemMedicineListRoute[0]['parameterCode'].toString()
|
|
|
|
|
? model.itemMedicineListRoute[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: route['parameterCode'].toString(),
|
|
|
|
|
drugId: _selectedMedication.itemId.toString(),
|
|
|
|
|
strength: strengthController.text,
|
|
|
|
@ -931,7 +1122,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPriscriptionforDrug(List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
|
|
|
|
|
getPriscriptionforDrug(
|
|
|
|
|
List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
|
|
|
|
|
var prescriptionDetails = [];
|
|
|
|
|
if (prescriptionList.length > 0) {
|
|
|
|
|
prescriptionList[0].entityList.forEach((element) {
|
|
|
|
|