diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index c16c5959..78c309ca 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -457,7 +457,6 @@ class SOAPViewModel extends BaseViewModel { } else { patient.episodeNo = _SOAPService.episodeID; setState(ViewState.Idle); - } } @@ -584,4 +583,258 @@ class SOAPViewModel extends BaseViewModel { } else return -1; } + + onUpdateSubjectStepStart(PatiantInformtion patientInfo) async { + GetChiefComplaintReqModel getChiefComplaintReqModel = + GetChiefComplaintReqModel( + admissionNo: + patientInfo + .admissionNo != + null + ? int.parse(patientInfo.admissionNo) + : null, + patientMRN: patientInfo.patientMRN, + appointmentNo: patientInfo.appointmentNo != null + ? int.parse(patientInfo.appointmentNo.toString()) + : null, + episodeId: patientInfo.episodeNo, + episodeID: patientInfo.episodeNo, + doctorID: ''); + var services = [ + _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel) + ]; + + if (patientInfo.admissionNo == null) { + complaintsControllerError = ''; + medicationControllerError = ''; + illnessControllerError = ''; + GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo.toString(), + appointmentNo: int.parse(patientInfo.appointmentNo.toString()), + doctorID: '', + editedBy: ''); + services.add( + _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true)); + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: int.parse(patientInfo.appointmentNo.toString()), + doctorID: '', + editedBy: ''); + + services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP)); + } + + final results = await Future.wait(services); + await callServicesAfterGetPatientInfoForUpdateSubject(); + } + + callServicesAfterGetPatientInfoForUpdateSubject() async { + var services; + if (patientHistoryList.isNotEmpty) { + if (historyFamilyList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)); + } + } + if (historyMedicalList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)); + } + if (historySurgicalList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)); + } + if (historySportList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistorySports) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistorySports)); + } + } + + if (patientAllergiesList.isNotEmpty) { + if (allergiesList.isEmpty) if (services == null) { + services = [_SOAPService.getMasterLookup(MasterKeysService.Allergies)]; + } else + services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies)); + if (allergySeverityList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)); + } + } + + final results = await Future.wait(services ?? []); + + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + onAddMedicationStart() async { + setState(ViewState.Busy); + var services; + if (medicationStrengthList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)); + } + } + if (medicationFrequencyList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency) + ]; + } else { + services.add(_SOAPService.getMasterLookup( + MasterKeysService.MedicationFrequency)); + } + } + if (medicationDoseTimeList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)); + } + } + if (medicationRouteList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)); + } + } + if (allMedicationList.length == 0) { + await getMedicationList(); + if (services == null) { + services = [ + _prescriptionService.getMedicationList() + ]; + } else { + services.add( + _prescriptionService.getMedicationList()); + } + } + + final results = await Future.wait(services ?? []); + + if (_SOAPService.hasError ||_prescriptionService.hasError ) { + error = _SOAPService.error + _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + callAddAssessmentLookupsServices({bool allowSetState = true}) async { + if(allowSetState) + setState(ViewState.Busy); + var services; + if (listOfDiagnosisCondition.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)); + } + } + if (listOfDiagnosisType.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType) + ]; + } else { + services.add(_SOAPService.getMasterLookup( + MasterKeysService.DiagnosisType)); + } + } + if (listOfICD10.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.ICD10) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.ICD10)); + } + } + + final results = await Future.wait(services ?? []); + if(allowSetState) { + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + } + + onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async { + + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: + int.parse(patientInfo.appointmentNo.toString())); + + var services = [ + _SOAPService.getPatientAssessment(getAssessmentReqModel) + ]; + + final results = await Future.wait(services); + + + if (patientAssessmentList.isNotEmpty) { + await callAddAssessmentLookupsServices(allowSetState: false); + } + + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + + } } diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index ed2a2d74..a0cdb39c 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -18,14 +18,12 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class AddAssessmentDetails extends StatefulWidget { @@ -121,15 +119,9 @@ class _AddAssessmentDetailsState extends State { heightFactor: 1, child: BaseView( onModelReady: (model) async { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - if (model.listOfICD10.length == 0) { - await model.getMasterLookup(MasterKeysService.ICD10); - } + + model.callAddAssessmentLookupsServices(); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 439cb61a..80cdc34c 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/config/size_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/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -16,9 +15,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../shared_soap_widgets/SOAP_open_items.dart'; @@ -58,24 +55,10 @@ class _UpdateAssessmentPageState extends State onModelReady: (model) async { model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: '', - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString())); - await model.getPatientAssessment(getAssessmentReqModel); + + await model.onUpdateAssessmentStepStart(widget.patientInfo); + if (model.patientAssessmentList.isNotEmpty) { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - if (model.listOfICD10.length == 0) { - await model.getMasterLookup(MasterKeysService.ICD10); - } model.patientAssessmentList.forEach((element) { MasterKeyModel diagnosisType = model.getOneMasterKey( masterKeys: MasterKeysService.DiagnosisType, diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 5ce4250a..42b94656 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/size_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'; @@ -9,10 +8,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'examinations_list_search_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 384aff90..9dd00302 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ExaminationItemCard extends StatelessWidget { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 576c52c3..9712eafd 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -3,10 +3,9 @@ import 'package:doctor_app_flutter/config/size_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/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -15,10 +14,8 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_open_items.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index d32634b2..37a6096e 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -2,7 +2,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.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/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; @@ -16,10 +15,8 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 8c68a61e..60c43d00 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -9,10 +9,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'master_key_checkbox_search_allergies_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index f663d92e..b10d831d 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -8,11 +8,9 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'priority_bar.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index 33e7fcd1..e00a83f5 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../shared_soap_widgets/SOAP_open_items.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 67c1df55..553c2f17 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -13,13 +13,11 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; @@ -58,23 +56,7 @@ class _AddMedicationState extends State { return FractionallySizedBox( child: BaseView( onModelReady: (model) async { - if (model.medicationStrengthList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationStrength, - ); - } - if (model.medicationFrequencyList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationFrequency); - } - if (model.medicationDoseTimeList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationDoseTime); - } - if (model.medicationRouteList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationRoute); - } - if (model.allMedicationList.length == 0) - await model.getMedicationList(); + model.onAddMedicationStart(); }, builder: (_, model, w) => AppScaffold( 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 bf3e0988..72579790 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 @@ -3,15 +3,13 @@ import 'package:doctor_app_flutter/config/size_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/ChiefComplaint/GetChiefComplaintReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -20,9 +18,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjecti import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; @@ -57,33 +53,7 @@ class _UpdateSubjectivePageState extends State implements getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); - - model.complaintsControllerError = ''; - model.medicationControllerError = ''; - model.illnessControllerError = ''; - GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); - - await model.getPatientHistories(getHistoryReqModel, isFirst: true); - if (model.patientHistoryList.isNotEmpty) { - if (model.historyFamilyList.isEmpty) { - await model.getMasterLookup(MasterKeysService.HistoryFamily); - } - if (model.historyMedicalList.isEmpty) { - await model.getMasterLookup(MasterKeysService.HistoryMedical); - } - if (model.historySurgicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySurgical); - } - if (model.historySportList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySports); - } - model.patientHistoryList.forEach((element) { if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( @@ -138,17 +108,8 @@ class _UpdateSubjectivePageState extends State implements } getAllergies(SOAPViewModel model) async { - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP); - if (model.patientAllergiesList.isNotEmpty) { - if (model.allergiesList.isEmpty) await model.getMasterLookup(MasterKeysService.Allergies); - if (model.allergySeverityList.isEmpty) await model.getMasterLookup(MasterKeysService.AllergySeverity); + if (model.patientAllergiesList.isNotEmpty) { model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); @@ -183,16 +144,8 @@ class _UpdateSubjectivePageState extends State implements myAllergiesList.clear(); myHistoryList.clear(); model.setSubjectiveCallBack(this); - GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( - admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, - patientMRN: widget.patientInfo.patientMRN, - appointmentNo: widget.patientInfo.appointmentNo != null - ? int.parse(widget.patientInfo.appointmentNo.toString()) - : null, - episodeId: widget.patientInfo.episodeNo, - episodeID: widget.patientInfo.episodeNo, - doctorID: ''); - await model.getPatientChiefComplaint(getChiefComplaintReqModel); + await model.onUpdateSubjectStepStart(widget.patientInfo); + if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 07c8caf7..a6740a2c 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,10 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.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/core/viewModel/doctor_replay_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';