From 6392620df7a7f8351b5d82ba988f1cd33bb20d04 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Sun, 24 Nov 2024 08:41:37 +0300 Subject: [PATCH 01/10] WD: vida plus episode changes --- assets/images/svgs/favoriteadded.svg | 3 + lib/config/config.dart | 20 + lib/config/localized_values.dart | 14 +- lib/core/enum/master_lookup_key.dart | 4 +- .../assessment/FavoriteDiseaseDetails.dart | 92 +++ .../SOAP/assessment/audit_diagnosis.dart | 37 + .../model/SOAP/assessment/diagnosis_type.dart | 10 + .../patient_previous_diagnosis.dart | 190 ++++++ .../SOAP/assessment/search_diagnosis.dart | 83 +++ .../patient_physical_examination.dart | 97 +++ .../post_physical_examination_model.dart | 54 ++ lib/core/service/base/lookup-service.dart | 2 +- .../soap/SOAP_service.dart | 340 +++++++++- lib/core/viewModel/SOAP_view_model.dart | 174 ++++- .../objective/add_examination_page.dart | 2 +- .../objective/update_objective_page.dart | 4 +- .../assessment/add_diagnosis.dart | 82 ++- .../assessment/update_assessment_page.dart | 50 +- .../assessment/widget/audit_item.dart | 94 +++ .../widget/audit_list_bottom_sheet.dart | 62 ++ .../assessment/widget/current_diagnosis.dart | 155 ++++- .../assessment/widget/empty_dropdown.dart | 20 + .../assessment/widget/enter_diagnosis.dart | 639 +++++++++++------- .../assessment/widget/favotite_diagnosis.dart | 416 ++++++++++++ .../assessment/widget/previous_diagnosis.dart | 97 ++- .../widget/previous_diagnosis_item.dart | 86 ++- .../add_examination_page_vida_plus.dart | 4 +- ...inations_list_search_vida_plus_widget.dart | 93 +-- .../update_objective_page_vida_plus.dart | 91 +-- .../update_soap_index_vida_plus.dart | 16 +- .../translations_delegate_base_utils.dart | 10 + 31 files changed, 2566 insertions(+), 475 deletions(-) create mode 100644 assets/images/svgs/favoriteadded.svg create mode 100644 lib/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart create mode 100644 lib/core/model/SOAP/assessment/audit_diagnosis.dart create mode 100644 lib/core/model/SOAP/assessment/diagnosis_type.dart create mode 100644 lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart create mode 100644 lib/core/model/SOAP/assessment/search_diagnosis.dart create mode 100644 lib/core/model/SOAP/physical_exam/patient_physical_examination.dart create mode 100644 lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_item.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart diff --git a/assets/images/svgs/favoriteadded.svg b/assets/images/svgs/favoriteadded.svg new file mode 100644 index 00000000..3b4577cf --- /dev/null +++ b/assets/images/svgs/favoriteadded.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/config/config.dart b/lib/config/config.dart index ad086d11..b7dd3ee2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -308,6 +308,26 @@ const UPDATE_ALLERGIES = 'Services/DoctorApplication.svc/REST/UpdateAllergy'; const GET_CHIEF_COMPLAINT_VP = 'Services/DoctorApplication.svc/REST/ChiefComplaintDetails'; +const SEARCH_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/SearchDiagnosis'; + +const DIAGNOSIS_TYPE = 'Services/DoctorApplication.svc/REST/DiagnosisType'; + +const CONDITION_TYPE = 'Services/DoctorApplication.svc/REST/DiagnosisCondition'; + +const CREATE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/CreateDiagnosis'; + +const PREVIOUS_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisPreviousDetails'; + +const AUDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisAudit'; + +const REMOVE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisRemove'; + +const FAVORITE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisGetFavourite'; + +const ADD_TO_FAVORITE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisAddFavourite'; + +const MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/ContinuePreviousEpisode'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 22b0cc41..b8d6f97f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1203,7 +1203,17 @@ const Map> localizedValues = { "noPhysicalExamination": {"en": "No Physical Examination added, please add it from the button above", "ar":"لم يتم إضافة فحص بدني ، يرجى إضافته من الزر أعلاه"}, "noProgressNote": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, "mild": {"en": "Mild", "ar":"خفيف"}, - "moderate": {"en": "Moderate", "ar":"معتدل"}, + "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, + "event": {"en": "Event: ", "ar":"حدث: "}, + "deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "}, + "newValue": {"en": "New Value: ", "ar":"قيمة جديدة: "}, + "fieldName": {"en": "Field Name: ", "ar":"اسم الحقل: "}, + "oldValue": {"en": "Old Value: ", "ar":"القيمة القديمة: "}, + "favoriteDiagnosis": {"en": "Favorite Diagnosis", "ar":"التشخيص المفضل"}, + "addToFavorite": {"en": "Add To Favorite", "ar":"إضافة إلى المفضلة"}, "noDiagnosisFound": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, - + "areYouSureYouWantToDeleteDiagnosis": { + "en": "Are you sure you want to delete diagnosis", + "ar": "هل أنت متأكد من أنك تريد حذف التشخيص" + } }; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 04608719..514caf56 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -5,7 +5,7 @@ enum MasterKeysService { HistorySocial, HistorySports, HistorySurgical, - PhysicalExamination, + PostPhysicalExaminationModel, AllergySeverity, physiotherapyGoals, DiagnosisCondition, @@ -45,7 +45,7 @@ extension SelectedMasterKeysService on MasterKeysService { case MasterKeysService.HistorySurgical: return 66; break; - case MasterKeysService.PhysicalExamination: + case MasterKeysService.PostPhysicalExaminationModel: return 59; break; case MasterKeysService.AllergySeverity: diff --git a/lib/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart b/lib/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart new file mode 100644 index 00000000..19614800 --- /dev/null +++ b/lib/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart @@ -0,0 +1,92 @@ +class FavoriteDiseaseDetails { + String? categoryCode; + int? categoryId; + String? chapterCode; + String? codeRange; + String? createdBy; + String? diseaseType; + String? diseases; + String? diseasesCode; + int? diseasesId; + int? favoritesId; + int? hospitalGroupId; + int? hospitalId; + int? icdId; + String? icdSubVersion; + String? icdType; + String? icdVersion; + bool? isDeleted; + String? parentDiseasesCode; + String? problemCode; + String? problemDescription; + int? problemMasterId; + int? problemMasterRevisionId; + String? problemName; + String? problemType; + String? rowVersion; + String? sectionCode; + int? specificationId; + + FavoriteDiseaseDetails.fromJson(Map json) { + categoryCode = json['CategoryCode']; + categoryId = json['CategoryId']; + chapterCode = json['ChapterCode']; + codeRange = json['CodeRange']; + createdBy = json['CreatedBy']; + diseaseType = json['DiseaseType']; + diseases = json['Diseases']; + diseasesCode = json['DiseasesCode']; + diseasesId = json['DiseasesId']; + favoritesId = json['FavoritesId']; + hospitalGroupId = json['HospitalGroupID']; + hospitalId = json['HospitalID']; + icdId = json['IcdId']; + icdSubVersion = json['IcdSubVersion']; + icdType = json['IcdType']; + icdVersion = json['IcdVersion']; + isDeleted = json['IsDeleted']; + parentDiseasesCode = json['ParentDiseasesCode']; + problemCode = json['ProblemCode']; + problemDescription = json['ProblemDescription']; + problemMasterId = json['ProblemMasterID']; + problemMasterRevisionId = json['ProblemMasterRevisionID']; + problemName = json['ProblemName']; + problemType = json['ProblemType']; + rowVersion = json['RowVersion']; + sectionCode = json['SectionCode']; + specificationId = json['SpecificationId']; + } + + // toJson method + Map toJson() { + return { + 'CategoryCode': categoryCode, + 'CategoryId': categoryId, + 'ChapterCode': chapterCode, + 'CodeRange': codeRange, + 'CreatedBy': createdBy, + 'DiseaseType': diseaseType, + 'Diseases': diseases, + 'DiseasesCode': diseasesCode, + 'DiseasesId': diseasesId, + 'FavoritesId': favoritesId, + 'HospitalGroupID': hospitalGroupId, + 'HospitalID': hospitalId, + 'IcdId': icdId, + 'IcdSubVersion': icdSubVersion, + 'IcdType': icdType, + 'IcdVersion': icdVersion, + 'IsDeleted': isDeleted, + 'ParentDiseasesCode': parentDiseasesCode, + 'ProblemCode': problemCode, + 'ProblemDescription': problemDescription, + 'ProblemMasterID': problemMasterId, + 'ProblemMasterRevisionID': problemMasterRevisionId, + 'ProblemName': problemName, + 'ProblemType': problemType, + 'RowVersion': rowVersion, + 'SectionCode': sectionCode, + 'SpecificationId': specificationId, + }; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/assessment/audit_diagnosis.dart b/lib/core/model/SOAP/assessment/audit_diagnosis.dart new file mode 100644 index 00000000..ac7abbdc --- /dev/null +++ b/lib/core/model/SOAP/assessment/audit_diagnosis.dart @@ -0,0 +1,37 @@ +class AuditDiagnosis { + String? approvedBy; + String? approvedOn; + String? createdBy; + String? createdOn; + String? deletedBy; + String? deletedOn; + String? deletedRemarks; + String? diagnosisType; + bool? isEventIdentifiedExternally; + bool? isResolved; + String? modifiedBy; + String? modifiedOn; + int? patientId; + int? patientProblemRevisionId; + String? remarks; + String? status; + + AuditDiagnosis.fromJson(Map json) { + approvedBy = json['approvedBy']; + approvedOn = json['approvedOn']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + deletedBy = json['deletedBy']; + deletedOn = json['deletedOn']; + deletedRemarks = json['deletedRemarks']; + diagnosisType = json['diagnosisType']; + isEventIdentifiedExternally = json['isEventIdentifiedExternally']; + isResolved = json['isResolved']; + modifiedBy = json['modifiedBy']; + modifiedOn = json['modifiedOn']; + patientId = json['patientId']; + patientProblemRevisionId = json['patientProblemRevisionId']; + remarks = json['remarks']; + status = json['status']; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/assessment/diagnosis_type.dart b/lib/core/model/SOAP/assessment/diagnosis_type.dart new file mode 100644 index 00000000..549342d0 --- /dev/null +++ b/lib/core/model/SOAP/assessment/diagnosis_type.dart @@ -0,0 +1,10 @@ +class DiagnosisType { + String? diagnosisType; + String? name; + + + DiagnosisType.fromJson(Map json) { + diagnosisType = json['diagnosisType'] ?? ''; + name = json['name'] ?? ''; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart new file mode 100644 index 00000000..0cc2401e --- /dev/null +++ b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart @@ -0,0 +1,190 @@ +class PatientPreviousDiagnosis { + bool? active; + int? admissionId; + int? admissionRequestId; + int? appointmentId; + String? approvedBy; + String? approvedOn; + int? assessmentId; + int? chiefComplainId; + int? clinicGroupId; + int? clinicId; + String? condition; + String? createdBy; + String? createdOn; + String? deletedBy; + String? deletedByDoctorName; + String? deletedOn; + String? deletedRemarks; + String? diagnosisType; + int? doctorId; + int? episodeId; + int? hospitalGroupId; + int? hospitalId; + dynamic icdCodeDetailsDto; + String? icdSubVersion; + String? icdType; + dynamic icdVersion; + String? location; + String? loginUserId; + String? modifiedBy; + String? modifiedOn; + String? module; + String? parentLocation; + int? patientId; + dynamic patientProblemChangeHistories; + int? patientProblemId; + int? patientProblemRevisionId; + int? pomrId; + bool? previousProblem; + int? problemId; + String? problemName; + String? remarks; + bool? resolved; + String? selectedCategoryCode; + String? selectedChapterCode; + String? selectedDisease; + String? selectedIcdCode; + String? selectedSectionCode; + String? status; + List? visitWisePatientDiagnoses; + bool? visitWiseSelected; + + PatientPreviousDiagnosis.fromJson(Map json) { + active = json['active']; + admissionId = json['admissionId']; + admissionRequestId = json['admissionRequestId']; + appointmentId = json['appointmentId']; + approvedBy = json['approvedBy']; + approvedOn = json['approvedOn']; + assessmentId = json['assessmentId']; + chiefComplainId = json['chiefComplainId']; + clinicGroupId = json['clinicGroupId']; + clinicId = json['clinicId']; + condition = json['condition']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + deletedBy = json['deletedBy']; + deletedByDoctorName = json['deletedByDoctorName']; + deletedOn = json['deletedOn']; + deletedRemarks = json['deletedRemarks']; + diagnosisType = json['diagnosisType']; + doctorId = json['doctorId']; + episodeId = json['episodeId']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + icdCodeDetailsDto = json['icdCodeDetailsDto']; + icdSubVersion = json['icdSubVersion']; + icdType = json['icdType']; + icdVersion = json['icdVersion']; + location = json['location']; + loginUserId = json['loginUserId']; + modifiedBy = json['modifiedBy']; + modifiedOn = json['modifiedOn']; + module = json['module']; + parentLocation = json['parentLocation']; + patientId = json['patientId']; + patientProblemChangeHistories = json['patientProblemChangeHistories']; + patientProblemId = json['patientProblemId']; + patientProblemRevisionId = json['patientProblemRevisionId']; + pomrId = json['pomrId']; + previousProblem = json['previousProblem']; + problemId = json['problemId']; + problemName = json['problemName']; + remarks = json['remarks']; + resolved = json['resolved']; + selectedCategoryCode = json['selectedCategoryCode']; + selectedChapterCode = json['selectedChapterCode']; + selectedDisease = json['selectedDisease']; + selectedIcdCode = json['selectedIcdCode']; + selectedSectionCode = json['selectedSectionCode']; + status = json['status']; + visitWiseSelected = json['visitWiseSelected']; + if (json['visitWisePatientDiagnoses'] != null) { + visitWisePatientDiagnoses = []; + json['visitWisePatientDiagnoses'].forEach((v) { + visitWisePatientDiagnoses!.add(VisitWisePatientDiagnosis.fromJson(v)); + }); + } + } +} + +class VisitWisePatientDiagnosis { + bool? active; + int? admissionId; + int? appointmentId; + String? approvedBy; + String? approvedOn; + int? assessmentId; + int? clinicId; + String? condition; + String? createdBy; + String? createdOn; + String? deletedBy; + String? deletedOn; + String? deletedRemarks; + String? diagnosisType; + int? doctorId; + int? episodeId; + int? hospitalGroupId; + int? hospitalId; + String? icdSubVersion; + String? icdType; + dynamic icdVersion; // Adjust type if necessary + bool? isPreviousProblem; + String? location; + String? loginUserId; + String? modifiedBy; + String? modifiedOn; + int? patientDiagnosisId; + int? patientId; + int? patientProblemRevisionId; + int? pomrId; + String? problemName; + String? remarks; + bool? resolved; + bool? selected; + String? selectedDisease; + int? selectedDoctorId; + String? selectedIcdCode; + + VisitWisePatientDiagnosis.fromJson(Map json) { + active = json['active']; + admissionId = json['admissionId']; + appointmentId = json['appointmentId']; + approvedBy = json['approvedBy']; + approvedOn = json['approvedOn']; + assessmentId = json['assessmentId']; + clinicId = json['clinicId']; + condition = json['condition']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + deletedBy = json['deletedBy']; + deletedOn = json['deletedOn']; + deletedRemarks = json['deletedRemarks']; + diagnosisType = json['diagnosisType']; + doctorId = json['doctorId']; + episodeId = json['episodeId']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + icdSubVersion = json['icdSubVersion']; + icdType = json['icdType']; + icdVersion = json['icdVersion']; + isPreviousProblem = json['isPreviousProblem']; + location = json['location']; + loginUserId = json['loginUserId']; + modifiedBy = json['modifiedBy']; + modifiedOn = json['modifiedOn']; + patientDiagnosisId = json['patientDiagnosisId']; + patientId = json['patientId']; + patientProblemRevisionId = json['patientProblemRevisionId']; + pomrId = json['pomrId']; + problemName = json['problemName']; + remarks = json['remarks']; + resolved = json['resolved']; + selected = json['selected']; + selectedDisease = json['selectedDisease']; + selectedDoctorId = json['selectedDoctorId']; + selectedIcdCode = json['selectedIcdCode']; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/assessment/search_diagnosis.dart b/lib/core/model/SOAP/assessment/search_diagnosis.dart new file mode 100644 index 00000000..832ff167 --- /dev/null +++ b/lib/core/model/SOAP/assessment/search_diagnosis.dart @@ -0,0 +1,83 @@ +class SearchDiagnosis { + String? category; + String? categoryId; + String? codeRange; + String? diseaseType; + String? diseases; + String? diseasesBCode; + String? diseasesCode; + String? diseasesDataId; + String? diseasesId; + String? diseasesName; + int? hospitalGroupId; + int? hospitalId; + String? icdSubVersion; + String? icdType; + List? icdVersion; + String? icdVersionDisplay; + bool? isDeleted; + String? layerID; + String? parentDiseasesCode; + String? specification; + int? specificationId; + String? specificationNo; + + // Default constructor + SearchDiagnosis(); + + // fromJson constructor + SearchDiagnosis.fromJson(Map json) { + category = json['category']; + categoryId = json['categoryId']; + codeRange = json['codeRange']; + diseaseType = json['diseaseType']; + diseases = json['diseases']; + diseasesBCode = json['diseasesBCode']; + diseasesCode = json['diseasesCode']; + diseasesDataId = json['diseasesDataId']; + diseasesId = json['diseasesId']; + diseasesName = json['diseasesName']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + icdSubVersion = json['icdSubVersion']; + icdType = json['icdType']; + icdVersion = json['icdVersion'] != null + ? List.from(json['icdVersion']) + : null; + icdVersionDisplay = json['icdVersionDisplay']; + isDeleted = json['isDeleted'] == "True"; + layerID = json['layerID']; + parentDiseasesCode = json['parentDiseasesCode']; + specification = json['specification']; + specificationId = json['specificationId']; + specificationNo = json['specificationNo']; + } + + // toJson method + Map toJson() { + return { + 'category': category, + 'categoryId': categoryId, + 'codeRange': codeRange, + 'diseaseType': diseaseType, + 'diseases': diseases, + 'diseasesBCode': diseasesBCode, + 'diseasesCode': diseasesCode, + 'diseasesDataId': diseasesDataId, + 'diseasesId': diseasesId, + 'diseasesName': diseasesName, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'icdSubVersion': icdSubVersion, + 'icdType': icdType, + 'icdVersion': icdVersion, + 'icdVersionDisplay': icdVersionDisplay, + 'isDeleted': isDeleted.toString(), + 'layerID': layerID, + 'parentDiseasesCode': parentDiseasesCode, + 'specification': specification, + 'specificationId': specificationId, + 'specificationNo': specificationNo, + }; + } +} \ No newline at end of file diff --git a/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart b/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart new file mode 100644 index 00000000..9938648f --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart @@ -0,0 +1,97 @@ +class PatientPhysicalExamination { + int? patientPhysicalExaminationRevisionID; + int? patientPhysicalExaminationID; + int? patientID; + int? physicalExaminationSystemID; + String? physicalExaminationDescription; + int? physicalExaminationCondition; + String? remark; + int? assessmentId; + String? userType; + int? specialtyID; + String? specialityDescription; + String? loginUserId; + bool? isMandatory; + String? examinationType; + dynamic additionalParams; // Use dynamic for null or varied types + int? hospitalGroupID; + int? hospitalID; + int? dbCRUDOperation; + bool? isActive; + int? createdBy; + String? createdOn; + int? modifiedBy; + String? modifiedOn; + int? approvedBy; + String? approvedOn; + String? rowVersion; + int? pomrid; + + // Default constructor + PatientPhysicalExamination(); + + // fromJson constructor + PatientPhysicalExamination.fromJson(Map json) { + patientPhysicalExaminationRevisionID = + json['patientPhysicalExaminationRevisionID']; + patientPhysicalExaminationID = json['patientPhysicalExaminationID']; + patientID = json['patientID']; + physicalExaminationSystemID = json['physicalExaminationSystemID']; + physicalExaminationDescription = json['physicalExaminationDescription']; + physicalExaminationCondition = json['physicalExaminationCondition']; + remark = json['remark']; + assessmentId = json['assessmentId']; + userType = json['userType']; + specialtyID = json['specialtyID']; + specialityDescription = json['specialityDescription']; + loginUserId = json['loginUserId']; + isMandatory = json['isMandatory']; + examinationType = json['examinationType']; + additionalParams = json['additionalParams']; + hospitalGroupID = json['hospitalGroupID']; + hospitalID = json['hospitalID']; + dbCRUDOperation = json['dbCRUDOperation']; + isActive = json['isActive']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + modifiedBy = json['modifiedBy']; + modifiedOn = json['modifiedOn']; + approvedBy = json['approvedBy']; + approvedOn = json['approvedOn']; + rowVersion = json['rowVersion']; + pomrid = json['pomrid']; + } + + // toJson method + Map toJson() { + return { + 'patientPhysicalExaminationRevisionID': patientPhysicalExaminationRevisionID, + 'patientPhysicalExaminationID': patientPhysicalExaminationID, + 'patientID': patientID, + 'physicalExaminationSystemID': physicalExaminationSystemID, + 'physicalExaminationDescription': physicalExaminationDescription, + 'physicalExaminationCondition': physicalExaminationCondition, + 'remark': remark, + 'assessmentId': assessmentId, + 'userType': userType, + 'specialtyID': specialtyID, + 'specialityDescription': specialityDescription, + 'loginUserId': loginUserId, + 'isMandatory': isMandatory, + 'examinationType': examinationType, + 'additionalParams': additionalParams, + 'hospitalGroupID': hospitalGroupID, + 'hospitalID': hospitalID, + 'dbCRUDOperation': dbCRUDOperation, + 'isActive': isActive, + 'createdBy': createdBy, + 'createdOn': createdOn, + 'modifiedBy': modifiedBy, + 'modifiedOn': modifiedOn, + 'approvedBy': approvedBy, + 'approvedOn': approvedOn, + 'rowVersion': rowVersion, + 'pomrid': pomrid, + }; + } +} 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 new file mode 100644 index 00000000..127b5e49 --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart @@ -0,0 +1,54 @@ +class PostPhysicalExaminationModel { + bool? isChecked; + bool? selected; + int? pomrid; + int? patientID; + bool? isClinicPhysicalExamination; + int? physicalExaminationSystemID; + String? physicalExaminationDescription; + int? specialityID; + dynamic selectedOptions; + bool? isMandatory; + String? specialityDescription; + int? physicalExaminationCondition; + String? loginUserId; + String? remark; + + PostPhysicalExaminationModel(); + + PostPhysicalExaminationModel.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, + }; + } +} \ No newline at end of file diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index b9f6a69f..d7254814 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -109,7 +109,7 @@ class LookupService extends BaseService { _historySurgicalList.add(MasterKeyModel.fromJson(v)); }); break; - case MasterKeysService.PhysicalExamination: + case MasterKeysService.PostPhysicalExaminationModel: _physicalExaminationList.clear(); entryList.forEach((v) { _physicalExaminationList.add(MasterKeyModel.fromJson(v)); 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 e6321cd3..7fc58e7a 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -3,11 +3,16 @@ import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_mod import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; 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/model/SOAP/assessment/FavoriteDiseaseDetails.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_complaint_vidaplus.dart'; 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/patient_physical_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; @@ -25,11 +30,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_e import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; -import 'package:http/http.dart'; import '../../../../config/shared_pref_kay.dart'; import '../../../../utils/date-utils.dart'; import '../../../model/SOAP/assessment/patch_assessment_req_model.dart'; @@ -48,6 +50,16 @@ class SOAPService extends LookupService { List hopiDetails = []; List patientChiefComplaintListVidaPlus = []; List searchChiefComplaintListVidaPlus = []; + List patientPreviousDiagnosisList = []; + List favoriteDiagnosisDetailsList = []; + List auditDiagnosislist = []; + List searchDiagnosisList = []; + List patientPhysicalExaminationList = []; + Map diagnosisTypeList = {}; + Map conditionTypeList = {}; + List icdVersionList = []; + bool addedToFavorite = false; + bool showAuditBottomSheet = false; int? episodeID; bool isPrescriptionOrder = false; @@ -426,7 +438,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; @@ -437,10 +449,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!; @@ -464,7 +474,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, @@ -477,7 +487,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; @@ -519,7 +529,7 @@ class SOAPService extends LookupService { await baseAppClient.post(UPDATE_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; @@ -544,7 +554,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; @@ -581,7 +591,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; @@ -631,4 +642,311 @@ class SOAPService extends LookupService { super.error = error; }, body: request); } + + searchDiagnosis(PatiantInformtion patient, String diagnosis) async { + Map request = { + "diseaseCode": diagnosis, + }; + hasError = false; + searchDiagnosisList.clear(); + + 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); + } + + void _processData() { + Set icdVersions = {}; + for (var item in searchDiagnosisList) { + if (item.icdVersion != null) { + icdVersions.addAll(item.icdVersion ?? []); + } + } + icdVersionList = icdVersions.toList(); + } + + SearchDiagnosis? findParent(String selectedICD) { + for (var item in searchDiagnosisList) { + if (item.icdVersion != null && + (item.icdVersion as List).contains(selectedICD)) { + return item; + } + } + return null; + } + + getDiagnosisType(PatiantInformtion patient) async { + Map request = {}; + hasError = false; + 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); + } + + getConditionType(PatiantInformtion patient) async { + Map request = {}; + hasError = false; + 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); + } + + auditDiagnosis( + PatiantInformtion patient, + String patientProblemRevisionID, + ) async { + Map request = { + "patientProblemRevisionId": patientProblemRevisionID, + "ProjectID": patient.projectId + }; + hasError = false; + 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); + } + + getPreviousDiagnosis(PatiantInformtion patient) async { + Map request = { + // "HospitalGroupID": await sharedPref.getString(DOCTOR_SETUP_ID), //setup + // "hospitalId": patient.projectId, + // "patientId": patient.patientId, + // "patientPomrId": patient.pomrId, + // "startRow": 0, + // "endRow": 1000, + // "ProjectID": patient.projectId + //todo just for the test as the create diagnosis is still not working + "HospitalGroupID": 105, + "hospitalId": 313, + "patientId": 70010976, + "patientPomrId": 8414, + "startRow": 0, + "endRow": 2, + "ProjectID": 313 + }; + hasError = false; + 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); + } + + removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId, + String? problemId, String? deletedRemarks) async { + Map request = { + // "patientProblemId": patientProblemId, + // "patientId": patientInfo.patientId, + // "problemId": problemId, + // "deletedRemarks": deletedRemarks, + // "ProjectID": patientInfo.projectId + //todo just for the test as the create diagnosis is still not working + "patientProblemId": 13691, + "patientId": 70010986, + "problemId": 41698, + "deletedRemarks": "kethees test", + "ProjectID": 313 + }; + hasError = false; + 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); + } + + favoriteDiagnosis( + PatiantInformtion patientInfo, + ) async { + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + + Map request = { + "projectId": patientInfo.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "userId": user?['List_MemberInformation'][0]['MemberID'], + "favoritesType": "DIAGNOSIS", + "clinicId": patientInfo.clinicId, + "ProjectID": patientInfo.projectId, + }; + hasError = false; + 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); + } + + getPhysicalExamination( + PatiantInformtion patientInfo, + ) async { + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + + Map request = { + "patientId": patientInfo.patientId, + "pomrId": patientInfo.pomrId, + "hospitalId": patientInfo.projectId, + "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "ProjectID":patientInfo.projectId + }; + hasError = false; + patientPhysicalExaminationList.clear(); + await baseAppClient.post(FAVORITE_DIAGNOSIS, + 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); + } + + addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, + String subFavoriteCode, String? userId) async { + Map request = { + "ProjectID": paitientInfo.projectId, + "listDiagnosisFavourite": [ + { + "createdBy": doctorName, + "favoritesType": "DIAGNOSIS", + "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "hospitalId": paitientInfo.projectId, + "subFavoritesCode": subFavoriteCode, + "userId": userId + } + ] + }; + hasError = false; + addedToFavorite = false; + 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); + } + + convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { + Map request = { + "patientProblemRevisionId": diagnosis.patientProblemRevisionId, + "patientId": paitientInfo.patientId, + "doctorId": paitientInfo.doctorId, + "pomrId": paitientInfo.pomrId, + "appointmentId": paitientInfo.appointmentNo, + "createdBy": diagnosis.createdBy, + "hospitalId": diagnosis.hospitalId, + "hospitalGroupId": diagnosis.hospitalGroupId, + "clinicGroupId": diagnosis.clinicGroupId, + "clinicId": diagnosis.clinicId, + "isSelected": true, + "ProjectID":paitientInfo.projectId + }; + hasError = false; + 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); + } + + createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis, + int diagnosisType, String conditionType, String remarks, bool isNew) { + /*{ +"codeRange": "A79", +"selectedDisease": "Trench fever", +"categoryId": 3962, +"diseasesCode": "A79.0", +"diseasesId": 17664, +"selectedIcdCode": "A79.0", +"selectedCategoryCode": "A79.0", +"selectedSectionCode": "A79", +"selectedChapterCode": "XX", +"selectedNandaCode": "A79.0", +"codeType": "ICD", +"problemId": 1634, +"icdId": 1, +"problemName": "default", +}*/ + + var request = { + "pomrId": patient.pomrId, + "appointmentId": patient.appointmentNo, + "clinicGroupId": patient.clinicGroupId, + "clinicId": patient.clinicId, + "patientId": patient.patientId, + "hospitalId": searchDiagnosis.hospitalId, + "hospitalGroupId": searchDiagnosis.hospitalGroupId, + "diagnosisType": diagnosisType, + "condition": conditionType, + "remarks": remarks, + "icdType": searchDiagnosis.icdType, + "icdVersion": searchDiagnosis.icdVersion, + "icdSubVersion": searchDiagnosis.icdSubVersion, + "isNew": isNew, + "specificationId": searchDiagnosis.specificationId, + }; + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index be098f49..7b431a04 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; 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/Allergy/get_allergies_res_model.dart'; @@ -6,6 +7,11 @@ import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; @@ -21,6 +27,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_I import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.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'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; @@ -108,10 +115,36 @@ class SOAPViewModel extends BaseViewModel { List get searchChiefComplaintList => _SOAPService.searchChiefComplaintListVidaPlus; + List get searchDiagnosisList => + _SOAPService.searchDiagnosisList; + + List get icdVersionList => _SOAPService.icdVersionList; + + List get patientPreviousDiagnosis => + _SOAPService.patientPreviousDiagnosisList; + + List get favoriteDiagnosisDetails => + _SOAPService.favoriteDiagnosisDetailsList; + + Map get diagnosisTypeList => _SOAPService.diagnosisTypeList; + + Map get conditionTypeMap => _SOAPService.conditionTypeList; + + List get conditionTypeList => + _SOAPService.conditionTypeList.keys.toList(); + List get getChiefComplaintListVidaPlus => _SOAPService.patientChiefComplaintListVidaPlus; + List get patientPhysicalExaminationList => + _SOAPService.patientPhysicalExaminationList; + + List get auditDiagnosislist => + _SOAPService.auditDiagnosislist; + int? get episodeID => _SOAPService.episodeID; + bool get isFavorite => _SOAPService.addedToFavorite; + bool get showAudit => _SOAPService.showAuditBottomSheet; bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; bool isAddProgress = true; @@ -120,6 +153,7 @@ class SOAPViewModel extends BaseViewModel { String complaintsControllerError = ''; String medicationControllerError = ''; String illnessControllerError = ''; + String selectedIcd = ''; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; @@ -430,7 +464,7 @@ class SOAPViewModel extends BaseViewModel { return result.first; } break; - case MasterKeysService.PhysicalExamination: + case MasterKeysService.PostPhysicalExaminationModel: List result = physicalExaminationList.where((element) { return element.id == id && element.typeId == masterKeys.getMasterKeyService(); @@ -1002,4 +1036,142 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + searchDiagnosis(PatiantInformtion patientInfo, String searchQuery) async { + setState(ViewState.BusyLocal); + await _SOAPService.searchDiagnosis(patientInfo, searchQuery); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + getConditionAndType(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getDiagnosisType(patientInfo); + await _SOAPService.getConditionType(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + getType(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + // await _SOAPService.getDiagnosisType(patientInfo); + await _SOAPService.getConditionType(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + getPreviousPatientDetails(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getPreviousDiagnosis(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + getAuditOfDiagnosis( + PatiantInformtion patient, + String patientProblemRevisionID, + ) async { + setState(ViewState.BusyLocal); + await _SOAPService.auditDiagnosis(patient, patientProblemRevisionID); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + SearchDiagnosis? findTheDiagnosisItem(String icdVersion) { + selectedIcd = icdVersion; + return _SOAPService.findParent(icdVersion); + } + + void removeDiagnosis( + PatiantInformtion patientInfo, { + String? patientProblemId, + String? problemId, + String? deletedRemarks, + }) async { + setState(ViewState.BusyLocal); + await _SOAPService.removeDiagnosis( + patientInfo, patientProblemId, problemId, deletedRemarks); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + void favoriteDiagnosis( + PatiantInformtion patientInfo, { + String? patientProblemId, + String? problemId, + String? deletedRemarks, + }) async { + setState(ViewState.BusyLocal); + await _SOAPService.favoriteDiagnosis(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + void addToFavoriteDiagnosis( + PatiantInformtion patientInfo, { + SearchDiagnosis? diagnosis + }) async { + setState(ViewState.BusyLocal); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + await _SOAPService.addToFavoriteDiagnosis(patientInfo,profile?['DoctorName'] ??'',diagnosis?.diseasesBCode ?? '',user?['List_MemberInformation'][0]['MemberID'] ??''); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + void convertPreviousDiagnosisCurrent( + PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { + setState(ViewState.BusyLocal); + await _SOAPService.convertPreviousDiagnosisCurrent(paitientInfo,diagnosis); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + void getPhysicalExamination( + PatiantInformtion paitientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getPhysicalExamination(paitientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + void toggleFavorite(bool status ){ + _SOAPService.addedToFavorite + = status; + } + + void toggleShowBottomSheetValue(bool status){ + _SOAPService.showAuditBottomSheet + = status; + } + } 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 7be4b062..238f8dd8 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 @@ -38,7 +38,7 @@ class _AddExaminationPageState extends State { if (model.physicalExaminationList.length == 0) { WidgetsBinding.instance.addPostFrameCallback((_) async { await model.getMasterLookup( - MasterKeysService.PhysicalExamination, + MasterKeysService.PostPhysicalExaminationModel, ); }); } 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 b44c35db..d9d4ed1b 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 @@ -63,11 +63,11 @@ class _UpdateObjectivePageState extends State implements Ob await model.getPatientPhysicalExam(widget.patientInfo); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); + await model.getMasterLookup(MasterKeysService.PostPhysicalExaminationModel); } model.patientPhysicalExamList.forEach((element) { MasterKeyModel? examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PhysicalExamination, + masterKeys: MasterKeysService.PostPhysicalExaminationModel, id: element.examId, ); MySelectedExamination tempEam = SoapUtils.generateMySelectedExamination( diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart index e9e5d933..c271a5ae 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart @@ -1,13 +1,23 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.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'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart'; 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:hexcolor/hexcolor.dart'; class AddDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + + const AddDiagnosis({super.key, required this.patientInfo}); + @override State createState() => _AddDiagnosisState(); } @@ -15,6 +25,7 @@ class AddDiagnosis extends StatefulWidget { class _AddDiagnosisState extends State with SingleTickerProviderStateMixin { TabController? _tabController; + bool isLoading = true; @override void initState() { @@ -25,7 +36,18 @@ class _AddDiagnosisState extends State @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) { + WidgetsBinding.instance.addPostFrameCallback((_) { + model.toggleFavorite(false); + model.getConditionAndType(widget.patientInfo); + model.favoriteDiagnosis(widget.patientInfo); + setState(() { + isLoading = false; + }); + }); + }, builder: (_, model, w) => AppScaffold( + isLoading: model.state == ViewState.BusyLocal , isShowAppBar: true, appBar: PatientSearchHeader( title: TranslationBase.of(context).addDiagnosis), @@ -51,7 +73,7 @@ class _AddDiagnosisState extends State ), Tab( child: AppText( - TranslationBase.of(context).mappedDiagnosis, + TranslationBase.of(context).favoriteDiagnosis, color: Color(0xFF6D6D6D), fontSize: 14, fontWeight: FontWeight.w600, @@ -65,13 +87,67 @@ class _AddDiagnosisState extends State child: TabBarView( controller: _tabController, children: [ - EnterDiagnosis(), - EnterDiagnosis(), + EnterDiagnosis( + patientInfo: widget.patientInfo, + ), + FavoriteDiagnosis( + patientInfo: widget.patientInfo, + ), ], ), ), ], ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + // height: SizeConfig.heightMultiplier! * + // (SizeConfig.isHeightVeryShort ? 8 : 6), + // padding: 10, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async {}, + ), + ), + ], + ), + ) + ], + ), + ), + ), )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart index a320ce92..09c07d54 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart @@ -1,5 +1,6 @@ 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/view_state.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_assement.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; @@ -67,49 +68,15 @@ class _UpdateAssessmentPageState extends State model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); WidgetsBinding.instance.addPostFrameCallback((_) async { - await model.isPrescriptionOrderCreated(widget.patientInfo); - await model.onUpdateAssessmentStepStart(widget.patientInfo); - - if (model.patientAssessmentList.isNotEmpty) { - model.patientAssessmentList.forEach((element) { - MasterKeyModel? diagnosisType = model.getOneMasterKey( - masterKeys: MasterKeysService.DiagnosisType, - id: element.diagnosisTypeID, - ); - MasterKeyModel? selectedICD = model.getOneMasterKey( - masterKeys: MasterKeysService.ICD10, - id: element.icdCode10ID, - ); - MasterKeyModel? diagnosisCondition = model.getOneMasterKey( - masterKeys: MasterKeysService.DiagnosisCondition, - id: element.conditionID!, - ); - if (diagnosisCondition != null && - diagnosisType != null && - diagnosisCondition != null) { - MySelectedAssessment temMySelectedAssessment = - SoapUtils.generateMySelectedAssessment( - appointmentNo: element.appointmentNo, - remark: element.remarks, - diagnosisType: diagnosisType, - diagnosisCondition: diagnosisCondition, - selectedICD: selectedICD, - doctorID: element.doctorID, - doctorName: element.doctorName, - createdBy: element.createdBy, - createdOn: element.createdOn, - icdCode10ID: element.icdCode10ID); - - mySelectedAssessmentList.add(temMySelectedAssessment); - } - }); - } - + widget.changeLoadingState(true); + model.getPreviousPatientDetails(widget.patientInfo); widget.changeLoadingState(false); + //todo handle get diagnosis list }); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, + isLoading: model.state == ViewState.BusyLocal, backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -158,7 +125,7 @@ class _UpdateAssessmentPageState extends State Tab( child: AppText( TranslationBase.of(context) - .currentDiagnosis, + .previousDiagnosis, color: Color(0xFF6D6D6D), fontSize: 14, fontWeight: FontWeight.w600, @@ -175,10 +142,13 @@ class _UpdateAssessmentPageState extends State controller: _tabController, children: [ CurrentDiagnosis( + patientInfo: widget.patientInfo, + model: model, currentDiagnosisItems: [''], ), PreviousDiagnosis( - diagnosisItems: [''], + diagnosisItems: model.patientPreviousDiagnosis, + patientInfo: widget.patientInfo, ) ], ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_item.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_item.dart new file mode 100644 index 00000000..3fc197f7 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_item.dart @@ -0,0 +1,94 @@ +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class AuditItem extends StatelessWidget { + final AuditDiagnosis auditDiagnosis; + + const AuditItem({super.key, required this.auditDiagnosis}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + auditDiagnosis.createdBy ?? '', + fontWeight: FontWeight.w600, + fontSize: 12, + color: Color(0xFF2B353E), + ), + AppText( + getDate(auditDiagnosis.createdOn?.isNotEmpty== true ? auditDiagnosis.createdOn ?? '' : auditDiagnosis.modifiedOn??''), + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF2B353E), + ), + ], + ), + SizedBox(height: 4,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).diagnosis}: ${auditDiagnosis.diagnosisType}", + fontWeight: FontWeight.w600, + fontSize: 12, + color: Color(0xFF2B353E), + ), + AppText( + getTime(auditDiagnosis.createdOn?.isNotEmpty== true ? auditDiagnosis.createdOn ?? '' : auditDiagnosis.modifiedOn??''), + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF2B353E), + ), + ], + ), + SizedBox( + height: 4, + ), + + Visibility( + visible: auditDiagnosis.deletedRemarks?.isEmpty == true, + child: AppText( + //todo handle the item after the discussion from the vidapro team this is temporary + "${TranslationBase.of(context).remarks}: ${auditDiagnosis.remarks?.isNotEmpty == true? auditDiagnosis.remarks : TranslationBase.of(context).noRemarks}", + fontWeight: FontWeight.w600, + fontSize: 12, + color: Color(0xFF2B353E), + ), + ), + Visibility( + visible: auditDiagnosis.deletedRemarks?.isNotEmpty == true, + child: AppText( + //todo handle the item after the discussion from the vidapro team this is temporary + "${TranslationBase.of(context).deletedRemarks}${auditDiagnosis.deletedRemarks}", + fontWeight: FontWeight.w600, + fontSize: 12, + color: Color(0xFF2B353E), + ), + ), + ], + ), + ); + } + + String getDate(String dateTime) { + if (dateTime.isEmpty) return ''; + DateTime now = DateTime.now(); + return DateFormat('dd MMM yyyy').format(now); + } + + String getTime(String dateTime) { + if (dateTime.isEmpty) return ''; + DateTime now = DateTime.now(); + return DateFormat('hh:mm a').format(now); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart new file mode 100644 index 00000000..befb56e5 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart @@ -0,0 +1,62 @@ +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_item.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class AuditListBottomSheet extends StatelessWidget { + final List auditList; + + const AuditListBottomSheet({super.key, required this.auditList}); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.56:MediaQuery.sizeOf(context).height*.28, + child: Material( + color: Color(0xFFF7F7F7), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 32), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).audit, + fontWeight: FontWeight.w700, + fontSize: 24, + color: Color(0xFF2B353E), + ), + SizedBox( + height: 16, + ), + SizedBox( + height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.25:MediaQuery.sizeOf(context).height*.12, + child: Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10)), + color: Colors.white, + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: ListView.separated( + + itemCount: auditList.length, + itemBuilder: (context, index) => AuditItem( + auditDiagnosis: auditList[index], + ), + separatorBuilder: (_, __) => Divider(), + )) + ], + ), + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart index 8d64deee..71a69dbb 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart @@ -1,15 +1,35 @@ +import 'package:doctor_app_flutter/config/config.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/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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'; -class CurrentDiagnosis extends StatelessWidget { +import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart'; + +class CurrentDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; final List currentDiagnosisItems; + final SOAPViewModel model; + + const CurrentDiagnosis( + {super.key, + required this.currentDiagnosisItems, + required this.patientInfo, + required this.model}); + + @override + State createState() => _CurrentDiagnosisState(); +} - const CurrentDiagnosis({super.key, required this.currentDiagnosisItems}); +class _CurrentDiagnosisState extends State { + TextEditingController deleteController = TextEditingController(); @override Widget build(BuildContext context) { @@ -24,7 +44,12 @@ class CurrentDiagnosis extends StatelessWidget { AddSoapItem( title: TranslationBase.of(context).addNewDiagnosis, onAddSoapItemClicked: () { - Navigator.push(context, FadePage(page: AddDiagnosis())); + Navigator.push( + context, + FadePage( + page: AddDiagnosis( + patientInfo: widget.patientInfo, + ))); }), SizedBox( height: 16, @@ -33,29 +58,125 @@ class CurrentDiagnosis extends StatelessWidget { SizedBox( height: 16, ), - if (currentDiagnosisItems.isEmpty) ...{ + if (widget.currentDiagnosisItems.isEmpty) ...{ Center( child: EmptyDiagnosis(), ), } else ...{ Flexible( + child: ListView.separated( + itemBuilder: (_, index) { + return SoapDetailItem( + title: 'lorem ipsum', + status: 'active', + condition: 'acute', + remarks: 'initial', + onSoapDetailActionClicked: (action) { + switch (action) { + case SoapDetailItemActions.EDIT: + // TODO: Handle this case. + case SoapDetailItemActions.RESOLVE: + // TODO: Handle this case. - child: - ListView.separated( - itemBuilder: (_, index) { - return SoapDetailItem( - title: 'lorem ipsum', - status: 'active', - condition: 'acute', - remarks: 'initial', - onSoapDetailActionClicked: (action) {}, - ); - }, - separatorBuilder: (_, index) => Divider(), - itemCount: currentDiagnosisItems.length)) + case SoapDetailItemActions.REMOVE: + showConfirmationDialog(context, + "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", + () { + widget.model + .removeDiagnosis(widget.patientInfo); + }); + case SoapDetailItemActions.CHANGE_STATUS: + // TODO: Handle this case. + default: + } + }, + ); + }, + separatorBuilder: (_, index) => Divider(), + itemCount: widget.currentDiagnosisItems.length)) } ], ), ); } + + showConfirmationDialog( + BuildContext context, String message, Function okFunction) { + return showDialog( + context: context, + barrierDismissible: true, // user must tap button! + builder: (_) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AlertDialog( + title: null, + content: Container( + child: Column( + children: [ + AppText(message), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .areYouSureYouWantToDeleteDiagnosis, + textAlign: TextAlign.center, + ), + SizedBox( + height: 8, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: deleteController, + maxLines: 25, + minLines: 3, + hasBorder: true, + onChanged: (value) {}, + inputType: TextInputType.multiline, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ], + ), + ), + actions: [ + Row( + children: [ + Expanded( + child: AppButton( + onPressed: () { + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.black, + color: Color(0xffEAEAEA), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppButton( + onPressed: () { + okFunction(); + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).delete, + fontColor: Colors.white, + color: Colors.red[600], + ), + ), + ], + ), + ], + ), + ], + ), + ); + }).then((value) { + deleteController.clear(); + }); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart new file mode 100644 index 00000000..1db5dd98 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class EmptyDropDown extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Expanded(child: SizedBox.shrink()), + Align( + alignment: Alignment.centerLeft, + child: Icon(Icons.keyboard_arrow_down), + ) + ], + ), + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart index 8e34b682..45b6ddbe 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart @@ -1,14 +1,27 @@ +import 'dart:async'; + import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.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/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; -List patientState = ["","Stable", "Not Stable", "Not Defined"]; + +List patientState = ["", "Stable", "Not Stable", "Not Defined"]; class EnterDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + + const EnterDiagnosis({super.key, required this.patientInfo}); + @override State createState() => _EnterDiagnosisState(); } @@ -17,276 +30,420 @@ class _EnterDiagnosisState extends State { final TextEditingController filteredSearchController = TextEditingController(); bool showAllDiagnosis = true; - bool status = true; - String selectedItem = "Stable"; + String status = ''; + String? selectedItem; TextEditingController remarksController = TextEditingController(); + Timer? _tTimer; + SOAPViewModel? model; + SearchDiagnosis? selectedDiagnosis; + void _onTextChanged(String text) { + if (_tTimer != null) { + _tTimer!.cancel(); + } + _tTimer = Timer(Duration(milliseconds: 500), () { + _onStopped(text); + }); + } + + void _onStopped(String searchText) async { + await model?.searchDiagnosis(widget.patientInfo, searchText); + } @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addDiagnosis, - fontWeight: FontWeight.w600, - color: Color(0xFF2E303A), - fontSize: 16, - ), - SizedBox( - height: 16, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).selectAllergy, - isTextFieldHasSuffix: true, - hasBorder: true, - controller: filteredSearchController, - onChanged: (value) {}, - onFieldSubmitted: () {}, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Color(0xff2B353E), - size: 30, - ), - onPressed: () {}, - ), - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + return BaseView( + onModelReady: (model) { + this.model = model; + }, + builder: (_, model, w) => SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Switch( - value: showAllDiagnosis, - activeColor: Colors.red, - onChanged: (bool value) { - setState(() { - showAllDiagnosis = value; - }); + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, + ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).diagnosis, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onClick: () { + setState( + () { + selectedDiagnosis = null; + filteredSearchController.text = ''; + model.selectedIcd = ''; }, + ); + }, + onChanged: (value) { + if (value != null) _onTextChanged(value); + }, + onFieldSubmitted: () {}, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, ), - SizedBox( - width: 8, - ), - AppText( - TranslationBase.of(context).showAllDiagnosis, - fontWeight: FontWeight.w500, - color: Color(0xFF2E303A), - fontSize: 11, - ), - ], + onPressed: () {}, + ), ), - SvgPicture.asset('assets/images/svgs/information.svg'), - ], - ), - Container( - margin: EdgeInsets.only(bottom: 12), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, - ), - ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () {}, - 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).acute, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + Positioned( + child: Material( + elevation: 4.0, // Optional: for shadow effect + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: 0, maxHeight: 300), + child: ListView.builder( + shrinkWrap: true, + itemCount: model.icdVersionList.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + child: AppText(model.icdVersionList[index]), + onTap: () { + setState( + () { + selectedDiagnosis = + model.findTheDiagnosisItem( + model.icdVersionList[index]); + filteredSearchController.text = + model.icdVersionList[index]; + model.searchDiagnosisList.clear(); + model.icdVersionList.clear(); + }, + ); + }, + ), + ); + }, ), - ], + ), ), - )), - Expanded( - child: InkWell( - onTap: () {}, - child: Row( + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 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, - ), - ), + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { + setState(() { + showAllDiagnosis = value; + }); + }, + ), + SizedBox( + width: 8, ), AppText( - TranslationBase.of(context).subAcute, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, ), ], ), + SvgPicture.asset('assets/images/svgs/information.svg'), + ], + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, ), ), - Expanded( - child: InkWell( - onTap: () {}, - 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, + // Row( + // children: [ + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = ""; + // }); + // }, + // 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).acute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "2"; + // }); + // }, + // 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).subAcute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // ), + // ), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "3"; + // }); + // }, + // 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, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).chronic, + // 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: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + 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 == model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], ), - ), - ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ AppText( - TranslationBase.of(context).chronic, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null + ? model.diagnosisTypeList.keys.first + : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedItem = newValue; + }); + }, + items: model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), ], ), ), ), - ], - ), - SizedBox(height: 8,), - - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).patientCondition, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), - SizedBox( - height: 4, - ), - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem, - iconSize: 25, - elevation: 16, - - onChanged: (newValue) async { - setState(() { - selectedItem = newValue ?? ""; - }); - }, - items: patientState.map((item) { - return DropdownMenuItem( - child: AppText( - item, - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, - ), - value: item, - ); - }).toList(), - ), - ), - ], + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), ), - ), - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) {}, - onClick: () {}, - onFieldSubmitted: () {}, - ), - ), - SizedBox( - height: 16, - ), - Row( - children: [ - SvgPicture.asset('assets/images/svgs/save_as_draft.svg'), SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).saveAsDraft, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), + height: 16, ), + InkWell( + onTap: () { + if (selectedDiagnosis != null) + model.addToFavoriteDiagnosis(widget.patientInfo, + diagnosis: selectedDiagnosis); + }, + child: Row( + children: [ + SvgPicture.asset(model.isFavorite + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).addToFavorite, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ), + ) ], - ) - ], + ), + ), ), ); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart new file mode 100644 index 00000000..219f45cb --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart @@ -0,0 +1,416 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.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/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; + +List patientState = ["", "Stable", "Not Stable", "Not Defined"]; + +class FavoriteDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + + const FavoriteDiagnosis({super.key, required this.patientInfo}); + + @override + State createState() => _FavoriteDiagnosisState(); +} + +class _FavoriteDiagnosisState extends State { + final TextEditingController filteredSearchController = + TextEditingController(); + bool showAllDiagnosis = true; + String status = ''; + String? selectedItem; + String? selectedFavorite; + TextEditingController remarksController = TextEditingController(); + Timer? _tTimer; + SOAPViewModel? model; + SearchDiagnosis? selectedDiagnosis; + + void _onTextChanged(String text) { + if (_tTimer != null) { + _tTimer!.cancel(); + } + _tTimer = Timer(Duration(milliseconds: 500), () { + _onStopped(text); + }); + } + + void _onStopped(String searchText) async { + await model?.searchDiagnosis(widget.patientInfo, searchText); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + this.model = model; + WidgetsBinding.instance.addPostFrameCallback((_) { + model.favoriteDiagnosis(widget.patientInfo); + }); + }, + builder: (_, model, w) => SingleChildScrollView( + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnosis, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.favoriteDiagnosisDetails.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + itemHeight: null, + value: selectedFavorite == null + ? model.favoriteDiagnosisDetails.first + .diseases + : selectedFavorite, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedFavorite = newValue; + }); + }, + items: model.favoriteDiagnosisDetails + .map((item) { + return DropdownMenuItem( + child: AppText( + item.diseases ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item.diseases, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + + SizedBox( + height: 8, + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + // Row( + // children: [ + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = ""; + // }); + // }, + // 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).acute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "2"; + // }); + // }, + // 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).subAcute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // ), + // ), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "3"; + // }); + // }, + // 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, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).chronic, + // 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: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + 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 == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + itemHeight: null, + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null + ? model.diagnosisTypeList.keys.first + : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedItem = newValue; + }); + }, + items: model.diagnosisTypeList.keys + .map((item) { + return DropdownMenuItem( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + SizedBox( + height: 16, + ), + ], + ), + ), + )); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart index 48dc1189..20a30c2f 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart @@ -1,3 +1,9 @@ +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; @@ -5,10 +11,14 @@ 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:flutter/material.dart'; +import '../../../../../../core/viewModel/SOAP_view_model.dart'; + class PreviousDiagnosis extends StatelessWidget { - final List diagnosisItems; + final List diagnosisItems; + final PatiantInformtion patientInfo; - const PreviousDiagnosis({super.key, required this.diagnosisItems}); + const PreviousDiagnosis( + {super.key, required this.diagnosisItems, required this.patientInfo}); @override Widget build(BuildContext context) { @@ -17,27 +27,68 @@ class PreviousDiagnosis extends StatelessWidget { child: EmptyDiagnosis(), ); - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: ListView.separated( - itemBuilder: (_, index) { - return PreviousDiagnosisItem( - title: 'lorem ipsum', - status: 'active', - condition: 'acute', - remarks: 'initial', - onSoapDetailActionClicked: (action) {}, - ); - }, - separatorBuilder: (_, index) => Divider(), - itemCount: diagnosisItems.length), - ) - ], - ), + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) { + if(model.showAudit){ + WidgetsBinding.instance.addPostFrameCallback((_){ + showAuditBottomSheet(context,model.auditDiagnosislist,model.toggleShowBottomSheetValue); + model.toggleShowBottomSheetValue(false); + }); + } + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: ListView.separated( + itemBuilder: (_, index) { + return PreviousDiagnosisItem( + title: diagnosisItems[index].selectedDisease ?? '', + status: diagnosisItems[index].status ?? '', + condition: diagnosisItems[index].condition ?? '', + remarks: diagnosisItems[index].remarks ?? '', + onSoapDetailActionClicked: (action) { + switch (action) { + case SoapDetailItemActions.AUDIT: + model.getAuditOfDiagnosis( + patientInfo, + diagnosisItems[index] + .patientProblemRevisionId + ?.toString() ?? + ''); + break; + case SoapDetailItemActions.CHANGE_STATUS: + model.convertPreviousDiagnosisCurrent(patientInfo, diagnosisItems[index]); + default: + } + }, + ); + }, + separatorBuilder: (_, index) => Divider(), + itemCount: diagnosisItems.length), + ) + ], + ), + );} ); } + + void showAuditBottomSheet( + BuildContext context, + List diagnosis, void Function(bool status) toggleShowBottomSheetValue, + ) { + showModalBottomSheet( + isDismissible: true, + context: context, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), + builder: (_) { + return AuditListBottomSheet( + auditList: diagnosis, + ); + }, + ).then((value)=>toggleShowBottomSheetValue(false)); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart index 8cb6c800..0b83fc8f 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart @@ -4,6 +4,7 @@ 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:flutter_svg/svg.dart'; +import 'package:hexcolor/hexcolor.dart'; typedef OnSoapDetailActionClicked = Function(SoapDetailItemActions); @@ -29,35 +30,49 @@ class PreviousDiagnosisItem extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( - children: [ + // Stack( + // children: [ Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - title, - color: Color(0XFF2B353E), - fontSize: 12, - fontWeight: FontWeight.bold, - ), Row( children: [ - AppText( - "${TranslationBase.of(context).condition}:", - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - SizedBox( - width: 4, - ), - AppText( - condition, - color: Color(0xffD02127), - fontSize: 10, - fontWeight: FontWeight.w500, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + title, + color: Color(0XFF2B353E), + fontSize: 12, + fontWeight: FontWeight.bold, + ), + SizedBox(height: 4,), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + condition, + color: Color(0xffD02127), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + ], + ), ), + Status(status: status), + ], ), Visibility( @@ -77,10 +92,10 @@ class PreviousDiagnosisItem extends StatelessWidget { )) ], ), - Align( - alignment: Alignment.topRight, child: Status(status: status)) - ], - ), + // Align( + // alignment: Alignment.topRight, child: Status(status: status)) + // ], + // ), SizedBox( height: 16, ), @@ -103,13 +118,18 @@ class PreviousDiagnosisItem extends StatelessWidget { ), SizedBox( width: 187, - child: AppButton( - onPressed: () { - onSoapDetailActionClicked( - SoapDetailItemActions.CHANGE_STATUS); - }, - title: TranslationBase.of(context).makeCurrentDiagnosis, - ), + height: 27, + child: Material( + color: HexColor("#D02127"), + shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(5.0)) , + child: InkWell( + onTap: () { + onSoapDetailActionClicked( + SoapDetailItemActions.CHANGE_STATUS); + }, + child:Center(child: AppText( TranslationBase.of(context).makeCurrentDiagnosis, color: Colors.white,)), + ), + ), ) ], ) diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart index 9b2c73a2..49b0d9d7 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart @@ -43,7 +43,7 @@ class _AddExaminationPageVidaPlusState if (model.physicalExaminationList.length == 0) { WidgetsBinding.instance.addPostFrameCallback((_) async { await model.getMasterLookup( - MasterKeysService.PhysicalExamination, + MasterKeysService.PostPhysicalExaminationModel, ); }); } @@ -77,7 +77,7 @@ class _AddExaminationPageVidaPlusState children: [ ExaminationsListSearchVidaPlusWidget( mySelectedExamination: widget.mySelectedExamination, - masterList: model.physicalExaminationList, + masterList: model.patientPhysicalExaminationList, isServiceSelected: (master) => isServiceSelected(master), removeExamination: (selectedExamination) { diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart index 954f6cf2..502114c9 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -12,7 +13,7 @@ class ExaminationsListSearchVidaPlusWidget extends StatefulWidget { final Function(MySelectedExamination) removeExamination; final Function(MySelectedExamination) addExamination; final bool Function(MasterKeyModel) isServiceSelected; - final List? masterList; + final List? masterList; final List? mySelectedExamination; ExaminationsListSearchVidaPlusWidget({required this.removeExamination, required this.addExamination, required this.isServiceSelected, this.masterList, this.mySelectedExamination}); @@ -23,7 +24,7 @@ class ExaminationsListSearchVidaPlusWidget extends StatefulWidget { class _ExaminationsListSearchVidaPlusWidgetState extends State { int expandedIndex = -1; - List? items = []; + List? items = []; TextEditingController filteredSearchController = TextEditingController(); @override @@ -66,55 +67,55 @@ class _ExaminationsListSearchVidaPlusWidgetState extends State dummySearchList = []; - dummySearchList.addAll(widget.masterList as Iterable); - if (query.isNotEmpty) { - List dummyListData = []; - dummySearchList.forEach((item) { - if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || item.nameEn!.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(item); - } - }); - setState(() { - items!.clear(); - items!.addAll(dummyListData); - }); - return; - } else { - setState(() { - items!.clear(); - items!.addAll(widget.masterList as Iterable); - }); - } + // List dummySearchList = []; + // dummySearchList.addAll(widget.masterList as Iterable); + // if (query.isNotEmpty) { + // List dummyListData = []; + // dummySearchList.forEach((item) { + // if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || item.nameEn!.toLowerCase().contains(query.toLowerCase())) { + // dummyListData.add(item); + // } + // }); + // setState(() { + // items!.clear(); + // items!.addAll(dummyListData); + // }); + // return; + // } else { + // setState(() { + // items!.clear(); + // items!.addAll(widget.masterList as Iterable); + // }); + // } } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart index fc8e53d7..7f5805c5 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart @@ -68,40 +68,45 @@ class _UpdateObjectivePageVidaPlusState @override Widget build(BuildContext context) { - return BaseView( onModelReady: (model) async { WidgetsBinding.instance.addPostFrameCallback((_) async { - model.setObjectiveCallBack(this); - mySelectedExamination.clear(); - model.isAddExamInProgress = true; - await model.getPatientPhysicalExam(widget.patientInfo); - if (model.patientPhysicalExamList.isNotEmpty) { - if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); + if (model.patientPhysicalExaminationList == 0) { + model.getPhysicalExamination(widget.patientInfo); } - model.patientPhysicalExamList.forEach((element) { - MasterKeyModel? examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PhysicalExamination, - id: element.examId, - ); - MySelectedExamination tempEam = - SoapUtils.generateMySelectedExamination( - examination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - createdOn: element.createdOn, - editedOn: element.editedOn, - notExamined: element.notExamined, - isNew: element.isNew, - isLocal: false, - isAbnormal: element.isAbnormal, - ); - mySelectedExamination.add(tempEam); - }); - } - widget.changeLoadingState(false);}); + // model.getPatientPhysicalExam(widget.patientInfo); + model.setObjectiveCallBack(this); + mySelectedExamination.clear(); + model.isAddExamInProgress = true; + await model.getPatientPhysicalExam(widget.patientInfo); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PostPhysicalExaminationModel); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel? examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PostPhysicalExaminationModel, + id: element.examId, + ); + MySelectedExamination tempEam = + SoapUtils.generateMySelectedExamination( + examination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + createdOn: element.createdOn, + editedOn: element.editedOn, + notExamined: element.notExamined, + isNew: element.isNew, + isLocal: false, + isAbnormal: element.isAbnormal, + ); + mySelectedExamination.add(tempEam); + }); + } + widget.changeLoadingState(false); + }); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, @@ -131,29 +136,31 @@ class _UpdateObjectivePageVidaPlusState child: Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 10,), + SizedBox( + height: 10, + ), AddSoapItem( title: TranslationBase.of(context).physicalExamination, onAddSoapItemClicked: () { openExaminationList(context); }), - SizedBox(height: 16,), + SizedBox( + height: 16, + ), if (mySelectedExamination.isEmpty) ...{ - - Center( + Center( child: Padding( padding: const EdgeInsets.all(65), - child: EmptyWidget(TranslationBase.of(context).noPhysicalExamination), + child: EmptyWidget(TranslationBase.of(context) + .noPhysicalExamination), ), ), - } else ...{ Divider(), ListOfExamination( - listOfSelection: mySelectedExamination - ) + listOfSelection: mySelectedExamination) } // if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal) @@ -333,10 +340,8 @@ class _UpdateObjectivePageVidaPlusState mySelectedExamination: mySelectedExamination, addSelectedExamination: (List mySelectedExaminationLocal) { - pushAddExamination(mySelectedExaminationLocal); - // mySelectedExaminationLocal.forEach((element) { // if (mySelectedExamination.singleWhere( // (it) => @@ -377,12 +382,14 @@ class _UpdateObjectivePageVidaPlusState await submitUpdateObjectivePage(model); } - void pushAddExamination(List mySelectedExaminationLocal) { + void pushAddExamination( + List mySelectedExaminationLocal) { Navigator.push( context, FadePage( page: AddDetailsToExaminationVidaPlus( - mySelectedExamination: mySelectedExamination,), + mySelectedExamination: mySelectedExamination, + ), ), ); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index 4608e1e0..50cf8db0 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget { class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex = 0; + int _currentIndex =2; List myAllergiesList = []; List myHistoryList = []; @@ -98,7 +98,12 @@ class _UpdateSoapIndexVidaPlusState extends State scrollDirection: Axis.horizontal, children: [ - + UpdateAssessmentPage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState, + ), UpdateSubjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, @@ -109,12 +114,7 @@ class _UpdateSoapIndexVidaPlusState extends State currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState, - ), + UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 27db82f0..d443785b 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1932,6 +1932,16 @@ class TranslationBase { String get subAcute => localizedValues['subAcute']![locale.languageCode]!; String get chronic => localizedValues['chronic']![locale.languageCode]!; + String get addToFavorite => localizedValues['addToFavorite']![locale.languageCode]!; + String get favoriteDiagnosis => localizedValues['favoriteDiagnosis']![locale.languageCode]!; + String get areYouSureYouWantToDeleteDiagnosis => localizedValues['areYouSureYouWantToDeleteDiagnosis']![locale.languageCode]!; + String get fieldName => localizedValues['fieldName']![locale.languageCode]!; + String get oldValue => localizedValues['oldValue']![locale.languageCode]!; + String get newValue => localizedValues['newValue']![locale.languageCode]!; + String get event => localizedValues['event']![locale.languageCode]!; + String get deletedRemarks => localizedValues['deletedRemarks']![locale.languageCode]!; + String get noRemarks => localizedValues['noRemarks']![locale.languageCode]!; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 5e31c9cf985a45fabe9569366b995d079f83f59b Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Mon, 25 Nov 2024 09:14:47 +0300 Subject: [PATCH 02/10] WD: general speciality --- lib/config/config.dart | 4 + .../SOAP/physical_exam/GeneralSpeciality.dart | 24 + .../soap/SOAP_service.dart | 705 ++++++++++-------- lib/core/viewModel/SOAP_view_model.dart | 60 +- .../add_details_to_examination_vida_plus.dart | 48 +- .../add_examination_page_vida_plus.dart | 85 ++- .../add_examination_vida_plus_widget.dart | 258 +------ ...inations_list_search_vida_plus_widget.dart | 36 +- .../objective/list_of_examination.dart | 28 +- .../update_objective_page_vida_plus.dart | 316 ++++---- 10 files changed, 696 insertions(+), 868 deletions(-) create mode 100644 lib/core/model/SOAP/physical_exam/GeneralSpeciality.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index b7dd3ee2..70c60788 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -328,6 +328,10 @@ const ADD_TO_FAVORITE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/Diagnosis const MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/ContinuePreviousEpisode'; +const SEARCH_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/SearchPhysicalExam'; + +const GET_GENERAL_SPECIALITY = 'Services/DoctorApplication.svc/REST/GetGeneralSpeciality'; + var selectedPatientType = 1; diff --git a/lib/core/model/SOAP/physical_exam/GeneralSpeciality.dart b/lib/core/model/SOAP/physical_exam/GeneralSpeciality.dart new file mode 100644 index 00000000..7428f6a2 --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/GeneralSpeciality.dart @@ -0,0 +1,24 @@ +class GeneralSpeciality { + int? id; + bool? isActive; + String? name; + int? rowVersion; + bool isSelected = false; + + GeneralSpeciality(); + + GeneralSpeciality.fromJson(Map json) { + id = json['id']; + isActive = json['isActive']; + name = json['name']; + rowVersion = json['rowVersion']; + } + Map toJson() { + return { + 'id': id, + 'isActive': isActive, + 'name': name, + 'rowVersion': rowVersion, + }; + } +} 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 7fc58e7a..c7d74ce0 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -12,7 +12,9 @@ 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/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'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; @@ -55,6 +57,7 @@ class SOAPService extends LookupService { List auditDiagnosislist = []; List searchDiagnosisList = []; List patientPhysicalExaminationList = []; + List generalSpeciality = []; Map diagnosisTypeList = {}; Map conditionTypeList = {}; List icdVersionList = []; @@ -69,26 +72,25 @@ 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 { @@ -96,11 +98,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( @@ -108,11 +110,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( @@ -121,11 +123,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( @@ -133,11 +135,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( @@ -145,11 +147,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( @@ -157,11 +159,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 { @@ -169,11 +171,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( @@ -181,11 +183,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( @@ -194,11 +196,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( @@ -206,11 +208,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( @@ -218,11 +220,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( @@ -230,11 +232,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 { @@ -243,16 +245,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, @@ -260,15 +262,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( @@ -276,15 +278,16 @@ 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( @@ -292,14 +295,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( @@ -307,15 +310,16 @@ 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( @@ -323,15 +327,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( @@ -339,31 +343,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 */ @@ -376,16 +380,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 { @@ -393,20 +397,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!); @@ -438,22 +442,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( @@ -487,17 +491,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; @@ -529,13 +533,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 { @@ -548,17 +552,15 @@ 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 { @@ -569,15 +571,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 { @@ -588,20 +590,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": [ { @@ -615,11 +617,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 { @@ -631,16 +633,17 @@ 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 { @@ -652,14 +655,15 @@ 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() { @@ -688,13 +692,14 @@ 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 { @@ -703,20 +708,18 @@ 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 @@ -725,14 +728,15 @@ 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 { @@ -757,14 +761,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, @@ -786,18 +790,17 @@ 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 = { @@ -812,18 +815,17 @@ 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 = { @@ -831,19 +833,59 @@ class SOAPService extends LookupService { "pomrId": patientInfo.pomrId, "hospitalId": patientInfo.projectId, "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), - "ProjectID":patientInfo.projectId + "ProjectID": patientInfo.projectId }; hasError = false; patientPhysicalExaminationList.clear(); - await baseAppClient.post(FAVORITE_DIAGNOSIS, + 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) { + response['ListPhysicalExam']['resultData'].forEach((v) => + patientPhysicalExaminationList.add( + PatientPhysicalExamination.fromJson(v))); + }, onFailure: (String error, int statusCode) { physicalExaminationList.clear(); - hasError = true; - super.error = error; - }, body: request); + hasError = true; + super.error = error; + }, body: request); + } + + postPhysicalExamination(PatiantInformtion patientInfo,List physicalExamination) async { + var jsonListOfPhysicalExamination = []; + physicalExamination.forEach((value)=>jsonListOfPhysicalExamination.add(value.toJson())); + + Map request = { + "ProjectID": patientInfo.patientId, + "listCreatPhysicalExam": jsonListOfPhysicalExamination + }; + hasError = false; + await baseAppClient.post(SEARCH_PHYSICAL_EXAMINATION, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast( + response['ListPhysicalExam']['message']); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + + getGeneralSpeciality(PatiantInformtion patientInfo) async { + + Map request = { + "ProjectID": patientInfo.patientId, + }; + hasError = false; + 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); } addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, @@ -866,23 +908,24 @@ 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); - } - - convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { + 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, + PatientPreviousDiagnosis diagnosis) async { Map request = { "patientProblemRevisionId": diagnosis.patientProblemRevisionId, "patientId": paitientInfo.patientId, @@ -895,21 +938,21 @@ class SOAPService extends LookupService { "clinicGroupId": diagnosis.clinicGroupId, "clinicId": diagnosis.clinicId, "isSelected": true, - "ProjectID":paitientInfo.projectId + "ProjectID": paitientInfo.projectId }; hasError = false; 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); } createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis, diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 7b431a04..1b1e3bf7 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -29,6 +29,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_ex 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'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_examination_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; @@ -48,6 +49,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjecti import '../../locator.dart'; import '../model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import '../model/SOAP/assessment/patch_assessment_req_model.dart'; +import '../model/SOAP/physical_exam/GeneralSpeciality.dart'; import 'base_view_model.dart'; class SOAPViewModel extends BaseViewModel { @@ -142,8 +144,13 @@ class SOAPViewModel extends BaseViewModel { List get auditDiagnosislist => _SOAPService.auditDiagnosislist; + List get speciality => + _SOAPService.generalSpeciality; + int? get episodeID => _SOAPService.episodeID; + bool get isFavorite => _SOAPService.addedToFavorite; + bool get showAudit => _SOAPService.showAuditBottomSheet; bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; @@ -1128,24 +1135,27 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void addToFavoriteDiagnosis( - PatiantInformtion patientInfo, { - SearchDiagnosis? diagnosis - }) async { + void addToFavoriteDiagnosis(PatiantInformtion patientInfo, + {SearchDiagnosis? diagnosis}) async { setState(ViewState.BusyLocal); Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map? user = await sharedPref.getObj(LOGGED_IN_USER); - await _SOAPService.addToFavoriteDiagnosis(patientInfo,profile?['DoctorName'] ??'',diagnosis?.diseasesBCode ?? '',user?['List_MemberInformation'][0]['MemberID'] ??''); + await _SOAPService.addToFavoriteDiagnosis( + patientInfo, + profile?['DoctorName'] ?? '', + diagnosis?.diseasesBCode ?? '', + user?['List_MemberInformation'][0]['MemberID'] ?? ''); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - void convertPreviousDiagnosisCurrent( - PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { + + void convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, + PatientPreviousDiagnosis diagnosis) async { setState(ViewState.BusyLocal); - await _SOAPService.convertPreviousDiagnosisCurrent(paitientInfo,diagnosis); + await _SOAPService.convertPreviousDiagnosisCurrent(paitientInfo, diagnosis); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1153,8 +1163,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void getPhysicalExamination( - PatiantInformtion paitientInfo) async { + void getPhysicalExamination(PatiantInformtion paitientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.getPhysicalExamination(paitientInfo); if (_SOAPService.hasError) { @@ -1164,14 +1173,33 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void toggleFavorite(bool status ){ - _SOAPService.addedToFavorite - = status; + void postPhysicalExamination(PatiantInformtion patientInfo, + List physicalExamination) async { + setState(ViewState.BusyLocal); + await _SOAPService.postPhysicalExamination( + patientInfo, physicalExamination); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + void getGeneralSpeciality(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getGeneralSpeciality( + patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); } - void toggleShowBottomSheetValue(bool status){ - _SOAPService.showAuditBottomSheet - = status; + void toggleFavorite(bool status) { + _SOAPService.addedToFavorite = status; } + void toggleShowBottomSheetValue(bool status) { + _SOAPService.showAuditBottomSheet = status; + } } 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 c310ddc7..07e6443e 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,4 +1,5 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.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/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -15,7 +16,7 @@ import 'package:provider/provider.dart'; import '../../../../../core/viewModel/project_view_model.dart'; class AddDetailsToExaminationVidaPlus extends StatefulWidget { - final List? mySelectedExamination; + final List? mySelectedExamination; const AddDetailsToExaminationVidaPlus({super.key, this.mySelectedExamination}); @@ -43,31 +44,26 @@ class _AddDetailsToExaminationVidaPlusState extends State? mySelectedExamination; - final Function(List) addSelectedExamination; - final Function(MasterKeyModel) removeExamination; + final PatiantInformtion patientInfo; + final List? examination; - AddExaminationPageVidaPlus( - {this.mySelectedExamination, - required this.addSelectedExamination, - required this.removeExamination}); + ///todo handle the data if edit is added + AddExaminationPageVidaPlus({required this.patientInfo, this.examination}); @override _AddExaminationPageVidaPlusState createState() => @@ -28,12 +34,11 @@ class AddExaminationPageVidaPlus extends StatefulWidget { class _AddExaminationPageVidaPlusState extends State { - List mySelectedExaminationLocal = []; + List mySelectedExaminationLocal = []; @override initState() { super.initState(); - mySelectedExaminationLocal = widget.mySelectedExamination!; } @override @@ -42,15 +47,16 @@ class _AddExaminationPageVidaPlusState onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { WidgetsBinding.instance.addPostFrameCallback((_) async { - await model.getMasterLookup( - MasterKeysService.PostPhysicalExaminationModel, - ); + if (model.speciality.isEmpty) { + await model.getGeneralSpeciality(widget.patientInfo); + } }); } }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, + isLoading: model.state == ViewState.Busy, appBar: PatientSearchHeader( title: TranslationBase.of(context).examinationPart), backgroundColor: Colors.white, @@ -76,19 +82,42 @@ class _AddExaminationPageVidaPlusState mainAxisSize: MainAxisSize.max, children: [ ExaminationsListSearchVidaPlusWidget( - mySelectedExamination: widget.mySelectedExamination, - masterList: model.patientPhysicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), + masterList: model.speciality, removeExamination: (selectedExamination) { + if(selectedExamination == null ) return; + setState(() { mySelectedExaminationLocal .remove(selectedExamination); + // Find the object by its ID + try { + final speciality = + model.speciality.firstWhere( + (speciality) => + speciality.id == selectedExamination.id, + orElse: () => throw Exception( + 'Speciality with ID ${selectedExamination.id} not found!'), + ); + + speciality.isSelected = false; + } catch (e) {} }); }, addExamination: (selectedExamination) { + if(selectedExamination == null ) return; + mySelectedExaminationLocal.insert( 0, selectedExamination); + + try { + final speciality = model.speciality.firstWhere( + (speciality) => + speciality.id == selectedExamination.id, + orElse: () => throw Exception( + 'Speciality with ID ${selectedExamination.id} not found!'), + ); + speciality.isSelected = true; + } catch (e) {} //setState(() {}); }, ), @@ -128,10 +157,7 @@ class _AddExaminationPageVidaPlusState fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { - Navigator.pop(context); - widget.addSelectedExamination(mySelectedExaminationLocal); - - + pushAddExamination(mySelectedExaminationLocal); }, ), ), @@ -141,14 +167,15 @@ class _AddExaminationPageVidaPlusState ); } - isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = mySelectedExaminationLocal.where( - (element) => - masterKey.id == element.selectedExamination!.id && - masterKey.typeId == element.selectedExamination!.typeId); - if (exam.length > 0) { - return true; - } - return false; + void pushAddExamination( + List mySelectedExaminationLocal) { + Navigator.push( + context, + FadePage( + page: AddDetailsToExaminationVidaPlus( + mySelectedExamination: mySelectedExaminationLocal, + ), + ), + ); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart index a4510410..90fec299 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart @@ -1,6 +1,7 @@ // ignore: must_be_immutable import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.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/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -13,22 +14,16 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationVidaPlusWidget extends StatefulWidget { - MasterKeyModel? item; - final Function(MySelectedExamination) removeExamination; - final Function(MySelectedExamination) addExamination; - final bool Function(MasterKeyModel) isServiceSelected; - bool isExpand; + GeneralSpeciality? item; + final Function(GeneralSpeciality?) removeExamination; + final Function(GeneralSpeciality?) addExamination; - final Function() expandClick; - final List? mySelectedExamination; + final List? mySelectedExamination; AddExaminationVidaPlusWidget({ this.item, required this.removeExamination, required this.addExamination, - required this.isServiceSelected, - this.isExpand = false, - required this.expandClick, this.mySelectedExamination, }); @@ -43,17 +38,7 @@ class _AddExaminationVidaPlusWidgetState extends State exam = widget.mySelectedExamination!.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId); - if (exam.length > 0) { - return exam.first; + } } - return null; } + } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart index 502114c9..f3baebfc 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.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/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart'; @@ -8,23 +9,25 @@ import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dar import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; - class ExaminationsListSearchVidaPlusWidget extends StatefulWidget { - final Function(MySelectedExamination) removeExamination; - final Function(MySelectedExamination) addExamination; - final bool Function(MasterKeyModel) isServiceSelected; - final List? masterList; - final List? mySelectedExamination; + final Function(GeneralSpeciality?) removeExamination; + final Function(GeneralSpeciality?) addExamination; + final List? masterList; - ExaminationsListSearchVidaPlusWidget({required this.removeExamination, required this.addExamination, required this.isServiceSelected, this.masterList, this.mySelectedExamination}); + ExaminationsListSearchVidaPlusWidget( + {required this.removeExamination, + required this.addExamination, + this.masterList}); @override - _ExaminationsListSearchVidaPlusWidgetState createState() => _ExaminationsListSearchVidaPlusWidgetState(); + _ExaminationsListSearchVidaPlusWidgetState createState() => + _ExaminationsListSearchVidaPlusWidgetState(); } -class _ExaminationsListSearchVidaPlusWidgetState extends State { +class _ExaminationsListSearchVidaPlusWidgetState + extends State { int expandedIndex = -1; - List? items = []; + List? items = []; TextEditingController filteredSearchController = TextEditingController(); @override @@ -44,7 +47,8 @@ class _ExaminationsListSearchVidaPlusWidgetState extends State AddExaminationVidaPlusWidget( + item: items![index], + addExamination: widget.addExamination, + removeExamination: widget.removeExamination, + ), + separatorBuilder: (_, __) => Divider(), + ) // ...items!.mapIndexed((index, item) { // return Column( // children: [ diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart index a9b246e2..01f4ce6d 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; @@ -8,7 +9,7 @@ import 'package:provider/provider.dart'; import '../../../../../utils/translations_delegate_base_utils.dart'; class ListOfExamination extends StatelessWidget { - final List listOfSelection; + final List listOfSelection; const ListOfExamination({super.key, required this.listOfSelection}); @@ -20,25 +21,8 @@ class ListOfExamination extends StatelessWidget { physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (_, index) => SoapDetailItem( - title: projectViewModel.isArabic - ? listOfSelection[index] - .selectedExamination! - .nameAr != - null && - listOfSelection[index] - .selectedExamination! - .nameAr != - "" - ? listOfSelection[index] - .selectedExamination! - .nameAr! - : listOfSelection[index] - .selectedExamination! - .nameEn! - : listOfSelection[index] - .selectedExamination! - .nameEn!, - condition: getCondition(listOfSelection[index], context)??TranslationBase.of(context).notExamined, + title: "${listOfSelection[index].physicalExaminationDescription}", + condition: getCondition(listOfSelection[index].physicalExaminationCondition ?? 3, context)??TranslationBase.of(context).notExamined, remarks: listOfSelection[index].remark??'', onSoapDetailActionClicked: (action) { ///todo handle the event as per the actiion @@ -51,9 +35,9 @@ class ListOfExamination extends StatelessWidget { ); } - String? getCondition(MySelectedExamination examination, BuildContext context) => examination.isNormal + String? getCondition(int condition, BuildContext context) => condition ==0 ? TranslationBase.of(context).normal - : examination.isAbnormal + : condition == 1 ? TranslationBase.of(context).abnormal : TranslationBase.of(context).notExamined; } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart index 7f5805c5..008ec26e 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart @@ -4,6 +4,7 @@ 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/view_state.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.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_exam_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; @@ -51,7 +52,7 @@ class UpdateObjectivePageVidaPlus extends StatefulWidget { class _UpdateObjectivePageVidaPlusState extends State implements ObjectiveCallBack { bool isSysExaminationExpand = false; - List mySelectedExamination = []; + List mySelectedExamination = []; BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { @@ -74,37 +75,6 @@ class _UpdateObjectivePageVidaPlusState if (model.patientPhysicalExaminationList == 0) { model.getPhysicalExamination(widget.patientInfo); } - // model.getPatientPhysicalExam(widget.patientInfo); - model.setObjectiveCallBack(this); - mySelectedExamination.clear(); - model.isAddExamInProgress = true; - await model.getPatientPhysicalExam(widget.patientInfo); - if (model.patientPhysicalExamList.isNotEmpty) { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PostPhysicalExaminationModel); - } - model.patientPhysicalExamList.forEach((element) { - MasterKeyModel? examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PostPhysicalExaminationModel, - id: element.examId, - ); - MySelectedExamination tempEam = - SoapUtils.generateMySelectedExamination( - examination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - createdOn: element.createdOn, - editedOn: element.editedOn, - notExamined: element.notExamined, - isNew: element.isNew, - isLocal: false, - isAbnormal: element.isAbnormal, - ); - mySelectedExamination.add(tempEam); - }); - } widget.changeLoadingState(false); }); }, @@ -220,177 +190,143 @@ class _UpdateObjectivePageVidaPlusState ); } - submitUpdateObjectivePage(SOAPViewModel model) async { - if (mySelectedExamination.isNotEmpty) { - if (!model.isAddExamInProgress && - widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo!.isNotEmpty) { - Navigator.of(context).pop(); - } else { - widget.changeLoadingState(true); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); - mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel - .listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; - ListHisProgNotePhysicalExaminationVM - listHisProgNotePhysicalExaminationVM = - ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo == null - ? 0 - : widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo == null - ? 0 - : widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination!.id, - examType: exam.selectedExamination!.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew, - ); - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo!.isNotEmpty) { - listHisProgNotePhysicalExaminationVM.admissionNo = - int.parse(widget.patientInfo.admissionNo!); - } else { - listHisProgNotePhysicalExaminationVM.admissionNo = 0; - } - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM! - .add(listHisProgNotePhysicalExaminationVM); - }); - - if (model.patientPhysicalExamList.isEmpty) { - await model.postPhysicalExam(postPhysicalExamRequestModel); - } else { - await model.patchPhysicalExam(postPhysicalExamRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - widget.changeLoadingState(false); - Utils.showErrorToast(model.error); - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo!.isNotEmpty) { - // Navigator.of(context).pop(); - model.isAddExamInProgress = false; - } - } else { - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo!.isNotEmpty) { - // Navigator.of(context).pop(); - widget.changeLoadingState(false); - model.isAddExamInProgress = false; - } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(2); - } - } - } - } else { - Utils.showErrorToast(TranslationBase.of(context).examinationErrorMsg); - } - } - - removeExamination(MasterKeyModel masterKey) { - Iterable history = mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination!.id && - masterKey.typeId == element.selectedExamination!.typeId); + // submitUpdateObjectivePage(SOAPViewModel model) async { + // if (mySelectedExamination.isNotEmpty) { + // if (!model.isAddExamInProgress && + // widget.patientInfo.admissionNo != null && + // widget.patientInfo.admissionNo!.isNotEmpty) { + // Navigator.of(context).pop(); + // } else { + // widget.changeLoadingState(true); + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // + // DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + // PostPhysicalExamRequestModel postPhysicalExamRequestModel = + // new PostPhysicalExamRequestModel(); + // mySelectedExamination.forEach((exam) { + // if (postPhysicalExamRequestModel + // .listHisProgNotePhysicalExaminationVM == + // null) + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + // []; + // ListHisProgNotePhysicalExaminationVM + // listHisProgNotePhysicalExaminationVM = + // ListHisProgNotePhysicalExaminationVM( + // patientMRN: widget.patientInfo.patientMRN, + // episodeId: widget.patientInfo.episodeNo == null + // ? 0 + // : widget.patientInfo.episodeNo, + // appointmentNo: widget.patientInfo.appointmentNo == null + // ? 0 + // : widget.patientInfo.appointmentNo, + // remarks: exam.remark ?? '', + // createdBy: exam.createdBy ?? doctorProfile.doctorID, + // createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), + // editedBy: doctorProfile.doctorID, + // editedOn: DateTime.now().toIso8601String(), + // examId: exam.selectedExamination!.id, + // examType: exam.selectedExamination!.typeId, + // isAbnormal: exam.isAbnormal, + // isNormal: exam.isNormal, + // notExamined: exam.notExamined, + // examinationType: exam.isNormal + // ? 1 + // : exam.isAbnormal + // ? 2 + // : 3, + // examinationTypeName: exam.isNormal + // ? "Normal" + // : exam.isAbnormal + // ? 'AbNormal' + // : "Not Examined", + // isNew: exam.isNew, + // ); + // if (widget.patientInfo.admissionNo != null && + // widget.patientInfo.admissionNo!.isNotEmpty) { + // listHisProgNotePhysicalExaminationVM.admissionNo = + // int.parse(widget.patientInfo.admissionNo!); + // } else { + // listHisProgNotePhysicalExaminationVM.admissionNo = 0; + // } + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM! + // .add(listHisProgNotePhysicalExaminationVM); + // }); + // + // if (model.patientPhysicalExamList.isEmpty) { + // await model.postPhysicalExam(postPhysicalExamRequestModel); + // } else { + // await model.patchPhysicalExam(postPhysicalExamRequestModel); + // } + // + // if (model.state == ViewState.ErrorLocal) { + // widget.changeLoadingState(false); + // Utils.showErrorToast(model.error); + // if (widget.patientInfo.admissionNo != null && + // widget.patientInfo.admissionNo!.isNotEmpty) { + // // Navigator.of(context).pop(); + // model.isAddExamInProgress = false; + // } + // } else { + // if (widget.patientInfo.admissionNo != null && + // widget.patientInfo.admissionNo!.isNotEmpty) { + // // Navigator.of(context).pop(); + // widget.changeLoadingState(false); + // model.isAddExamInProgress = false; + // } else { + // widget.changeLoadingState(true); + // widget.changePageViewIndex(2); + // } + // } + // } + // } else { + // Utils.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + // } + // } - if (history.length > 0) { - setState(() { - if (history.first.isLocal) { - mySelectedExamination.remove(history.first); - } else { - history.first.notExamined = true; - history.first.isNormal = false; - history.first.isAbnormal = false; - } - }); - } - } + // removeExamination(MasterKeyModel masterKey) { + // Iterable history = mySelectedExamination.where( + // (element) => + // masterKey.id == element.selectedExamination!.id && + // masterKey.typeId == element.selectedExamination!.typeId); + // + // if (history.length > 0) { + // setState(() { + // if (history.first.isLocal) { + // mySelectedExamination.remove(history.first); + // } else { + // history.first.notExamined = true; + // history.first.isNormal = false; + // history.first.isAbnormal = false; + // } + // }); + // } + // } openExaminationList(BuildContext context) { Navigator.push( context, FadePage( page: AddExaminationPageVidaPlus( - mySelectedExamination: mySelectedExamination, - addSelectedExamination: - (List mySelectedExaminationLocal) { - pushAddExamination(mySelectedExaminationLocal); - - // mySelectedExaminationLocal.forEach((element) { - // if (mySelectedExamination.singleWhere( - // (it) => - // it.selectedExamination!.id == - // element.selectedExamination!.id, - // orElse: () => MySelectedExamination()) == - // MySelectedExamination()) { - // mySelectedExamination.insert(0, element); - // } - // }); - - /// remove items. - // List removedList = []; - // mySelectedExamination.forEach((element) { - // if (mySelectedExaminationLocal.singleWhere( - // (it) => - // it.selectedExamination!.id == - // element.selectedExamination!.id, - // orElse: () => MySelectedExamination()) == - // MySelectedExamination()) { - // removedList.add(element); - // } - // }); - - // removedList.forEach((element) { - // removeExamination(element.selectedExamination!); - // }); - // Navigator.of(context).pop(); - // setState(() {}); - }, - removeExamination: (masterKey) => removeExamination(masterKey)), + patientInfo: widget.patientInfo, + ), ), ); } @override nextFunction(model) async { - await submitUpdateObjectivePage(model); + // await submitUpdateObjectivePage(model); } - void pushAddExamination( - List mySelectedExaminationLocal) { - Navigator.push( - context, - FadePage( - page: AddDetailsToExaminationVidaPlus( - mySelectedExamination: mySelectedExamination, - ), - ), - ); - } + // void pushAddExamination( + // List mySelectedExaminationLocal) { + // Navigator.push( + // context, + // FadePage( + // page: AddDetailsToExaminationVidaPlus( + // mySelectedExamination: mySelectedExamination, + // ), + // ), + // ); + // } } From a1960c8799ba372aa290e583f3651e7ae7ece104 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Mon, 25 Nov 2024 15:18:20 +0300 Subject: [PATCH 03/10] WD: adding the physical examinatoin. --- lib/config/config.dart | 4 + lib/config/localized_values.dart | 1 + .../model/SOAP/physical_exam/Category.dart | 93 +++ .../CreatePhysicalExamination.dart | 71 ++ .../post_physical_examination_model.dart | 1 + .../soap/SOAP_service.dart | 718 +++++++++--------- lib/core/viewModel/SOAP_view_model.dart | 41 +- .../add_details_to_examination_vida_plus.dart | 126 ++- .../add_examination_page_vida_plus.dart | 1 + .../objective/widget/examination_items.dart | 505 +++++++----- .../translations_delegate_base_utils.dart | 1 + 11 files changed, 968 insertions(+), 594 deletions(-) create mode 100644 lib/core/model/SOAP/physical_exam/Category.dart create mode 100644 lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart 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]!; From d098b419e283a1a1b5ca2da6cb40443772022bbb Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Tue, 26 Nov 2024 09:35:16 +0300 Subject: [PATCH 04/10] WD: get Progress note api integrated --- lib/config/config.dart | 2 + .../SOAP/assessment/search_diagnosis.dart | 15 + .../SOAP/progress_note/progress_note.dart | 85 +++++ .../soap/SOAP_service.dart | 31 ++ lib/core/viewModel/SOAP_view_model.dart | 15 + .../plan/update_plan_page_vida_plus.dart | 295 +++++++----------- .../plan/widget/list_of_notes.dart | 3 +- 7 files changed, 266 insertions(+), 180 deletions(-) create mode 100644 lib/core/model/SOAP/progress_note/progress_note.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 23a4af3e..8ef1f0e1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -336,6 +336,8 @@ const GET_SPECIALITY_DETAILS = 'Services/DoctorApplication.svc/REST/SearchGenera const POST_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const GET_PROGRESS_NOTE_NEW = 'Services/DoctorApplication.svc/REST/GetProgressNote'; + var selectedPatientType = 1; diff --git a/lib/core/model/SOAP/assessment/search_diagnosis.dart b/lib/core/model/SOAP/assessment/search_diagnosis.dart index 832ff167..3a02db9c 100644 --- a/lib/core/model/SOAP/assessment/search_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/search_diagnosis.dart @@ -21,6 +21,11 @@ class SearchDiagnosis { String? specification; int? specificationId; String? specificationNo; + String? selectedIcdCode; + String? selectedCategoryCode; + String? selectedSectionCode; + String? selectedChapterCode; + String? selectedNandaCode; // Default constructor SearchDiagnosis(); @@ -51,6 +56,11 @@ class SearchDiagnosis { specification = json['specification']; specificationId = json['specificationId']; specificationNo = json['specificationNo']; + selectedIcdCode = json['selectedIcdCode']; + selectedCategoryCode = json['selectedCategoryCode']; + selectedSectionCode = json['selectedSectionCode']; + selectedChapterCode = json['selectedChapterCode']; + selectedNandaCode = json['selectedNandaCode']; } // toJson method @@ -78,6 +88,11 @@ class SearchDiagnosis { 'specification': specification, 'specificationId': specificationId, 'specificationNo': specificationNo, + 'selectedIcdCode': selectedIcdCode, + 'selectedCategoryCode': selectedCategoryCode, + 'selectedSectionCode': selectedSectionCode, + 'selectedChapterCode': selectedChapterCode, + 'selectedNandaCode': selectedNandaCode, }; } } \ No newline at end of file diff --git a/lib/core/model/SOAP/progress_note/progress_note.dart b/lib/core/model/SOAP/progress_note/progress_note.dart new file mode 100644 index 00000000..3afc7be9 --- /dev/null +++ b/lib/core/model/SOAP/progress_note/progress_note.dart @@ -0,0 +1,85 @@ +class ProgressNote { + int? clinicGroupId; + int? clinicId; + int? createdById; + String? createdOn; + int? employeeId; + int? hospitalGroupId; + int? hospitalId; + String? loginUserId; + String? manualDate; + String? modifiedOn; + String? patientCondition; + String? patientConditionName; + int? patientId; + int? patientPomrId; + String? progressNote; + int? progressNoteId; + String? progressNotesTypes; + String? progressNotesTypesName; + String? speciality; + String? specialityName; + int? subCategoryId; + String? userFullName; + int? userId; + String? userType; + + ProgressNote(); + + ProgressNote.fromJson(Map json) { + clinicGroupId = json['clinicGroupId']; + clinicId = json['clinicId']; + createdById = json['createdById']; + createdOn = json['createdOn']; + employeeId = json['employeeId']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + loginUserId = json['loginUserId']; + manualDate = json['manualDate']; + modifiedOn = json['modifiedOn']; + patientCondition = json['patientCondition']; + patientConditionName = json['patientConditionName']; + patientId = json['patientId']; + patientPomrId = json['patientPomrId']; + progressNote = json['progressNote']; + progressNoteId = json['progressNoteId']; + progressNotesTypes = json['progressNotesTypes']; + progressNotesTypesName = json['progressNotesTypesName']; + speciality = json['speciality']; + specialityName = json['specialityName']; + subCategoryId = json['subCategoryId']; + userFullName = json['userFullName']; + userId = json['userId']; + userType = json['userType']; + } + + // toJson method + Map toJson() { + return { + 'clinicGroupId': clinicGroupId, + 'clinicId': clinicId, + 'createdById': createdById, + 'createdOn': createdOn, + 'employeeId': employeeId, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'loginUserId': loginUserId, + 'manualDate': manualDate, + 'modifiedOn': modifiedOn, + 'patientCondition': patientCondition, + 'patientConditionName': patientConditionName, + 'patientId': patientId, + 'patientPomrId': patientPomrId, + 'progressNote': progressNote, + 'progressNoteId': progressNoteId, + 'progressNotesTypes': progressNotesTypes, + 'progressNotesTypesName': progressNotesTypesName, + 'speciality': speciality, + 'specialityName': specialityName, + 'subCategoryId': subCategoryId, + 'userFullName': userFullName, + 'userId': userId, + 'userType': userType, + }; + } +} 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 28f973dc..934f0ea0 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -34,6 +34,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_e import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import '../../../../config/shared_pref_kay.dart'; @@ -48,6 +49,7 @@ class SOAPService extends LookupService { List patientHistoryList = []; List patientPhysicalExamList = []; List patientProgressNoteList = []; + List patientProgressNoteListVidaPlus = []; List patientAssessmentList = []; List searchAllergiesList = []; List patientAllergiesVidaPlus = []; @@ -961,6 +963,35 @@ class SOAPService extends LookupService { }, body: request); } + Future getProgressNoteNew( + PatiantInformtion patientInformation) async { + Map request = { + "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "hospitalId": patientInformation.projectId, + "patientId": patientInformation.patientId, + "patientPomrId": patientInformation.pomrId, + "endRow": 10000, // because no information is provided for the end row + "startRow": 0, + "ProjectID":patientInformation.projectId + }; + hasError = false; + await baseAppClient.post(GET_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientProgressNoteListVidaPlus.clear(); + response['ProgressNoteList']['resultData'].forEach((v) { + v['data'].forEach((progressNote){ + patientProgressNoteListVidaPlus.add(ProgressNote.fromJson(progressNote)); + + }); + }); + }, 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); diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 283d2586..bab64bde 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -36,6 +36,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/soap/SOAP_service.dart'; @@ -147,6 +148,7 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.auditDiagnosislist; List get speciality => _SOAPService.generalSpeciality; + List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; Map> get specialityDetails => _SOAPService.specialityDetails; @@ -1219,6 +1221,9 @@ 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); @@ -1229,4 +1234,14 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + void getProgressNote(PatiantInformtion patientInformation) async { + setState(ViewState.BusyLocal); + await _SOAPService.getProgressNoteNew(patientInformation); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart index 0921a8a0..98228a8c 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -1,28 +1,17 @@ -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/view_state.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; -import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:doctor_app_flutter/utils/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/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -50,14 +39,7 @@ class UpdatePlanPageVidaPlus extends StatefulWidget { class _UpdatePlanPageVidaPlusState extends State implements PlanCallBack { - bool isAddProgress = true; bool isProgressExpanded = true; - List listOfProgressNote = [GetPatientProgressNoteResModel()]; - GetPatientProgressNoteResModel patientProgressNote = - GetPatientProgressNoteResModel(); - - TextEditingController progressNoteController = - TextEditingController(text: null); BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { @@ -75,88 +57,56 @@ class _UpdatePlanPageVidaPlusState extends State @override void initState() { super.initState(); - if (patientProgressNote.planNote != null) { - setState(() { - isAddProgress = false; - }); - } } - getPatientProgressNote(SOAPViewModel model, - {bool isAddProgress = false}) async { - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel); - - ///TODO set progressNote in model; - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote!); - patientProgressNote.planNote = progressNoteController.text; - - patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; - setState(() { - isAddProgress = isAddProgress; - widget.sOAPViewModel.isAddProgress = isAddProgress; - widget.sOAPViewModel.progressNoteText = progressNoteController.text; - }); - } - } + // getPatientProgressNote(SOAPViewModel model, + // {bool isAddProgress = false}) async { + // GetProgressNoteReqModel getGetProgressNoteReqModel = + // GetProgressNoteReqModel( + // appointmentNo: + // int.parse(widget.patientInfo.appointmentNo.toString()), + // patientMRN: widget.patientInfo.patientMRN, + // episodeID: widget.patientInfo.episodeNo.toString(), + // editedBy: '', + // doctorID: ''); + // await widget.sOAPViewModel + // .getPatientProgressNote(getGetProgressNoteReqModel); + // + // ///TODO set progressNote in model; + // if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + // progressNoteController.text = Utils.parseHtmlString( + // widget.sOAPViewModel.patientProgressNoteList[0].planNote!); + // patientProgressNote.planNote = progressNoteController.text; + // + // patientProgressNote.createdByName = + // widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + // patientProgressNote.createdOn = + // widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + // patientProgressNote.editedOn = + // widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + // patientProgressNote.editedByName = + // widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + // patientProgressNote.appointmentNo = + // widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + // setState(() { + // isAddProgress = isAddProgress; + // widget.sOAPViewModel.isAddProgress = isAddProgress; + // widget.sOAPViewModel.progressNoteText = progressNoteController.text; + // }); + // } + // } @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { widget.sOAPViewModel.setPlanCallBack(this); - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); + widget.changeLoadingState(true); WidgetsBinding.instance.addPostFrameCallback((_) async { - await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel);}); - - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote!); - patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; - widget.sOAPViewModel.progressNoteText = progressNoteController.text; - - setState(() { - isAddProgress = false; - widget.sOAPViewModel.isAddProgress = false; - }); - } + if (model.progressNote.isEmpty) { + await model.getProgressNote(widget.patientInfo); + } + }); widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( @@ -168,7 +118,6 @@ class _UpdatePlanPageVidaPlusState extends State child: FractionallySizedBox( widthFactor: 0.90, child: Column( - children: [ SOAPStepHeader( currentIndex: widget.currentIndex, @@ -202,7 +151,7 @@ class _UpdatePlanPageVidaPlusState extends State height: 16, ), - if (listOfProgressNote.isEmpty) ...{ + if (model.progressNote.isEmpty) ...{ Center( child: Padding( padding: const EdgeInsets.all(65), @@ -211,9 +160,7 @@ class _UpdatePlanPageVidaPlusState extends State ), } else ...{ Divider(), - ListOfNotes( - notes: listOfProgressNote - ) + ListOfNotes(notes: model.progressNote) } // if (mySelectedExamination.isEmpty) ...{ @@ -365,94 +312,84 @@ class _UpdatePlanPageVidaPlusState extends State )); } - submitPlan(SOAPViewModel model) async { - if (progressNoteController.text.isNotEmpty) { - widget.changeLoadingState(true); - PostProgressNoteRequestModel postProgressNoteRequestModel = - new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - planNote: patientProgressNote.planNote, - doctorID: widget.patientInfo.doctorId, - createdBy: widget.patientInfo.doctorId, - createdByName: widget.patientInfo.doctorName, - editedBy: ''); - - if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { - await widget.sOAPViewModel - .postProgressNote(postProgressNoteRequestModel); - } else { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; - await widget.sOAPViewModel - .patchProgressNote(postProgressNoteRequestModel); - } - - if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.sOAPViewModel.error); - } else { - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel); - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote!); - patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; - - setState(() { - isAddProgress = false; - widget.sOAPViewModel.isAddProgress = false; - }); - } - - Navigator.of(context).pop(); - Utils.showErrorToast("Episode Created Successfully"); - } - widget.changeLoadingState(false); - } else { - Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); - } - } + // submitPlan(SOAPViewModel model) async { + // if (progressNoteController.text.isNotEmpty) { + // widget.changeLoadingState(true); + // PostProgressNoteRequestModel postProgressNoteRequestModel = + // new PostProgressNoteRequestModel( + // patientMRN: widget.patientInfo.patientMRN, + // episodeId: widget.patientInfo.episodeNo, + // appointmentNo: widget.patientInfo.appointmentNo, + // planNote: patientProgressNote.planNote, + // doctorID: widget.patientInfo.doctorId, + // createdBy: widget.patientInfo.doctorId, + // createdByName: widget.patientInfo.doctorName, + // editedBy: ''); + // + // if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { + // await widget.sOAPViewModel + // .postProgressNote(postProgressNoteRequestModel); + // } else { + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + // postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; + // await widget.sOAPViewModel + // .patchProgressNote(postProgressNoteRequestModel); + // } + // + // if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { + // Utils.showErrorToast(widget.sOAPViewModel.error); + // } else { + // GetProgressNoteReqModel getGetProgressNoteReqModel = + // GetProgressNoteReqModel( + // appointmentNo: + // int.parse(widget.patientInfo.appointmentNo.toString()), + // patientMRN: widget.patientInfo.patientMRN, + // episodeID: widget.patientInfo.episodeNo.toString(), + // editedBy: '', + // doctorID: ''); + // await widget.sOAPViewModel + // .getPatientProgressNote(getGetProgressNoteReqModel); + // if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + // progressNoteController.text = Utils.parseHtmlString( + // widget.sOAPViewModel.patientProgressNoteList[0].planNote!); + // patientProgressNote.planNote = progressNoteController.text; + // patientProgressNote.createdByName = + // widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + // patientProgressNote.createdOn = + // widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + // patientProgressNote.editedOn = + // widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + // patientProgressNote.editedByName = + // widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + // patientProgressNote.appointmentNo = + // widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + // + // setState(() { + // isAddProgress = false; + // widget.sOAPViewModel.isAddProgress = false; + // }); + // } + // + // Navigator.of(context).pop(); + // Utils.showErrorToast("Episode Created Successfully"); + // } + // widget.changeLoadingState(false); + // } else { + // Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + // } + // } @override nextFunction(model) { - if (progressNoteController.text.isNotEmpty) { - if (isAddProgress) { - submitPlan(model); - } else { - Navigator.of(context).pop(); - } - } else { - Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); - } + //todo handle the next event here } void navigateToAddPlan() { Navigator.push( - context, - FadePage( - page: AddProgressNote ( - - ), - )); + context, + FadePage( + page: AddProgressNote(), + )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart index 4929ca0e..d74ab0c3 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart @@ -1,9 +1,10 @@ import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart'; import 'package:flutter/material.dart'; class ListOfNotes extends StatelessWidget{ - final List notes; + final List notes; const ListOfNotes({super.key, required this.notes}); @override From 2fbb25de774d48abdfb130a4b021b6a6b8958b6d Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Tue, 26 Nov 2024 10:25:52 +0300 Subject: [PATCH 05/10] 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,); }, ), ), From 7253f6c05e9dca23ef88e248576673fea95180b1 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 27 Nov 2024 10:40:49 +0300 Subject: [PATCH 06/10] WD: physical examination completed. --- lib/config/localized_values.dart | 2 + .../model/SOAP/physical_exam/Category.dart | 2 + .../CreatePhysicalExamination.dart | 5 +- .../patient_physical_examination.dart | 2 +- .../soap/SOAP_service.dart | 80 +- lib/core/viewModel/SOAP_view_model.dart | 47 +- .../add_details_to_examination_vida_plus.dart | 36 +- .../add_examination_page_vida_plus.dart | 106 +- .../add_examination_vida_plus_widget.dart | 2 +- ...inations_list_search_vida_plus_widget.dart | 120 ++- .../objective/list_of_examination.dart | 2 +- .../update_objective_page_vida_plus.dart | 10 +- .../objective/widget/examination_items.dart | 912 ++++++++++++------ .../plan/update_plan_page_vida_plus.dart | 2 +- .../update_soap_index_vida_plus.dart | 22 +- .../translations_delegate_base_utils.dart | 3 + 16 files changed, 848 insertions(+), 505 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 95c2b501..b9a0b7b0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1204,6 +1204,8 @@ const Map> localizedValues = { "noPhysicalExamination": {"en": "No Physical Examination added, please add it from the button above", "ar":"لم يتم إضافة فحص بدني ، يرجى إضافته من الزر أعلاه"}, "noProgressNote": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, "mild": {"en": "Mild", "ar":"خفيف"}, + "remarksCanNotBeEmpty": {"en": "Remarks Can Not Be Empty", "ar":"لا يمكن أن تكون الملاحظات فارغة"}, + "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, "event": {"en": "Event: ", "ar":"حدث: "}, "deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "}, diff --git a/lib/core/model/SOAP/physical_exam/Category.dart b/lib/core/model/SOAP/physical_exam/Category.dart index 84cecfcc..975af7c4 100644 --- a/lib/core/model/SOAP/physical_exam/Category.dart +++ b/lib/core/model/SOAP/physical_exam/Category.dart @@ -42,6 +42,7 @@ class Category { String? pomrId; int? paitientId; int? userID; + bool isExpanded = false; Category(); @@ -55,6 +56,7 @@ class Category { conditionsList!.add(Condition.fromJson(v)); }); } + if(conditionsList?.isNotEmpty == true) selectedCondition = int.parse(conditionsList?.first.conditionName ??'-1'); description = json['description']; descriptionAlias = json['descriptionAlias']; id = json['id']; diff --git a/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart b/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart index b97999f4..ac77890d 100644 --- a/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart +++ b/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart @@ -67,5 +67,8 @@ extension ConvertCategoryToCreatePhysicalExamination on Category { ..specialityID = this.specialityId ..patientID = this.paitientId ..pomrid = this.pomrId - ..loginUserId = this.userID?.toString(); + ..loginUserId = this.userID?.toString() + ..isMandatory = false + ..specialityDescription = this.specialityName + ..isClinicPhysicalExamination = true; } diff --git a/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart b/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart index 9938648f..ec4253a6 100644 --- a/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart +++ b/lib/core/model/SOAP/physical_exam/patient_physical_examination.dart @@ -25,7 +25,7 @@ class PatientPhysicalExamination { int? approvedBy; String? approvedOn; String? rowVersion; - int? pomrid; + String? pomrid; // Default constructor PatientPhysicalExamination(); 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 934f0ea0..88a1ac46 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -834,7 +834,16 @@ class SOAPService extends LookupService { ) async { Map? user = await sharedPref.getObj(LOGGED_IN_USER); - Map request = { + Map request = + // { + // "patientId": 70024978, + // "pomrId": 10819, + // "hospitalId": 313, + // "hospitalGroupId": 105, + // "ProjectID": 313 + // }; + + { "patientId": patientInfo.patientId, "pomrId": patientInfo.pomrId, "hospitalId": patientInfo.projectId, @@ -855,40 +864,42 @@ class SOAPService extends LookupService { }, body: request); } - Future postPhysicalExamination(PatiantInformtion patientInfo, - List physicalExamination) async { + Future postPhysicalExamination( + PatiantInformtion patientInfo, List physicalExamination) async { List jsonListOfPhysicalExamination = []; - physicalExamination - .forEach((value) => jsonListOfPhysicalExamination.add(value.createPhysicalExaminationFromCategory())); + physicalExamination.forEach((value) => jsonListOfPhysicalExamination + .add(value.createPhysicalExaminationFromCategory())); Map request = { - "ProjectID": patientInfo.patientId, + "ProjectID": patientInfo.projectId, "listCreatPhysicalExam": jsonListOfPhysicalExamination }; hasError = false; - bool data = await baseAppClient.post(POST_PHYSICAL_EXAM, + var success = false; + await baseAppClient.post(POST_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { DrAppToastMsg.showSuccesToast(response['ListPhysicalExam']['message']); - return true; + success = true; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - return false; + success = false; }, body: request); - return data; + return success; } getGeneralSpeciality(PatiantInformtion patientInfo) async { Map request = { - "ProjectID": patientInfo.patientId, + "ProjectID": patientInfo.projectId, }; hasError = false; generalSpeciality.clear(); await baseAppClient.post(GET_GENERAL_SPECIALITY, onSuccess: (dynamic response, int statusCode) { - response['ListGeneralSpeciality']['resultData'] - .forEach((v) => generalSpeciality.add(GeneralSpeciality.fromJson(v))); + response['ListGeneralSpeciality']['resultData'].forEach((v) => + v['categories'].forEach( + (cat) => generalSpeciality.add(GeneralSpeciality.fromJson(cat)))); }, onFailure: (String error, int statusCode) { hasError = true; generalSpeciality.clear(); @@ -963,8 +974,7 @@ class SOAPService extends LookupService { }, body: request); } - Future getProgressNoteNew( - PatiantInformtion patientInformation) async { + Future getProgressNoteNew(PatiantInformtion patientInformation) async { Map request = { "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), "hospitalId": patientInformation.projectId, @@ -972,37 +982,43 @@ class SOAPService extends LookupService { "patientPomrId": patientInformation.pomrId, "endRow": 10000, // because no information is provided for the end row "startRow": 0, - "ProjectID":patientInformation.projectId + "ProjectID": patientInformation.projectId }; hasError = false; await baseAppClient.post(GET_PROGRESS_NOTE, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientProgressNoteListVidaPlus.clear(); - response['ProgressNoteList']['resultData'].forEach((v) { - v['data'].forEach((progressNote){ - patientProgressNoteListVidaPlus.add(ProgressNote.fromJson(progressNote)); - - }); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + print("Success"); + patientProgressNoteListVidaPlus.clear(); + response['ProgressNoteList']['resultData'].forEach((v) { + v['data'].forEach((progressNote) { + patientProgressNoteListVidaPlus + .add(ProgressNote.fromJson(progressNote)); + }); + }); + }, 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; + specialityDetails.clear(); List categoryData = []; - await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, + await baseAppClient.post(GET_SPECIALITY_DETAILS, 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']))); + response['ListEyeGeneralSpeciality']['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; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 668e8b7d..870272fc 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -48,6 +48,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessme import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import '../../locator.dart'; import '../model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; @@ -147,7 +148,8 @@ class SOAPViewModel extends BaseViewModel { List get auditDiagnosislist => _SOAPService.auditDiagnosislist; - List get speciality => _SOAPService.generalSpeciality; + List? mainSpecialityList = null; + List speciality = []; List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; @@ -1181,16 +1183,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postPhysicalExamination(PatiantInformtion patientInfo) async { - setState(ViewState.BusyLocal); + + List getListOfSelectedCategory(){ List mappedItems = []; for (List category in specialityDetails.values) { var selectedCategory = - category.where((value) => value.isSelected == true); + category.where((value) => value.isSelected == true); mappedItems.addAll(selectedCategory); } + return mappedItems; + } + + Future postPhysicalExamination(PatiantInformtion patientInfo, List listOfSelectedCategory) async { + setState(ViewState.BusyLocal); bool result = - await _SOAPService.postPhysicalExamination(patientInfo, mappedItems); + await _SOAPService.postPhysicalExamination(patientInfo, listOfSelectedCategory); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1200,9 +1207,11 @@ class SOAPViewModel extends BaseViewModel { return result; } - void getGeneralSpeciality(PatiantInformtion patientInfo) async { + getGeneralSpeciality(PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.getGeneralSpeciality(patientInfo); + mainSpecialityList = _SOAPService.generalSpeciality; + speciality = mainSpecialityList ?? []; if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1210,7 +1219,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void getSpecialityDetails(String speciality, int? specialityId, + getSpecialityDetails(String speciality, int? specialityId, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.getSpecialityDetails( @@ -1230,7 +1239,7 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.showAuditBottomSheet = status; } - void getProgressNote(PatiantInformtion patientInformation) async { + getProgressNote(PatiantInformtion patientInformation) async { setState(ViewState.BusyLocal); await _SOAPService.getProgressNoteNew(patientInformation); if (_SOAPService.hasError) { @@ -1239,4 +1248,26 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + void changeCurrentCategorySelectedState( + GeneralSpeciality selectedExamination, bool status) { + final item = speciality.firstWhere( + (speciality) => speciality.id == selectedExamination.id, + orElse: () => throw Exception( + 'Speciality with ID ${selectedExamination.id} not found!'), + ); + item.isSelected = status; + notifyListeners(); + } + + void filterData(String query) { + if (query.isEmpty) { + speciality = mainSpecialityList ?? []; + } + var searchList = + mainSpecialityList?.where((value) => value.name?.toLowerCase().contains(query.toLowerCase()) == true).toList() ?? + []; + speciality = searchList; + notifyListeners(); + } } 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 fe9bcf38..6abbdb52 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 @@ -4,11 +4,13 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/GeneralSpeciali 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/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; 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'; @@ -34,7 +36,7 @@ class AddDetailsToExaminationVidaPlus extends StatefulWidget { class _AddDetailsToExaminationVidaPlusState extends State { - bool isSysExaminationExpand = false; + String currentlyExpanded = ''; @override Widget build(BuildContext context) { @@ -42,12 +44,12 @@ class _AddDetailsToExaminationVidaPlusState ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { + WidgetsBinding.instance.addPostFrameCallback((_) async { widget.mySelectedExamination?.forEach((value) => model.getSpecialityDetails( - value.name ?? '', value.id, widget.patientInfo)); + value.name ?? '', value.id, widget.patientInfo));}); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, isShowAppBar: true, isLoading: model.state == ViewState.BusyLocal, appBar: PatientSearchHeader( @@ -66,13 +68,14 @@ class _AddDetailsToExaminationVidaPlusState headerTitle: title, onTap: () { setState(() { - isSysExaminationExpand = - !isSysExaminationExpand; + if(currentlyExpanded == title) { + currentlyExpanded = ''; + }else currentlyExpanded = title; }); }, child: ExaminationItems( examination: model.specialityDetails[title]), - isExpanded: isSysExaminationExpand, + isExpanded: currentlyExpanded == title, ); }, separatorBuilder: (context, index) { @@ -112,7 +115,26 @@ class _AddDetailsToExaminationVidaPlusState fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { - model.postPhysicalExamination(widget.patientInfo,); + var listOfSelectedCategory = model.getListOfSelectedCategory(); + if(listOfSelectedCategory.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).kindlySelectCategory); + return; + } + if(listOfSelectedCategory.any((value) => value.remarksController.text.isEmpty)){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); + return; + } + var result = await model.postPhysicalExamination(widget.patientInfo,listOfSelectedCategory); + if(result){ + model.getPhysicalExamination(widget.patientInfo); + Navigator.popUntil(context, ((route) { + if (route.settings.name == UPDATE_EPISODE_VIDA_PLUS) { + return true; + } else { + return false; + } + })); + } }, ), ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart index de5f06a1..56140917 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart @@ -45,27 +45,22 @@ class _AddExaminationPageVidaPlusState Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - WidgetsBinding.instance.addPostFrameCallback((_) async { - if (model.speciality.isEmpty) { - await model.getGeneralSpeciality(widget.patientInfo); - } - }); - } + WidgetsBinding.instance.addPostFrameCallback((_) async => + await model.getGeneralSpeciality(widget.patientInfo) + ); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, isShowAppBar: true, - isLoading: model.state == ViewState.Busy, + isLoading: model.state == ViewState.BusyLocal, appBar: PatientSearchHeader( title: TranslationBase.of(context).examinationPart), backgroundColor: Colors.white, - body: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: Padding( + body: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Padding( padding: const EdgeInsets.all(16.0), child: Material( shape: RoundedRectangleBorder( @@ -75,60 +70,35 @@ class _AddExaminationPageVidaPlusState color: Color(0xFFEFEFEF), )), color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - ExaminationsListSearchVidaPlusWidget( - masterList: model.speciality, - removeExamination: (selectedExamination) { - if(selectedExamination == null ) return; - - setState(() { - mySelectedExaminationLocal - .remove(selectedExamination); - // Find the object by its ID - try { - final speciality = - model.speciality.firstWhere( - (speciality) => - speciality.id == selectedExamination.id, - orElse: () => throw Exception( - 'Speciality with ID ${selectedExamination.id} not found!'), - ); - - speciality.isSelected = false; - } catch (e) {} - }); - }, - addExamination: (selectedExamination) { - if(selectedExamination == null ) return; - - mySelectedExaminationLocal.insert( - 0, selectedExamination); - - try { - final speciality = model.speciality.firstWhere( - (speciality) => - speciality.id == selectedExamination.id, - orElse: () => throw Exception( - 'Speciality with ID ${selectedExamination.id} not found!'), - ); - speciality.isSelected = true; - } catch (e) {} - //setState(() {}); - }, - ), - ], - ), - ), + child: ExaminationsListSearchVidaPlusWidget( + masterList: model.speciality, + removeExamination: (selectedExamination) { + if(selectedExamination == null ) return; + setState(() { + mySelectedExaminationLocal + .remove(selectedExamination); + // Find the object by its ID + try { + model.changeCurrentCategorySelectedState(selectedExamination, false); + } catch (e) {} + }); + }, + addExamination: (selectedExamination) { + if(selectedExamination == null ) return; + + mySelectedExaminationLocal.insert( + 0, selectedExamination); + + try { + model.changeCurrentCategorySelectedState(selectedExamination, true); + } catch (e) {} + //setState(() {}); + }, ), ), ), - ), - ], + ], + ), ), bottomNavigationBar: Material( color: Colors.white, @@ -157,6 +127,10 @@ class _AddExaminationPageVidaPlusState fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { + if(mySelectedExaminationLocal.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).kindlySelectCategory); + return; + } pushAddExamination(mySelectedExaminationLocal); }, ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart index 90fec299..5721dc70 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart @@ -77,7 +77,7 @@ class _AddExaminationVidaPlusWidgetState extends State( + + builder: (_, model, w) => Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + hintText: TranslationBase.of(context).searchExamination, + isTextFieldHasSuffix: false, + hasBorder: false, + controller: filteredSearchController, + onChanged: (value) { + if (value != null) filterSearchResults(model,value); + }, + suffixWidget: InkWell( + child: Icon( + Icons.search, + color: Colors.black, + ), + onTap: () {}, ), - onTap: () {}, + onClick: () {}, + onFieldSubmitted: () {}, ), - onClick: () {}, - onFieldSubmitted: () {}, ), ), - ), - ListView.separated( - itemCount: items?.length ?? 0, - itemBuilder: (_, index) => AddExaminationVidaPlusWidget( - item: items![index], - addExamination: widget.addExamination, - removeExamination: widget.removeExamination, - ), - separatorBuilder: (_, __) => Divider(), - ) - // ...items!.mapIndexed((index, item) { - // return Column( - // children: [ - // AddExaminationVidaPlusWidget( - // item: item, - // addExamination: widget.addExamination, - // removeExamination: widget.removeExamination, - // mySelectedExamination: widget.mySelectedExamination, - // isServiceSelected: widget.isServiceSelected, - // isExpand: index == expandedIndex, - // expandClick: () { - // setState(() { - // if (expandedIndex == index) { - // expandedIndex = -1; - // } else { - // expandedIndex = index; - // } - // }); - // }, - // ), - // Divider() - // ], - // ); - // }).toList(), - ], - ); + + ...model.speciality.mapIndexed((index, item) { + return Column( + children: [ + AddExaminationVidaPlusWidget( + item: item, + addExamination: widget.addExamination, + removeExamination: widget.removeExamination, + ), + SizedBox(height: 8,), + Divider() + ], + ); + }).toList(), + ], + ), + )); } - void filterSearchResults(String query) { + void filterSearchResults(SOAPViewModel model,String query) { + model.filterData(query); // List dummySearchList = []; // dummySearchList.addAll(widget.masterList as Iterable); // if (query.isNotEmpty) { diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart index 01f4ce6d..38f716c7 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart @@ -21,7 +21,7 @@ class ListOfExamination extends StatelessWidget { physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (_, index) => SoapDetailItem( - title: "${listOfSelection[index].physicalExaminationDescription}", + title: "${listOfSelection[index].specialityDescription}>${listOfSelection[index].physicalExaminationDescription}", condition: getCondition(listOfSelection[index].physicalExaminationCondition ?? 3, context)??TranslationBase.of(context).notExamined, remarks: listOfSelection[index].remark??'', onSoapDetailActionClicked: (action) { diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart index 008ec26e..6cadab91 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart @@ -72,14 +72,16 @@ class _UpdateObjectivePageVidaPlusState return BaseView( onModelReady: (model) async { WidgetsBinding.instance.addPostFrameCallback((_) async { - if (model.patientPhysicalExaminationList == 0) { + widget.changeLoadingState(true); + model.getPhysicalExamination(widget.patientInfo); - } + widget.changeLoadingState(false); }); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, + isLoading: model.state == ViewState.BusyLocal, backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -119,7 +121,7 @@ class _UpdateObjectivePageVidaPlusState height: 16, ), - if (mySelectedExamination.isEmpty) ...{ + if (model.patientPhysicalExaminationList.isEmpty) ...{ Center( child: Padding( padding: const EdgeInsets.all(65), @@ -130,7 +132,7 @@ class _UpdateObjectivePageVidaPlusState } else ...{ Divider(), ListOfExamination( - listOfSelection: mySelectedExamination) + listOfSelection: model.patientPhysicalExaminationList) } // if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal) diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart index 35013e5a..088b3845 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart @@ -28,321 +28,623 @@ class _ExaminationItemsState extends State { void initState() { // TODO: implement initState super.initState(); - this.examinations = examinations; + this.examinations = widget.examination; } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return Column( - children: [ - 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( + return SingleChildScrollView( + child: Column( + children: examinations?.map((value)=> 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: 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, + if (states.contains(MaterialState.selected)) { + return const BorderSide(color: Color(0xFFD02127)); + } + return const BorderSide(color: Color(0xFFE6E6E6)); + }, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16)), + value: value.isSelected, + controlAffinity: ListTileControlAffinity.leading, + onChanged: (bool? selected) { + setState(() { + value?.isSelected = selected ?? false; + }); + }, + title: AppText( + value.name!, + color: Color(0XFF575757), + fontSize: 14, + fontWeight: FontWeight.w400, + ), + ), + ), + (value.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, ), ), - ), - (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, + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: value + .conditionsList + ?.length ?? + 0, + itemBuilder: (context, currentIndex) => InkWell( + onTap: () { + setState(() { + value + .selectedCondition = + int.parse(value + .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: value + .selectedCondition == + int.parse(value + .conditionsList?[ + currentIndex] + .conditionName ?? + "-1") + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), ), - ), - 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: () {}, + AppText( + value + .conditionsList?[ + currentIndex] + .conditionCode ?? + '', + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier! * + 1.6, ), - ), - ], - ), - ) - : SizedBox.shrink(), - ], - ), - ), - ), - ], + ], + ), + )), + ), + // 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: value.remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + ], + ), + ) + : SizedBox.shrink(), + ], + ),)?.toList() ?? [] + // Expanded( + // child: ListView.builder( + // shrinkWrap: true, + // 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)); + // }, + // ), + // 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, + // ), + // ), + // 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: () {}, + // ), + // ), + // ], + // ), + // ) + // : SizedBox.shrink(), + // ], + // ), + // ), + // ), + // ], + ), ); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart index 98228a8c..b33caa3d 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -104,7 +104,7 @@ class _UpdatePlanPageVidaPlusState extends State widget.changeLoadingState(true); WidgetsBinding.instance.addPostFrameCallback((_) async { if (model.progressNote.isEmpty) { - await model.getProgressNote(widget.patientInfo); + model.getProgressNote(widget.patientInfo); } }); widget.changeLoadingState(false); diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index 50cf8db0..23283dd3 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget { class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex =2; + int _currentIndex =3; List myAllergiesList = []; List myHistoryList = []; @@ -97,32 +97,30 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ - - UpdateAssessmentPage( + UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, + sOAPViewModel: model, + changeStateFun: changeStateFun, ), - UpdateSubjectivePageVidaPlus( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), UpdateObjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), - - UpdatePlanPageVidaPlus( + UpdateAssessmentPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, - sOAPViewModel: model, - changeStateFun: changeStateFun, ), + UpdateSubjectivePageVidaPlus( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), ], ), ) diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 4d6a185d..4302f215 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1943,6 +1943,9 @@ class TranslationBase { String get deletedRemarks => localizedValues['deletedRemarks']![locale.languageCode]!; String get noRemarks => localizedValues['noRemarks']![locale.languageCode]!; + String get kindlySelectCategory => localizedValues['kindlySelectCategory']![locale.languageCode]!; + String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 76ce759e867e762c8ae62e8e9a3ea74fa3476206 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 27 Nov 2024 11:28:32 +0300 Subject: [PATCH 07/10] WD: getting plan --- lib/core/service/patient_medical_file/soap/SOAP_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 88a1ac46..e427f015 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -989,7 +989,7 @@ class SOAPService extends LookupService { onSuccess: (dynamic response, int statusCode) { print("Success"); patientProgressNoteListVidaPlus.clear(); - response['ProgressNoteList']['resultData'].forEach((v) { + response['ListProgressNote']['resultData'].forEach((v) { v['data'].forEach((progressNote) { patientProgressNoteListVidaPlus .add(ProgressNote.fromJson(progressNote)); From 6559dd123f1de8c46d9d587f89b1f5799b995f78 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 27 Nov 2024 16:51:32 +0300 Subject: [PATCH 08/10] WD: create dignosis and favorite diagnosis and listing of diagnosis --- lib/config/config.dart | 4 + lib/config/localized_values.dart | 2 + .../SOAP/assessment/search_diagnosis.dart | 1 + .../soap/SOAP_service.dart | 135 +++- lib/core/viewModel/SOAP_view_model.dart | 70 +- .../assessment/add_diagnosis.dart | 51 -- .../assessment/update_assessment_page.dart | 3 +- .../widget/audit_list_bottom_sheet.dart | 2 +- .../assessment/widget/current_diagnosis.dart | 184 +++-- .../assessment/widget/edit_diagnosis.dart | 422 ++++++++++ .../assessment/widget/enter_diagnosis.dart | 687 ++++++++--------- .../assessment/widget/favotite_diagnosis.dart | 723 ++++++++++-------- .../plan/update_plan_page_vida_plus.dart | 8 +- .../update_soap_index_vida_plus.dart | 15 +- .../translations_delegate_base_utils.dart | 2 + 15 files changed, 1430 insertions(+), 879 deletions(-) create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 8ef1f0e1..d6f98ec6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -338,6 +338,10 @@ const POST_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/PostPhysi const GET_PROGRESS_NOTE_NEW = 'Services/DoctorApplication.svc/REST/GetProgressNote'; +const GET_LIST_OF_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisDetailsSearch'; + +const EDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/EditDiagnosis'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b9a0b7b0..283cfb13 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1208,6 +1208,8 @@ const Map> localizedValues = { "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, "event": {"en": "Event: ", "ar":"حدث: "}, + "selectedDiagnosis": {"en": "Kindly Select Diagnosis", "ar":"يرجى اختيار التشخيص: "}, + "selectConditionFirst": {"en": "Kindly Select Diagnosis Condition", "ar":"يرجى اختيار حالة التشخيص: "}, "deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "}, "newValue": {"en": "New Value: ", "ar":"قيمة جديدة: "}, "fieldName": {"en": "Field Name: ", "ar":"اسم الحقل: "}, diff --git a/lib/core/model/SOAP/assessment/search_diagnosis.dart b/lib/core/model/SOAP/assessment/search_diagnosis.dart index 3a02db9c..0a7ab2e7 100644 --- a/lib/core/model/SOAP/assessment/search_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/search_diagnosis.dart @@ -26,6 +26,7 @@ class SearchDiagnosis { String? selectedSectionCode; String? selectedChapterCode; String? selectedNandaCode; + bool isFavorite = false; // Default constructor SearchDiagnosis(); 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 e427f015..d91be174 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -57,6 +57,7 @@ class SOAPService extends LookupService { List patientChiefComplaintListVidaPlus = []; List searchChiefComplaintListVidaPlus = []; List patientPreviousDiagnosisList = []; + List patientDiagnosisList = []; List favoriteDiagnosisDetailsList = []; List auditDiagnosislist = []; List searchDiagnosisList = []; @@ -66,7 +67,6 @@ class SOAPService extends LookupService { Map diagnosisTypeList = {}; Map conditionTypeList = {}; List icdVersionList = []; - bool addedToFavorite = false; bool showAuditBottomSheet = false; int? episodeID; @@ -775,6 +775,37 @@ class SOAPService extends LookupService { }, body: request); } + getDiagnosis(PatiantInformtion patient) async { + Map request = { + "hospitalGroupId": 105, + "hospitalId": 313, + "patientId": 70023498, + "patientPomrId": 9907, + "startRow": 0, + "endRow": 10, + "isSelected": true, + "ProjectID": 313 + // "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + // "hospitalId": patient.projectId, + // "patientId": patient.patientId, + // "patientPomrId": patient.pomrId, + // "startRow": 0, + // "endRow": 1000000, + // "ProjectID": patient.projectId + }; + hasError = false; + await baseAppClient.post(GET_LIST_OF_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + patientDiagnosisList.clear(); + response['ListDiagnosisDetailsSearch']['resultData'].forEach((v) => + patientDiagnosisList.add(PatientPreviousDiagnosis.fromJson(v))); + }, onFailure: (String error, int statusCode) { + patientDiagnosisList.clear(); + hasError = true; + super.error = error; + }, body: request); + } + removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId, String? problemId, String? deletedRemarks) async { Map request = { @@ -835,15 +866,15 @@ class SOAPService extends LookupService { Map? user = await sharedPref.getObj(LOGGED_IN_USER); Map request = - // { - // "patientId": 70024978, - // "pomrId": 10819, - // "hospitalId": 313, - // "hospitalGroupId": 105, - // "ProjectID": 313 - // }; - - { + // { + // "patientId": 70024978, + // "pomrId": 10819, + // "hospitalId": 313, + // "hospitalGroupId": 105, + // "ProjectID": 313 + // }; + + { "patientId": patientInfo.patientId, "pomrId": patientInfo.pomrId, "hospitalId": patientInfo.projectId, @@ -907,8 +938,8 @@ class SOAPService extends LookupService { }, body: request); } - addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, - String subFavoriteCode, String? userId) async { + Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, + String subFavoriteCode, dynamic? userId) async { Map request = { "ProjectID": paitientInfo.projectId, "listDiagnosisFavourite": [ @@ -923,24 +954,27 @@ class SOAPService extends LookupService { ] }; hasError = false; - addedToFavorite = false; + var isFavoriteAdded = false; favoriteDiagnosisDetailsList.clear(); await baseAppClient.post(ADD_TO_FAVORITE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { var result = response['ListDiagnosisAddFavourite']['resultData']; + isFavoriteAdded = true; if ((result as List).isEmpty) { - addedToFavorite = false; DrAppToastMsg.showErrorToast( response['ListDiagnosisAddFavourite']['message']); } else { - addedToFavorite = true; - DrAppToastMsg.showSuccesToast("Added To Favorite"); + DrAppToastMsg.showSuccesToast(response['ListDiagnosisAddFavourite']['message']); } + }, onFailure: (String error, int statusCode) { favoriteDiagnosisDetailsList.clear(); hasError = true; + isFavoriteAdded = false; super.error = error; }, body: request); + + return isFavoriteAdded; } convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, @@ -960,7 +994,7 @@ class SOAPService extends LookupService { "ProjectID": paitientInfo.projectId }; hasError = false; - addedToFavorite = false; + var addedToFavorite = false; await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { var result = response['ContinuePreviousEpisode']['resultData']; @@ -1028,41 +1062,68 @@ class SOAPService extends LookupService { } } - createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis, - int diagnosisType, String conditionType, String remarks, bool isNew) { - /*{ -"codeRange": "A79", -"selectedDisease": "Trench fever", -"categoryId": 3962, -"diseasesCode": "A79.0", -"diseasesId": 17664, -"selectedIcdCode": "A79.0", -"selectedCategoryCode": "A79.0", -"selectedSectionCode": "A79", -"selectedChapterCode": "XX", -"selectedNandaCode": "A79.0", -"codeType": "ICD", -"problemId": 1634, -"icdId": 1, -"problemName": "default", -}*/ + Future createDiagnosis(PatiantInformtion patient, SearchDiagnosis? searchDiagnosis, + String? diagnosisType, String conditionType, String remarks, bool isNew) async{ + Map? user = await sharedPref.getObj(LOGGED_IN_USER); var request = { "pomrId": patient.pomrId, "appointmentId": patient.appointmentNo, "clinicGroupId": patient.clinicGroupId, "clinicId": patient.clinicId, "patientId": patient.patientId, - "hospitalId": searchDiagnosis.hospitalId, + "hospitalId": searchDiagnosis!.hospitalId, "hospitalGroupId": searchDiagnosis.hospitalGroupId, "diagnosisType": diagnosisType, "condition": conditionType, "remarks": remarks, "icdType": searchDiagnosis.icdType, - "icdVersion": searchDiagnosis.icdVersion, + // "icdVersion": searchDiagnosis.icdVersion, "icdSubVersion": searchDiagnosis.icdSubVersion, "isNew": isNew, "specificationId": searchDiagnosis.specificationId, + "selectedDisease": searchDiagnosis.diseasesName, + "diseasesCode": searchDiagnosis.diseasesCode, + "diseasesId": searchDiagnosis.diseasesId, + "selectedIcdCode": searchDiagnosis.selectedIcdCode, + "selectedCategoryCode": searchDiagnosis.selectedCategoryCode, + "selectedSectionCode": searchDiagnosis.selectedSectionCode, + "selectedChapterCode": searchDiagnosis.selectedChapterCode, + "selectedNandaCode": searchDiagnosis.selectedNandaCode, + "isResolved": false, + "doctorId": patient.doctorId, + "doctorCode": user?['List_MemberInformation'][0]['MemberID'], + "ProjectID": patient.projectId, + "codeRange":searchDiagnosis.codeRange }; + var success = false; + await baseAppClient.post(CREATE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async{ + + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + var request = diag; + var success = false; + await baseAppClient.post(CREATE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 870272fc..ff0733a4 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -129,6 +129,9 @@ class SOAPViewModel extends BaseViewModel { List get patientPreviousDiagnosis => _SOAPService.patientPreviousDiagnosisList; + List get diagnosisList => + _SOAPService.patientDiagnosisList; + List get favoriteDiagnosisDetails => _SOAPService.favoriteDiagnosisDetailsList; @@ -159,7 +162,6 @@ class SOAPViewModel extends BaseViewModel { int? get episodeID => _SOAPService.episodeID; - bool get isFavorite => _SOAPService.addedToFavorite; bool get showAudit => _SOAPService.showAuditBottomSheet; @@ -1096,6 +1098,16 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + getCurrentDiagnosisList(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getDiagnosis(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + getAuditOfDiagnosis( PatiantInformtion patient, String patientProblemRevisionID, @@ -1145,21 +1157,29 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void addToFavoriteDiagnosis(PatiantInformtion patientInfo, + Future addToFavoriteDiagnosis(PatiantInformtion patientInfo, {SearchDiagnosis? diagnosis}) async { setState(ViewState.BusyLocal); Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map? user = await sharedPref.getObj(LOGGED_IN_USER); - await _SOAPService.addToFavoriteDiagnosis( + var userID = user?['List_MemberInformation'][0]['MemberID']; + bool result = await _SOAPService.addToFavoriteDiagnosis( patientInfo, profile?['DoctorName'] ?? '', diagnosis?.diseasesBCode ?? '', - user?['List_MemberInformation'][0]['MemberID'] ?? ''); + userID); + + // if (diagnosis != null) { + diagnosis?.isFavorite = result; + // searchDiagnosisList[index] = diagnosis; + // } + if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + return diagnosis; } void convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, @@ -1183,21 +1203,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - - List getListOfSelectedCategory(){ + List getListOfSelectedCategory() { List mappedItems = []; for (List category in specialityDetails.values) { var selectedCategory = - category.where((value) => value.isSelected == true); + category.where((value) => value.isSelected == true); mappedItems.addAll(selectedCategory); } return mappedItems; } - Future postPhysicalExamination(PatiantInformtion patientInfo, List listOfSelectedCategory) async { + Future postPhysicalExamination(PatiantInformtion patientInfo, + List listOfSelectedCategory) async { setState(ViewState.BusyLocal); - bool result = - await _SOAPService.postPhysicalExamination(patientInfo, listOfSelectedCategory); + bool result = await _SOAPService.postPhysicalExamination( + patientInfo, listOfSelectedCategory); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1231,9 +1251,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void toggleFavorite(bool status) { - _SOAPService.addedToFavorite = status; - } void toggleShowBottomSheetValue(bool status) { _SOAPService.showAuditBottomSheet = status; @@ -1249,6 +1266,25 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future createDiagnosis( + PatiantInformtion patientInformation, + SearchDiagnosis? searchDiagnosis, + String? diagnosisType, + String conditionType, + String remarks, + bool isNew) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.createDiagnosis(patientInformation, + searchDiagnosis, diagnosisType, conditionType, remarks, isNew); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + return result; + } + void changeCurrentCategorySelectedState( GeneralSpeciality selectedExamination, bool status) { final item = speciality.firstWhere( @@ -1264,9 +1300,11 @@ class SOAPViewModel extends BaseViewModel { if (query.isEmpty) { speciality = mainSpecialityList ?? []; } - var searchList = - mainSpecialityList?.where((value) => value.name?.toLowerCase().contains(query.toLowerCase()) == true).toList() ?? - []; + var searchList = mainSpecialityList + ?.where((value) => + value.name?.toLowerCase().contains(query.toLowerCase()) == true) + .toList() ?? + []; speciality = searchList; notifyListeners(); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart index c271a5ae..d7399d58 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart @@ -38,7 +38,6 @@ class _AddDiagnosisState extends State return BaseView( onModelReady: (model) { WidgetsBinding.instance.addPostFrameCallback((_) { - model.toggleFavorite(false); model.getConditionAndType(widget.patientInfo); model.favoriteDiagnosis(widget.patientInfo); setState(() { @@ -98,56 +97,6 @@ class _AddDiagnosisState extends State ), ], ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - children: [ - Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300]!, - // height: SizeConfig.heightMultiplier! * - // (SizeConfig.isHeightVeryShort ? 8 : 6), - // padding: 10, - fontColor: Colors.black, - fontWeight: FontWeight.w600, - onPressed: () { - Navigator.pop(context); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).save, - fontWeight: FontWeight.w600, - color: Color(0xFF359846), - onPressed: () async {}, - ), - ), - ], - ), - ) - ], - ), - ), - ), )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart index 09c07d54..e22cc6ff 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart @@ -70,6 +70,7 @@ class _UpdateAssessmentPageState extends State WidgetsBinding.instance.addPostFrameCallback((_) async { widget.changeLoadingState(true); model.getPreviousPatientDetails(widget.patientInfo); + model.getCurrentDiagnosisList(widget.patientInfo); widget.changeLoadingState(false); //todo handle get diagnosis list }); @@ -144,7 +145,7 @@ class _UpdateAssessmentPageState extends State CurrentDiagnosis( patientInfo: widget.patientInfo, model: model, - currentDiagnosisItems: [''], + currentDiagnosisItems: model.diagnosisList, ), PreviousDiagnosis( diagnosisItems: model.patientPreviousDiagnosis, diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart index befb56e5..f976063b 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart @@ -12,7 +12,7 @@ class AuditListBottomSheet extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.56:MediaQuery.sizeOf(context).height*.28, + height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.41:MediaQuery.sizeOf(context).height*.28, child: Material( color: Color(0xFFF7F7F7), shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart index 71a69dbb..5a493e21 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart @@ -1,7 +1,11 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.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/profile/soap_update_vida_plus/assessment/add_diagnosis.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; @@ -15,7 +19,7 @@ import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart'; class CurrentDiagnosis extends StatefulWidget { final PatiantInformtion patientInfo; - final List currentDiagnosisItems; + final List currentDiagnosisItems; final SOAPViewModel model; const CurrentDiagnosis( @@ -33,71 +37,102 @@ class _CurrentDiagnosisState extends State { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - height: 10, - ), - AddSoapItem( - title: TranslationBase.of(context).addNewDiagnosis, - onAddSoapItemClicked: () { - Navigator.push( - context, - FadePage( - page: AddDiagnosis( - patientInfo: widget.patientInfo, - ))); - }), - SizedBox( - height: 16, - ), - Divider(), - SizedBox( - height: 16, - ), - if (widget.currentDiagnosisItems.isEmpty) ...{ - Center( - child: EmptyDiagnosis(), - ), - } else ...{ - Flexible( - child: ListView.separated( - itemBuilder: (_, index) { - return SoapDetailItem( - title: 'lorem ipsum', - status: 'active', - condition: 'acute', - remarks: 'initial', - onSoapDetailActionClicked: (action) { - switch (action) { - case SoapDetailItemActions.EDIT: - // TODO: Handle this case. - case SoapDetailItemActions.RESOLVE: - // TODO: Handle this case. - - case SoapDetailItemActions.REMOVE: - showConfirmationDialog(context, - "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", - () { - widget.model - .removeDiagnosis(widget.patientInfo); - }); - case SoapDetailItemActions.CHANGE_STATUS: - // TODO: Handle this case. - default: - } - }, - ); - }, - separatorBuilder: (_, index) => Divider(), - itemCount: widget.currentDiagnosisItems.length)) + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) { + if (model.showAudit) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showAuditBottomSheet(context, model.auditDiagnosislist, + model.toggleShowBottomSheetValue); + model.toggleShowBottomSheetValue(false); + }); } - ], - ), - ); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + height: 10, + ), + AddSoapItem( + title: TranslationBase.of(context).addNewDiagnosis, + onAddSoapItemClicked: () async { + bool result = await Navigator.push( + context, + FadePage( + page: AddDiagnosis( + patientInfo: widget.patientInfo, + ))); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + }), + SizedBox( + height: 16, + ), + Divider(), + SizedBox( + height: 16, + ), + if (widget.currentDiagnosisItems.isEmpty) ...{ + Center( + child: EmptyDiagnosis(), + ), + } else ...{ + Flexible( + child: ListView.separated( + itemBuilder: (_, index) { + return SoapDetailItem( + title: widget.currentDiagnosisItems[index] + .selectedDisease ?? + '', + status: + widget.currentDiagnosisItems[index].status ?? + '', + condition: widget + .currentDiagnosisItems[index].condition ?? + '', + remarks: + widget.currentDiagnosisItems[index].remarks ?? + '', + onSoapDetailActionClicked: (action) { + switch (action) { + case SoapDetailItemActions.AUDIT: + model.getAuditOfDiagnosis( + widget.patientInfo, + widget.currentDiagnosisItems[index] + .patientProblemRevisionId + ?.toString() ?? + ''); + break; + case SoapDetailItemActions.EDIT: + // TODO: Handle this case. + case SoapDetailItemActions.RESOLVE: + // TODO: Handle this case. + + case SoapDetailItemActions.REMOVE: + showConfirmationDialog(context, + "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", + () { + widget.model + .removeDiagnosis(widget.patientInfo); + }); + case SoapDetailItemActions.CHANGE_STATUS: + // TODO: Handle this case. + default: + } + }, + ); + }, + separatorBuilder: (_, index) => Divider(), + itemCount: widget.currentDiagnosisItems.length)) + } + ], + ), + ); + }); } showConfirmationDialog( @@ -179,4 +214,23 @@ class _CurrentDiagnosisState extends State { deleteController.clear(); }); } + + void showAuditBottomSheet( + BuildContext context, + List diagnosis, + void Function(bool status) toggleShowBottomSheetValue, + ) { + showModalBottomSheet( + isDismissible: true, + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20))), + builder: (_) { + return AuditListBottomSheet( + auditList: diagnosis, + ); + }, + ).then((value) => toggleShowBottomSheetValue(false)); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart new file mode 100644 index 00000000..fca866bc --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart @@ -0,0 +1,422 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.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'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; +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:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; + +List patientState = ["", "Stable", "Not Stable", "Not Defined"]; + +class EnterDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + final PatientPreviousDiagnosis diagnosis; + + const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis}); + + @override + State createState() => _EnterDiagnosisState(); +} + +class _EnterDiagnosisState extends State { + final TextEditingController filteredSearchController = + TextEditingController(); + bool showAllDiagnosis = true; + String status = ''; + String? selectedDiagnosisItem; + TextEditingController remarksController = TextEditingController(); + Timer? _tTimer; + SOAPViewModel? model; + SearchDiagnosis? selectedDiagnosis; + + void _onTextChanged(String text) { + if (_tTimer != null) { + _tTimer!.cancel(); + } + _tTimer = Timer(Duration(milliseconds: 500), () { + _onStopped(text); + }); + } + + void _onStopped(String searchText) async { + await model?.searchDiagnosis(widget.patientInfo, searchText); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + this.model = model; + }, + builder: (_, model, w) => AppScaffold( + isLoading: model.state == ViewState.BusyLocal , + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).addDiagnosis), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, + ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).diagnosis, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onClick: () { + setState( + () { + selectedDiagnosis = null; + filteredSearchController.text = ''; + model.selectedIcd = ''; + }, + ); + }, + onChanged: (value) { + if (value != null) _onTextChanged(value); + }, + onFieldSubmitted: () {}, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, + ), + onPressed: () {}, + ), + ), + Positioned( + child: Material( + elevation: 4.0, // Optional: for shadow effect + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: 0, maxHeight: 300), + child: ListView.builder( + shrinkWrap: true, + itemCount: model.icdVersionList.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + child: AppText(model.icdVersionList[index]), + onTap: () { + setState( + () { + selectedDiagnosis = + model.findTheDiagnosisItem( + model.icdVersionList[index]); + filteredSearchController.text = + model.icdVersionList[index]; + model.searchDiagnosisList.clear(); + model.icdVersionList.clear(); + }, + ); + }, + ), + ); + }, + ), + ), + ), + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { + setState(() { + showAllDiagnosis = value; + }); + }, + ), + SizedBox( + width: 8, + ), + AppText( + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, + ), + ], + ), + SvgPicture.asset('assets/images/svgs/information.svg'), + ], + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + 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 == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedDiagnosisItem == null + ? model.diagnosisTypeList.keys.first + : selectedDiagnosisItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedDiagnosisItem = newValue; + }); + }, + items: + model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + SizedBox( + height: 16, + ), + InkWell( + onTap: () async { + if (selectedDiagnosis != null) { + SearchDiagnosis? diagnosis = + await model.addToFavoriteDiagnosis(widget.patientInfo, + diagnosis: selectedDiagnosis); + setState(() { + selectedDiagnosis = diagnosis; + }); + } + }, + child: Row( + children: [ + SvgPicture.asset(selectedDiagnosis?.isFavorite == true + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).addToFavorite, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + if(selectedDiagnosis == null ){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); + return; + } + if(status.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst); + return; + } + + if(remarksController.text.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); + return; + } + + bool result = await model.createDiagnosis( + widget.patientInfo, + selectedDiagnosis, + selectedDiagnosisItem, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart index 45b6ddbe..0ecac958 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart @@ -8,8 +8,11 @@ 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/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; 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:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -31,7 +34,7 @@ class _EnterDiagnosisState extends State { TextEditingController(); bool showAllDiagnosis = true; String status = ''; - String? selectedItem; + String? selectedDiagnosisItem; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; @@ -56,392 +59,354 @@ class _EnterDiagnosisState extends State { onModelReady: (model) { this.model = model; }, - builder: (_, model, w) => SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addDiagnosis, - fontWeight: FontWeight.w600, - color: Color(0xFF2E303A), - fontSize: 16, - ), - SizedBox( - height: 16, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).diagnosis, - isTextFieldHasSuffix: true, - hasBorder: true, - controller: filteredSearchController, - onClick: () { - setState( - () { - selectedDiagnosis = null; - filteredSearchController.text = ''; - model.selectedIcd = ''; - }, - ); - }, - onChanged: (value) { - if (value != null) _onTextChanged(value); - }, - onFieldSubmitted: () {}, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Color(0xff2B353E), - size: 30, - ), - onPressed: () {}, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, ), - ), - Positioned( - child: Material( - elevation: 4.0, // Optional: for shadow effect - child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 0, maxHeight: 300), - child: ListView.builder( - shrinkWrap: true, - itemCount: model.icdVersionList.length, - itemBuilder: (context, index) { - return ListTile( - title: InkWell( - child: AppText(model.icdVersionList[index]), - onTap: () { - setState( - () { - selectedDiagnosis = - model.findTheDiagnosisItem( - model.icdVersionList[index]); - filteredSearchController.text = - model.icdVersionList[index]; - model.searchDiagnosisList.clear(); - model.icdVersionList.clear(); - }, - ); - }, - ), - ); + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).diagnosis, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onClick: () { + setState( + () { + selectedDiagnosis = null; + filteredSearchController.text = ''; + model.selectedIcd = ''; }, + ); + }, + onChanged: (value) { + if (value != null) _onTextChanged(value); + }, + onFieldSubmitted: () {}, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, ), + onPressed: () {}, ), ), - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Switch( - value: showAllDiagnosis, - activeColor: Colors.red, - onChanged: (bool value) { - setState(() { - showAllDiagnosis = value; - }); + Positioned( + child: Material( + elevation: 4.0, // Optional: for shadow effect + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: 0, maxHeight: 300), + child: ListView.builder( + shrinkWrap: true, + itemCount: model.icdVersionList.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + child: AppText(model.icdVersionList[index]), + onTap: () { + setState( + () { + selectedDiagnosis = + model.findTheDiagnosisItem( + model.icdVersionList[index]); + filteredSearchController.text = + model.icdVersionList[index]; + model.searchDiagnosisList.clear(); + model.icdVersionList.clear(); + }, + ); + }, + ), + ); }, ), - SizedBox( - width: 8, - ), - AppText( - TranslationBase.of(context).showAllDiagnosis, - fontWeight: FontWeight.w500, - color: Color(0xFF2E303A), - fontSize: 11, - ), - ], + ), ), - SvgPicture.asset('assets/images/svgs/information.svg'), - ], - ), - Container( - margin: EdgeInsets.only(bottom: 12), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, ), - ), - // Row( - // children: [ - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = ""; - // }); - // }, - // 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).acute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // )), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "2"; - // }); - // }, - // 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).subAcute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "3"; - // }); - // }, - // 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, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).chronic, - // 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: model.conditionTypeList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { setState(() { - status = model.conditionTypeList[index]; + showAllDiagnosis = value; }); }, - 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( + ), + SizedBox( + width: 8, + ), + AppText( + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, + ), + ], + ), + SvgPicture.asset('assets/images/svgs/information.svg'), + ], + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, decoration: BoxDecoration( - color: - status == model.conditionTypeList[index] - ? HexColor("#D02127") - : Colors.white, + color: Colors.white, shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), ), ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedDiagnosisItem == null + ? model.diagnosisTypeList.keys.first + : selectedDiagnosisItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedDiagnosisItem = newValue; + }); + }, + items: + model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), - ], - ), - )), - ), - SizedBox( - height: 8, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + SizedBox( + height: 16, + ), + InkWell( + onTap: () async { + if (selectedDiagnosis != null) { + SearchDiagnosis? diagnosis = + await model.addToFavoriteDiagnosis(widget.patientInfo, + diagnosis: selectedDiagnosis); + setState(() { + selectedDiagnosis = diagnosis; + }); + } + }, + child: Row( children: [ + SvgPicture.asset(selectedDiagnosis?.isFavorite == true + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, + ), AppText( - TranslationBase.of(context).diagnoseType, + TranslationBase.of(context).addToFavorite, textAlign: TextAlign.start, fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), ), SizedBox( - height: 4, + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + if(selectedDiagnosis == null ){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); + return; + } + if(status.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst); + return; + } + + if(remarksController.text.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); + return; + } + + bool result = await model.createDiagnosis( + widget.patientInfo, + selectedDiagnosis, + selectedDiagnosisItem, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, + ), ), - model.diagnosisTypeList.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem == null - ? model.diagnosisTypeList.keys.first - : selectedItem, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedItem = newValue; - }); - }, - items: model.diagnosisTypeList.keys.map((item) { - return DropdownMenuItem( - child: AppText( - item ?? '', - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, - ), - value: item, - ); - }).toList(), - ), - ), ], ), - ), - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) {}, - onClick: () {}, - onFieldSubmitted: () {}, - ), - ), - SizedBox( - height: 16, - ), - InkWell( - onTap: () { - if (selectedDiagnosis != null) - model.addToFavoriteDiagnosis(widget.patientInfo, - diagnosis: selectedDiagnosis); - }, - child: Row( - children: [ - SvgPicture.asset(model.isFavorite - ? 'assets/images/svgs/favoriteadded.svg' - : 'assets/images/svgs/favorite.svg'), - SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).addToFavorite, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), - ), - ], - ), - ) - ], + ) + ], + ), ), ), ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart index 219f45cb..71e82650 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart @@ -9,7 +9,9 @@ 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/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; 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:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -60,357 +62,406 @@ class _FavoriteDiagnosisState extends State { model.favoriteDiagnosis(widget.patientInfo); }); }, - builder: (_, model, w) => SingleChildScrollView( - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addDiagnosis, - fontWeight: FontWeight.w600, - color: Color(0xFF2E303A), - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).diagnosis, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), - SizedBox( - height: 4, - ), - model.favoriteDiagnosisDetails.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - itemHeight: null, - value: selectedFavorite == null - ? model.favoriteDiagnosisDetails.first - .diseases - : selectedFavorite, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedFavorite = newValue; - }); - }, - items: model.favoriteDiagnosisDetails - .map((item) { - return DropdownMenuItem( - child: AppText( - item.diseases ?? '', - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, - ), - value: item.diseases, - ); - }).toList(), - ), - ), - ], - ), + builder: (_, model, w) => AppScaffold( + body: SingleChildScrollView( + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, ), - ), - - SizedBox( - height: 8, - ), - Container( - margin: EdgeInsets.only(bottom: 12), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, + SizedBox( + height: 16, ), - ), - // Row( - // children: [ - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = ""; - // }); - // }, - // 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).acute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // )), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "2"; - // }); - // }, - // 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).subAcute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "3"; - // }); - // }, - // 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, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).chronic, - // 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: model.conditionTypeList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { - setState(() { - status = model.conditionTypeList[index]; - }); - }, - 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 == - model.conditionTypeList[index] - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), - ), - ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier! * 1.6, - ), - ], - ), - )), - ), - SizedBox( - height: 8, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).diagnoseType, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), - SizedBox( - height: 4, - ), - model.diagnosisTypeList.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - itemHeight: null, - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem == null - ? model.diagnosisTypeList.keys.first - : selectedItem, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedItem = newValue; - }); - }, - items: model.diagnosisTypeList.keys - .map((item) { - return DropdownMenuItem( - child: Padding( - padding: const EdgeInsets.all(8.0), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnosis, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.favoriteDiagnosisDetails.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + itemHeight: null, + value: selectedFavorite == null + ? model.favoriteDiagnosisDetails.first + .diseases + : selectedFavorite, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedFavorite = newValue; + }); + }, + items: model.favoriteDiagnosisDetails + .map((item) { + return DropdownMenuItem( child: AppText( - item ?? '', + item.diseases ?? '', fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, fontWeight: FontWeight.normal, textAlign: TextAlign.left, ), - ), - value: item, - ); - }).toList(), + value: item.diseases, + ); + }).toList(), + ), ), + ], + ), + ), + ), + + SizedBox( + height: 8, + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + // Row( + // children: [ + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = ""; + // }); + // }, + // 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).acute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "2"; + // }); + // }, + // 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).subAcute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // ), + // ), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "3"; + // }); + // }, + // 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, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).chronic, + // 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: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + 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 == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier! * 1.6, + ), + ], ), - ], + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + itemHeight: null, + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null + ? model.diagnosisTypeList.keys.first + : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedItem = newValue; + }); + }, + items: model.diagnosisTypeList.keys + .map((item) { + return DropdownMenuItem( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), ), ), - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) {}, - onClick: () {}, - onFieldSubmitted: () {}, + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), ), - ), - SizedBox( - height: 16, - ), - ], + SizedBox( + height: 16, + ), + ], + ), ), ), - )); + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async {}, + ), + ), + ], + ), + ) + ], + ), + ), + ), + )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart index b33caa3d..ff8e2bd0 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -101,13 +101,13 @@ class _UpdatePlanPageVidaPlusState extends State return BaseView( onModelReady: (model) async { widget.sOAPViewModel.setPlanCallBack(this); - widget.changeLoadingState(true); WidgetsBinding.instance.addPostFrameCallback((_) async { - if (model.progressNote.isEmpty) { + widget.changeLoadingState(true); + model.getProgressNote(widget.patientInfo); - } + widget.changeLoadingState(false); + }); - widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index 23283dd3..e9304c61 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget { class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex =3; + int _currentIndex =2; List myAllergiesList = []; List myHistoryList = []; @@ -97,6 +97,12 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ + UpdateAssessmentPage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState, + ), UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, @@ -110,12 +116,7 @@ class _UpdateSoapIndexVidaPlusState extends State currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState, - ), + UpdateSubjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 4302f215..658ebb0e 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1945,6 +1945,8 @@ class TranslationBase { String get kindlySelectCategory => localizedValues['kindlySelectCategory']![locale.languageCode]!; String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!; + String get selectedDiagnosis => localizedValues['selectedDiagnosis']![locale.languageCode]!; + String get selectConditionFirst => localizedValues['selectConditionFirst']![locale.languageCode]!; } From 1976c04e12c141aa6c396a79834905389b07b6d8 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Sun, 1 Dec 2024 10:32:12 +0300 Subject: [PATCH 09/10] WD: diagnosis and progress note get and getclininc api added. --- lib/config/config.dart | 3 + lib/config/localized_values.dart | 2 + .../patient_previous_diagnosis.dart | 101 +++- lib/core/model/SOAP/progress_note/Clinic.dart | 35 ++ .../soap/SOAP_service.dart | 109 +++- lib/core/viewModel/SOAP_view_model.dart | 39 +- .../assessment/widget/current_diagnosis.dart | 20 +- .../assessment/widget/edit_diagnosis.dart | 399 ++++++++------ .../assessment/widget/enter_diagnosis.dart | 6 +- .../plan/widget/add_progress_note.dart | 7 + .../widget/add_progress_note_details.dart | 488 +++++++++--------- .../update_soap_index_vida_plus.dart | 10 +- .../translations_delegate_base_utils.dart | 2 + 13 files changed, 774 insertions(+), 447 deletions(-) create mode 100644 lib/core/model/SOAP/progress_note/Clinic.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index d6f98ec6..a818633c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -342,6 +342,9 @@ const GET_LIST_OF_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisDeta const EDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/EditDiagnosis'; +const RESOLVE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisResolve'; +const GET_CLINIC = 'Services/DoctorApplication.svc/REST/GetDoctorClinicsForVidaPlus'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 283cfb13..240edfef 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1208,11 +1208,13 @@ const Map> localizedValues = { "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, "event": {"en": "Event: ", "ar":"حدث: "}, + "editDiagnosis": {"en": "Edit Diagnosis ", "ar":"تحرير التشخيص"}, "selectedDiagnosis": {"en": "Kindly Select Diagnosis", "ar":"يرجى اختيار التشخيص: "}, "selectConditionFirst": {"en": "Kindly Select Diagnosis Condition", "ar":"يرجى اختيار حالة التشخيص: "}, "deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "}, "newValue": {"en": "New Value: ", "ar":"قيمة جديدة: "}, "fieldName": {"en": "Field Name: ", "ar":"اسم الحقل: "}, + "noChangeRecorded": {"en": "No Change Recorded Unable To Perform Edit", "ar":"لم يتم تسجيل أي تغيير، غير قادر على إجراء التحرير"}, "oldValue": {"en": "Old Value: ", "ar":"القيمة القديمة: "}, "favoriteDiagnosis": {"en": "Favorite Diagnosis", "ar":"التشخيص المفضل"}, "addToFavorite": {"en": "Add To Favorite", "ar":"إضافة إلى المفضلة"}, diff --git a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart index 0cc2401e..c4fc3b71 100644 --- a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart @@ -107,6 +107,61 @@ class PatientPreviousDiagnosis { }); } } + + Map toJson() { + return { + 'active': active, + 'admissionId': admissionId, + 'admissionRequestId': admissionRequestId, + 'appointmentId': appointmentId, + 'approvedBy': approvedBy, + 'approvedOn': approvedOn, + 'assessmentId': assessmentId, + 'chiefComplainId': chiefComplainId, + 'clinicGroupId': clinicGroupId, + 'clinicId': clinicId, + 'condition': condition, + 'createdBy': createdBy, + 'createdOn': createdOn, + 'deletedBy': deletedBy, + 'deletedByDoctorName': deletedByDoctorName, + 'deletedOn': deletedOn, + 'deletedRemarks': deletedRemarks, + 'diagnosisType': diagnosisType, + 'doctorId': doctorId, + 'episodeId': episodeId, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'icdCodeDetailsDto': icdCodeDetailsDto, + 'icdSubVersion': icdSubVersion, + 'icdType': icdType, + 'icdVersion': icdVersion, + 'location': location, + 'loginUserId': loginUserId, + 'modifiedBy': modifiedBy, + 'modifiedOn': modifiedOn, + 'module': module, + 'parentLocation': parentLocation, + 'patientId': patientId, + 'patientProblemChangeHistories': patientProblemChangeHistories, + 'patientProblemId': patientProblemId, + 'patientProblemRevisionId': patientProblemRevisionId, + 'pomrId': pomrId, + 'previousProblem': previousProblem, + 'problemId': problemId, + 'problemName': problemName, + 'remarks': remarks, + 'resolved': resolved, + 'selectedCategoryCode': selectedCategoryCode, + 'selectedChapterCode': selectedChapterCode, + 'selectedDisease': selectedDisease, + 'selectedIcdCode': selectedIcdCode, + 'selectedSectionCode': selectedSectionCode, + 'status': status, + 'visitWiseSelected': visitWiseSelected, + 'visitWisePatientDiagnoses': visitWisePatientDiagnoses?.map((v) => v.toJson()).toList(), + }; + } } class VisitWisePatientDiagnosis { @@ -130,7 +185,7 @@ class VisitWisePatientDiagnosis { int? hospitalId; String? icdSubVersion; String? icdType; - dynamic icdVersion; // Adjust type if necessary + dynamic icdVersion; bool? isPreviousProblem; String? location; String? loginUserId; @@ -187,4 +242,46 @@ class VisitWisePatientDiagnosis { selectedDoctorId = json['selectedDoctorId']; selectedIcdCode = json['selectedIcdCode']; } -} \ No newline at end of file + + Map toJson() { + return { + 'active': active, + 'admissionId': admissionId, + 'appointmentId': appointmentId, + 'approvedBy': approvedBy, + 'approvedOn': approvedOn, + 'assessmentId': assessmentId, + 'clinicId': clinicId, + 'condition': condition, + 'createdBy': createdBy, + 'createdOn': createdOn, + 'deletedBy': deletedBy, + 'deletedOn': deletedOn, + 'deletedRemarks': deletedRemarks, + 'diagnosisType': diagnosisType, + 'doctorId': doctorId, + 'episodeId': episodeId, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'icdSubVersion': icdSubVersion, + 'icdType': icdType, + 'icdVersion': icdVersion, + 'isPreviousProblem': isPreviousProblem, + 'location': location, + 'loginUserId': loginUserId, + 'modifiedBy': modifiedBy, + 'modifiedOn': modifiedOn, + 'patientDiagnosisId': patientDiagnosisId, + 'patientId': patientId, + 'patientProblemRevisionId': patientProblemRevisionId, + 'pomrId': pomrId, + 'problemName': problemName, + 'remarks': remarks, + 'resolved': resolved, + 'selected': selected, + 'selectedDisease': selectedDisease, + 'selectedDoctorId': selectedDoctorId, + 'selectedIcdCode': selectedIcdCode, + }; + } +} diff --git a/lib/core/model/SOAP/progress_note/Clinic.dart b/lib/core/model/SOAP/progress_note/Clinic.dart new file mode 100644 index 00000000..70f56492 --- /dev/null +++ b/lib/core/model/SOAP/progress_note/Clinic.dart @@ -0,0 +1,35 @@ +class Clinic { + int? clinicGroupID; + String? clinicGroupName; + int? clinicID; + String? clinicNameArabic; + String? clinicNameEnglish; + + Clinic({ + this.clinicGroupID, + this.clinicGroupName, + this.clinicID, + this.clinicNameArabic, + this.clinicNameEnglish, + }); + + factory Clinic.fromJson(Map json) { + return Clinic( + clinicGroupID: json['clinicGroupID'], + clinicGroupName: json['clinicGroupName'], + clinicID: json['clinicID'], + clinicNameArabic: json['clinicNameArabic'], + clinicNameEnglish: json['clinicNameEnglish'], + ); + } + + Map toJson() { + return { + 'clinicGroupID': clinicGroupID, + 'clinicGroupName': clinicGroupName, + 'clinicID': clinicID, + 'clinicNameArabic': clinicNameArabic, + 'clinicNameEnglish': clinicNameEnglish, + }; + } +} \ No newline at end of file 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 d91be174..361eff19 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -31,6 +31,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/history/post_histories_reques 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/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/Clinic.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; @@ -63,6 +64,7 @@ class SOAPService extends LookupService { List searchDiagnosisList = []; List patientPhysicalExaminationList = []; List generalSpeciality = []; + List clinicsList = []; Map> specialityDetails = {}; Map diagnosisTypeList = {}; Map conditionTypeList = {}; @@ -938,8 +940,8 @@ class SOAPService extends LookupService { }, body: request); } - Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, - String subFavoriteCode, dynamic? userId) async { + Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, + String doctorName, String subFavoriteCode, dynamic? userId) async { Map request = { "ProjectID": paitientInfo.projectId, "listDiagnosisFavourite": [ @@ -960,13 +962,13 @@ class SOAPService extends LookupService { onSuccess: (dynamic response, int statusCode) { var result = response['ListDiagnosisAddFavourite']['resultData']; isFavoriteAdded = true; - if ((result as List).isEmpty) { + if ((result is List) && (result as List).isEmpty) { DrAppToastMsg.showErrorToast( response['ListDiagnosisAddFavourite']['message']); } else { - DrAppToastMsg.showSuccesToast(response['ListDiagnosisAddFavourite']['message']); + DrAppToastMsg.showSuccesToast( + response['ListDiagnosisAddFavourite']['message']); } - }, onFailure: (String error, int statusCode) { favoriteDiagnosisDetailsList.clear(); hasError = true; @@ -1062,9 +1064,13 @@ class SOAPService extends LookupService { } } - Future createDiagnosis(PatiantInformtion patient, SearchDiagnosis? searchDiagnosis, - String? diagnosisType, String conditionType, String remarks, bool isNew) async{ - + Future createDiagnosis( + PatiantInformtion patient, + SearchDiagnosis? searchDiagnosis, + String? diagnosisType, + String conditionType, + String remarks, + bool isNew) async { Map? user = await sharedPref.getObj(LOGGED_IN_USER); var request = { "pomrId": patient.pomrId, @@ -1094,35 +1100,88 @@ class SOAPService extends LookupService { "doctorId": patient.doctorId, "doctorCode": user?['List_MemberInformation'][0]['MemberID'], "ProjectID": patient.projectId, - "codeRange":searchDiagnosis.codeRange + "codeRange": searchDiagnosis.codeRange }; var success = false; await baseAppClient.post(CREATE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); - success = true; - }, onFailure: (String error, int statusCode) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { success = false; - hasError = true; - super.error = error; - }, body: request); + hasError = true; + super.error = error; + }, body: request); return success; } - Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async{ - Map? user = await sharedPref.getObj(LOGGED_IN_USER); - var request = diag; + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { + var request = diagnosis.toJson(); var success = false; - await baseAppClient.post(CREATE_DIAGNOSIS, + await baseAppClient.post(EDIT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); - success = true; - }, onFailure: (String error, int statusCode) { + if (response['ListVisitWisePatientDiagnosis']['resultData'] != null && + (response['ListVisitWisePatientDiagnosis']['resultData'] as List) + .isNotEmpty) { + success = true; + return; + } success = false; - hasError = true; - super.error = error; - }, body: request); + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + + Future resolveDiagnosis(PatientPreviousDiagnosis diagnosis) async { + var request = { + "patientProblemRevisionId": diagnosis.patientProblemRevisionId, + "patientProblemId": diagnosis.patientProblemId, + "patientId": diagnosis.patientId, + "doctorId": diagnosis.doctorId, + "pomrId": diagnosis.pomrId, + "appointmentId": diagnosis.appointmentId, + "problemId": diagnosis.problemId, + "diagnosisType": diagnosis.diagnosisType, + }; + var success = false; + await baseAppClient.post(RESOLVE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + if (response['ListDiagnosisResolve'] != null && + response['ListDiagnosisResolve']['resultData'] != null && + (response['ListVisitWisePatientDiagnosis']['resultData'] as List) + .isNotEmpty) { + success = true; + return; + } + success = false; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + + Future getClinic() async { + 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)))); + success = false; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); return success; } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index ff0733a4..c621e4c2 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -9,7 +9,6 @@ import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_re import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; @@ -26,13 +25,12 @@ import 'package:doctor_app_flutter/core/model/SOAP/in_patient/get_episode_for_in 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'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_examination_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/Clinic.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; @@ -156,6 +154,8 @@ class SOAPViewModel extends BaseViewModel { List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; + List get clinics => + _SOAPService.clinicsList; Map> get specialityDetails => _SOAPService.specialityDetails; @@ -1285,6 +1285,29 @@ class SOAPViewModel extends BaseViewModel { return result; } + + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.editDiagnosis(diagnosis); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + return result; + } + + Future resolveDiagnosis(PatientPreviousDiagnosis diagnosis) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.resolveDiagnosis(diagnosis); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + return result; + } + void changeCurrentCategorySelectedState( GeneralSpeciality selectedExamination, bool status) { final item = speciality.firstWhere( @@ -1308,4 +1331,14 @@ class SOAPViewModel extends BaseViewModel { speciality = searchList; notifyListeners(); } + + getClinics() async { + setState(ViewState.BusyLocal); + await _SOAPService.getClinic(); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart index 5a493e21..e88f2612 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart @@ -6,6 +6,7 @@ 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/profile/soap_update_vida_plus/assessment/add_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; @@ -97,7 +98,7 @@ class _CurrentDiagnosisState extends State { remarks: widget.currentDiagnosisItems[index].remarks ?? '', - onSoapDetailActionClicked: (action) { + onSoapDetailActionClicked: (action) async{ switch (action) { case SoapDetailItemActions.AUDIT: model.getAuditOfDiagnosis( @@ -108,9 +109,22 @@ class _CurrentDiagnosisState extends State { ''); break; case SoapDetailItemActions.EDIT: - // TODO: Handle this case. + bool result = await Navigator.push( + context, + FadePage( + page: EditDiagnosis( + patientInfo: widget.patientInfo, diagnosis: widget.currentDiagnosisItems[index], + ))); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + break; case SoapDetailItemActions.RESOLVE: - // TODO: Handle this case. + bool result = await model.resolveDiagnosis(widget.currentDiagnosisItems[index]); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + break; case SoapDetailItemActions.REMOVE: showConfirmationDialog(context, diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart index fca866bc..fcb2cc05 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart @@ -19,31 +19,41 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:get_it/get_it.dart'; import 'package:hexcolor/hexcolor.dart'; -List patientState = ["", "Stable", "Not Stable", "Not Defined"]; - -class EnterDiagnosis extends StatefulWidget { +class EditDiagnosis extends StatefulWidget { final PatiantInformtion patientInfo; final PatientPreviousDiagnosis diagnosis; - const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis}); + const EditDiagnosis( + {super.key, required this.patientInfo, required this.diagnosis}); @override - State createState() => _EnterDiagnosisState(); + State createState() => _EditDiagnosisState(); } -class _EnterDiagnosisState extends State { +class _EditDiagnosisState extends State { final TextEditingController filteredSearchController = - TextEditingController(); + TextEditingController(); bool showAllDiagnosis = true; String status = ''; String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; SearchDiagnosis? selectedDiagnosis; + @override + void initState() { + super.initState(); + filteredSearchController.text = widget.diagnosis.selectedDisease ?? ''; + filteredSearchController.text = widget.diagnosis.remarks ?? ''; + status = widget.diagnosis.condition ?? ''; + selectedDiagnosisItemValue = widget.diagnosis?.diagnosisType ?? ''; + } + void _onTextChanged(String text) { if (_tTimer != null) { _tTimer!.cancel(); @@ -59,15 +69,31 @@ class _EnterDiagnosisState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) { - this.model = model; - }, - builder: (_, model, w) => AppScaffold( - isLoading: model.state == ViewState.BusyLocal , + return BaseView(onModelReady: (model) { + this.model = model; + WidgetsBinding.instance.addPostFrameCallback((_) { + model.getConditionAndType(widget.patientInfo); + }); + }, builder: (_, model, w) { + if (selectedDiagnosisItem == null && model.diagnosisTypeList.isNotEmpty) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + setState(() { + selectedDiagnosisItem = model.diagnosisTypeList.keys.firstWhere( + (k) => + model.diagnosisTypeList[k] == selectedDiagnosisItemValue, + orElse: () => ''); + if (selectedDiagnosisItem?.isEmpty == true) + selectedDiagnosisItem = null; + }); + } + }); + } + return AppScaffold( + isLoading: model.state == ViewState.BusyLocal, isShowAppBar: true, appBar: PatientSearchHeader( - title: TranslationBase.of(context).addDiagnosis), + title: TranslationBase.of(context).editDiagnosis), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), @@ -75,7 +101,7 @@ class _EnterDiagnosisState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).addDiagnosis, + TranslationBase.of(context).editDiagnosis, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), fontSize: 16, @@ -90,7 +116,7 @@ class _EnterDiagnosisState extends State { controller: filteredSearchController, onClick: () { setState( - () { + () { selectedDiagnosis = null; filteredSearchController.text = ''; model.selectedIcd = ''; @@ -124,12 +150,12 @@ class _EnterDiagnosisState extends State { child: AppText(model.icdVersionList[index]), onTap: () { setState( - () { + () { selectedDiagnosis = model.findTheDiagnosisItem( model.icdVersionList[index]); filteredSearchController.text = - model.icdVersionList[index]; + model.icdVersionList[index]; model.searchDiagnosisList.clear(); model.icdVersionList.clear(); }, @@ -145,34 +171,34 @@ class _EnterDiagnosisState extends State { SizedBox( height: 8, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Switch( - value: showAllDiagnosis, - activeColor: Colors.red, - onChanged: (bool value) { - setState(() { - showAllDiagnosis = value; - }); - }, - ), - SizedBox( - width: 8, - ), - AppText( - TranslationBase.of(context).showAllDiagnosis, - fontWeight: FontWeight.w500, - color: Color(0xFF2E303A), - fontSize: 11, - ), - ], - ), - SvgPicture.asset('assets/images/svgs/information.svg'), - ], - ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Row( + // children: [ + // Switch( + // value: showAllDiagnosis, + // activeColor: Colors.red, + // onChanged: (bool value) { + // setState(() { + // showAllDiagnosis = value; + // }); + // }, + // ), + // SizedBox( + // width: 8, + // ), + // AppText( + // TranslationBase.of(context).showAllDiagnosis, + // fontWeight: FontWeight.w500, + // color: Color(0xFF2E303A), + // fontSize: 11, + // ), + // ], + // ), + // SvgPicture.asset('assets/images/svgs/information.svg'), + // ], + // ), Container( margin: EdgeInsets.only(bottom: 12), child: AppText( @@ -190,43 +216,44 @@ class _EnterDiagnosisState extends State { scrollDirection: Axis.horizontal, itemCount: model.conditionTypeList.length, itemBuilder: (context, index) => InkWell( - onTap: () { - setState(() { - status = model.conditionTypeList[index]; - }); - }, - 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 == - model.conditionTypeList[index] - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + 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 == + model.conditionTypeList[index] + .toLowerCase() + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), ), - ), - ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], ), - ], - ), - )), + )), ), SizedBox( height: 8, @@ -258,38 +285,38 @@ class _EnterDiagnosisState extends State { model.diagnosisTypeList.isEmpty ? EmptyDropDown() : DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedDiagnosisItem == null - ? model.diagnosisTypeList.keys.first - : selectedDiagnosisItem, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedDiagnosisItem = newValue; - }); - }, - items: - model.diagnosisTypeList.keys.map((item) { - return DropdownMenuItem( - child: AppText( - item ?? '', - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedDiagnosisItem == null + ? model.diagnosisTypeList.keys.first + : selectedDiagnosisItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedDiagnosisItem = newValue; + }); + }, + items: + model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), ), - value: item, - ); - }).toList(), - ), - ), + ), ], ), ), @@ -310,35 +337,35 @@ class _EnterDiagnosisState extends State { SizedBox( height: 16, ), - InkWell( - onTap: () async { - if (selectedDiagnosis != null) { - SearchDiagnosis? diagnosis = - await model.addToFavoriteDiagnosis(widget.patientInfo, - diagnosis: selectedDiagnosis); - setState(() { - selectedDiagnosis = diagnosis; - }); - } - }, - child: Row( - children: [ - SvgPicture.asset(selectedDiagnosis?.isFavorite == true - ? 'assets/images/svgs/favoriteadded.svg' - : 'assets/images/svgs/favorite.svg'), - SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).addToFavorite, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), - ), - ], - ), - ) + // InkWell( + // onTap: () async { + // if (selectedDiagnosis != null) { + // SearchDiagnosis? diagnosis = + // await model.addToFavoriteDiagnosis(widget.patientInfo, + // diagnosis: selectedDiagnosis); + // setState(() { + // selectedDiagnosis = diagnosis; + // }); + // } + // }, + // child: Row( + // children: [ + // SvgPicture.asset(selectedDiagnosis?.isFavorite == true + // ? 'assets/images/svgs/favoriteadded.svg' + // : 'assets/images/svgs/favorite.svg'), + // SizedBox( + // width: 4, + // ), + // AppText( + // TranslationBase.of(context).addToFavorite, + // textAlign: TextAlign.start, + // fontWeight: FontWeight.w600, + // fontSize: 10, + // color: Color(0xFF449BF1), + // ), + // ], + // ), + // ) ], ), ), @@ -377,37 +404,65 @@ class _EnterDiagnosisState extends State { ), Expanded( child: AppButton( - title: TranslationBase.of(context).save, - fontWeight: FontWeight.w600, - color: Color(0xFF359846), - onPressed: () async { - selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; - if(selectedDiagnosis == null ){ - DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); - return; - } - if(status.isEmpty){ - DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst); - return; - } + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= + model.diagnosisTypeList.keys.first; + if (selectedDiagnosis == null && + filteredSearchController.text.isEmpty) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .selectedDiagnosis); + return; + } + if (status.isEmpty) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .selectConditionFirst); + return; + } - if(remarksController.text.isEmpty){ - DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); - return; - } + if (remarksController.text.isEmpty) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .remarksCanNotBeEmpty); + return; + } - bool result = await model.createDiagnosis( - widget.patientInfo, - selectedDiagnosis, - selectedDiagnosisItem, - status, - remarksController.text, - false); - if (result) { - Navigator.pop(context, result); - } - }, - ), + if (filteredSearchController.text == + widget.diagnosis.selectedDisease && + status == widget.diagnosis.condition && + widget.diagnosis.diagnosisType == + selectedDiagnosisItem && + widget.diagnosis.remarks == + filteredSearchController.text) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .noChangeRecorded); + return; + } + widget.diagnosis.selectedDisease = + filteredSearchController.text; + widget.diagnosis.selectedCategoryCode = + selectedDiagnosis?.selectedCategoryCode ?? ''; + widget.diagnosis.selectedIcdCode = + selectedDiagnosis?.selectedIcdCode ?? ''; + widget.diagnosis.selectedChapterCode = + selectedDiagnosis?.selectedChapterCode ?? ''; + widget.diagnosis.selectedSectionCode = + selectedDiagnosis?.selectedSectionCode ?? ''; + widget.diagnosis.condition = status; + widget.diagnosis.diagnosisType = + selectedDiagnosisItem; + + bool result = + await model.editDiagnosis(widget.diagnosis); + if (result) { + Navigator.pop(context, result); + } + }), ), ], ), @@ -416,7 +471,7 @@ class _EnterDiagnosisState extends State { ), ), ), - ), - ); + ); + }); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart index 0ecac958..be205dfa 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart @@ -35,6 +35,7 @@ class _EnterDiagnosisState extends State { bool showAllDiagnosis = true; String status = ''; String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; @@ -265,6 +266,7 @@ class _EnterDiagnosisState extends State { if (newValue != null) setState(() { selectedDiagnosisItem = newValue; + selectedDiagnosisItemValue = model.diagnosisTypeList[newValue]; }); }, items: @@ -375,6 +377,8 @@ class _EnterDiagnosisState extends State { color: Color(0xFF359846), onPressed: () async { selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + selectedDiagnosisItemValue = model.diagnosisTypeList[selectedDiagnosisItem]; + if(selectedDiagnosis == null ){ DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); return; @@ -392,7 +396,7 @@ class _EnterDiagnosisState extends State { bool result = await model.createDiagnosis( widget.patientInfo, selectedDiagnosis, - selectedDiagnosisItem, + selectedDiagnosisItemValue, status, remarksController.text, false); diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart index b60845bb..48b6032e 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/enum/view_state.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'; @@ -11,7 +12,13 @@ class AddProgressNote extends StatelessWidget{ @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model){ + WidgetsBinding.instance.addPostFrameCallback((_) async { + model.getClinics(); + }); + }, builder: (_, model, w) => AppScaffold( + isLoading: model.state == ViewState.BusyLocal, isShowAppBar: true, appBar: PatientSearchHeader( title: TranslationBase.of(context).progressNote diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart index d8e699f5..7158bac1 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart @@ -1,5 +1,8 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.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/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -7,8 +10,10 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-cust import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; -List patientState = ["","Stable", "Not Stable", "Not Defined"]; +import '../../../../../../core/model/SOAP/progress_note/Clinic.dart'; +import '../../../../../base/base_view.dart'; class AddProgressNoteDetails extends StatefulWidget { @override @@ -16,37 +21,15 @@ class AddProgressNoteDetails extends StatefulWidget { } class _AddProgressNoteDetailsState extends State { - String selectedItem = "Stable"; + Clinic? selectedItem ; int status = 1; final TextEditingController noteController = TextEditingController(); - @override Widget build(BuildContext context) { - return Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addProgressNote, - fontSize: 16, - fontWeight: FontWeight.w600, - textAlign: TextAlign.start, - color: Colors.black, - ), - SizedBox( - height: 16, - ), - Material( + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + builder: (_, model, w) => Material( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), side: BorderSide( @@ -61,236 +44,269 @@ class _AddProgressNoteDetailsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).patientCondition, - textAlign: TextAlign.start, + TranslationBase.of(context).addProgressNote, + fontSize: 16, fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), + textAlign: TextAlign.start, + color: Colors.black, ), SizedBox( - height: 4, + height: 16, ), - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem, - iconSize: 25, - elevation: 16, - - onChanged: (newValue) async { - setState(() { - selectedItem = newValue ?? ""; - }); - }, - items: patientState.map((item) { - return DropdownMenuItem( - child: AppText( - item, - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patientCondition, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), ), - value: item, - ); - }).toList(), - ), - ), - ], - ), - ), - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).progressNoteType, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, - ), - SizedBox( - height: 8, - ), - Row( - children: [ - Flexible( - child: InkWell( - onTap: () { - setState(() { - status = 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: status == 1 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), + SizedBox( + height: 4, + ), + model.clinics.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null ? model.clinics.first : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedItem = newValue; + }); + }, + items: model.clinics.map((item) { + return DropdownMenuItem( + child: AppText( + projectViewModel.isArabic + ? item.clinicNameArabic ?? '' + : item.clinicNameEnglish ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], ), ), - AppText( - TranslationBase.of(context).doctorProgressNote, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - fontSize: 12, - ), - ], - ), - )), - Flexible( - child: InkWell( - onTap: () { - setState(() { - status = 2; - }); - }, - child: Row( + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).progressNoteType, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + SizedBox( + height: 8, + ), + 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), + Flexible( + child: InkWell( + onTap: () { + setState(() { + status = 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: status == 1 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).doctorProgressNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], ), - child: Container( - decoration: BoxDecoration( - color: status == 2 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, + )), + Flexible( + child: InkWell( + onTap: () { + setState(() { + status = 2; + }); + }, + 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).nurseNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], ), ), ), - AppText( - TranslationBase.of(context).nurseNote, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - fontSize: 12, - ), ], ), - ), - ), - ], - ), - SizedBox( - height: 24, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).speciality, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), SizedBox( - height: 4, + height: 24, ), - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem, - iconSize: 25, - elevation: 16, - - onChanged: (newValue) async { - setState(() { - selectedItem = newValue ?? ""; - }); - }, - items: patientState.map((item) { - return DropdownMenuItem( - child: AppText( - "item", - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).speciality, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, ), - value: item, - ); - }).toList(), + model.clinics.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null ? model.clinics.first : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedItem = newValue; + }); + }, + items: model.clinics.map((item) { + return DropdownMenuItem( + child: AppText( + projectViewModel.isArabic + ? item.clinicNameArabic ?? '' + : item.clinicNameEnglish ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), ), ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).addYourNote, + controller: noteController, + inputType: TextInputType.multiline, + maxLines: 25, + minLines: 4, + hasBorder: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 16, + ), + Row( + children: [ + SvgPicture.asset( + 'assets/images/svgs/save_as_draft.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).saveAsDraft, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ) ], ), ), - ), - SizedBox( - height: 16, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).addYourNote, - controller: noteController, - inputType: TextInputType.multiline, - maxLines: 25, - minLines: 4, - hasBorder: true, - onClick: () {}, - onChanged: (value) {}, - onFieldSubmitted: () {}, - ), - SizedBox( - height: 16, - ), - Row( - children: [ - SvgPicture.asset('assets/images/svgs/save_as_draft.svg'), - SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).saveAsDraft, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), - ), - ], - ) - ], - ), - ), - ); + )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index e9304c61..4daed7e3 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget { class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex =2; + int _currentIndex = 3; List myAllergiesList = []; List myHistoryList = []; @@ -97,19 +97,19 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ - UpdateAssessmentPage( + UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, + sOAPViewModel: model, + changeStateFun: changeStateFun, ), - UpdatePlanPageVidaPlus( + UpdateAssessmentPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, - sOAPViewModel: model, - changeStateFun: changeStateFun, ), UpdateObjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 658ebb0e..9d952a1e 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1947,6 +1947,8 @@ class TranslationBase { String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!; String get selectedDiagnosis => localizedValues['selectedDiagnosis']![locale.languageCode]!; String get selectConditionFirst => localizedValues['selectConditionFirst']![locale.languageCode]!; + String get editDiagnosis => localizedValues['editDiagnosis']![locale.languageCode]!; + String get noChangeRecorded => localizedValues['noChangeRecorded']![locale.languageCode]!; } From 70114b8f192e28b696512d4492462dd4e2288ddd Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Sun, 1 Dec 2024 10:51:56 +0300 Subject: [PATCH 10/10] WD: reverting the value of enum --- lib/config/localized_values.dart | 2 +- lib/core/enum/master_lookup_key.dart | 4 ++-- lib/core/service/base/lookup-service.dart | 2 +- .../profile/soap_update/objective/add_examination_page.dart | 2 +- .../profile/soap_update/objective/update_objective_page.dart | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 10820435..3a0b56bd 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1223,7 +1223,7 @@ const Map> localizedValues = { "areYouSureYouWantToDeleteDiagnosis": { "en": "Are you sure you want to delete diagnosis", "ar": "هل أنت متأكد من أنك تريد حذف التشخيص" - } + }, "activate": {"en": "Activate", "ar":"فعل"}, "resolved": {"en": "Resolved", "ar":"تم الحل"}, diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 514caf56..04608719 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -5,7 +5,7 @@ enum MasterKeysService { HistorySocial, HistorySports, HistorySurgical, - PostPhysicalExaminationModel, + PhysicalExamination, AllergySeverity, physiotherapyGoals, DiagnosisCondition, @@ -45,7 +45,7 @@ extension SelectedMasterKeysService on MasterKeysService { case MasterKeysService.HistorySurgical: return 66; break; - case MasterKeysService.PostPhysicalExaminationModel: + case MasterKeysService.PhysicalExamination: return 59; break; case MasterKeysService.AllergySeverity: diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index d7254814..b9f6a69f 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -109,7 +109,7 @@ class LookupService extends BaseService { _historySurgicalList.add(MasterKeyModel.fromJson(v)); }); break; - case MasterKeysService.PostPhysicalExaminationModel: + case MasterKeysService.PhysicalExamination: _physicalExaminationList.clear(); entryList.forEach((v) { _physicalExaminationList.add(MasterKeyModel.fromJson(v)); 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 238f8dd8..7be4b062 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 @@ -38,7 +38,7 @@ class _AddExaminationPageState extends State { if (model.physicalExaminationList.length == 0) { WidgetsBinding.instance.addPostFrameCallback((_) async { await model.getMasterLookup( - MasterKeysService.PostPhysicalExaminationModel, + MasterKeysService.PhysicalExamination, ); }); } 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 d9d4ed1b..b44c35db 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 @@ -63,11 +63,11 @@ class _UpdateObjectivePageState extends State implements Ob await model.getPatientPhysicalExam(widget.patientInfo); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PostPhysicalExaminationModel); + await model.getMasterLookup(MasterKeysService.PhysicalExamination); } model.patientPhysicalExamList.forEach((element) { MasterKeyModel? examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PostPhysicalExaminationModel, + masterKeys: MasterKeysService.PhysicalExamination, id: element.examId, ); MySelectedExamination tempEam = SoapUtils.generateMySelectedExamination(