|
|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
|
|
|
|
|
@ -10,8 +12,6 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_history_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_history_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
|
@ -51,7 +51,41 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
|
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies),
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo);
|
|
|
|
|
|
|
|
|
|
if (model.allergiesList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.Allergies);
|
|
|
|
|
if (model.allergySeverityList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.AllergySeverity);
|
|
|
|
|
await model.getPatientChiefComplaint(generalGetReqForSOAP);
|
|
|
|
|
if (model.chiefComplaintList.isNotEmpty) {
|
|
|
|
|
complaintsController.text =
|
|
|
|
|
model.chiefComplaintList[0].chiefComplaint;
|
|
|
|
|
illnessController.text = model.chiefComplaintList[0].hopi;
|
|
|
|
|
}
|
|
|
|
|
await model.getPatientAllergy(generalGetReqForSOAP);
|
|
|
|
|
if (model.patientAllergiesList.isNotEmpty) {
|
|
|
|
|
model.patientAllergiesList.forEach((element) {
|
|
|
|
|
MasterKeyModel selectedAllergy = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.Allergies,
|
|
|
|
|
id: element.allergyDiseaseId,
|
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
|
MasterKeyModel selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
|
id: element.severity,
|
|
|
|
|
);
|
|
|
|
|
MySelectedAllergy mySelectedAllergy = MySelectedAllergy(
|
|
|
|
|
selectedAllergy: selectedAllergy,
|
|
|
|
|
selectedAllergySeverity: selectedAllergySeverity);
|
|
|
|
|
|
|
|
|
|
widget.myAllergiesList.add(mySelectedAllergy);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
@ -279,45 +313,45 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
formKey.currentState.validate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length>25) {
|
|
|
|
|
// await postChiefComplaint(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 {
|
|
|
|
|
// 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');
|
|
|
|
|
// }
|
|
|
|
|
if (complaintsController.text.isNotEmpty &&
|
|
|
|
|
illnessController.text.isNotEmpty &&
|
|
|
|
|
complaintsController.text.length > 25) {
|
|
|
|
|
await postChiefComplaint(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 {
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
@ -334,22 +368,28 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
//TODO: make static value dynamic
|
|
|
|
|
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM
|
|
|
|
|
.add(ListHisProgNotePatientAllergyDiseaseVM(
|
|
|
|
|
allergyDiseaseId: allergy.selectedAllergy.id,
|
|
|
|
|
allergyDiseaseType: allergy.selectedAllergy.typeId,
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
severity: allergy.selectedAllergySeverity.id,
|
|
|
|
|
remarks: allergy.remark,
|
|
|
|
|
createdBy: 1485,
|
|
|
|
|
//
|
|
|
|
|
createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
editedBy: 1485,
|
|
|
|
|
editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
isChecked: false,
|
|
|
|
|
isUpdatedByNurse: false));
|
|
|
|
|
allergyDiseaseId: allergy.selectedAllergy.id,
|
|
|
|
|
allergyDiseaseType: allergy.selectedAllergy.id,
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
severity: allergy.selectedAllergySeverity.id,
|
|
|
|
|
remarks: allergy.remark,
|
|
|
|
|
createdBy: 4709,
|
|
|
|
|
//
|
|
|
|
|
createdOn: DateTime.now().toIso8601String(),
|
|
|
|
|
//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
editedBy: 4709,
|
|
|
|
|
editedOn: DateTime.now().toIso8601String(),
|
|
|
|
|
//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
isChecked: false,
|
|
|
|
|
isUpdatedByNurse: false));
|
|
|
|
|
});
|
|
|
|
|
await model.patchAllergy(postAllergyRequestModel);
|
|
|
|
|
if (model.patientAllergiesList.isEmpty) {
|
|
|
|
|
await model.postAllergy(postAllergyRequestModel);
|
|
|
|
|
} else {
|
|
|
|
|
await model.patchAllergy(postAllergyRequestModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
helpers.showErrorToast(model.error);
|
|
|
|
|
@ -374,6 +414,14 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
isChecked: false,
|
|
|
|
|
));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.patientAllergiesList.isEmpty) {
|
|
|
|
|
await model.postHistories(postHistoriesRequestModel);
|
|
|
|
|
} else {
|
|
|
|
|
await model.patchHistories(postHistoriesRequestModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await model.patchHistories(postHistoriesRequestModel);
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
|