From 4bb68778dc2ef29b7cee1fa96a6bb27bb1ef0635 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Wed, 4 Dec 2024 15:55:12 +0300 Subject: [PATCH] allergies changes --- .../soap/SOAP_service.dart | 18 ++++++++++++++-- lib/core/viewModel/SOAP_view_model.dart | 4 ++-- .../patient_profile_screen.dart | 2 +- .../allergies/update_allergies_widget.dart | 21 ++++++++++++++++++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index dbcc2149..826ca410 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -456,13 +456,15 @@ class SOAPService extends LookupService { } Future addAllergies( - AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async { + AllergiesListVidaPlus allergy, PatiantInformtion patientInfo, bool isNoKnown) async { + if(!isNoKnown){ allergy.allergyReactionDTOs!.forEach((value) { value.patientID = patientInfo.patientMRN; value.pomrid = int.parse(patientInfo.pomrId!); value.allergyReactionMappingID = 1; }); +} var request = { "patientsAllergyRevisionID": allergy.allergyRevisionID, "patientMRN": patientInfo.patientMRN, @@ -481,9 +483,21 @@ class SOAPService extends LookupService { "dbCRUDOperation": 1, "allergyID": allergy.allergyID, "allergyName": allergy.allergyName, - "allergyTypeID": allergy.allergyTypeID + "allergyTypeID": allergy.allergyTypeID, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) }; + if(isNoKnown){ + request['isAllergy'] ='NO_KNOWN_ALLERGIES'; + request['allergyName'] = "No Known Allergies"; + request['userType'] ='DOCTOR'; + request['allergyTypeID'] = request['allergyID'] = 0; + request['isActive'] = true; + request['remarks'] =""; + request['isActivePatientsAllergy'] =true; + request['patientsAllergyReactionsDTOs'] =[]; + } + hasError = false; await baseAppClient.post(POST_ALLERGIES, diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 310c6949..fd5e4262 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -1018,9 +1018,9 @@ class SOAPViewModel extends BaseViewModel { } addAllergies( - AllergiesListVidaPlus request, PatiantInformtion patientInfo) async { + AllergiesListVidaPlus request, PatiantInformtion patientInfo, {bool isNoKnown =false}) async { setState(ViewState.BusyLocal); - await _SOAPService.addAllergies(request, patientInfo); + await _SOAPService.addAllergies(request, patientInfo, isNoKnown); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 7b49ea34..588a9b13 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -302,7 +302,7 @@ class _PatientProfileScreenState extends State with Single }); }else { Navigator.of(context).pushNamed( - UPDATE_EPISODE_VIDA_PLUS, arguments: { + UPDATE_EPISODE, arguments: { 'patient': patient }); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart index 11f79794..82c6a943 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; @@ -73,7 +74,12 @@ class _UpdateAllergiesWidgetState extends State { activeColor: Colors.red, onChanged: (value) { noKnownAllergies = value!; - setState(() {}); + if(value){ + setNoKnownAllergy(model); + } + setState(() { + + }); }, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, @@ -269,4 +275,17 @@ class _UpdateAllergiesWidgetState extends State { }); }); } + + setNoKnownAllergy(SOAPViewModel model) async { + GifLoaderDialogUtils.showMyDialog(context); + AllergiesListVidaPlus request= AllergiesListVidaPlus(); + + + await model!.addAllergies(request, widget.patientInfo, isNoKnown: true); + await model!.getAllergiesVidaPlus(widget.patientInfo); + setState(() { + + }); + GifLoaderDialogUtils.hideDialog(context); + } }