updating prescription after backend fix

merge-requests/321/head
hussam al-habibeh 4 years ago
parent ae17998e0a
commit f32d25b007

@ -47,7 +47,7 @@ class PrescriptionRequestModel {
int itemId; int itemId;
String doseStartDate; String doseStartDate;
int duration; int duration;
int dose; double dose;
int doseUnitId; int doseUnitId;
int route; int route;
int frequency; int frequency;

@ -61,7 +61,7 @@ postProcedure(
sss.add(PrescriptionRequestModel( sss.add(PrescriptionRequestModel(
covered: true, covered: true,
dose: int.parse(dose), dose: double.parse(dose),
itemId: drugId.isEmpty ? 1 : int.parse(drugId), itemId: drugId.isEmpty ? 1 : int.parse(drugId),
doseUnitId: int.parse(doseUnit), doseUnitId: int.parse(doseUnit),
route: route.isEmpty ? 1 : int.parse(route), route: route.isEmpty ? 1 : int.parse(route),
@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0.550, 0.550,
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter( // LengthLimitingTextInputFormatter(
4), // 4),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -767,16 +767,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
"Please Fill All Fields"); "Please Fill All Fields");
return; return;
} }
if (int.parse( if (double.parse(
strengthController.text) > strengthController.text) >
1000) { 1000.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength"); "1000 is the MAX for the strength");
return; return;
} }
if (int.parse( if (double.parse(
strengthController.text) == strengthController.text) ==
0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "Streangth can't be zero");
return; return;

@ -703,16 +703,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
title: 'update prescription' title: 'update prescription'
.toUpperCase(), .toUpperCase(),
onPressed: () { onPressed: () {
if (int.parse( if (double.parse(
strengthController.text) > strengthController.text) >
1000) { 1000.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength"); "1000 is the MAX for the strength");
return; return;
} }
if (int.parse(strengthController if (double.parse(
strengthController
.text) == .text) ==
0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "Streangth can't be zero");
return; return;
@ -872,8 +873,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
sss.add(PrescriptionRequestModel( sss.add(PrescriptionRequestModel(
covered: true, covered: true,
dose: newDoseStreangth.isNotEmpty dose: newDoseStreangth.isNotEmpty
? int.parse(newDoseStreangth) ? double.parse(newDoseStreangth)
: int.parse(doseStreangth), : double.parse(doseStreangth),
//frequency.isNotEmpty ? int.parse(dose) : 1, //frequency.isNotEmpty ? int.parse(dose) : 1,
itemId: drugId, itemId: drugId,
doseUnitId: doseUnitId:

@ -25,14 +25,15 @@ postProcedure(
PatiantInformtion patient, PatiantInformtion patient,
List<EntityList> entityList}) async { List<EntityList> entityList}) async {
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
List<Controls> controls = List();
List<Procedures> controlsProcedure = List(); List<Procedures> controlsProcedure = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.appointmentNo = patient.appointmentNo;
postProcedureReqModel.episodeID = patient.episodeNo; postProcedureReqModel.episodeID = patient.episodeNo;
postProcedureReqModel.patientMRN = patient.patientMRN; postProcedureReqModel.patientMRN = patient.patientMRN;
entityList.forEach((element) { entityList.forEach((element) {
List<Controls> controls = List();
controls.add( controls.add(
Controls( Controls(
code: "remarks", code: "remarks",
@ -41,16 +42,13 @@ postProcedure(
controls.add( controls.add(
Controls(code: "ordertype", controlValue: element.type), Controls(code: "ordertype", controlValue: element.type),
); );
});
entityList.forEach((element) {
controlsProcedure.add(Procedures( controlsProcedure.add(Procedures(
category: element.categoryID, category: element.categoryID,
procedure: element.procedureId, procedure: element.procedureId,
controls: controls)); controls: controls));
}); });
postProcedureReqModel.procedures = controlsProcedure;
postProcedureReqModel.procedures = controlsProcedure;
await model.postProcedure(postProcedureReqModel, patient.patientMRN); await model.postProcedure(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {

@ -136,8 +136,8 @@ class _EntityListCheckboxSearchWidgetState
historyInfo.type = historyInfo.type =
setSelectedType(value) setSelectedType(value)
.toString(); .toString();
// historyInfo.type = historyInfo.type =
// value.toString(); value.toString();
}, },
), ),
Text('routine'), Text('routine'),
@ -149,8 +149,8 @@ class _EntityListCheckboxSearchWidgetState
historyInfo.type = historyInfo.type =
setSelectedType(value) setSelectedType(value)
.toString(); .toString();
// historyInfo.type = historyInfo.type =
// value.toString(); value.toString();
}, },
), ),
Text(TranslationBase.of(context) Text(TranslationBase.of(context)

@ -91,7 +91,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
builder: builder:
(BuildContext context, ProcedureViewModel model, Widget child) => (BuildContext context, ProcedureViewModel model, Widget child) =>
NetworkBaseView( NetworkBaseView(
baseViewModel: widget.model, baseViewModel: model,
child: DraggableScrollableSheet( child: DraggableScrollableSheet(
minChildSize: 0.90, minChildSize: 0.90,
initialChildSize: 0.95, initialChildSize: 0.95,
@ -310,12 +310,16 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
updateProcedureReqModel.lineItemNo = 1; updateProcedureReqModel.lineItemNo = 1;
updateProcedureReqModel.orderNo = orderNo; updateProcedureReqModel.orderNo = orderNo;
entityList.forEach((element) {
controls.add( controls.add(
Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), Controls(
code: "remarks",
controlValue: element.remarks.isNotEmpty ? element.remarks : ""),
); );
controls.add( controls.add(
Controls(code: "ordertype", controlValue: "1"), Controls(code: "ordertype", controlValue: '1'),
); );
});
entityList.isNotEmpty entityList.isNotEmpty
? entityList.forEach((element) { ? entityList.forEach((element) {

Loading…
Cancel
Save