|
|
|
@ -84,7 +84,7 @@ postPrescription(
|
|
|
|
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
|
|
|
|
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
|
|
|
|
await model!.postPrescription(postProcedureReqModel, patient.patientMRN!);
|
|
|
|
await model!.postPrescription(postProcedureReqModel, patient.patientMRN!);
|
|
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
if (model.state == ViewState.Error) {
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
} else if (model.state == ViewState.Idle) {
|
|
|
|
} else if (model.state == ViewState.Idle) {
|
|
|
|
model.getPrescriptions(patient);
|
|
|
|
model.getPrescriptions(patient);
|
|
|
|
@ -112,6 +112,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
String? strengthError;
|
|
|
|
String? strengthError;
|
|
|
|
|
|
|
|
|
|
|
|
late int selectedType;
|
|
|
|
late int selectedType;
|
|
|
|
|
|
|
|
bool isSubmitted = false;
|
|
|
|
|
|
|
|
|
|
|
|
TextEditingController strengthController = TextEditingController();
|
|
|
|
TextEditingController strengthController = TextEditingController();
|
|
|
|
TextEditingController indicationController = TextEditingController();
|
|
|
|
TextEditingController indicationController = TextEditingController();
|
|
|
|
@ -211,7 +212,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
onModelReady: (model) async {
|
|
|
|
onModelReady: (model) async {
|
|
|
|
x = model.patientAssessmentList.map((element) {
|
|
|
|
x = model.patientAssessmentList.map((element) {
|
|
|
|
@ -432,8 +432,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
width: 5.0,
|
|
|
|
width: 5.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.560,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.560,
|
|
|
|
element: units,
|
|
|
|
element: model.itemMedicineListUnit.length == 1
|
|
|
|
|
|
|
|
? units = model.itemMedicineListUnit[0]
|
|
|
|
|
|
|
|
: units,
|
|
|
|
elementError: unitError ?? "",
|
|
|
|
elementError: unitError ?? "",
|
|
|
|
keyName: 'description',
|
|
|
|
keyName: 'description',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
@ -451,8 +454,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
elementList: model.itemMedicineListRoute,
|
|
|
|
elementList: model.itemMedicineListRoute,
|
|
|
|
element: route,
|
|
|
|
element: model.itemMedicineListRoute.length == 1
|
|
|
|
|
|
|
|
? route = model.itemMedicineListRoute[0]
|
|
|
|
|
|
|
|
: route,
|
|
|
|
elementError: routeError ?? "",
|
|
|
|
elementError: routeError ?? "",
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyName: 'description',
|
|
|
|
keyName: 'description',
|
|
|
|
@ -466,9 +472,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
hintText: TranslationBase.of(context).frequency ?? "",
|
|
|
|
hintText: TranslationBase.of(context).frequency ?? "",
|
|
|
|
elementError: frequencyError ?? "",
|
|
|
|
elementError: frequencyError ?? "",
|
|
|
|
element: frequency,
|
|
|
|
element: model.itemMedicineList.length == 1
|
|
|
|
|
|
|
|
? frequency = model.itemMedicineList[0]
|
|
|
|
|
|
|
|
: frequency,
|
|
|
|
elementList: model.itemMedicineList,
|
|
|
|
elementList: model.itemMedicineList,
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyName: 'description',
|
|
|
|
keyName: 'description',
|
|
|
|
@ -492,6 +501,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
hintText: TranslationBase.of(context).doseTime ?? "",
|
|
|
|
hintText: TranslationBase.of(context).doseTime ?? "",
|
|
|
|
elementError: doseTimeError ?? "",
|
|
|
|
elementError: doseTimeError ?? "",
|
|
|
|
element: doseTime,
|
|
|
|
element: doseTime,
|
|
|
|
@ -561,6 +571,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
|
|
|
isSubmitted: isSubmitted,
|
|
|
|
element: duration,
|
|
|
|
element: duration,
|
|
|
|
elementError: durationError ?? "",
|
|
|
|
elementError: durationError ?? "",
|
|
|
|
hintText: TranslationBase.of(context).duration ?? "",
|
|
|
|
hintText: TranslationBase.of(context).duration ?? "",
|
|
|
|
@ -664,7 +675,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
if (_selectedMedication!.isNarcotic == true) {
|
|
|
|
if (_selectedMedication!.isNarcotic == true) {
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
Navigator.pop(context);
|
|
|
|
// Navigator.pop(context);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -766,35 +777,36 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
isSubmitted = true;
|
|
|
|
if (duration == null) {
|
|
|
|
if (duration == null) {
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
durationError = null;
|
|
|
|
durationError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (doseTime == null) {
|
|
|
|
if (doseTime == null) {
|
|
|
|
doseTimeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
doseTimeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
doseTimeError = null;
|
|
|
|
doseTimeError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (route == null) {
|
|
|
|
if (route == null) {
|
|
|
|
routeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
routeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
routeError = null;
|
|
|
|
routeError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (frequency == null) {
|
|
|
|
if (frequency == null) {
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frequencyError = null;
|
|
|
|
frequencyError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (units == null) {
|
|
|
|
if (units == null) {
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired;
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
unitError = null;
|
|
|
|
unitError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
strengthError = null;
|
|
|
|
strengthError = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|