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 1377a582..03581d63 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -308,6 +308,43 @@ 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'; + +const SEARCH_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/SearchPhysicalExam'; + +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'; + +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'; + +const RESOLVE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisResolve'; +const GET_CLINIC = 'Services/DoctorApplication.svc/REST/GetDoctorClinicsForVidaPlus'; + const CONTINUE_EPISODE_VP = 'Services/DoctorApplication.svc/REST/ContinueEpisode'; const UPDATE_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/UpdateChiefComplaint'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cde167f4..3a0b56bd 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": "خطط ما بعد العملية والتكلفة المقدرة" @@ -1204,7 +1205,25 @@ const Map> localizedValues = { "noProgressNote": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, "mild": {"en": "Mild", "ar":"خفيف"}, "moderate": {"en": "Moderate", "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":"حدث: "}, + "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":"إضافة إلى المفضلة"}, "noDiagnosisFound": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, + "areYouSureYouWantToDeleteDiagnosis": { + "en": "Are you sure you want to delete diagnosis", + "ar": "هل أنت متأكد من أنك تريد حذف التشخيص" + }, "activate": {"en": "Activate", "ar":"فعل"}, "resolved": {"en": "Resolved", "ar":"تم الحل"}, 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..c4fc3b71 --- /dev/null +++ b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart @@ -0,0 +1,287 @@ +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)); + }); + } + } + + 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 { + 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; + 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']; + } + + 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/assessment/search_diagnosis.dart b/lib/core/model/SOAP/assessment/search_diagnosis.dart new file mode 100644 index 00000000..0a7ab2e7 --- /dev/null +++ b/lib/core/model/SOAP/assessment/search_diagnosis.dart @@ -0,0 +1,99 @@ +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; + String? selectedIcdCode; + String? selectedCategoryCode; + String? selectedSectionCode; + String? selectedChapterCode; + String? selectedNandaCode; + bool isFavorite = false; + + // 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']; + selectedIcdCode = json['selectedIcdCode']; + selectedCategoryCode = json['selectedCategoryCode']; + selectedSectionCode = json['selectedSectionCode']; + selectedChapterCode = json['selectedChapterCode']; + selectedNandaCode = json['selectedNandaCode']; + } + + // 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, + 'selectedIcdCode': selectedIcdCode, + 'selectedCategoryCode': selectedCategoryCode, + 'selectedSectionCode': selectedSectionCode, + 'selectedChapterCode': selectedChapterCode, + 'selectedNandaCode': selectedNandaCode, + }; + } +} \ No newline at end of file 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..975af7c4 --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/Category.dart @@ -0,0 +1,95 @@ +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; + bool isExpanded = false; + + 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)); + }); + } + if(conditionsList?.isNotEmpty == true) selectedCondition = int.parse(conditionsList?.first.conditionName ??'-1'); + 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..ac77890d --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart @@ -0,0 +1,74 @@ +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() + ..isMandatory = false + ..specialityDescription = this.specialityName + ..isClinicPhysicalExamination = true; +} 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/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..ec4253a6 --- /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; + String? 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..026d8c54 --- /dev/null +++ b/lib/core/model/SOAP/physical_exam/post_physical_examination_model.dart @@ -0,0 +1,55 @@ +@deprecated +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/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/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 a5b01ac7..9c4b83ba 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -4,6 +4,10 @@ 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/assessment/patch_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; @@ -11,6 +15,11 @@ 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'; import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetHomeMedication.dart'; import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetSearchCurrentMedication.dart'; import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart'; @@ -28,15 +37,22 @@ 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'; +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/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/utils/date-utils.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/utils/utils.dart'; +import '../../../../config/shared_pref_kay.dart'; +import '../../../../utils/date-utils.dart'; +import '../../../model/SOAP/assessment/patch_assessment_req_model.dart'; +import '../../../model/patient/patiant_info_model.dart'; +import '../../base/lookup-service.dart'; class SOAPService extends LookupService { List patientChiefComplaintList = []; @@ -44,6 +60,7 @@ class SOAPService extends LookupService { List patientHistoryList = []; List patientPhysicalExamList = []; List patientProgressNoteList = []; + List patientProgressNoteListVidaPlus = []; List patientAssessmentList = []; List searchAllergiesList = []; List patientAllergiesVidaPlus = []; @@ -54,6 +71,20 @@ class SOAPService extends LookupService { List getHomeMedicationList = []; List getSearchCurrentMedication = []; List getSearchCurrentMedicationDetails = []; + List patientPreviousDiagnosisList = []; + List patientDiagnosisList = []; + List favoriteDiagnosisDetailsList = []; + List auditDiagnosislist = []; + List searchDiagnosisList = []; + List patientPhysicalExaminationList = []; + List generalSpeciality = []; + List clinicsList = []; + Map> specialityDetails = {}; + Map diagnosisTypeList = {}; + Map conditionTypeList = {}; + List icdVersionList = []; + bool showAuditBottomSheet = false; + int? episodeID; bool isPrescriptionOrder = false; @@ -665,6 +696,539 @@ class SOAPService extends LookupService { }, 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); + } + + 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 = { + // "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": 70024978, + // "pomrId": 10819, + // "hospitalId": 313, + // "hospitalGroupId": 105, + // "ProjectID": 313 + // }; + + { + "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(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); + } + + Future postPhysicalExamination( + PatiantInformtion patientInfo, List physicalExamination) async { + List jsonListOfPhysicalExamination = []; + physicalExamination.forEach((value) => jsonListOfPhysicalExamination + .add(value.createPhysicalExaminationFromCategory())); + + Map request = { + "ProjectID": patientInfo.projectId, + "listCreatPhysicalExam": jsonListOfPhysicalExamination + }; + hasError = false; + var success = false; + await baseAppClient.post(POST_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast(response['ListPhysicalExam']['message']); + success = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + success = false; + }, body: request); + + return success; + } + + getGeneralSpeciality(PatiantInformtion patientInfo) async { + Map request = { + "ProjectID": patientInfo.projectId, + }; + hasError = false; + generalSpeciality.clear(); + await baseAppClient.post(GET_GENERAL_SPECIALITY, + onSuccess: (dynamic response, int statusCode) { + response['ListGeneralSpeciality']['resultData'].forEach((v) => + v['categories'].forEach( + (cat) => generalSpeciality.add(GeneralSpeciality.fromJson(cat)))); + }, onFailure: (String error, int statusCode) { + hasError = true; + generalSpeciality.clear(); + super.error = error; + }, body: request); + } + + Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, + String doctorName, String subFavoriteCode, dynamic? 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; + 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 is List) && (result as List).isEmpty) { + DrAppToastMsg.showErrorToast( + response['ListDiagnosisAddFavourite']['message']); + } else { + 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, + 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; + var 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); + } + + 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['ListProgressNote']['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(GET_SPECIALITY_DETAILS, + onSuccess: (dynamic response, int statusCode) { + 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; + }, body: request); + if (!hasError) { + specialityDetails[speciality] = categoryData; + } + } + + 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, + "hospitalGroupId": searchDiagnosis.hospitalGroupId, + "diagnosisType": diagnosisType, + "condition": conditionType, + "remarks": remarks, + "icdType": searchDiagnosis.icdType, + // "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 { + var request = diagnosis.toJson(); + var success = false; + await baseAppClient.post(EDIT_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + if (response['ListVisitWisePatientDiagnosis']['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 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; + } + continueEpisodeVidaPlus( diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 71a95fe5..310c6949 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,10 @@ 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/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/episode_by_chief_complaint_vidaplus.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'; @@ -23,13 +28,17 @@ import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetSearchC 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/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/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'; +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'; @@ -42,10 +51,12 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objectiv 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/cheif_complaints/update_Chief_complaints.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'; 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 { @@ -113,6 +124,27 @@ 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 diagnosisList => + _SOAPService.patientDiagnosisList; + + 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; @@ -121,8 +153,28 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.episodeByChiefComplaintListVidaPlus; + List get patientPhysicalExaminationList => + _SOAPService.patientPhysicalExaminationList; + + List get auditDiagnosislist => + _SOAPService.auditDiagnosislist; + + List? mainSpecialityList = null; + List speciality = []; + + List get progressNote => + _SOAPService.patientProgressNoteListVidaPlus; + List get clinics => + _SOAPService.clinicsList; + + Map> get specialityDetails => + _SOAPService.specialityDetails; + int? get episodeID => _SOAPService.episodeID; + + bool get showAudit => _SOAPService.showAuditBottomSheet; + bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; bool isAddProgress = true; bool isAddExamInProgress = true; @@ -130,6 +182,7 @@ class SOAPViewModel extends BaseViewModel { String complaintsControllerError = ''; String medicationControllerError = ''; String illnessControllerError = ''; + String selectedIcd = ''; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; @@ -1125,4 +1178,290 @@ class SOAPViewModel extends BaseViewModel { 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); + } + + 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, + ) 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); + } + + 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); + var userID = user?['List_MemberInformation'][0]['MemberID']; + bool result = await _SOAPService.addToFavoriteDiagnosis( + patientInfo, + profile?['DoctorName'] ?? '', + diagnosis?.diseasesBCode ?? '', + 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, + 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); + } + + List getListOfSelectedCategory() { + List mappedItems = []; + for (List category in specialityDetails.values) { + var selectedCategory = + 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, listOfSelectedCategory); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + return result; + } + + 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); + } else + setState(ViewState.Idle); + } + + 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); + } else + setState(ViewState.Idle); + } + + + void toggleShowBottomSheetValue(bool status) { + _SOAPService.showAuditBottomSheet = status; + } + + getProgressNote(PatiantInformtion patientInformation) async { + setState(ViewState.BusyLocal); + await _SOAPService.getProgressNoteNew(patientInformation); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + 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; + } + + + 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( + (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(); + } + + 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/add_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart index e9e5d933..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 @@ -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,17 @@ class _AddDiagnosisState extends State @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) { + WidgetsBinding.instance.addPostFrameCallback((_) { + 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 +72,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,8 +86,12 @@ class _AddDiagnosisState extends State child: TabBarView( controller: _tabController, children: [ - EnterDiagnosis(), - EnterDiagnosis(), + EnterDiagnosis( + patientInfo: widget.patientInfo, + ), + FavoriteDiagnosis( + patientInfo: widget.patientInfo, + ), ], ), ), 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..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 @@ -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,16 @@ 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); + model.getCurrentDiagnosisList(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 +126,7 @@ class _UpdateAssessmentPageState extends State Tab( child: AppText( TranslationBase.of(context) - .currentDiagnosis, + .previousDiagnosis, color: Color(0xFF6D6D6D), fontSize: 14, fontWeight: FontWeight.w600, @@ -175,10 +143,13 @@ class _UpdateAssessmentPageState extends State controller: _tabController, children: [ CurrentDiagnosis( - currentDiagnosisItems: [''], + patientInfo: widget.patientInfo, + model: model, + currentDiagnosisItems: model.diagnosisList, ), 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..f976063b --- /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*.41: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..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 @@ -1,61 +1,250 @@ +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/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'; 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 { - final List currentDiagnosisItems; +import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart'; - const CurrentDiagnosis({super.key, required this.currentDiagnosisItems}); +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(); +} + +class _CurrentDiagnosisState extends State { + TextEditingController deleteController = TextEditingController(); @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())); - }), - SizedBox( - height: 16, - ), - Divider(), - SizedBox( - height: 16, - ), - if (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) {}, - ); - }, - separatorBuilder: (_, index) => Divider(), - itemCount: 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) async{ + switch (action) { + case SoapDetailItemActions.AUDIT: + model.getAuditOfDiagnosis( + widget.patientInfo, + widget.currentDiagnosisItems[index] + .patientProblemRevisionId + ?.toString() ?? + ''); + break; + case SoapDetailItemActions.EDIT: + 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: + bool result = await model.resolveDiagnosis(widget.currentDiagnosisItems[index]); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + break; + + 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(); + }); + } + + 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..fcb2cc05 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart @@ -0,0 +1,477 @@ +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:get_it/get_it.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class EditDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + final PatientPreviousDiagnosis diagnosis; + + const EditDiagnosis( + {super.key, required this.patientInfo, required this.diagnosis}); + + @override + State createState() => _EditDiagnosisState(); +} + +class _EditDiagnosisState extends State { + final TextEditingController filteredSearchController = + 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(); + } + _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.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).editDiagnosis), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).editDiagnosis, + 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] + .toLowerCase() + ? 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 && + 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 (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); + } + }), + ), + ], + ), + ) + ], + ), + ), + ), + ); + }); + } +} 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..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 @@ -1,14 +1,30 @@ +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/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"]; + +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 +33,386 @@ class _EnterDiagnosisState extends State { final TextEditingController filteredSearchController = TextEditingController(); bool showAllDiagnosis = true; - bool status = true; - String selectedItem = "Stable"; + String status = ''; + String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; 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, - children: [ - Row( - children: [ - Switch( - value: showAllDiagnosis, - activeColor: Colors.red, - onChanged: (bool value) { - setState(() { - showAllDiagnosis = value; - }); - }, - ), - SizedBox( - width: 8, + return BaseView( + onModelReady: (model) { + this.model = model; + }, + 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, + ), + 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: () {}, ), - AppText( - TranslationBase.of(context).showAllDiagnosis, - fontWeight: FontWeight.w500, - color: Color(0xFF2E303A), - fontSize: 11, + ), + 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(); + }, + ); + }, + ), + ); + }, + ), + ), ), - ], - ), - 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( + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, 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, + Row( + children: [ + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { + setState(() { + showAllDiagnosis = value; + }); + }, ), - ), - ), - AppText( - TranslationBase.of(context).acute, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + SizedBox( + width: 8, + ), + AppText( + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, + ), + ], ), + SvgPicture.asset('assets/images/svgs/information.svg'), ], ), - )), - 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), + 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), ), - child: Container( - decoration: BoxDecoration( - color: - status == 2 ? HexColor("#D02127") : Colors.white, - shape: BoxShape.circle, - ), + SizedBox( + height: 4, ), - ), - AppText( - TranslationBase.of(context).subAcute, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), - ], + 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; + selectedDiagnosisItemValue = model.diagnosisTypeList[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(), + ), + ), + ], + ), ), ), - ), - Expanded( - child: InkWell( - onTap: () {}, + 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: [ - 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, - ), - ), + SvgPicture.asset(selectedDiagnosis?.isFavorite == true + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, ), AppText( - TranslationBase.of(context).chronic, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + TranslationBase.of(context).addToFavorite, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), ), ], ), - ), - ), - ], + ) + ], + ), ), - SizedBox(height: 8,), - - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( 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(), - ), - ), - ], - ), + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), + border: Border.all(color: HexColor('#707070'), width: 0), ), - 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: () {}, + 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; + selectedDiagnosisItemValue = model.diagnosisTypeList[selectedDiagnosisItem]; + + 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, + selectedDiagnosisItemValue, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, + ), + ), + ], + ), + ) + ], ), ), - 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/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..71e82650 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart @@ -0,0 +1,467 @@ +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_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 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) => 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: 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, + ), + ], + ), + ), + ), + 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/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_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..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 @@ -1,83 +1,149 @@ 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/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'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../../../core/viewModel/project_view_model.dart'; class AddDetailsToExaminationVidaPlus extends StatefulWidget { - final List? mySelectedExamination; + 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 { - bool isSysExaminationExpand = false; +class _AddDetailsToExaminationVidaPlusState + extends State { + String currentlyExpanded = ''; @override Widget build(BuildContext context) { print('the widget is build'); ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) async {}, + onModelReady: (model) async { + WidgetsBinding.instance.addPostFrameCallback((_) 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: - projectViewModel.isArabic - ? widget.mySelectedExamination![index].selectedExamination!.nameAr != null && widget.mySelectedExamination![index].selectedExamination!.nameAr != "" - ? widget.mySelectedExamination![index].selectedExamination!.nameAr! - : widget.mySelectedExamination![index].selectedExamination!.nameEn! - : widget.mySelectedExamination![index].selectedExamination!.nameEn!, - onTap: () { - setState(() { - isSysExaminationExpand = !isSysExaminationExpand; - }); - }, - child: ExaminationItems(examination:widget.mySelectedExamination![index]), - isExpanded: isSysExaminationExpand, - ); - - }, - separatorBuilder: (context, index) { - return SizedBox(height: 8,); - }, - itemCount: widget?.mySelectedExamination?.length ?? 0), - ), - ], + 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(() { + if(currentlyExpanded == title) { + currentlyExpanded = ''; + }else currentlyExpanded = title; + }); + }, + child: ExaminationItems( + examination: model.specialityDetails[title]), + isExpanded: currentlyExpanded == title, + ); + }, + 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 { + 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; + } + })); + } + }, + ), + ), + ], + ))), + )); } } - - - - /* Container( padding: EdgeInsets.symmetric(horizontal: 12), child: Column( @@ -230,4 +296,4 @@ 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,38 +34,33 @@ class AddExaminationPageVidaPlus extends StatefulWidget { class _AddExaminationPageVidaPlusState extends State { - List mySelectedExaminationLocal = []; + List mySelectedExaminationLocal = []; @override initState() { super.initState(); - mySelectedExaminationLocal = widget.mySelectedExamination!; } @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - WidgetsBinding.instance.addPostFrameCallback((_) async { - await model.getMasterLookup( - MasterKeysService.PhysicalExamination, - ); - }); - } + WidgetsBinding.instance.addPostFrameCallback((_) async => + await model.getGeneralSpeciality(widget.patientInfo) + ); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, isShowAppBar: true, + 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( @@ -69,37 +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( - mySelectedExamination: widget.mySelectedExamination, - masterList: model.physicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), - removeExamination: (selectedExamination) { - setState(() { - mySelectedExaminationLocal - .remove(selectedExamination); - }); - }, - addExamination: (selectedExamination) { - mySelectedExaminationLocal.insert( - 0, selectedExamination); - //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, @@ -128,10 +127,11 @@ class _AddExaminationPageVidaPlusState fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { - Navigator.pop(context); - widget.addSelectedExamination(mySelectedExaminationLocal); - - + if(mySelectedExaminationLocal.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).kindlySelectCategory); + return; + } + pushAddExamination(mySelectedExaminationLocal); }, ), ), @@ -141,14 +141,16 @@ 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, + patientInfo: widget.patientInfo, + ), + ), + ); } } 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..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 @@ -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 954f6cf2..f293df1e 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,5 +1,9 @@ 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/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/objective/add_examination_vida_plus_widget.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; @@ -7,114 +11,113 @@ 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 void initState() { - items!.addAll(widget.masterList!); super.initState(); } @override Widget build(BuildContext context) { - return 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(value); - }, - suffixWidget: InkWell( - child: Icon( - Icons.search, - color: Colors.black, + return BaseView( + + 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: () {}, ), ), - ), - ...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) { - 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); - }); - } + void filterSearchResults(SOAPViewModel model,String query) { + model.filterData(query); + // 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/list_of_examination.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart index a9b246e2..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 @@ -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].specialityDescription}>${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 fc8e53d7..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 @@ -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) { @@ -68,43 +69,19 @@ 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); - } - 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);}); + 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(), @@ -131,29 +108,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,), - - if (mySelectedExamination.isEmpty) ...{ + SizedBox( + height: 16, + ), - Center( + if (model.patientPhysicalExaminationList.isEmpty) ...{ + 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: model.patientPhysicalExaminationList) } // if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal) @@ -213,177 +192,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); + // 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); + // } + // } - 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); - - 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, + // ), + // ), + // ); + // } } 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 cc097d2f..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 @@ -1,5 +1,6 @@ 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/Category.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'; @@ -10,7 +11,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ExaminationItems extends StatefulWidget { - final MySelectedExamination? examination; + final List? examination; const ExaminationItems({super.key, this.examination}); @@ -21,142 +22,113 @@ 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 = widget.examination; } @override Widget build(BuildContext context) { 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, + 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: 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, + ), + ), ), - ), - ), - (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, - ), + (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, ), - 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, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), - ], - ), - )), - Expanded( - child: InkWell( + ), + 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(() { - status = 2; + value + .selectedCondition = + int.parse(value + .conditionsList?[ + currentIndex] + .conditionName ?? + "-1"); }); - 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), + 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), + border: Border.all( + color: Colors.grey, width: 1), ), child: Container( decoration: BoxDecoration( - color: status == 2 + color: value + .selectedCondition == + int.parse(value + .conditionsList?[ + currentIndex] + .conditionName ?? + "-1") ? HexColor("#D02127") : Colors.white, shape: BoxShape.circle, @@ -164,84 +136,515 @@ class _ExaminationItemsState extends State { ), ), AppText( - TranslationBase.of(context).abnormal, + value + .conditionsList?[ + currentIndex] + .conditionCode ?? + '', fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + fontSize: + SizeConfig.textMultiplier! * + 1.6, ), ], ), )), - 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, - ), - ), - ], - ), - )), - ], + ), + // 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: () {}, ), - 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, - ), - Divider() - ], + ), + ], + ), + ) + : 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 0921a8a0..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 @@ -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,89 +57,57 @@ 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: ''); WidgetsBinding.instance.addPostFrameCallback((_) async { - await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel);}); + widget.changeLoadingState(true); - 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; + model.getProgressNote(widget.patientInfo); + widget.changeLoadingState(false); - setState(() { - isAddProgress = false; - widget.sOAPViewModel.isAddProgress = false; - }); - } - widget.changeLoadingState(false); + }); }, builder: (_, model, w) => AppScaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -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/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/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 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 8bc4191f..14e5903d 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 = 3; List myAllergiesList = []; List myHistoryList = []; @@ -97,32 +97,31 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ - - - UpdateSubjectivePageVidaPlus( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateObjectivePageVidaPlus( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - 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, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), + + 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 128b871c..9589e220 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]!; @@ -1931,6 +1932,24 @@ class TranslationBase { String get acute => localizedValues['acute']![locale.languageCode]!; 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]!; + + 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]!; + String get editDiagnosis => localizedValues['editDiagnosis']![locale.languageCode]!; + String get noChangeRecorded => localizedValues['noChangeRecorded']![locale.languageCode]!; + String get activate => localizedValues['activate']![locale.languageCode]!; String get resolved => localizedValues['resolved']![locale.languageCode]!; }