fix things

merge-requests/202/head
Elham Rababah 5 years ago
parent efee00c79e
commit 14955201a9

@ -308,28 +308,34 @@ class _AssessmentPageState extends State<AssessmentPage> {
} }
submitAssessment(SOAPViewModel model) async { submitAssessment(SOAPViewModel model) async {
PostAssessmentRequestModel postAssessmentRequestModel = if (widget.mySelectedAssessment.selectedDiagnosisCondition != null &&
new PostAssessmentRequestModel( widget.mySelectedAssessment.selectedDiagnosisType != null) {
patientMRN: 3120690, PostAssessmentRequestModel postAssessmentRequestModel =
episodeId: 200012117, new PostAssessmentRequestModel(
appointmentNo: 2016054573, patientMRN: 3120690,
icdCodeDetails: [new IcdCodeDetails( episodeId: 200012117,
remarks: widget.mySelectedAssessment.remark, appointmentNo: 2016054573,
complexDiagnosis: true, icdCodeDetails: [
conditionId: widget.mySelectedAssessment.selectedDiagnosisCondition.id, new IcdCodeDetails(
diagnosisTypeId: widget.mySelectedAssessment.selectedDiagnosisType.id , remarks: widget.mySelectedAssessment.remark,
icdcode10Id: "1" complexDiagnosis: true,
)] conditionId:
); widget.mySelectedAssessment.selectedDiagnosisCondition.id,
diagnosisTypeId:
widget.mySelectedAssessment.selectedDiagnosisType.id,
icdcode10Id: "1")
]);
await model.postAssessment(postAssessmentRequestModel); await model.postAssessment(postAssessmentRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
} else {
widget.changePageViewIndex(3);
}
} else { } else {
widget.changePageViewIndex(3); helpers.showErrorToast('Please add required field correctly');
} }
} }
openAssessmentDialog(BuildContext context) { openAssessmentDialog(BuildContext context) {

@ -352,11 +352,12 @@ class _ObjectivePageState extends State<ObjectivePage> {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
} else { } else {
widget.changePageViewIndex(2);
} }
} else {
helpers.showErrorToast('Please add required field correctly');
} }
// TODO move it back to else stat when it work.
widget.changePageViewIndex(2);
} }

@ -277,13 +277,45 @@ class _SubjectivePageState extends State<SubjectivePage> {
{SOAPViewModel model, {SOAPViewModel model,
List<MySelectedAllergy> myAllergiesList, List<MySelectedAllergy> myAllergiesList,
List<MasterKeyModel> myHistoryList}) async { List<MasterKeyModel> myHistoryList}) async {
await postChiefComplaint(model: model); formKey.currentState.save();
if (myHistoryList.length != 0) formKey.currentState.validate();
await postHistories(model: model, myHistoryList: myHistoryList); if(complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length>25) {
if (myAllergiesList.length != 0) await postChiefComplaint(model: model);
await postAllergy(myAllergiesList: myAllergiesList, model: model); if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
if (myAllergiesList.length != 0) {
await postAllergy(myAllergiesList: myAllergiesList, model: model);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
widget.changePageViewIndex(1);
}
}
}
} else {
if (myAllergiesList.length != 0) {
await postAllergy(myAllergiesList: myAllergiesList, model: model);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
widget.changePageViewIndex(1);
}
} else {
widget.changePageViewIndex(1);
}
}
}
} else {
helpers.showErrorToast('Please add required field correctly');
}
widget.changePageViewIndex(1);
} }
postAllergy( postAllergy(
@ -362,9 +394,6 @@ class _SubjectivePageState extends State<SubjectivePage> {
await model.postChiefComplaint(postChiefComplaintRequestModel); await model.postChiefComplaint(postChiefComplaintRequestModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
}
} }
} }

Loading…
Cancel
Save