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 9c4b83ba..1c8e66cf 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -67,10 +67,12 @@ class SOAPService extends LookupService { List hopiDetails = []; List patientChiefComplaintListVidaPlus = []; List searchChiefComplaintListVidaPlus = []; - List episodeByChiefComplaintListVidaPlus = []; + List episodeByChiefComplaintListVidaPlus = + []; List getHomeMedicationList = []; List getSearchCurrentMedication = []; - List getSearchCurrentMedicationDetails = []; + List getSearchCurrentMedicationDetails = + []; List patientPreviousDiagnosisList = []; List patientDiagnosisList = []; List favoriteDiagnosisDetailsList = []; @@ -412,24 +414,25 @@ class SOAPService extends LookupService { }, body: request); } - Future getEditAllergies(int allergyId) async { hasError = false; await baseAppClient.post(GET_EDIT_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - print("Success"); - searchAllergiesList.clear(); - - response['List_SearchAllergies']['resultData'].forEach((v) { - searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {"allergyId": allergyId, "setupId": await sharedPref.getString(DOCTOR_SETUP_ID)}); - } + print("Success"); + searchAllergiesList.clear(); + response['List_SearchAllergies']['resultData'].forEach((v) { + searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "allergyId": allergyId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) + }); + } Future searchAllergies(String searchKey) async { hasError = false; @@ -481,7 +484,7 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); + DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -492,10 +495,8 @@ class SOAPService extends LookupService { Future resolveAllergies( PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async { - /*changed request parameters based on the vida plus requested */ - var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); List? reaction = allergy.patientsAllergyReactionsDTOs!; @@ -519,7 +520,7 @@ class SOAPService extends LookupService { "allergyTypeName": allergy.allergyTypeName, "assessmentId": 0, "isActive": allergy.isActivePatientsAllergy, - "patientsAllergyReactionsDTOs":reactionRequest, + "patientsAllergyReactionsDTOs": reactionRequest, "dbCRUDOperation": 2, "allergyID": allergy.allergyID, "allergyName": allergy.allergyName, @@ -532,7 +533,7 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(RESOLVE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Resolved Successfully"); + DrAppToastMsg.showSuccesToast("Resolved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -543,10 +544,9 @@ class SOAPService extends LookupService { Future updateAllergies( PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async { - var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); List? reaction = - allergy.patientsAllergyReactionsDTOs!; + allergy.patientsAllergyReactionsDTOs!; List? reactionRequest = []; reaction.forEach((value) { reactionRequest.add(AllergyReactionDTOs( @@ -568,7 +568,7 @@ class SOAPService extends LookupService { "assessmentId": 0, "isActive": allergy.isActivePatientsAllergy, "isActivePatientsAllergy": allergy.isActivePatientsAllergy, - "patientsAllergyReactionsDTOs":reactionRequest, + "patientsAllergyReactionsDTOs": reactionRequest, "dbCRUDOperation": 2, "allergyID": allergy.allergyID, "allergyName": allergy.allergyName, @@ -583,7 +583,7 @@ class SOAPService extends LookupService { await baseAppClient.post(UPDATE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Updated Successfully"); + DrAppToastMsg.showSuccesToast("Allergies Updated Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -608,7 +608,7 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(CREATE_HOPI, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("History Saved Successfully"); + DrAppToastMsg.showSuccesToast("History Saved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -645,7 +645,8 @@ class SOAPService extends LookupService { patientChiefComplaintListVidaPlus.clear(); response['ListChiefComplaintDetails']['resultData'].forEach((v) { - patientChiefComplaintListVidaPlus.add(GetChiefComplaintVidaPlus.fromJson(v)); + patientChiefComplaintListVidaPlus + .add(GetChiefComplaintVidaPlus.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -770,9 +771,11 @@ class SOAPService extends LookupService { PatiantInformtion patient, String patientProblemRevisionID, ) async { + print('the setup id is ${await sharedPref.getString(DOCTOR_SETUP_ID)}'); Map request = { "patientProblemRevisionId": patientProblemRevisionID, - "ProjectID": patient.projectId + "ProjectID": patient.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) }; hasError = false; auditDiagnosislist.clear(); @@ -858,13 +861,15 @@ class SOAPService extends LookupService { // "patientId": patientInfo.patientId, // "problemId": problemId, // "deletedRemarks": deletedRemarks, - // "ProjectID": patientInfo.projectId + // "ProjectID": patientInfo.projectId, + // "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) //todo just for the test as the create diagnosis is still not working "patientProblemId": 13691, "patientId": 70010986, "problemId": 41698, "deletedRemarks": "kethees test", - "ProjectID": 313 + "ProjectID": 313, + "setupId": 105 }; hasError = false; patientPreviousDiagnosisList.clear(); @@ -924,7 +929,8 @@ class SOAPService extends LookupService { "pomrId": patientInfo.pomrId, "hospitalId": patientInfo.projectId, "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), - "ProjectID": patientInfo.projectId + "ProjectID": patientInfo.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) }; hasError = false; patientPhysicalExaminationList.clear(); @@ -948,6 +954,7 @@ class SOAPService extends LookupService { Map request = { "ProjectID": patientInfo.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID), "listCreatPhysicalExam": jsonListOfPhysicalExamination }; hasError = false; @@ -1190,6 +1197,7 @@ class SOAPService extends LookupService { "appointmentId": diagnosis.appointmentId, "problemId": diagnosis.problemId, "diagnosisType": diagnosis.diagnosisType, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) }; var success = false; await baseAppClient.post(RESOLVE_DIAGNOSIS, @@ -1212,13 +1220,12 @@ class SOAPService extends LookupService { } Future getClinic() async { - Map request = {}; + Map request = {}; var success = false; await baseAppClient.post(GET_CLINIC, onSuccess: (dynamic response, int statusCode) { - response['ListDoctorClinics'].forEach((v) => - v['categories'].forEach( - (cat) => clinicsList.add(Clinic.fromJson(cat)))); + response['ListDoctorClinics'].forEach((v) => v['categories'] + .forEach((cat) => clinicsList.add(Clinic.fromJson(cat)))); success = false; }, onFailure: (String error, int statusCode) { success = false; @@ -1229,59 +1236,57 @@ class SOAPService extends LookupService { return success; } - - continueEpisodeVidaPlus( PatiantInformtion patient, List chiefComplaint) async { - List> chiefComplaintList=[]; + List> chiefComplaintList = []; - chiefComplaint.forEach((action){ - action.chiefComplains!.forEach((action2){ - chiefComplaintList.add({"chiefComplain": action2.chiefComplain,"chiefComplainTemplateId": action!.chiefComplainTemplateId}); + chiefComplaint.forEach((action) { + action.chiefComplains!.forEach((action2) { + chiefComplaintList.add({ + "chiefComplain": action2.chiefComplain, + "chiefComplainTemplateId": action!.chiefComplainTemplateId + }); }); }); Map request = { "appointmentId": patient.appointmentNo, "projectId": patient.projectId, "setupId": await sharedPref.getString(DOCTOR_SETUP_ID), - "chiefComplain":chiefComplaintList - + "chiefComplain": chiefComplaintList }; hasError = false; await baseAppClient.post(CONTINUE_EPISODE_VP, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - updateChiefComplaintVidaPlus( - PatiantInformtion patient, GetChiefComplaintVidaPlus chiefComplaint) async { + updateChiefComplaintVidaPlus(PatiantInformtion patient, + GetChiefComplaintVidaPlus chiefComplaint) async { Map request = { "AppointmentNo": patient.appointmentNo, "pomrId": patient.pomrId, "PatientMRN": patient.patientMRN, - "PatientName":patient.firstName! + ' '+ patient.lastName! , - "addedChiefComplaintCreateDtos": [ - - ], - "removedChiefComplaintIds":[chiefComplaint.chiefComplainId] + "PatientName": patient.firstName! + ' ' + patient.lastName!, + "addedChiefComplaintCreateDtos": [], + "removedChiefComplaintIds": [chiefComplaint.chiefComplainId] }; hasError = false; await baseAppClient.post(UPDATE_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - DrAppToastMsg.showErrorToast(response['List_UpdateChiefComplaint']['message']); - }, onFailure: (String error, int statusCode) { - - hasError = true; - super.error = error; - }, body: request); + print("Success"); + DrAppToastMsg.showErrorToast( + response['List_UpdateChiefComplaint']['message']); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - episodeByChiefComplaint( - PatiantInformtion patient) async { + + episodeByChiefComplaint(PatiantInformtion patient) async { Map request = { "patientId": patient.patientId, "clinicId": patient.clinicId, @@ -1289,120 +1294,103 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(EPISODE_BY_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { - episodeByChiefComplaintListVidaPlus.clear(); - - response['EpisodeByChiefcomplaint']['resultData'].forEach((v) { - episodeByChiefComplaintListVidaPlus.add(EpisodeByChiefComplaintVidaPlus.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + episodeByChiefComplaintListVidaPlus.clear(); + + response['EpisodeByChiefcomplaint']['resultData'].forEach((v) { + episodeByChiefComplaintListVidaPlus + .add(EpisodeByChiefComplaintVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - getHomeMedication( - PatiantInformtion patient) async { + getHomeMedication(PatiantInformtion patient) async { Map request = { "patientId": patient.patientId, }; hasError = false; await baseAppClient.post(GET_HOME_MEDICATION, onSuccess: (dynamic response, int statusCode) { - getHomeMedicationList.clear(); - response['ListHomeMedication']['resultData'].forEach((v) { - getHomeMedicationList.add(GetHomeMedicationList.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + getHomeMedicationList.clear(); + response['ListHomeMedication']['resultData'].forEach((v) { + getHomeMedicationList.add(GetHomeMedicationList.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - searchCurrentMedication( - String query - ) async { - Map request = { - "SearchKey": query - }; + searchCurrentMedication(String query) async { + Map request = {"SearchKey": query}; hasError = false; await baseAppClient.post(SEARCH_CURRENT_MEDICATION, onSuccess: (dynamic response, int statusCode) { - getSearchCurrentMedication.clear(); - response['ListFormulatorySearch']['resultData'].forEach((v) { - getSearchCurrentMedication.add(GetSearchCurrentMedication.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + getSearchCurrentMedication.clear(); + response['ListFormulatorySearch']['resultData'].forEach((v) { + getSearchCurrentMedication.add(GetSearchCurrentMedication.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - - getCurrentMedicationDetails( - String id - ) async { - Map request = { - "genericFormularyId": id - }; + getCurrentMedicationDetails(String id) async { + Map request = {"genericFormularyId": id}; hasError = false; await baseAppClient.post(SEARCH_CURRENT_MEDICATION_DETAILS, onSuccess: (dynamic response, int statusCode) { - getSearchCurrentMedicationDetails.clear(); - response['ListFormularyMaster']['resultData'].forEach((v) { - getSearchCurrentMedicationDetails.add(GetSearchCurrentMedicationDetails.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + getSearchCurrentMedicationDetails.clear(); + response['ListFormularyMaster']['resultData'].forEach((v) { + getSearchCurrentMedicationDetails + .add(GetSearchCurrentMedicationDetails.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - removeCurrentMedicationVidaPlus( - String medicationID) async { - Map request = { - - "homeMedicationId":medicationID - }; + removeCurrentMedicationVidaPlus(String medicationID) async { + Map request = {"homeMedicationId": medicationID}; hasError = false; await baseAppClient.post(REMOVE_CURRENT_MEDICATION, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - - hasError = true; - super.error = error; - }, body: request); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } addCurrentMedicationVidaPlus( Map request, PatiantInformtion patientInfo) async { - var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); - Map genericRequest ={ - "patientId": patientInfo.patientId, - "patientPomrId": patientInfo.pomrId, - "hospitalId": patientInfo.projectId, - "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), - "clinicGroupId": patientInfo.clinicGroupId, - "clinicId": patientInfo.clinicId, - "appointmentId": patientInfo.appointmentNo, - "created_by": patientInfo.doctorId, - "loginUserId": doctorProfile['List_MemberInformation'][0]['MemberID'], - }; + Map genericRequest = { + "patientId": patientInfo.patientId, + "patientPomrId": patientInfo.pomrId, + "hospitalId": patientInfo.projectId, + "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "clinicGroupId": patientInfo.clinicGroupId, + "clinicId": patientInfo.clinicId, + "appointmentId": patientInfo.appointmentNo, + "created_by": patientInfo.doctorId, + "loginUserId": doctorProfile['List_MemberInformation'][0]['MemberID'], + }; Map finalRequest = {} ..addAll(request) ..addAll(genericRequest); hasError = false; await baseAppClient.post(ADD_CURRENT_MEDICATION, - onSuccess: (dynamic response, int statusCode) { - - }, onFailure: (String error, int statusCode) { - - hasError = true; - super.error = error; - }, body: finalRequest); + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: finalRequest); } } -