|
|
|
|
@ -34,9 +34,25 @@ class AddDrugWidget extends StatefulWidget {
|
|
|
|
|
final String instruction;
|
|
|
|
|
final DateTime selectedDate;
|
|
|
|
|
|
|
|
|
|
const AddDrugWidget({Key key, this.patient, this.prescriptionList, this.medicineModel,
|
|
|
|
|
this.modelPrescription, this.units, this.route, this.frequency, this.duration, this.doseTime,
|
|
|
|
|
this.uom, this.x, this.selectedMedication, this.strength, this.indication, this.instruction, this.selectedDate}) : super(key: key);
|
|
|
|
|
const AddDrugWidget(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.patient,
|
|
|
|
|
this.prescriptionList,
|
|
|
|
|
this.medicineModel,
|
|
|
|
|
this.modelPrescription,
|
|
|
|
|
this.units,
|
|
|
|
|
this.route,
|
|
|
|
|
this.frequency,
|
|
|
|
|
this.duration,
|
|
|
|
|
this.doseTime,
|
|
|
|
|
this.uom,
|
|
|
|
|
this.x,
|
|
|
|
|
this.selectedMedication,
|
|
|
|
|
this.strength,
|
|
|
|
|
this.indication,
|
|
|
|
|
this.instruction,
|
|
|
|
|
this.selectedDate})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AddDrugWidgetState createState() => _AddDrugWidgetState();
|
|
|
|
|
@ -47,75 +63,84 @@ class _AddDrugWidgetState extends State<AddDrugWidget> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
baseViewModel: widget.medicineModel,
|
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
|
title: TranslationBase.of(context).addMedication),
|
|
|
|
|
appBar:
|
|
|
|
|
BottomSheetTitle(title: TranslationBase.of(context).addMedication),
|
|
|
|
|
body: Container(
|
|
|
|
|
height: SizeConfig.realScreenHeight * .8,
|
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
DrugToDrug(
|
|
|
|
|
widget.patient,
|
|
|
|
|
widget.medicineModel.getPrescriptionForDrug(
|
|
|
|
|
widget.prescriptionList, widget.medicineModel
|
|
|
|
|
),
|
|
|
|
|
widget.medicineModel.patientAssessmentList),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
children: [
|
|
|
|
|
DrugToDrug(
|
|
|
|
|
widget.patient,
|
|
|
|
|
widget.medicineModel.getPrescriptionForDrug(
|
|
|
|
|
widget.prescriptionList, widget.medicineModel),
|
|
|
|
|
widget.medicineModel.patientAssessmentList),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: widget.medicineModel.state == ViewState.BusyLocal || widget.medicineModel.state == ViewState.Busy
|
|
|
|
|
bottomSheet: widget.medicineModel.state == ViewState.BusyLocal ||
|
|
|
|
|
widget.medicineModel.state == ViewState.Busy
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: BottomSheetDialogButton(
|
|
|
|
|
label: TranslationBase.of(context).addMedication,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await widget.medicineModel.postPrescription(
|
|
|
|
|
isLocalBusy: true,
|
|
|
|
|
icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty
|
|
|
|
|
? widget.medicineModel.patientAssessmentList[0].icdCode10ID
|
|
|
|
|
.isEmpty
|
|
|
|
|
? "test"
|
|
|
|
|
: widget.medicineModel.patientAssessmentList[0].icdCode10ID
|
|
|
|
|
.toString()
|
|
|
|
|
: "test",
|
|
|
|
|
dose: widget.strength,
|
|
|
|
|
doseUnit: widget.medicineModel.itemMedicineListUnit.length == 1
|
|
|
|
|
? widget.medicineModel.itemMedicineListUnit[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.units['parameterCode'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn: widget.doseTime['id'].toString(),
|
|
|
|
|
model: widget.modelPrescription,
|
|
|
|
|
duration: widget.duration['id'].toString(),
|
|
|
|
|
frequency: widget.medicineModel.itemMedicineList.length == 1
|
|
|
|
|
? widget.medicineModel.itemMedicineList[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.frequency['parameterCode'].toString(),
|
|
|
|
|
route: widget.medicineModel.itemMedicineListRoute.length == 1
|
|
|
|
|
? widget.medicineModel.itemMedicineListRoute[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.route['parameterCode'].toString(),
|
|
|
|
|
drugId: widget.selectedMedication.itemId.toString(),
|
|
|
|
|
strength: widget.strength,
|
|
|
|
|
indication: widget.indication,
|
|
|
|
|
instruction: widget.instruction,
|
|
|
|
|
doseTime: widget.selectedDate,
|
|
|
|
|
);
|
|
|
|
|
if (widget.medicineModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Helpers.showErrorToast(widget.medicineModel.error);
|
|
|
|
|
} else if (widget.modelPrescription.state == ViewState.Idle) {
|
|
|
|
|
widget.modelPrescription.getPrescriptions(widget.patient);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).medicationHasBeenAdded);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
label: TranslationBase.of(context).addMedication,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await widget.medicineModel.postPrescription(
|
|
|
|
|
isLocalBusy: true,
|
|
|
|
|
icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty
|
|
|
|
|
? widget.medicineModel.patientAssessmentList[0]
|
|
|
|
|
.icdCode10ID.isEmpty
|
|
|
|
|
? "test"
|
|
|
|
|
: widget.medicineModel.patientAssessmentList[0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.toString()
|
|
|
|
|
: "test",
|
|
|
|
|
dose: widget.strength,
|
|
|
|
|
doseUnit:
|
|
|
|
|
widget.medicineModel.itemMedicineListUnit.length == 1
|
|
|
|
|
? widget.medicineModel
|
|
|
|
|
.itemMedicineListUnit[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.units['parameterCode'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn: widget.doseTime['id'].toString(),
|
|
|
|
|
model: widget.modelPrescription,
|
|
|
|
|
duration: widget.duration['id'].toString(),
|
|
|
|
|
frequency: widget.medicineModel.itemMedicineList.length == 1
|
|
|
|
|
? widget
|
|
|
|
|
.medicineModel.itemMedicineList[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.frequency['parameterCode'].toString(),
|
|
|
|
|
route: widget.medicineModel.itemMedicineListRoute.length == 1
|
|
|
|
|
? widget.medicineModel
|
|
|
|
|
.itemMedicineListRoute[0]['parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: widget.route['parameterCode'].toString(),
|
|
|
|
|
drugId: widget.selectedMedication.itemId.toString(),
|
|
|
|
|
strength: widget.strength,
|
|
|
|
|
indication: widget.indication,
|
|
|
|
|
instruction: widget.instruction,
|
|
|
|
|
doseTime: widget.selectedDate,
|
|
|
|
|
);
|
|
|
|
|
if (widget.medicineModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Helpers.showErrorToast(widget.medicineModel.error);
|
|
|
|
|
} else if (widget.modelPrescription.state == ViewState.Idle) {
|
|
|
|
|
await widget.modelPrescription.getPrescriptionListNew(
|
|
|
|
|
appNo: widget.patient.appointmentNo,
|
|
|
|
|
mrn: widget.patient.patientMRN,
|
|
|
|
|
isLocalBusy: true);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
TranslationBase.of(context).medicationHasBeenAdded);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|