From 2fbb25de774d48abdfb130a4b021b6a6b8958b6d Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Tue, 26 Nov 2024 10:25:52 +0300 Subject: [PATCH] WD: post physical Examination. --- lib/core/viewModel/SOAP_view_model.dart | 37 ++++++++----------- .../add_details_to_examination_vida_plus.dart | 2 +- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index bab64bde..668e8b7d 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -148,7 +148,9 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.auditDiagnosislist; List get speciality => _SOAPService.generalSpeciality; - List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; + + List get progressNote => + _SOAPService.patientProgressNoteListVidaPlus; Map> get specialityDetails => _SOAPService.specialityDetails; @@ -1179,11 +1181,16 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postPhysicalExamination(PatiantInformtion patientInfo, - List physicalExamination) async { + Future postPhysicalExamination(PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); - bool result = await _SOAPService.postPhysicalExamination( - patientInfo, physicalExamination); + List mappedItems = []; + for (List category in specialityDetails.values) { + var selectedCategory = + category.where((value) => value.isSelected == true); + mappedItems.addAll(selectedCategory); + } + bool result = + await _SOAPService.postPhysicalExamination(patientInfo, mappedItems); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1203,9 +1210,11 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void getSpecialityDetails(String speciality,int? specialityId, PatiantInformtion patientInfo) async { + void getSpecialityDetails(String speciality, int? specialityId, + PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); - await _SOAPService.getSpecialityDetails(speciality,specialityId, patientInfo); + await _SOAPService.getSpecialityDetails( + speciality, specialityId, patientInfo); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1221,20 +1230,6 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.showAuditBottomSheet = status; } - /** - * todo as physical examination is having some issue and under discussion - */ - void savePhysicalexamination() { - var mappedItems = - setState(ViewState.BusyLocal); - // await _SOAPService.getSpecialityDetails(speciality); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - void getProgressNote(PatiantInformtion patientInformation) async { setState(ViewState.BusyLocal); await _SOAPService.getProgressNoteNew(patientInformation); diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart index 013d841e..fe9bcf38 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart @@ -112,7 +112,7 @@ class _AddDetailsToExaminationVidaPlusState fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { - model.savePhysicalexamination(); + model.postPhysicalExamination(widget.patientInfo,); }, ), ),