return the function code back

merge-requests/787/head
Elham Rababh 3 years ago
parent 8147d20fc6
commit 6db5191e07

@ -363,8 +363,8 @@ class SOAPViewModel extends BaseViewModel {
GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
appointmentNo: int.parse(
episodeID: patientInfo.episodeNo == null?"0":patientInfo.episodeNo.toString(),
appointmentNo: patientInfo.appointmentNo == null ?0:int.parse(
patientInfo.appointmentNo.toString(),
),
);

@ -507,15 +507,13 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> implements
@override
nextFunction(model) {
// TODO Elham*
widget.changePageViewIndex(3);
// if (mySelectedAssessmentList.isEmpty) {
// Helpers.showErrorToast(
// TranslationBase.of(context)
// .assessmentErrorMsg);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(3);
// }
if (mySelectedAssessmentList.isEmpty) {
Helpers.showErrorToast(
TranslationBase.of(context)
.assessmentErrorMsg);
} else {
widget.changeLoadingState(true);
widget.changePageViewIndex(3);
}
}
}

@ -205,75 +205,71 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
}
submitUpdateObjectivePage(SOAPViewModel model) async {
// TODO Elham*
widget.changePageViewIndex(2);
if (mySelectedExamination.isNotEmpty) {
widget.changeLoadingState(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
/// TODO Elham* move this logic to view model
// if (mySelectedExamination.isNotEmpty) {
// widget.changeLoadingState(true);
// Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
//
// DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
// PostPhysicalExamRequestModel postPhysicalExamRequestModel =
// new PostPhysicalExamRequestModel();
// mySelectedExamination.forEach((exam) {
// if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
// null)
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
// [];
// ListHisProgNotePhysicalExaminationVM
// listHisProgNotePhysicalExaminationVM =
// ListHisProgNotePhysicalExaminationVM(
// patientMRN: widget.patientInfo.patientMRN,
// episodeId: widget.patientInfo.episodeNo,
// appointmentNo: widget.patientInfo.appointmentNo,
// remarks: exam.remark ?? '',
// createdBy: exam.createdBy ?? doctorProfile.doctorID,
// createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
// editedBy: doctorProfile.doctorID,
// editedOn: DateTime.now().toIso8601String(),
// examId: exam.selectedExamination.id,
// examType: exam.selectedExamination.typeId,
// isAbnormal: exam.isAbnormal,
// isNormal: exam.isNormal,
// notExamined: exam.notExamined,
// examinationType: exam.isNormal
// ? 1
// : exam.isAbnormal
// ? 2
// : 3,
// examinationTypeName: exam.isNormal
// ? "Normal"
// : exam.isAbnormal
// ? 'AbNormal'
// : "Not Examined",
// isNew: exam.isNew,
// );
// if (widget.patientInfo.admissionNo != null &&
// widget.patientInfo.admissionNo.isNotEmpty) {
// listHisProgNotePhysicalExaminationVM.admissionNo =
// int.parse(widget.patientInfo.admissionNo);
// }
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
// .add(listHisProgNotePhysicalExaminationVM);
// });
//
// if (model.patientPhysicalExamList.isEmpty) {
// await model.postPhysicalExam(postPhysicalExamRequestModel);
// } else {
// await model.patchPhysicalExam(postPhysicalExamRequestModel);
// }
//
// if (model.state == ViewState.ErrorLocal) {
// widget.changeLoadingState(false);
// Helpers.showErrorToast(model.error);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(2);
// }
// } else {
// Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
// }
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel =
new PostPhysicalExamRequestModel();
mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
[];
ListHisProgNotePhysicalExaminationVM
listHisProgNotePhysicalExaminationVM =
ListHisProgNotePhysicalExaminationVM(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo == null?0: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo == null?0:widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal,
notExamined: exam.notExamined,
examinationType: exam.isNormal
? 1
: exam.isAbnormal
? 2
: 3,
examinationTypeName: exam.isNormal
? "Normal"
: exam.isAbnormal
? 'AbNormal'
: "Not Examined",
isNew: exam.isNew,
);
if (widget.patientInfo.admissionNo != null &&
widget.patientInfo.admissionNo.isNotEmpty) {
listHisProgNotePhysicalExaminationVM.admissionNo =
int.parse(widget.patientInfo.admissionNo);
}
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
.add(listHisProgNotePhysicalExaminationVM);
});
if (model.patientPhysicalExamList.isEmpty) {
await model.postPhysicalExam(postPhysicalExamRequestModel);
} else {
await model.patchPhysicalExam(postPhysicalExamRequestModel);
}
if (model.state == ViewState.ErrorLocal) {
widget.changeLoadingState(false);
Helpers.showErrorToast(model.error);
} else {
widget.changeLoadingState(true);
widget.changePageViewIndex(2);
}
} else {
Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
}
}
removeExamination(MasterKeyModel masterKey) {

@ -400,7 +400,6 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
@override
nextFunction(model) {
print("dfdfdf");
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
submitPlan(model);

@ -334,54 +334,50 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) {
await postChiefComplaint(model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
if (myAllergiesList.length != 0) {
await postAllergy(myAllergiesList: myAllergiesList, model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
widget.changeLoadingState(true);
widget.changePageViewIndex(1);
} else {
setState(() {
if (complaintsController.text.isEmpty) {
complaintsControllerError = TranslationBase.of(context).emptyMessage;
} else if (complaintsController.text.length < 25) {
complaintsControllerError =
TranslationBase.of(context).chiefComplaintLength;
}
if (illnessController.text.isEmpty) {
illnessControllerError = TranslationBase.of(context).emptyMessage;
}
///TODO Elham*
///
widget.changePageViewIndex(1);
// if (complaintsController.text.isNotEmpty &&
// illnessController.text.isNotEmpty &&
// complaintsController.text.length > 25) {
// await postChiefComplaint(model: model);
// if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error);
// }
// if (myHistoryList.length != 0) {
// await postHistories(model: model, myHistoryList: myHistoryList);
// if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error);
// }
// }
// if (myAllergiesList.length != 0) {
// await postAllergy(myAllergiesList: myAllergiesList, model: model);
// if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error);
// }
// }
// widget.changeLoadingState(true);
//
// widget.changePageViewIndex(1);
// } else {
// setState(() {
// if (complaintsController.text.isEmpty) {
// complaintsControllerError = TranslationBase.of(context).emptyMessage;
// } else if (complaintsController.text.length < 25) {
// complaintsControllerError =
// TranslationBase.of(context).chiefComplaintLength;
// }
//
// if (illnessController.text.isEmpty) {
// illnessControllerError = TranslationBase.of(context).emptyMessage;
// }
//
// if (medicationController.text.isEmpty) {
// medicationControllerError = TranslationBase.of(context).emptyMessage;
// }
// });
//
// widget.changeLoadingState(false);
// Helpers.showErrorToast(
// TranslationBase.of(context).chiefComplaintErrorMsg);
// }
if (medicationController.text.isEmpty) {
medicationControllerError = TranslationBase.of(context).emptyMessage;
}
});
widget.changeLoadingState(false);
Helpers.showErrorToast(
TranslationBase.of(context).chiefComplaintErrorMsg);
}
}
postAllergy(

Loading…
Cancel
Save