diff --git a/lib/config/config.dart b/lib/config/config.dart index 70c60788..23a4af3e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -332,6 +332,10 @@ const SEARCH_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/SearchP const GET_GENERAL_SPECIALITY = 'Services/DoctorApplication.svc/REST/GetGeneralSpeciality'; +const GET_SPECIALITY_DETAILS = 'Services/DoctorApplication.svc/REST/SearchGeneralSpeciality'; + +const POST_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b8d6f97f..95c2b501 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -485,6 +485,7 @@ const Map> localizedValues = { "ar": "ملاحظات على نوع النظام الغذائي" }, "save": {"en": "SAVE", "ar": "حفظ"}, + "saveSmall": {"en": "Save", "ar": "حفظ"}, "postPlansEstimatedCost": { "en": "POST PLANS & ESTIMATED COST", "ar": "خطط ما بعد العملية والتكلفة المقدرة" diff --git a/lib/core/model/SOAP/physical_exam/Category.dart b/lib/core/model/SOAP/physical_exam/Category.dart new file mode 100644 index 00000000..84cecfcc --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/Category.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; + +class Condition { + String? conditionCode; + String? conditionName; + + Condition(); + + Condition.fromJson(Map json) { + conditionCode = json['conditionCode']; + conditionName = json['conditionName']; + } + + Map toJson() { + return { + 'conditionCode': conditionCode, + 'conditionName': conditionName, + }; + } +} + +class Category { + int? categoryId; + String? code; + String? codeAlias; + List? conditionsList; + String? description; + String? descriptionAlias; + int? id; + bool? isActive; + bool? isBuiltin; + String? languageCode; + String? name; + String? nameAlias; + int? rowVersion; + int? specialityId; + String? specialityName; + List? translationValues; + bool isSelected = false; + TextEditingController remarksController = TextEditingController(); + int selectedCondition = -1; + String? pomrId; + int? paitientId; + int? userID; + + Category(); + + Category.fromJson(Map json,int? specialityId, String specialityName, String? pomrId, int paitientId, int userID) { + categoryId = json['categoryId']; + code = json['code']; + codeAlias = json['codeAlias']; + if (json['conditionsList'] != null) { + conditionsList = []; + json['conditionsList'].forEach((v) { + conditionsList!.add(Condition.fromJson(v)); + }); + } + description = json['description']; + descriptionAlias = json['descriptionAlias']; + id = json['id']; + isActive = json['isActive']; + isBuiltin = json['isBuiltin']; + languageCode = json['languageCode']; + name = json['name']; + nameAlias = json['nameAlias']; + rowVersion = json['rowVersion']; + translationValues = json['translationValues']; + this.specialityName = specialityName; + this.specialityId = specialityId; + this.pomrId = pomrId; + this.paitientId = paitientId; + this.userID = userID; + } + + Map toJson() { + return { + 'categoryId': categoryId, + 'code': code, + 'codeAlias': codeAlias, + 'conditionsList': conditionsList?.map((v) => v.toJson()).toList(), + 'description': description, + 'descriptionAlias': descriptionAlias, + 'id': id, + 'isActive': isActive, + 'isBuiltin': isBuiltin, + 'languageCode': languageCode, + 'name': name, + 'nameAlias': nameAlias, + 'rowVersion': rowVersion, + 'translationValues': translationValues, + }; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart b/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart new file mode 100644 index 00000000..b97999f4 --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart @@ -0,0 +1,71 @@ +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/Category.dart'; + +class CreatePhysicalExamination { + bool? isChecked; // it will be told + bool? selected; // same as above + String? pomrid; // paitient + int? patientID; // paitint + bool? isClinicPhysicalExamination; // it will be told + int? physicalExaminationSystemID; // category id + String? physicalExaminationDescription; // name of the category + int? specialityID; // id of the specialitiy id + dynamic selectedOptions; // it will also be told but it could be sent as null + bool? isMandatory; // it will also be checked default value is false + String? specialityDescription; // name of the speciality + int? physicalExaminationCondition; // condition selected + String? loginUserId; // doctor id + String? remark; + + CreatePhysicalExamination(); + + CreatePhysicalExamination.fromJson(Map json) { + isChecked = json['isChecked']; + selected = json['selected']; + pomrid = json['pomrid']; + patientID = json['patientID']; + isClinicPhysicalExamination = json['isClinicPhysicalExamination']; + physicalExaminationSystemID = json['physicalExaminationSystemID']; + physicalExaminationDescription = json['physicalExaminationDescription']; + specialityID = json['specialityID']; + selectedOptions = json['selectedOptions']; + isMandatory = json['isMandatory']; + specialityDescription = json['specialityDescription']; + physicalExaminationCondition = json['physicalExaminationCondition']; + loginUserId = json['loginUserId']; + remark = json['remark']; + } + + Map toJson() { + return { + 'isChecked': isChecked, + 'selected': selected, + 'pomrid': pomrid, + 'patientID': patientID, + 'isClinicPhysicalExamination': isClinicPhysicalExamination, + 'physicalExaminationSystemID': physicalExaminationSystemID, + 'physicalExaminationDescription': physicalExaminationDescription, + 'specialityID': specialityID, + 'selectedOptions': selectedOptions, + 'isMandatory': isMandatory, + 'specialityDescription': specialityDescription, + 'physicalExaminationCondition': physicalExaminationCondition, + 'loginUserId': loginUserId, + 'remark': remark, + }; + } +} + +extension ConvertCategoryToCreatePhysicalExamination on Category { + CreatePhysicalExamination createPhysicalExaminationFromCategory() => + CreatePhysicalExamination() + ..physicalExaminationDescription = this.name + ..physicalExaminationSystemID = this.categoryId + ..physicalExaminationCondition = this.selectedCondition + ..remark = this.remarksController.text + ..selected = false + ..isChecked = false + ..specialityID = this.specialityId + ..patientID = this.paitientId + ..pomrid = this.pomrId + ..loginUserId = this.userID?.toString(); +} diff --git a/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart b/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart index 127b5e49..026d8c54 100644 --- a/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart +++ b/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart @@ -1,3 +1,4 @@ +@deprecated class PostPhysicalExaminationModel { bool? isChecked; bool? selected; 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 c7d74ce0..28f973dc 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -12,6 +12,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_ import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/get_hopi_details.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/Category.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/GeneralSpeciality.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_examination_model.dart'; @@ -58,6 +60,7 @@ class SOAPService extends LookupService { List searchDiagnosisList = []; List patientPhysicalExaminationList = []; List generalSpeciality = []; + Map> specialityDetails = {}; Map diagnosisTypeList = {}; Map conditionTypeList = {}; List icdVersionList = []; @@ -72,25 +75,26 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_EPISODE, onSuccess: (dynamic response, int statusCode) { - print("Success"); - episodeID = response['EpisodeID']; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postEpisodeReqModel.toJson()); + print("Success"); + episodeID = response['EpisodeID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeReqModel.toJson()); } - Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel - postEpisodeForInpatientRequestModel) async { + Future postEpisodeForInPatient( + PostEpisodeForInpatientRequestModel + postEpisodeForInpatientRequestModel) async { hasError = false; await baseAppClient.post(POST_EPISODE_FOR_IN_PATIENT, onSuccess: (dynamic response, int statusCode) { - episodeID = response['EpisodeID']; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postEpisodeForInpatientRequestModel.toJson()); + episodeID = response['EpisodeID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeForInpatientRequestModel.toJson()); } Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { @@ -98,11 +102,11 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = super.error! + "\n" + error; - }, body: postAllergyRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = super.error! + "\n" + error; + }, body: postAllergyRequestModel.toJson()); } Future postHistories( @@ -110,11 +114,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_HISTORY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = super.error! + "\n" + error; - }, body: postHistoriesRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = super.error! + "\n" + error; + }, body: postHistoriesRequestModel.toJson()); } Future postChiefComplaint( @@ -123,11 +127,11 @@ class SOAPService extends LookupService { super.error = ""; await baseAppClient.post(POST_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postChiefComplaintRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); } Future postPhysicalExam( @@ -135,11 +139,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postPhysicalExamRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); } Future postProgressNote( @@ -147,11 +151,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_PROGRESS_NOTE, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postProgressNoteRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postProgressNoteRequestModel.toJson()); } Future postAssessment( @@ -159,11 +163,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postAssessmentRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAssessmentRequestModel.toJson()); } Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async { @@ -171,11 +175,11 @@ class SOAPService extends LookupService { await baseAppClient.post(PATCH_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = "\n" + error; - }, body: patchAllergyRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = "\n" + error; + }, body: patchAllergyRequestModel.toJson()); } Future patchHistories( @@ -183,11 +187,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(PATCH_HISTORY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = super.error! + "\n" + error; - }, body: patchHistoriesRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = super.error! + "\n" + error; + }, body: patchHistoriesRequestModel.toJson()); } Future patchChiefComplaint( @@ -196,11 +200,11 @@ class SOAPService extends LookupService { super.error = ""; await baseAppClient.post(PATCH_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: patchChiefComplaintRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchChiefComplaintRequestModel.toJson()); } Future patchPhysicalExam( @@ -208,11 +212,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(PATCH_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: patchPhysicalExamRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchPhysicalExamRequestModel.toJson()); } Future patchProgressNote( @@ -220,11 +224,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(PATCH_PROGRESS_NOTE, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: patchProgressNoteRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchProgressNoteRequestModel.toJson()); } Future patchAssessment( @@ -232,11 +236,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: patchAssessmentRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchAssessmentRequestModel.toJson()); } Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP) async { @@ -245,16 +249,16 @@ class SOAPService extends LookupService { ///TODO Elham* change the url constant to get getPatientAllergy await baseAppClient.post(GET_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientAllergiesList.clear(); + print("Success"); + patientAllergiesList.clear(); - response['List_Allergies']['entityList'].forEach((v) { - patientAllergiesList.add(GetAllergiesResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: generalGetReqForSOAP.toJson()); + response['List_Allergies']['entityList'].forEach((v) { + patientAllergiesList.add(GetAllergiesResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: generalGetReqForSOAP.toJson()); } Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, @@ -262,15 +266,15 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_HISTORY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - if (isFirst) patientHistoryList.clear(); - response['List_History']['entityList'].forEach((v) { - patientHistoryList.add(GetHistoryResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getHistoryReqModel.toJson()); + print("Success"); + if (isFirst) patientHistoryList.clear(); + response['List_History']['entityList'].forEach((v) { + patientHistoryList.add(GetHistoryResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHistoryReqModel.toJson()); } Future getPatientChiefComplaint( @@ -278,16 +282,15 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientChiefComplaintList.clear(); - response['List_ChiefComplaint']['entityList'].forEach((v) { - patientChiefComplaintList.add( - GetChiefComplaintResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getChiefComplaintReqModel.toJson()); + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getChiefComplaintReqModel.toJson()); } Future getPatientPhysicalExam( @@ -295,14 +298,14 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - patientPhysicalExamList.clear(); - response['PhysicalExamList']['entityList'].forEach((v) { - patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getPhysicalExamReqModel.toJson()); + patientPhysicalExamList.clear(); + response['PhysicalExamList']['entityList'].forEach((v) { + patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getPhysicalExamReqModel.toJson()); } Future getPatientProgressNote( @@ -310,16 +313,15 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_PROGRESS_NOTE, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientProgressNoteList.clear(); - response['ProgressNoteList']['entityList'].forEach((v) { - patientProgressNoteList.add( - GetPatientProgressNoteResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getGetProgressNoteReqModel.toJson()); + print("Success"); + patientProgressNoteList.clear(); + response['ProgressNoteList']['entityList'].forEach((v) { + patientProgressNoteList.add(GetPatientProgressNoteResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getGetProgressNoteReqModel.toJson()); } Future getPatientAssessment( @@ -327,15 +329,15 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientAssessmentList.clear(); - response['AssessmentList']['entityList'].forEach((v) { - patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getAssessmentReqModel.toJson()); + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getAssessmentReqModel.toJson()); } Future getEpisodeForInpatient( @@ -343,31 +345,31 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_EPISODE_FOR_INPATIENT, onSuccess: (dynamic response, int statusCode) { - print("Success"); + print("Success"); - episodeID = response["GetEpisodeNo"]; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getEpisodeForInpatientReqModel.toJson()); + episodeID = response["GetEpisodeNo"]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getEpisodeForInpatientReqModel.toJson()); } Future isPrescriptionOrderCreated(PatiantInformtion patientInfo) async { hasError = false; await baseAppClient.post(IS_PRESCRIPTION_ORDER_CREATED, onSuccess: (dynamic response, int statusCode) { - print("Success"); - - isPrescriptionOrder = response['IsPrescriptionCreated']; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: { - "PatientMRN": patientInfo.patientMRN, - "EncounterNo": patientInfo.appointmentNo, - "EncounterType": patientInfo.appointmentTypeId, - "DoctorID": patientInfo.doctorId, - }); + print("Success"); + + isPrescriptionOrder = response['IsPrescriptionCreated']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "PatientMRN": patientInfo.patientMRN, + "EncounterNo": patientInfo.appointmentNo, + "EncounterType": patientInfo.appointmentTypeId, + "DoctorID": patientInfo.doctorId, + }); } /* vida plus API allergies */ @@ -380,16 +382,16 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(PATIENT_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientAllergiesVidaPlus.clear(); + print("Success"); + patientAllergiesVidaPlus.clear(); - response['List_PatientAllergies']['resultData'].forEach((v) { - patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + response['List_PatientAllergies']['resultData'].forEach((v) { + patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } Future searchAllergies(String searchKey) async { @@ -397,20 +399,20 @@ class SOAPService extends LookupService { await baseAppClient.post(SEARCH_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - print("Success"); - searchAllergiesList.clear(); + 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: {"AllergyName": searchKey}); + response['List_SearchAllergies']['resultData'].forEach((v) { + searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {"AllergyName": searchKey}); } - Future addAllergies(AllergiesListVidaPlus allergy, - PatiantInformtion patientInfo) async { + Future addAllergies( + AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async { allergy.allergyReactionDTOs!.forEach((value) { value.patientID = patientInfo.patientMRN; value.pomrid = int.parse(patientInfo.pomrId!); @@ -442,22 +444,22 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: { - "listProgNotePatientAllergyDiseaseVM": [request] - }); + DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "listProgNotePatientAllergyDiseaseVM": [request] + }); } - Future resolveAllergies(PatientAllergiesVidaPlus allergy, - PatiantInformtion patientInfo) async { + 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!; + allergy.patientsAllergyReactionsDTOs!; List? reactionRequest = []; reaction.forEach((value) { reactionRequest.add(AllergyReactionDTOs( @@ -491,17 +493,17 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(RESOLVE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Resolved Successfully"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: { - "listProgNotePatientAllergyDiseaseVM": [request] - }); + DrAppToastMsg.showSuccesToast("Resolved Successfully"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "listProgNotePatientAllergyDiseaseVM": [request] + }); } - Future updateAllergies(AllergiesListVidaPlus allergy, - PatiantInformtion patientInfo) async { + Future updateAllergies( + AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async { allergy.allergyReactionDTOs!.forEach((value) { value.patientID = patientInfo.patientMRN; value.pomrid = patientInfo.episodeNo; @@ -533,13 +535,13 @@ class SOAPService extends LookupService { await baseAppClient.post(UPDATE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: { - "listProgNotePatientAllergyDiseaseVM": [request] - }); + DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "listProgNotePatientAllergyDiseaseVM": [request] + }); } saveHopi(Map req, PatiantInformtion patient) async { @@ -552,15 +554,17 @@ class SOAPService extends LookupService { "patientId": patient.patientMRN, "patientPomrId": patient.pomrId, }; - Map finalRequest = {}..addAll(request)..addAll(req); + Map finalRequest = {} + ..addAll(request) + ..addAll(req); hasError = false; await baseAppClient.post(CREATE_HOPI, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("History Saved Successfully"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: finalRequest); + DrAppToastMsg.showSuccesToast("History Saved Successfully"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: finalRequest); } getHopi(PatiantInformtion patient) async { @@ -571,15 +575,15 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(HOPI_DETAILS, onSuccess: (dynamic response, int statusCode) { - hopiDetails.clear(); + hopiDetails.clear(); - response['DetailHOPI']['resultData'].forEach((v) { - hopiDetails.add(GetHopiDetails.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + response['DetailHOPI']['resultData'].forEach((v) { + hopiDetails.add(GetHopiDetails.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } getChiefComplaint(PatiantInformtion patient) async { @@ -590,20 +594,20 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(GET_CHIEF_COMPLAINT_VP, onSuccess: (dynamic response, int statusCode) { - patientChiefComplaintListVidaPlus.clear(); + patientChiefComplaintListVidaPlus.clear(); - response['ListChiefComplaintDetails']['resultData'].forEach((v) { - patientChiefComplaintListVidaPlus - .add(GetChiefComplaintVidaPlus.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + response['ListChiefComplaintDetails']['resultData'].forEach((v) { + patientChiefComplaintListVidaPlus + .add(GetChiefComplaintVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - postChiefComplaintVidaPlus(PatiantInformtion patient, - String cheifComplaint) async { + postChiefComplaintVidaPlus( + PatiantInformtion patient, String cheifComplaint) async { Map request = { "ListCreateChiefComplaint": [ { @@ -617,11 +621,11 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(POST_CHIEF_COMPLAINT_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); } searchChiefComplaintVidaPlus(PatiantInformtion patient, String CC) async { @@ -633,17 +637,16 @@ class SOAPService extends LookupService { searchChiefComplaintListVidaPlus.clear(); await baseAppClient.post(SEARCH_CHIEF_COMPLAINT_VP, onSuccess: (dynamic response, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); - // - response['List_SearchChiefComplaint']['resultData'].forEach((v) { - searchChiefComplaintListVidaPlus.add( - SearchChiefComplaint.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); - hasError = true; - super.error = error; - }, body: request); + searchChiefComplaintListVidaPlus.clear(); + // + response['List_SearchChiefComplaint']['resultData'].forEach((v) { + searchChiefComplaintListVidaPlus.add(SearchChiefComplaint.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + searchChiefComplaintListVidaPlus.clear(); + hasError = true; + super.error = error; + }, body: request); } searchDiagnosis(PatiantInformtion patient, String diagnosis) async { @@ -655,15 +658,14 @@ class SOAPService extends LookupService { await baseAppClient.post(SEARCH_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - response['List_Diagnosis']['resultData'] - .forEach((v) => - searchDiagnosisList.add(SearchDiagnosis.fromJson(v))); - _processData(); - }, onFailure: (String error, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); - hasError = true; - super.error = error; - }, body: request); + response['List_Diagnosis']['resultData'] + .forEach((v) => searchDiagnosisList.add(SearchDiagnosis.fromJson(v))); + _processData(); + }, onFailure: (String error, int statusCode) { + searchChiefComplaintListVidaPlus.clear(); + hasError = true; + super.error = error; + }, body: request); } void _processData() { @@ -692,14 +694,13 @@ class SOAPService extends LookupService { diagnosisTypeList.clear(); await baseAppClient.post(DIAGNOSIS_TYPE, onSuccess: (dynamic response, int statusCode) { - response['ListDiagnosisTypeModel']['resultData'] - .forEach((v) => - diagnosisTypeList[v['name']] = v['diagnosisType']); - }, onFailure: (String error, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListDiagnosisTypeModel']['resultData'] + .forEach((v) => diagnosisTypeList[v['name']] = v['diagnosisType']); + }, onFailure: (String error, int statusCode) { + searchChiefComplaintListVidaPlus.clear(); + hasError = true; + super.error = error; + }, body: request); } getConditionType(PatiantInformtion patient) async { @@ -708,18 +709,20 @@ class SOAPService extends LookupService { conditionTypeList.clear(); await baseAppClient.post(CONDITION_TYPE, onSuccess: (dynamic response, int statusCode) { - response['ListDiagnosisCondition']['resultData'] - .forEach((v) => conditionTypeList[v['itemName']] = v['id']); - ; - }, onFailure: (String error, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListDiagnosisCondition']['resultData'] + .forEach((v) => conditionTypeList[v['itemName']] = v['id']); + ; + }, onFailure: (String error, int statusCode) { + searchChiefComplaintListVidaPlus.clear(); + hasError = true; + super.error = error; + }, body: request); } - auditDiagnosis(PatiantInformtion patient, - String patientProblemRevisionID,) async { + auditDiagnosis( + PatiantInformtion patient, + String patientProblemRevisionID, + ) async { Map request = { "patientProblemRevisionId": patientProblemRevisionID, "ProjectID": patient.projectId @@ -728,15 +731,14 @@ class SOAPService extends LookupService { auditDiagnosislist.clear(); await baseAppClient.post(AUDIT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - response['ListDaignosisAudit']['resultData'] - .forEach((v) => - auditDiagnosislist.add(AuditDiagnosis.fromJson(v))); - showAuditBottomSheet = auditDiagnosislist.isNotEmpty; - }, onFailure: (String error, int statusCode) { - auditDiagnosislist.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListDaignosisAudit']['resultData'] + .forEach((v) => auditDiagnosislist.add(AuditDiagnosis.fromJson(v))); + showAuditBottomSheet = auditDiagnosislist.isNotEmpty; + }, onFailure: (String error, int statusCode) { + auditDiagnosislist.clear(); + hasError = true; + super.error = error; + }, body: request); } getPreviousDiagnosis(PatiantInformtion patient) async { @@ -761,14 +763,14 @@ class SOAPService extends LookupService { patientPreviousDiagnosisList.clear(); await baseAppClient.post(PREVIOUS_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - response['ListDiagnosisPrviousDetials']['resultData'].forEach((v) => - patientPreviousDiagnosisList - .add(PatientPreviousDiagnosis.fromJson(v))); - }, onFailure: (String error, int statusCode) { - patientPreviousDiagnosisList.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListDiagnosisPrviousDetials']['resultData'].forEach((v) => + patientPreviousDiagnosisList + .add(PatientPreviousDiagnosis.fromJson(v))); + }, onFailure: (String error, int statusCode) { + patientPreviousDiagnosisList.clear(); + hasError = true; + super.error = error; + }, body: request); } removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId, @@ -790,17 +792,18 @@ class SOAPService extends LookupService { patientPreviousDiagnosisList.clear(); await baseAppClient.post(REMOVE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast( - response['ListDiagnosisRemove']['message']); - //todo get the current diagnosis after the delete if it is successful - }, onFailure: (String error, int statusCode) { - patientPreviousDiagnosisList.clear(); - hasError = true; - super.error = error; - }, body: request); + DrAppToastMsg.showSuccesToast(response['ListDiagnosisRemove']['message']); + //todo get the current diagnosis after the delete if it is successful + }, onFailure: (String error, int statusCode) { + patientPreviousDiagnosisList.clear(); + hasError = true; + super.error = error; + }, body: request); } - favoriteDiagnosis(PatiantInformtion patientInfo,) async { + favoriteDiagnosis( + PatiantInformtion patientInfo, + ) async { Map? user = await sharedPref.getObj(LOGGED_IN_USER); Map request = { @@ -815,17 +818,18 @@ class SOAPService extends LookupService { favoriteDiagnosisDetailsList.clear(); await baseAppClient.post(FAVORITE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - response['ListDiagnosisGetFavourite']['resultData'].forEach((v) => - favoriteDiagnosisDetailsList.add( - FavoriteDiseaseDetails.fromJson(v))); - }, onFailure: (String error, int statusCode) { - favoriteDiagnosisDetailsList.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListDiagnosisGetFavourite']['resultData'].forEach((v) => + favoriteDiagnosisDetailsList.add(FavoriteDiseaseDetails.fromJson(v))); + }, onFailure: (String error, int statusCode) { + favoriteDiagnosisDetailsList.clear(); + hasError = true; + super.error = error; + }, body: request); } - getPhysicalExamination(PatiantInformtion patientInfo,) async { + getPhysicalExamination( + PatiantInformtion patientInfo, + ) async { Map? user = await sharedPref.getObj(LOGGED_IN_USER); Map request = { @@ -839,38 +843,41 @@ class SOAPService extends LookupService { patientPhysicalExaminationList.clear(); await baseAppClient.post(SEARCH_PHYSICAL_EXAMINATION, onSuccess: (dynamic response, int statusCode) { - response['ListPhysicalExam']['resultData'].forEach((v) => - patientPhysicalExaminationList.add( - PatientPhysicalExamination.fromJson(v))); - }, onFailure: (String error, int statusCode) { - physicalExaminationList.clear(); - hasError = true; - super.error = error; - }, body: request); + response['ListPhysicalExam']['resultData'].forEach((v) => + patientPhysicalExaminationList + .add(PatientPhysicalExamination.fromJson(v))); + }, onFailure: (String error, int statusCode) { + physicalExaminationList.clear(); + hasError = true; + super.error = error; + }, body: request); } - postPhysicalExamination(PatiantInformtion patientInfo,List physicalExamination) async { - var jsonListOfPhysicalExamination = []; - physicalExamination.forEach((value)=>jsonListOfPhysicalExamination.add(value.toJson())); + Future postPhysicalExamination(PatiantInformtion patientInfo, + List physicalExamination) async { + List jsonListOfPhysicalExamination = []; + physicalExamination + .forEach((value) => jsonListOfPhysicalExamination.add(value.createPhysicalExaminationFromCategory())); Map request = { "ProjectID": patientInfo.patientId, "listCreatPhysicalExam": jsonListOfPhysicalExamination }; hasError = false; - await baseAppClient.post(SEARCH_PHYSICAL_EXAMINATION, + bool data = await baseAppClient.post(POST_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast( - response['ListPhysicalExam']['message']); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); - } + DrAppToastMsg.showSuccesToast(response['ListPhysicalExam']['message']); + return true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + return false; + }, body: request); + return data; + } getGeneralSpeciality(PatiantInformtion patientInfo) async { - Map request = { "ProjectID": patientInfo.patientId, }; @@ -878,14 +885,13 @@ class SOAPService extends LookupService { generalSpeciality.clear(); await baseAppClient.post(GET_GENERAL_SPECIALITY, onSuccess: (dynamic response, int statusCode) { - response['ListGeneralSpeciality']['resultData'].forEach((v) => - generalSpeciality.add( - GeneralSpeciality.fromJson(v))); - }, onFailure: (String error, int statusCode) { - hasError = true; - generalSpeciality.clear(); - super.error = error; - }, body: request); + response['ListGeneralSpeciality']['resultData'] + .forEach((v) => generalSpeciality.add(GeneralSpeciality.fromJson(v))); + }, onFailure: (String error, int statusCode) { + hasError = true; + generalSpeciality.clear(); + super.error = error; + }, body: request); } addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, @@ -908,20 +914,20 @@ class SOAPService extends LookupService { favoriteDiagnosisDetailsList.clear(); await baseAppClient.post(ADD_TO_FAVORITE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - var result = response['ListDiagnosisAddFavourite']['resultData']; - if ((result as List).isEmpty) { - addedToFavorite = false; - DrAppToastMsg.showErrorToast( - response['ListDiagnosisAddFavourite']['message']); - } else { - addedToFavorite = true; - DrAppToastMsg.showSuccesToast("Added To Favorite"); - } - }, onFailure: (String error, int statusCode) { - favoriteDiagnosisDetailsList.clear(); - hasError = true; - super.error = error; - }, body: request); + var result = response['ListDiagnosisAddFavourite']['resultData']; + if ((result as List).isEmpty) { + addedToFavorite = false; + DrAppToastMsg.showErrorToast( + response['ListDiagnosisAddFavourite']['message']); + } else { + addedToFavorite = true; + DrAppToastMsg.showSuccesToast("Added To Favorite"); + } + }, onFailure: (String error, int statusCode) { + favoriteDiagnosisDetailsList.clear(); + hasError = true; + super.error = error; + }, body: request); } convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, @@ -944,15 +950,35 @@ class SOAPService extends LookupService { addedToFavorite = false; await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - var result = response['ContinuePreviousEpisode']['resultData']; - if ((result as List).isEmpty) { - DrAppToastMsg.showErrorToast( - response['ContinuePreviousEpisode']['message']); - } - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + var result = response['ContinuePreviousEpisode']['resultData']; + if ((result as List).isEmpty) { + DrAppToastMsg.showErrorToast( + response['ContinuePreviousEpisode']['message']); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + getSpecialityDetails(String speciality, int? specialityId, + PatiantInformtion patientInfo) async { + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + var userId = user?['List_MemberInformation'][0]['MemberID']; + Map request = {"searchParam": speciality}; + hasError = false; + List categoryData = []; + await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + response['ContinuePreviousEpisode']['resultData'].forEach( + (value) => categoryData.add(Category.fromJson(value, specialityId, speciality,patientInfo.pomrId,patientInfo.patientId,user?['List_MemberInformation'][0]['MemberID']))); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + if (!hasError) { + specialityDetails[speciality] = categoryData; + } } createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis, diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 1b1e3bf7..283d2586 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -25,6 +25,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/history/post_histories_reques import 'package:doctor_app_flutter/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/Category.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart'; @@ -144,8 +146,10 @@ class SOAPViewModel extends BaseViewModel { List get auditDiagnosislist => _SOAPService.auditDiagnosislist; - List get speciality => - _SOAPService.generalSpeciality; + List get speciality => _SOAPService.generalSpeciality; + + Map> get specialityDetails => + _SOAPService.specialityDetails; int? get episodeID => _SOAPService.episodeID; @@ -1173,21 +1177,33 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void postPhysicalExamination(PatiantInformtion patientInfo, - List physicalExamination) async { + Future postPhysicalExamination(PatiantInformtion patientInfo, + List physicalExamination) async { setState(ViewState.BusyLocal); - await _SOAPService.postPhysicalExamination( + bool result = await _SOAPService.postPhysicalExamination( patientInfo, physicalExamination); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + + return result; } + void getGeneralSpeciality(PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); - await _SOAPService.getGeneralSpeciality( - patientInfo); + await _SOAPService.getGeneralSpeciality(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + void getSpecialityDetails(String speciality,int? specialityId, PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getSpecialityDetails(speciality,specialityId, patientInfo); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1202,4 +1218,15 @@ class SOAPViewModel extends BaseViewModel { void toggleShowBottomSheetValue(bool status) { _SOAPService.showAuditBottomSheet = status; } + + void savePhysicalexamination() { + var mappedItems = + setState(ViewState.BusyLocal); + // await _SOAPService.getSpecialityDetails(speciality); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } 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 07e6443e..013d841e 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 @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/GeneralSpeciality.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; @@ -10,6 +12,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plu import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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:provider/provider.dart'; @@ -17,15 +20,20 @@ import '../../../../../core/viewModel/project_view_model.dart'; class AddDetailsToExaminationVidaPlus extends StatefulWidget { final List? mySelectedExamination; + final PatiantInformtion patientInfo; - const AddDetailsToExaminationVidaPlus({super.key, this.mySelectedExamination}); + const AddDetailsToExaminationVidaPlus( + {super.key, + this.mySelectedExamination, + required this.patientInfo}); @override State createState() => _AddDetailsToExaminationVidaPlusState(); } -class _AddDetailsToExaminationVidaPlusState extends State { +class _AddDetailsToExaminationVidaPlusState + extends State { bool isSysExaminationExpand = false; @override @@ -33,47 +41,87 @@ class _AddDetailsToExaminationVidaPlusState extends State( - onModelReady: (model) async {}, + onModelReady: (model) async { + widget.mySelectedExamination?.forEach((value) => + model.getSpecialityDetails( + value.name ?? '', value.id, widget.patientInfo)); + }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: PatientSearchHeader( - title: TranslationBase.of(context).examinationPart), - backgroundColor: Colors.white, - body: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - children: [ - // Expanded( - // child: ListView.separated( - // itemBuilder: (context, index) { - // return ExpandableSOAPWidget( - // headerTitle:, - // onTap: () { - // setState(() { - // isSysExaminationExpand = !isSysExaminationExpand; - // }); - // }, - // child: ExaminationItems(examination:widget.mySelectedExamination![index]), - // isExpanded: isSysExaminationExpand, - // ); - // - // }, - // separatorBuilder: (context, index) { - // return SizedBox(height: 8,); - // }, - // itemCount: widget?.mySelectedExamination?.length ?? 0), - // ), - ], + baseViewModel: model, + isShowAppBar: true, + isLoading: model.state == ViewState.BusyLocal, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).examinationPart), + backgroundColor: Colors.white, + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + var title = + model.specialityDetails.keys.elementAt(index); + return ExpandableSOAPWidget( + headerTitle: title, + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: ExaminationItems( + examination: model.specialityDetails[title]), + isExpanded: isSysExaminationExpand, + ); + }, + separatorBuilder: (context, index) { + return SizedBox( + height: 8, + ); + }, + itemCount: model.specialityDetails.length ?? 0), + ), + ], + ), ), - ))); + bottomNavigationBar: Material( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).cancelSmall, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () async { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).saveSmall, + color: Color(0xff359846), + fontColor: Colors.white, + fontWeight: FontWeight.w600, + onPressed: () async { + model.savePhysicalexamination(); + }, + ), + ), + ], + ))), + )); } } - - - - /* Container( padding: EdgeInsets.symmetric(horizontal: 12), child: Column( @@ -226,4 +274,4 @@ class _AddDetailsToExaminationVidaPlusState extends State? examination; const ExaminationItems({super.key, this.examination}); @@ -21,15 +22,13 @@ class ExaminationItems extends StatefulWidget { class _ExaminationItemsState extends State { bool isExpanded = false; - int status = 1; - - TextEditingController remarksController = TextEditingController(); + List? examinations; @override void initState() { // TODO: implement initState super.initState(); - remarksController.text = widget.examination?.remark ?? ""; + this.examinations = examinations; } @override @@ -37,210 +36,312 @@ class _ExaminationItemsState extends State { ProjectViewModel projectViewModel = Provider.of(context); return Column( children: [ - ListTileTheme( - horizontalTitleGap: 0, - child: CheckboxListTile( - activeColor: Color(0xFFD02127), - checkColor: Colors.white, - contentPadding: EdgeInsets.zero, - side: MaterialStateBorderSide.resolveWith( - (Set states) { - if (states.contains(MaterialState.selected)) { - return const BorderSide(color: Color(0xFFD02127)); - } - return const BorderSide(color: Color(0xFFE6E6E6)); - }, - ), - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), - value: isExpanded, - controlAffinity: ListTileControlAffinity.leading, - onChanged: (bool? value) { - setState(() { - isExpanded = value ?? false; - }); - }, - title: AppText( - projectViewModel.isArabic - ? widget.examination!.selectedExamination!.nameAr != null && - widget.examination!.selectedExamination!.nameAr != "" - ? widget.examination!.selectedExamination!.nameAr! - : widget.examination!.selectedExamination!.nameEn! - : widget.examination!.selectedExamination!.nameEn!, - color: Color(0XFF575757), - fontSize: 14, - fontWeight: FontWeight.w400, - ), - ), - ), - (isExpanded) - ? Container( - padding: EdgeInsets.symmetric(horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(bottom: 8), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), + Expanded( + child: ListView.builder( + itemCount: examinations?.length ?? 0, + itemBuilder: (context, index) => Column( + children: [ + ListTileTheme( + horizontalTitleGap: 0, + child: CheckboxListTile( + activeColor: Color(0xFFD02127), + checkColor: Colors.white, + contentPadding: EdgeInsets.zero, + side: MaterialStateBorderSide.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return const BorderSide(color: Color(0xFFD02127)); + } + return const BorderSide(color: Color(0xFFE6E6E6)); + }, ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - status = 1; - }); - widget.examination!.isNormal = true; - widget.examination!.isAbnormal = false; - widget.examination!.notExamined = false; - }, - child: Row( - children: [ - Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: - Border.all(color: Colors.grey, width: 1), - ), - child: Container( - decoration: BoxDecoration( - color: status == 1 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), - ), - ), - AppText( - TranslationBase.of(context).normal, - fontWeight: FontWeight.normal, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16)), + value: examinations?[index].isSelected, + controlAffinity: ListTileControlAffinity.leading, + onChanged: (bool? value) { + setState(() { + examinations?[index].isSelected = value ?? false; + }); + }, + title: AppText( + examinations![index].name!, + color: Color(0XFF575757), + fontSize: 14, + fontWeight: FontWeight.w400, + ), + ), + ), + (examinations?[index].isSelected == true) + ? Container( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 8), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier! * 1.6, ), - ], - ), - )), - Expanded( - child: InkWell( - onTap: () { - setState(() { - status = 2; - }); - widget.examination!.isNormal = false; - widget.examination!.isAbnormal = true; - widget.examination!.notExamined = false; - }, - child: Row( - children: [ - Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: - Border.all(color: Colors.grey, width: 1), - ), - child: Container( - decoration: BoxDecoration( - color: status == 2 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), - ), - ), - AppText( - TranslationBase.of(context).abnormal, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: examinations?[index] + .conditionsList + ?.length ?? + 0, + itemBuilder: (context, currentIndex) => InkWell( + onTap: () { + setState(() { + examinations?[index] + .selectedCondition = + int.parse(examinations?[index] + .conditionsList?[ + currentIndex] + .conditionName ?? + "-1"); + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric( + horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: examinations?[index] + .selectedCondition == + int.parse(examinations?[ + index] + .conditionsList?[ + currentIndex] + .conditionName ?? + "-1") + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + examinations?[index] + .conditionsList?[ + currentIndex] + .conditionCode ?? + '', + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier! * + 1.6, + ), + ], + ), + )), + ), + // Row( + // children: [ + // if(examinations?[index] + // .conditionsList?.length == 1) + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // examinations?[index].selectedCondition = + // int.parse(examinations?[index] + // .conditionsList?[0] + // .conditionName ?? + // "-1"); + // }); + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: + // EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all( + // color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: examinations?[index].selectedCondition == + // int.parse(examinations?[index] + // .conditionsList?[0] + // .conditionName ?? + // "-1") + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // examinations?[index] + // .conditionsList?[0] + // .conditionCode ?? + // TranslationBase.of(context).normal, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: + // SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // setState(() { + // examinations?[index].selectedCondition = + // int.parse(examinations?[index] + // .conditionsList?[1] + // .conditionName ?? + // "-1"); + // }); + // }); + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: + // EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all( + // color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: examinations?[index].selectedCondition == + // int.parse(examinations?[index] + // .conditionsList?[1] + // .conditionName ?? + // "-1") + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // examinations?[index] + // .conditionsList?[1] + // .conditionCode ?? + // TranslationBase.of(context).abnormal, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: + // SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // setState(() { + // examinations?[index].selectedCondition = + // int.parse(examinations?[index] + // .conditionsList?[2] + // .conditionName ?? + // "-1"); + // }); + // }); + // + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: + // EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all( + // color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: examinations?[index].selectedCondition == + // int.parse(examinations?[index] + // .conditionsList?[2] + // .conditionName ?? + // "-1") + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // Expanded( + // child: AppText( + // examinations?[index] + // .conditionsList?[2] + // .conditionCode ?? + // TranslationBase.of(context).notExamined, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: + // SizeConfig.textMultiplier! * 1.6, + // ), + // ), + // ], + // ), + // )), + // ], + // ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: examinations?[index].remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, ), - ], - ), - )), - if (widget.examination?.isLocal == false) - Expanded( - child: InkWell( - onTap: () { - setState(() { - status = 3; - }); - widget.examination!.isNormal = false; - widget.examination!.isAbnormal = false; - widget.examination!.notExamined = true; - }, - child: Row( - children: [ - Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: Border.all( - color: Colors.grey, width: 1), - ), - child: Container( - decoration: BoxDecoration( - color: status == 3 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context).notExamined, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), - ), - ], ), - )), - ], - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) { - widget.examination!.remark = value; - }, - onClick: () {}, - onFieldSubmitted: () {}, - ), - ), - ], - ), - ) - : SizedBox.shrink(), - SizedBox( - height: 8, + ], + ), + ) + : SizedBox.shrink(), + ], + ), + ), ), - Divider() ], ); } diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index d443785b..4d6a185d 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -503,6 +503,7 @@ class TranslationBase { String get cancel => localizedValues['cancel']![locale.languageCode]!; String get cancelSmall => localizedValues['cancelSmall']![locale.languageCode]!; + String get saveSmall => localizedValues['saveSmall']![locale.languageCode]!; String get ok => localizedValues['ok']![locale.languageCode]!;