diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index a74e4a42..29caec43 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -93,6 +93,9 @@ class SOAPViewModel extends BaseViewModel { bool isAddProgress = true; String progressNoteText =""; + String complaintsControllerError = ''; + String medicationControllerError = ''; + String illnessControllerError = ''; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 5971fb6f..25269b2e 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -55,9 +55,7 @@ class _UpdateSubjectivePageState extends State TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); TextEditingController medicationController = TextEditingController(); - String complaintsControllerError = ''; - String medicationControllerError = ''; - String illnessControllerError = ''; + final formKey = GlobalKey(); List myAllergiesList = List(); List myHistoryList = List(); @@ -95,7 +93,8 @@ class _UpdateSubjectivePageState extends State id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( + MySelectedHistory mySelectedHistory = + SoapUtils.generateMySelectedHistory( history: history, isChecked: element.isChecked, remark: element.remarks, @@ -110,7 +109,8 @@ class _UpdateSubjectivePageState extends State id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( + MySelectedHistory mySelectedHistory = + SoapUtils.generateMySelectedHistory( history: history, isChecked: element.isChecked, remark: element.remarks, @@ -125,7 +125,8 @@ class _UpdateSubjectivePageState extends State id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( + MySelectedHistory mySelectedHistory = + SoapUtils.generateMySelectedHistory( history: history, isChecked: element.isChecked, remark: element.remarks, @@ -140,7 +141,8 @@ class _UpdateSubjectivePageState extends State id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( + MySelectedHistory mySelectedHistory = + SoapUtils.generateMySelectedHistory( history: history, isChecked: element.isChecked, remark: element.remarks, @@ -209,7 +211,10 @@ class _UpdateSubjectivePageState extends State model.setSubjectiveCallBack(this); GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( - admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN, + admissionNo: widget.patientInfo.admissionNo == null + ? 0 + : int.parse(widget.patientInfo.admissionNo), + patientMRN: widget.patientInfo.patientMRN, appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), episodeId: widget.patientInfo.episodeNo, @@ -260,9 +265,9 @@ class _UpdateSubjectivePageState extends State complaintsController: complaintsController, illnessController: illnessController, medicationController: medicationController, - complaintsControllerError: complaintsControllerError, - illnessControllerError: illnessControllerError, - medicationControllerError: medicationControllerError, + complaintsControllerError: model.complaintsControllerError, + illnessControllerError: model.illnessControllerError, + medicationControllerError: model.medicationControllerError, ), isExpanded: isChiefExpand, ), @@ -331,9 +336,9 @@ class _UpdateSubjectivePageState extends State formKey.currentState.save(); formKey.currentState.validate(); - complaintsControllerError = ''; - medicationControllerError = ''; - illnessControllerError = ''; + model.complaintsControllerError = ''; + model.medicationControllerError = ''; + model.illnessControllerError = ''; if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length > 25) { @@ -359,18 +364,18 @@ class _UpdateSubjectivePageState extends State } else { setState(() { if (complaintsController.text.isEmpty) { - complaintsControllerError = TranslationBase.of(context).emptyMessage; + model.complaintsControllerError = TranslationBase.of(context).emptyMessage; } else if (complaintsController.text.length < 25) { - complaintsControllerError = + model.complaintsControllerError = TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { - illnessControllerError = TranslationBase.of(context).emptyMessage; + model.illnessControllerError = TranslationBase.of(context).emptyMessage; } if (medicationController.text.isEmpty) { - medicationControllerError = TranslationBase.of(context).emptyMessage; + model.medicationControllerError = TranslationBase.of(context).emptyMessage; } }); @@ -464,7 +469,10 @@ class _UpdateSubjectivePageState extends State if (formKey.currentState.validate()) { PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( - admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN, + admissionNo: widget.patientInfo.admissionNo == null + ? 0 + : int.parse(widget.patientInfo.admissionNo), + patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, chiefComplaint: complaintsController.text,