diff --git a/lib/config/config.dart b/lib/config/config.dart index a818633c..03581d63 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -345,6 +345,23 @@ 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'; + +const EPISODE_BY_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/EpisodeByChiefcomplaint'; + +const GET_EDIT_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergy'; + +const GET_HOME_MEDICATION = 'Services/DoctorApplication.svc/REST/GetHomeMedication'; + +const SEARCH_CURRENT_MEDICATION = 'Services/DoctorApplication.svc/REST/SearchFormulary'; + +const SEARCH_CURRENT_MEDICATION_DETAILS = 'Services/DoctorApplication.svc/REST/GetFormularyMaster'; + +const REMOVE_CURRENT_MEDICATION = 'Services/DoctorApplication.svc/REST/DeleteHomeMedication'; + +const ADD_CURRENT_MEDICATION = 'Services/DoctorApplication.svc/REST/AddHomeMedication'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 240edfef..10820435 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1204,6 +1204,7 @@ const Map> localizedValues = { "noPhysicalExamination": {"en": "No Physical Examination added, please add it from the button above", "ar":"لم يتم إضافة فحص بدني ، يرجى إضافته من الزر أعلاه"}, "noProgressNote": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, "mild": {"en": "Mild", "ar":"خفيف"}, + "moderate": {"en": "Moderate", "ar":"معتدل"}, "remarksCanNotBeEmpty": {"en": "Remarks Can Not Be Empty", "ar":"لا يمكن أن تكون الملاحظات فارغة"}, "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, @@ -1223,4 +1224,7 @@ const Map> localizedValues = { "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/chief_complaint/episode_by_chief_complaint_vidaplus.dart b/lib/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart new file mode 100644 index 00000000..3494289f --- /dev/null +++ b/lib/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart @@ -0,0 +1,245 @@ +class EpisodeByChiefComplaintVidaPlus { + int? clinicId; + String? createdOn; + int? doctorId; + int? episodeStatus; + int? hospitalGroupId; + int? hospitalId; + String? modifiedOn; + int? patientEpisodeId; + int? patientId; + List? patientPomrs; + + EpisodeByChiefComplaintVidaPlus( + {this.clinicId, + this.createdOn, + this.doctorId, + this.episodeStatus, + this.hospitalGroupId, + this.hospitalId, + this.modifiedOn, + this.patientEpisodeId, + this.patientId, + this.patientPomrs}); + + EpisodeByChiefComplaintVidaPlus.fromJson(Map json) { + clinicId = json['clinicId']; + createdOn = json['createdOn']; + doctorId = json['doctorId']; + episodeStatus = json['episodeStatus']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + modifiedOn = json['modifiedOn']; + patientEpisodeId = json['patientEpisodeId']; + patientId = json['patientId']; + if (json['patientPomrs'] != null) { + patientPomrs = []; + json['patientPomrs'].forEach((v) { + patientPomrs!.add(new PatientPomrs.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['clinicId'] = this.clinicId; + data['createdOn'] = this.createdOn; + data['doctorId'] = this.doctorId; + data['episodeStatus'] = this.episodeStatus; + data['hospitalGroupId'] = this.hospitalGroupId; + data['hospitalId'] = this.hospitalId; + data['modifiedOn'] = this.modifiedOn; + data['patientEpisodeId'] = this.patientEpisodeId; + data['patientId'] = this.patientId; + if (this.patientPomrs != null) { + data['patientPomrs'] = this.patientPomrs!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PatientPomrs { + int? appointmentId; + int? chiefComplainTemplateId; + List? chiefComplains; + int? clinicGroupId; + String? createdOn; + int? doctorId; + String? doctorName; + int? episodeId; + bool? fallowUp; + bool? fallowUpRequired; + bool? isReadOnly; + String? modifiedOn; + int? patientId; + int? patientPomrId; + String? pomrSingOn; + int? pomrStatus; + bool? readOnly; + String? seenAtStatus; + String? vprnSeenAtStatus; + + PatientPomrs( + {this.appointmentId, + this.chiefComplainTemplateId, + this.chiefComplains, + this.clinicGroupId, + this.createdOn, + this.doctorId, + this.doctorName, + this.episodeId, + this.fallowUp, + this.fallowUpRequired, + this.isReadOnly, + this.modifiedOn, + this.patientId, + this.patientPomrId, + this.pomrSingOn, + this.pomrStatus, + this.readOnly, + this.seenAtStatus, + this.vprnSeenAtStatus}); + + PatientPomrs.fromJson(Map json) { + appointmentId = json['appointmentId']; + chiefComplainTemplateId = json['chiefComplainTemplateId']; + if (json['chiefComplains'] != null) { + chiefComplains = []; + json['chiefComplains'].forEach((v) { + chiefComplains!.add(new ChiefComplains.fromJson(v)); + }); + } + clinicGroupId = json['clinicGroupId']; + createdOn = json['createdOn']; + doctorId = json['doctorId']; + doctorName = json['doctorName']; + episodeId = json['episodeId']; + fallowUp = json['fallowUp']; + fallowUpRequired = json['fallowUpRequired']; + isReadOnly = json['isReadOnly']; + modifiedOn = json['modifiedOn']; + patientId = json['patientId']; + patientPomrId = json['patientPomrId']; + pomrSingOn = json['pomrSingOn']; + pomrStatus = json['pomrStatus']; + readOnly = json['readOnly']; + seenAtStatus = json['seenAtStatus']; + vprnSeenAtStatus = json['vprnSeenAtStatus']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentId'] = this.appointmentId; + data['chiefComplainTemplateId'] = this.chiefComplainTemplateId; + if (this.chiefComplains != null) { + data['chiefComplains'] = + this.chiefComplains!.map((v) => v.toJson()).toList(); + } + data['clinicGroupId'] = this.clinicGroupId; + data['createdOn'] = this.createdOn; + data['doctorId'] = this.doctorId; + data['doctorName'] = this.doctorName; + data['episodeId'] = this.episodeId; + data['fallowUp'] = this.fallowUp; + data['fallowUpRequired'] = this.fallowUpRequired; + data['isReadOnly'] = this.isReadOnly; + data['modifiedOn'] = this.modifiedOn; + data['patientId'] = this.patientId; + data['patientPomrId'] = this.patientPomrId; + data['pomrSingOn'] = this.pomrSingOn; + data['pomrStatus'] = this.pomrStatus; + data['readOnly'] = this.readOnly; + data['seenAtStatus'] = this.seenAtStatus; + data['vprnSeenAtStatus'] = this.vprnSeenAtStatus; + return data; + } +} + +class ChiefComplains { + int? appointmentId; + String? chiefComplain; + int? chiefComplainId; + int? clinicId; + String? createdBy; + int? createdId; + String? createdOn; + int? doctorId; + String? doctorName; + int? episodeId; + int? hospitalGroupId; + int? hospitalId; + String? loginUserId; + String? modifiedBy; + Null? modifiedId; + String? modifiedOn; + int? patientId; + String? patientName; + int? patientPomrId; + + ChiefComplains( + {this.appointmentId, + this.chiefComplain, + this.chiefComplainId, + this.clinicId, + this.createdBy, + this.createdId, + this.createdOn, + this.doctorId, + this.doctorName, + this.episodeId, + this.hospitalGroupId, + this.hospitalId, + this.loginUserId, + this.modifiedBy, + this.modifiedId, + this.modifiedOn, + this.patientId, + this.patientName, + this.patientPomrId}); + + ChiefComplains.fromJson(Map json) { + appointmentId = json['appointmentId']; + chiefComplain = json['chiefComplain']; + chiefComplainId = json['chiefComplainId']; + clinicId = json['clinicId']; + createdBy = json['createdBy']; + createdId = json['createdId']; + createdOn = json['createdOn']; + doctorId = json['doctorId']; + doctorName = json['doctorName']; + episodeId = json['episodeId']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + loginUserId = json['loginUserId']; + modifiedBy = json['modifiedBy']; + modifiedId = json['modifiedId']; + modifiedOn = json['modifiedOn']; + patientId = json['patientId']; + patientName = json['patientName']; + patientPomrId = json['patientPomrId']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentId'] = this.appointmentId; + data['chiefComplain'] = this.chiefComplain; + data['chiefComplainId'] = this.chiefComplainId; + data['clinicId'] = this.clinicId; + data['createdBy'] = this.createdBy; + data['createdId'] = this.createdId; + data['createdOn'] = this.createdOn; + data['doctorId'] = this.doctorId; + data['doctorName'] = this.doctorName; + data['episodeId'] = this.episodeId; + data['hospitalGroupId'] = this.hospitalGroupId; + data['hospitalId'] = this.hospitalId; + data['loginUserId'] = this.loginUserId; + data['modifiedBy'] = this.modifiedBy; + data['modifiedId'] = this.modifiedId; + data['modifiedOn'] = this.modifiedOn; + data['patientId'] = this.patientId; + data['patientName'] = this.patientName; + data['patientPomrId'] = this.patientPomrId; + return data; + } +} diff --git a/lib/core/model/SOAP/home_medication_vp/GetHomeMedication.dart b/lib/core/model/SOAP/home_medication_vp/GetHomeMedication.dart new file mode 100644 index 00000000..01d186c3 --- /dev/null +++ b/lib/core/model/SOAP/home_medication_vp/GetHomeMedication.dart @@ -0,0 +1,156 @@ +class GetHomeMedicationList { + List? personalizationEntity; + int? appointmentId; + int? clinicGroupId; + int? clinicId; + String? createdTime; + String? doseQuantity; + String? formularyName; + String? frequencyId; + String? frequencyString; + String? genericFormularyId; + String? homeMedFrom; + int? hospitalGroupId; + int? hospitalId; + String? id; + bool? isActive; + bool? isEHRIPReconciled; + bool? isEHROPReconciled; + bool? isERIPReconciled; + bool? isFreeText; + bool? isReconciled; + bool? isUnknownDetail; + String? lastUpdatedTime; + int? patientId; + int? patientPomrId; + String? prescribeTypeAlias; + int? prescribedItemId; + String? prescribedItemName; + String? remarks; + String? routeId; + String? routeString; + String? rowVersion; + String? sentence; + String? strengthId; + String? strengthString; + + GetHomeMedicationList( + {this.personalizationEntity, + this.appointmentId, + this.clinicGroupId, + this.clinicId, + this.createdTime, + this.doseQuantity, + this.formularyName, + this.frequencyId, + this.frequencyString, + this.genericFormularyId, + this.homeMedFrom, + this.hospitalGroupId, + this.hospitalId, + this.id, + this.isActive, + this.isEHRIPReconciled, + this.isEHROPReconciled, + this.isERIPReconciled, + this.isFreeText, + this.isReconciled, + this.isUnknownDetail, + this.lastUpdatedTime, + this.patientId, + this.patientPomrId, + this.prescribeTypeAlias, + this.prescribedItemId, + this.prescribedItemName, + this.remarks, + this.routeId, + this.routeString, + this.rowVersion, + this.sentence, + this.strengthId, + this.strengthString}); + + GetHomeMedicationList.fromJson(Map json) { + if (json['PersonalizationEntity'] != null) { + personalizationEntity = []; + json['PersonalizationEntity'].forEach((v) { + personalizationEntity!.add( v.fromJson(v)); + }); + } + appointmentId = json['appointmentId']; + clinicGroupId = json['clinicGroupId']; + clinicId = json['clinicId']; + createdTime = json['createdTime']; + doseQuantity = json['doseQuantity']; + formularyName = json['formularyName']; + frequencyId = json['frequencyId']; + frequencyString = json['frequencyString']; + genericFormularyId = json['genericFormularyId']; + homeMedFrom = json['homeMedFrom']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + id = json['id']; + isActive = json['isActive']; + isEHRIPReconciled = json['isEHRIPReconciled']; + isEHROPReconciled = json['isEHROPReconciled']; + isERIPReconciled = json['isERIPReconciled']; + isFreeText = json['isFreeText']; + isReconciled = json['isReconciled']; + isUnknownDetail = json['isUnknownDetail']; + lastUpdatedTime = json['lastUpdatedTime']; + patientId = json['patientId']; + patientPomrId = json['patientPomrId']; + prescribeTypeAlias = json['prescribeTypeAlias']; + prescribedItemId = json['prescribedItemId']; + prescribedItemName = json['prescribedItemName']; + remarks = json['remarks']; + routeId = json['routeId']; + routeString = json['routeString']; + rowVersion = json['rowVersion']; + sentence = json['sentence']; + strengthId = json['strengthId']; + strengthString = json['strengthString']; + } + + Map toJson() { + final Map data = new Map(); + if (this.personalizationEntity != null) { + data['PersonalizationEntity'] = + this.personalizationEntity!.map((v) => v.toJson()).toList(); + } + data['appointmentId'] = this.appointmentId; + data['clinicGroupId'] = this.clinicGroupId; + data['clinicId'] = this.clinicId; + data['createdTime'] = this.createdTime; + data['doseQuantity'] = this.doseQuantity; + data['formularyName'] = this.formularyName; + data['frequencyId'] = this.frequencyId; + data['frequencyString'] = this.frequencyString; + data['genericFormularyId'] = this.genericFormularyId; + data['homeMedFrom'] = this.homeMedFrom; + data['hospitalGroupId'] = this.hospitalGroupId; + data['hospitalId'] = this.hospitalId; + data['id'] = this.id; + data['isActive'] = this.isActive; + data['isEHRIPReconciled'] = this.isEHRIPReconciled; + data['isEHROPReconciled'] = this.isEHROPReconciled; + data['isERIPReconciled'] = this.isERIPReconciled; + data['isFreeText'] = this.isFreeText; + data['isReconciled'] = this.isReconciled; + data['isUnknownDetail'] = this.isUnknownDetail; + data['lastUpdatedTime'] = this.lastUpdatedTime; + data['patientId'] = this.patientId; + data['patientPomrId'] = this.patientPomrId; + data['prescribeTypeAlias'] = this.prescribeTypeAlias; + data['prescribedItemId'] = this.prescribedItemId; + data['prescribedItemName'] = this.prescribedItemName; + data['remarks'] = this.remarks; + data['routeId'] = this.routeId; + data['routeString'] = this.routeString; + data['rowVersion'] = this.rowVersion; + data['sentence'] = this.sentence; + data['strengthId'] = this.strengthId; + data['strengthString'] = this.strengthString; + return data; + } +} diff --git a/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedication.dart b/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedication.dart new file mode 100644 index 00000000..fd94d9cf --- /dev/null +++ b/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedication.dart @@ -0,0 +1,40 @@ +class GetSearchCurrentMedication { + String? formularyName; + String? genericFormularyCode; + String? genericFormularyId; + int? hospitalGroupId; + int? hospitalId; + String? itemType; + bool? outOfStock; + + GetSearchCurrentMedication( + {this.formularyName, + this.genericFormularyCode, + this.genericFormularyId, + this.hospitalGroupId, + this.hospitalId, + this.itemType, + this.outOfStock}); + + GetSearchCurrentMedication.fromJson(Map json) { + formularyName = json['formularyName']; + genericFormularyCode = json['genericFormularyCode']; + genericFormularyId = json['genericFormularyId']; + hospitalGroupId = json['hospitalGroupId']; + hospitalId = json['hospitalId']; + itemType = json['itemType']; + outOfStock = json['outOfStock']; + } + + Map toJson() { + final Map data = new Map(); + data['formularyName'] = this.formularyName; + data['genericFormularyCode'] = this.genericFormularyCode; + data['genericFormularyId'] = this.genericFormularyId; + data['hospitalGroupId'] = this.hospitalGroupId; + data['hospitalId'] = this.hospitalId; + data['itemType'] = this.itemType; + data['outOfStock'] = this.outOfStock; + return data; + } +} diff --git a/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart b/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart new file mode 100644 index 00000000..0cdd9ada --- /dev/null +++ b/lib/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart @@ -0,0 +1,108 @@ +class GetSearchCurrentMedicationDetails { + List? genericItemFrequencyDetailsEntity; + List? genericItemRouteDetailsEntity; + List? itemStrengthDetailsDto; + int? patientTypeId; + + GetSearchCurrentMedicationDetails({this.genericItemFrequencyDetailsEntity, this.genericItemRouteDetailsEntity, this.itemStrengthDetailsDto, this.patientTypeId}); + + GetSearchCurrentMedicationDetails.fromJson(Map json) { + if (json['genericItemFrequencyDetailsEntity'] != null) { + genericItemFrequencyDetailsEntity = []; + json['genericItemFrequencyDetailsEntity'].forEach((v) { genericItemFrequencyDetailsEntity!.add(new GenericItemFrequencyDetailsEntity.fromJson(v)); }); + } + if (json['genericItemRouteDetailsEntity'] != null) { + genericItemRouteDetailsEntity = []; + json['genericItemRouteDetailsEntity'].forEach((v) { genericItemRouteDetailsEntity!.add(new GenericItemRouteDetailsEntity.fromJson(v)); }); + } + if (json['itemStrengthDetailsDto'] != null) { + itemStrengthDetailsDto = []; + json['itemStrengthDetailsDto'].forEach((v) { itemStrengthDetailsDto!.add(new ItemStrengthDetailsDto.fromJson(v)); }); + } + patientTypeId = json['patientTypeId']; + } + + Map toJson() { + final Map data = new Map(); + if (this.genericItemFrequencyDetailsEntity != null) { + data['genericItemFrequencyDetailsEntity'] = this.genericItemFrequencyDetailsEntity!.map((v) => v.toJson()).toList(); + } + if (this.genericItemRouteDetailsEntity != null) { + data['genericItemRouteDetailsEntity'] = this.genericItemRouteDetailsEntity!.map((v) => v.toJson()).toList(); + } + if (this.itemStrengthDetailsDto != null) { + data['itemStrengthDetailsDto'] = this.itemStrengthDetailsDto!.map((v) => v.toJson()).toList(); + } + data['patientTypeId'] = this.patientTypeId; + return data; + } +} + +class GenericItemFrequencyDetailsEntity { + bool? Default; + String? frequency; + int? frequencyId; + int? interval; + + GenericItemFrequencyDetailsEntity({this.Default, this.frequency, this.frequencyId, this.interval}); + +GenericItemFrequencyDetailsEntity.fromJson(Map json) { +Default = json['Default']; +frequency = json['Frequency']; +frequencyId = json['FrequencyId']; +interval = json['Interval']; +} + +Map toJson() { +final Map data = new Map(); +data['Default'] = this.Default; +data['Frequency'] = this.frequency; +data['FrequencyId'] = this.frequencyId; +data['Interval'] = this.interval; +return data; +} +} + +class GenericItemRouteDetailsEntity { +bool? Default; +String? route; +int? routeId; + +GenericItemRouteDetailsEntity({this.Default, this.route, this.routeId}); + +GenericItemRouteDetailsEntity.fromJson(Map json) { +Default = json['default']; +route = json['route']; +routeId = json['routeId']; +} + +Map toJson() { +final Map data = new Map(); +data['default'] = this.Default; +data['route'] = this.route; +data['routeId'] = this.routeId; +return data; +} +} + +class ItemStrengthDetailsDto { +bool? Default; +String? strength; +int? strengthId; + +ItemStrengthDetailsDto({this.Default, this.strength, this.strengthId}); + +ItemStrengthDetailsDto.fromJson(Map json) { +Default = json['default']; +strength = json['strength']; +strengthId = json['strengthId']; +} + +Map toJson() { +final Map data = new Map(); +data['default'] = this.Default; +data['strength'] = this.strength; +data['strengthId'] = this.strengthId; +return data; +} +} 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 361eff19..13d50adc 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; 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'; @@ -7,6 +8,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/assessment/FavoriteDiseaseDet 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'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_complaint_vidaplus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart'; @@ -17,6 +20,9 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/CreatePhysicalE 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'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; @@ -36,7 +42,11 @@ import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressN 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'; @@ -57,6 +67,10 @@ class SOAPService extends LookupService { List hopiDetails = []; List patientChiefComplaintListVidaPlus = []; List searchChiefComplaintListVidaPlus = []; + List episodeByChiefComplaintListVidaPlus = []; + List getHomeMedicationList = []; + List getSearchCurrentMedication = []; + List getSearchCurrentMedicationDetails = []; List patientPreviousDiagnosisList = []; List patientDiagnosisList = []; List favoriteDiagnosisDetailsList = []; @@ -398,6 +412,25 @@ class SOAPService extends LookupService { }, body: request); } + + Future getEditAllergies(int allergyId) async { + hasError = false; + + await baseAppClient.post(GET_EDIT_ALLERGIES, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + searchAllergiesList.clear(); + + response['List_SearchAllergies']['resultData'].forEach((v) { + searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {"allergyId": allergyId}); + } + + Future searchAllergies(String searchKey) async { hasError = false; @@ -448,7 +481,7 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); + DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -459,8 +492,10 @@ class SOAPService extends LookupService { Future resolveAllergies( PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async { + /*changed request parameters based on the vida plus requested */ + var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); List? reaction = allergy.patientsAllergyReactionsDTOs!; @@ -484,7 +519,7 @@ class SOAPService extends LookupService { "allergyTypeName": allergy.allergyTypeName, "assessmentId": 0, "isActive": allergy.isActivePatientsAllergy, - "patientsAllergyReactionsDTOs": reactionRequest, + "patientsAllergyReactionsDTOs":reactionRequest, "dbCRUDOperation": 2, "allergyID": allergy.allergyID, "allergyName": allergy.allergyName, @@ -497,7 +532,7 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(RESOLVE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Resolved Successfully"); + DrAppToastMsg.showSuccesToast("Resolved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -507,39 +542,48 @@ class SOAPService extends LookupService { } Future updateAllergies( - AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async { - allergy.allergyReactionDTOs!.forEach((value) { - value.patientID = patientInfo.patientMRN; - value.pomrid = patientInfo.episodeNo; - value.allergyReactionMappingID = 1; + PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async { + + var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); + List? reaction = + allergy.patientsAllergyReactionsDTOs!; + List? reactionRequest = []; + reaction.forEach((value) { + reactionRequest.add(AllergyReactionDTOs( + patientID: patientInfo.patientMRN, + pomrid: int.parse(patientInfo.pomrId!), + hospitalGroupID: value.hospitalGroupID, + allergyReactionMappingID: 0, + hospitalID: value.hospitalID, + isActive: value.isActive, + allergyReactionID: value.allergyReactionID, + allergyReactionName: value.allergyReactionName, + severity: value.severity)); }); var request = { - "patientsAllergyRevisionID": allergy.allergyRevisionID, + "pomrId": patientInfo.pomrId, "patientMRN": patientInfo.patientMRN, - "allergyDiseaseType": 0, "allergyTypeName": allergy.allergyTypeName, - "episodeId": patientInfo.episodeNo, - "isUpdatedByNurse": false, - "remarks": allergy.remark, - "createdBy": patientInfo.doctorId, - "createdOn": AppDateUtils.convertDateToFormat( - DateTime.now(), "yyyy-MM-dd kk:mm:ss"), "assessmentId": 0, - "isActive": allergy.isActive, - "isActivePatientsAllergy": true, - "patientsAllergyReactionsDTOs": allergy.allergyReactionDTOs, - "dbCRUDOperation": 1, + "isActive": allergy.isActivePatientsAllergy, + "isActivePatientsAllergy": allergy.isActivePatientsAllergy, + "patientsAllergyReactionsDTOs":reactionRequest, + "dbCRUDOperation": 2, "allergyID": allergy.allergyID, "allergyName": allergy.allergyName, - "allergyTypeID": allergy.allergyTypeID + "allergyTypeID": allergy.allergyTypeID, + "remarks": allergy.remark, + "projectId": patientInfo.projectId, + "editedBy": doctorProfile['List_MemberInformation'][0]['MemberID'], + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) }; hasError = false; await baseAppClient.post(UPDATE_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("Allergies Saved Successfully"); + DrAppToastMsg.showSuccesToast("Allergies Updated Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -564,7 +608,7 @@ class SOAPService extends LookupService { hasError = false; await baseAppClient.post(CREATE_HOPI, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast("History Saved Successfully"); + DrAppToastMsg.showSuccesToast("History Saved Successfully"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -601,8 +645,7 @@ class SOAPService extends LookupService { patientChiefComplaintListVidaPlus.clear(); response['ListChiefComplaintDetails']['resultData'].forEach((v) { - patientChiefComplaintListVidaPlus - .add(GetChiefComplaintVidaPlus.fromJson(v)); + patientChiefComplaintListVidaPlus.add(GetChiefComplaintVidaPlus.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -1185,4 +1228,181 @@ class SOAPService extends LookupService { return success; } + + + + continueEpisodeVidaPlus( + PatiantInformtion patient, List chiefComplaint) async { + List> chiefComplaintList=[]; + + chiefComplaint.forEach((action){ + action.chiefComplains!.forEach((action2){ + chiefComplaintList.add({"chiefComplain": action2.chiefComplain,"chiefComplainTemplateId": action!.chiefComplainTemplateId}); + }); + }); + Map request = { + "appointmentId": patient.appointmentNo, + "projectId": patient.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "chiefComplain":chiefComplaintList + + }; + hasError = false; + await baseAppClient.post(CONTINUE_EPISODE_VP, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + updateChiefComplaintVidaPlus( + PatiantInformtion patient, GetChiefComplaintVidaPlus chiefComplaint) async { + Map request = { + "AppointmentNo": patient.appointmentNo, + "pomrId": patient.pomrId, + "PatientMRN": patient.patientMRN, + "PatientName":patient.firstName! + ' '+ patient.lastName! , + "addedChiefComplaintCreateDtos": [ + + ], + "removedChiefComplaintIds":[chiefComplaint.chiefComplainId] + }; + hasError = false; + await baseAppClient.post(UPDATE_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + DrAppToastMsg.showErrorToast(response['List_UpdateChiefComplaint']['message']); + }, onFailure: (String error, int statusCode) { + + hasError = true; + super.error = error; + }, body: request); + } + episodeByChiefComplaint( + PatiantInformtion patient) async { + Map request = { + "patientId": patient.patientId, + "clinicId": patient.clinicId, + }; + hasError = false; + await baseAppClient.post(EPISODE_BY_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + episodeByChiefComplaintListVidaPlus.clear(); + + response['EpisodeByChiefcomplaint']['resultData'].forEach((v) { + episodeByChiefComplaintListVidaPlus.add(EpisodeByChiefComplaintVidaPlus.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + getHomeMedication( + PatiantInformtion patient) async { + Map request = { + "patientId": patient.patientId, + }; + hasError = false; + await baseAppClient.post(GET_HOME_MEDICATION, + onSuccess: (dynamic response, int statusCode) { + getHomeMedicationList.clear(); + response['ListHomeMedication']['resultData'].forEach((v) { + getHomeMedicationList.add(GetHomeMedicationList.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + searchCurrentMedication( + String query + ) async { + Map request = { + "SearchKey": query + }; + hasError = false; + await baseAppClient.post(SEARCH_CURRENT_MEDICATION, + onSuccess: (dynamic response, int statusCode) { + getSearchCurrentMedication.clear(); + response['ListFormulatorySearch']['resultData'].forEach((v) { + getSearchCurrentMedication.add(GetSearchCurrentMedication.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + + getCurrentMedicationDetails( + String id + ) async { + Map request = { + "genericFormularyId": id + }; + hasError = false; + await baseAppClient.post(SEARCH_CURRENT_MEDICATION_DETAILS, + onSuccess: (dynamic response, int statusCode) { + getSearchCurrentMedicationDetails.clear(); + response['ListFormularyMaster']['resultData'].forEach((v) { + getSearchCurrentMedicationDetails.add(GetSearchCurrentMedicationDetails.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + removeCurrentMedicationVidaPlus( + String medicationID) async { + Map request = { + + "homeMedicationId":medicationID + }; + hasError = false; + await baseAppClient.post(REMOVE_CURRENT_MEDICATION, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + + hasError = true; + super.error = error; + }, body: request); + } + + addCurrentMedicationVidaPlus( + Map request, PatiantInformtion patientInfo) async { + + var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER); + + Map genericRequest ={ + "patientId": patientInfo.patientId, + "patientPomrId": patientInfo.pomrId, + "hospitalId": patientInfo.projectId, + "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + "clinicGroupId": patientInfo.clinicGroupId, + "clinicId": patientInfo.clinicId, + "appointmentId": patientInfo.appointmentNo, + "created_by": patientInfo.doctorId, + "loginUserId": doctorProfile['List_MemberInformation'][0]['MemberID'], + }; + + Map finalRequest = {} + ..addAll(request) + ..addAll(genericRequest); + hasError = false; + await baseAppClient.post(ADD_CURRENT_MEDICATION, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + + hasError = true; + super.error = error; + }, body: finalRequest); + } } + diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index c621e4c2..310c6949 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/assessment/FavoriteDiseaseDet 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'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; @@ -21,6 +22,9 @@ import 'package:doctor_app_flutter/core/model/SOAP/get_hopi_details.dart'; import 'package:doctor_app_flutter/core/model/SOAP/history/get_history_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/history/get_history_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/history/post_histories_request_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'; 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'; @@ -45,6 +49,7 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/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'; @@ -143,6 +148,11 @@ class SOAPViewModel extends BaseViewModel { List get getChiefComplaintListVidaPlus => _SOAPService.patientChiefComplaintListVidaPlus; + + List get episodeByChiefComplaintListVidaPlus => + _SOAPService.episodeByChiefComplaintListVidaPlus; + + List get patientPhysicalExaminationList => _SOAPService.patientPhysicalExaminationList; @@ -185,6 +195,19 @@ class SOAPViewModel extends BaseViewModel { List? get allMedicationList => _prescriptionService.allMedicationList; + + List? get getHomeMedicationList => + _SOAPService.getHomeMedicationList; + + + List? get getMedicationListVP => + _SOAPService.getSearchCurrentMedication; + + + List? get getSearchCurrentMedicationDetails => + _SOAPService.getSearchCurrentMedicationDetails; + + late SubjectiveCallBack subjectiveCallBack; setSubjectiveCallBack(SubjectiveCallBack callBack) { @@ -483,7 +506,7 @@ class SOAPViewModel extends BaseViewModel { return result.first; } break; - case MasterKeysService.PostPhysicalExaminationModel: + case MasterKeysService.PhysicalExamination: List result = physicalExaminationList.where((element) { return element.id == id && element.typeId == masterKeys.getMasterKeyService(); @@ -974,6 +997,16 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + getEditAllergiesVidaPlus(int AllergyID ) async { + setState(ViewState.BusyLocal); + await _SOAPService.getEditAllergies(AllergyID); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + searchAllergies(String searchKey) async { setState(ViewState.BusyLocal); await _SOAPService.searchAllergies(searchKey); @@ -1006,6 +1039,18 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + + updateAllergies( + PatientAllergiesVidaPlus request, PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.updateAllergies(request, patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + saveHopi(Map req, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.saveHopi(req, patientInfo); @@ -1055,6 +1100,84 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + updateChiefComplaint(PatiantInformtion patientInfo, GetChiefComplaintVidaPlus CC) async { + setState(ViewState.BusyLocal); + await _SOAPService.updateChiefComplaintVidaPlus(patientInfo, CC); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + episodeByChiefComplaint(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.episodeByChiefComplaint(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + createCCByEpisode(PatiantInformtion patientInfo, List chiefComplaint) async { + setState(ViewState.BusyLocal); + await _SOAPService.continueEpisodeVidaPlus(patientInfo, chiefComplaint); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + getHomeMedication(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getHomeMedication(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + searchCurrentMedication(String searchQuery) async{ + setState(ViewState.BusyLocal); + await _SOAPService.searchCurrentMedication(searchQuery); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + getCurrentMedicationDetails(String id) async{ + setState(ViewState.BusyLocal); + await _SOAPService.getCurrentMedicationDetails(id); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + removeCurrentMedication(String id) async{ + setState(ViewState.BusyLocal); + await _SOAPService.removeCurrentMedicationVidaPlus(id); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + addCurrentMedication(request, PatiantInformtion patientInfo) async{ + setState(ViewState.BusyLocal); + await _SOAPService.addCurrentMedicationVidaPlus(request, patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + searchDiagnosis(PatiantInformtion patientInfo, String searchQuery) async { setState(ViewState.BusyLocal); diff --git a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart index 0fb93724..9735fe2c 100644 --- a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart @@ -52,7 +52,9 @@ class _AddPatientSickLeaveScreenState extends State { showDatePicker( context: context, initialDate: currentDate ?? DateTime.now(), - firstDate: DateTime(DateTime.now().year - 1), + firstDate: AppDateUtils.convertStringToDate( + widget!.patient!.arrivedOn!, + ), lastDate: DateTime(DateTime.now().year + 1), ).then((pickedDate) { if (pickedDate == null) { diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index b0dae525..10370c01 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -138,11 +138,7 @@ openReaction(model, AllergiesListVidaPlus mySelectedAllergy){ mySelectedAllergy: mySelectedAllergy, patientInfo: widget.patientInfo ) - // addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) { - // - // Navigator.of(context).pop(); - // - // }) + )); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart index 938f4c6a..8ac3c13b 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart @@ -1,18 +1,17 @@ +import 'package:doctor_app_flutter/config/config.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/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/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/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import '../../../../../../config/config.dart'; -import '../../../../../../core/model/patient/patiant_info_model.dart'; -import '../../../../../../core/viewModel/project_view_model.dart'; -import '../../../../../../widgets/shared/app_scaffold_widget.dart'; -import '../../../../../../widgets/shared/buttons/app_buttons_widget.dart'; -import '../../../../../base/base_view.dart'; -import '../../../../patient_search/patient_search_header.dart'; class ReactionsSelectionAllergiesWidget extends StatefulWidget { @@ -27,10 +26,9 @@ class ReactionsSelectionAllergiesWidget extends StatefulWidget { Key? key, required this.model, required this.patientInfo, - this.mySelectedAllergy, + this.mySelectedAllergy, this.editSelectedAllergy, this.isEdit = false, - this.buttonName, }) : super(key: key); @@ -42,375 +40,492 @@ class ReactionsSelectionAllergiesWidget extends StatefulWidget { class _ReactionsSelectionAllergiesWidgetState extends State { bool loading = false; + TextEditingController remark = TextEditingController(); + List? controllers =[]; @override void initState() { + controllers = List.generate(widget.mySelectedAllergy! + .allergyReactionDTOs!.length, (index) => ExpansionTileController()); super.initState(); } @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, w) => AppScaffold( - isLoading:loading, - appBar: PatientSearchHeader( - title: widget.mySelectedAllergy !=null ?widget.mySelectedAllergy!.allergyName : widget.editSelectedAllergy!.allergyName - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - widget.mySelectedAllergy != null ? Expanded( - child: RoundedContainer( - margin: EdgeInsets.all(15), - child: ListView.builder( - itemCount: - widget.mySelectedAllergy!.allergyReactionDTOs!.length, - itemBuilder: (context, index) { - loading = false; - return Column(children: [ - ExpansionTile( - key: Key(index.toString()), - dense: false, - enableFeedback: false, - showTrailingIcon: false, - - initiallyExpanded: widget - .mySelectedAllergy! - .allergyReactionDTOs![index].isSelected!, - leading: - Checkbox( - activeColor: Color(0xffD02127), - value: widget - .mySelectedAllergy! - .allergyReactionDTOs![index].isSelected!, onChanged: (value) { - - widget - .mySelectedAllergy! - .allergyReactionDTOs![index].isSelected = value; - setState(() { + builder: (_, model, w) => AppScaffold( + isLoading: loading, + appBar: PatientSearchHeader( + title: widget.mySelectedAllergy != null + ? widget.mySelectedAllergy!.allergyName + : widget.editSelectedAllergy!.allergyName), + body: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + widget.mySelectedAllergy != null + ? Expanded( + child: RoundedContainer( + margin: EdgeInsets.only(top:10, left: 15, right: 15, bottom: 10), + child: ListView.builder( + itemCount: widget.mySelectedAllergy! + .allergyReactionDTOs!.length, + itemBuilder: (context, index) { + loading = false; - }); + return Column(children: [ + ExpansionTile( - }), - title: AppText(widget - .mySelectedAllergy! - .allergyReactionDTOs![index] - .allergyReactionName!), - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: ListTile( - title: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Radio( + controller: controllers![index], + key: Key(index.toString()), + dense: false, + enableFeedback: false, + showTrailingIcon: false, + initiallyExpanded: widget + .mySelectedAllergy! + .allergyReactionDTOs![index] + .isSelected!, + leading: Checkbox( activeColor: Color(0xffD02127), - materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, - // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: 1, - groupValue: widget + value: widget .mySelectedAllergy! .allergyReactionDTOs![index] - .severity, + .isSelected!, onChanged: (value) { widget .mySelectedAllergy! .allergyReactionDTOs![index] - .severity = value; - setState(() {}); - }, - ), - AppText( - TranslationBase.of(context).mild, - fontSize: 10, - ), - ], - ))), - Expanded( - child: ListTile( - title: Row( - children: [ - Radio( - activeColor: Color(0xffD02127), - materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, - // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: 2, - groupValue: widget - .mySelectedAllergy! - .allergyReactionDTOs![index] - .severity, - onChanged: (value) { - widget - .mySelectedAllergy! - .allergyReactionDTOs![index] - .severity = value; - setState(() {}); - }, - ), - AppText( - TranslationBase.of(context).moderate, - fontSize: 10, - ), + .isSelected = value; + + value ==true ? controllers![index].expand() : controllers![index].collapse() ; + setState(() { + + }); // setState(() {}); + }), + title: AppText(widget + .mySelectedAllergy! + .allergyReactionDTOs![index] + .allergyReactionName!), + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: ListTile( + title: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + // Reduces padding around checkbox + visualDensity: + VisualDensity.compact, + value: 1, + groupValue: widget + .mySelectedAllergy! + .allergyReactionDTOs![index] + .severity, + onChanged: (value) { + widget + .mySelectedAllergy! + .allergyReactionDTOs![ + index] + .severity = value; + setState(() {}); + }, + ), + AppText( + TranslationBase.of(context) + .mild, + fontSize: 10, + ), + ], + ))), + Expanded( + child: ListTile( + title: Row( + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + // Reduces padding around checkbox + visualDensity: + VisualDensity.compact, + value: 2, + groupValue: widget + .mySelectedAllergy! + .allergyReactionDTOs![index] + .severity, + onChanged: (value) { + widget + .mySelectedAllergy! + .allergyReactionDTOs![ + index] + .severity = value; + setState(() {}); + }, + ), + AppText( + TranslationBase.of(context) + .moderate, + fontSize: 10, + ), + ], + ))), + Expanded( + child: ListTile( + title: Row( + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + // Reduces padding around checkbox + visualDensity: + VisualDensity.compact, + value: 3, + groupValue: widget + .mySelectedAllergy! + .allergyReactionDTOs![index] + .severity, + onChanged: (value) { + widget + .mySelectedAllergy! + .allergyReactionDTOs![ + index] + .severity = value; + setState(() {}); + }, + ), + AppText( + TranslationBase.of(context) + .severe, + fontSize: 10, + ), + ], + ))) + ], + ) ], - ))), - Expanded( - child: ListTile( - title: Row( - children: [ - Radio( + ), + Divider(), + ]); + }, + ))) + : Expanded( + child: RoundedContainer( + margin: EdgeInsets.all(15), + child: ListView.builder( + itemCount: widget.editSelectedAllergy! + .patientsAllergyReactionsDTOs!.length, + itemBuilder: (context, index) { + loading = false; + return Column(children: [ + ExpansionTile( + key: Key(index.toString()), + dense: false, + enableFeedback: false, + showTrailingIcon: false, + initiallyExpanded: widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![index] + .isSelected!, + leading: Checkbox( activeColor: Color(0xffD02127), - materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, - // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: 3, - groupValue: widget - .mySelectedAllergy! - .allergyReactionDTOs![index] - .severity, + value: widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .isSelected!, onChanged: (value) { widget - .mySelectedAllergy! - .allergyReactionDTOs![index] - .severity = value; + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .isSelected = value; setState(() {}); - }, - ), - AppText( - TranslationBase.of(context).severe, - fontSize: 10, - ), - ], - ))) - ], - ) - ], - ), - Divider(), - ]); - }, - ))) : Expanded( - child: RoundedContainer( - margin: EdgeInsets.all(15), - child: ListView.builder( - itemCount: - widget.editSelectedAllergy!.patientsAllergyReactionsDTOs!.length, - itemBuilder: (context, index) { - loading = false; - return Column(children: [ - ExpansionTile( - key: Key(index.toString()), - dense: false, - enableFeedback: false, - showTrailingIcon: false, - - initiallyExpanded: widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected!, - leading: - Checkbox( - activeColor: Color(0xffD02127), - value: widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected!, onChanged: (value) { - - widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected = value; - setState(() { - - }); - - }), - title: AppText( widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .allergyReactionName!), - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: ListTile( - title: Row( + }), + title: AppText(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![index] + .allergyReactionName!), + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: ListTile( + title: Row( mainAxisSize: MainAxisSize.min, children: [ Radio( activeColor: Color(0xffD02127), materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, + MaterialTapTargetSize + .shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: TranslationBase.of(context).mild, - groupValue:getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] + visualDensity: + VisualDensity.compact, + value: + TranslationBase.of(context) + .mild, + groupValue: getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] .severity!), onChanged: (value) { - widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .reactionSelection = getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .severity!); + widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .reactionSelection = + getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .severity!); setState(() {}); }, ), AppText( - TranslationBase.of(context).mild, + TranslationBase.of(context) + .mild, fontSize: 10, ), ], ))), - Expanded( - child: ListTile( - title: Row( + Expanded( + child: ListTile( + title: Row( children: [ Radio( activeColor: Color(0xffD02127), materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, + MaterialTapTargetSize + .shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: TranslationBase.of(context).moderate, - groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] + visualDensity: + VisualDensity.compact, + value: + TranslationBase.of(context) + .moderate, + groupValue: getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] .severity!), onChanged: (value) { - widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .severity!); + widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .reactionSelection = + getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .severity!); setState(() {}); }, ), AppText( - TranslationBase.of(context).moderate, + TranslationBase.of(context) + .moderate, fontSize: 10, ), ], ))), - Expanded( - child: ListTile( - title: Row( + Expanded( + child: ListTile( + title: Row( children: [ Radio( activeColor: Color(0xffD02127), materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, + MaterialTapTargetSize + .shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: TranslationBase.of(context).severe, - groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] + visualDensity: + VisualDensity.compact, + value: + TranslationBase.of(context) + .severe, + groupValue: getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] .severity!), onChanged: (value) { - widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index] - .severity!); + widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .reactionSelection = + getSeverityByID(widget + .editSelectedAllergy! + .patientsAllergyReactionsDTOs![ + index] + .severity!); setState(() {}); }, ), AppText( - TranslationBase.of(context).severe, + TranslationBase.of(context) + .severe, fontSize: 10, ), ], ))) - ], - ) - ], - ), - Divider(), - ]); - }, - ))) - ], - ), - bottomSheet: Container( - height: 90, - color: Colors.white, - margin: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).cancel, - vPadding: 8, - hPadding: 8, - color: Color(0xffEAEAEA), - fontColor: Colors.black, - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: Container( - child: AppButton( - loading: loading, - title: TranslationBase.of(context).save, - vPadding: 8, - hPadding: 8, - color: AppGlobal.appGreenColor, - fontColor: Colors.white, - onPressed: () { - if(widget.mySelectedAllergy ==null) { + ], + ) + ], + ), + Divider(), + ]); + }, + ))), - editAllergy(); - } - else{ + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: AppTextFieldCustom( - addAllergy(); + hintText: + TranslationBase.of(context).remarks, + controller: remark, + maxLines: 4, + minLines: 4, + hasBorder: true, + inputType: TextInputType.multiline, - } - }, - ), - ), - ), + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, + )), + SizedBox(height: 90,) ], - )) + ), + bottomSheet: Container( + height: 70, + color: Colors.white, + margin: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + vPadding: 8, + hPadding: 8, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + loading: loading, + title: TranslationBase.of(context).save, + vPadding: 8, + hPadding: 8, + color: AppGlobal.appGreenColor, + fontColor: Colors.white, + onPressed: () { + if (widget.isEdit == true) { + editAllergy(); + } else { + addAllergy(); + } + }, + ), + ), + ), + ], + )) - // CustomBottomSheetContainer( - // buttonColor: Color(0xff359846), - // fontColor: Colors.white, - // label: TranslationBase.of(context).next, - // onTap: () { - // widget.addReactionFun(widget - // .mySelectedAllergy - // ); - // }, - // ) + // CustomBottomSheetContainer( + // buttonColor: Color(0xff359846), + // fontColor: Colors.white, + // label: TranslationBase.of(context).next, + // onTap: () { + // widget.addReactionFun(widget + // .mySelectedAllergy + // ); + // }, + // ) - )); + )); } - getSeverityByID(int id){ - Map severity={ - 1:TranslationBase.of(context).mild, - 2:TranslationBase.of(context).moderate, - 3:TranslationBase.of(context).severe - }; + getSeverityByID(int id) { + Map severity = { + 1: TranslationBase.of(context).mild, + 2: TranslationBase.of(context).moderate, + 3: TranslationBase.of(context).severe + }; return severity[id]; } - addAllergy() async{ - setLoader(true); - AllergiesListVidaPlus request = widget - .mySelectedAllergy!; - request.allergyReactionDTOs = widget - .mySelectedAllergy!.allergyReactionDTOs!.where((i) => i.isSelected!).toList(); - await widget.model!.addAllergies(request, widget.patientInfo); - setLoader(false); - Navigator.of(context).pop(); + + addAllergy() async { + setLoader(true); + AllergiesListVidaPlus request = widget.mySelectedAllergy!; + request.remark = remark.text; + request.allergyReactionDTOs = widget.mySelectedAllergy!.allergyReactionDTOs! + .where((i) => i.isSelected!) + .toList(); + await widget.model!.addAllergies(request, widget.patientInfo); + await widget.model!.getAllergiesVidaPlus(widget.patientInfo); + setLoader(false); + Navigator.of(context).pop(); } - editAllergy(){ + editAllergy() async{ + setLoader(true); + PatientAllergiesVidaPlus request = widget.editSelectedAllergy!; + request.remark = remark.text; + request.patientsAllergyReactionsDTOs =[]; + widget.mySelectedAllergy!.allergyReactionDTOs! + .forEach((i){ + if(i.isSelected!){ + request.patientsAllergyReactionsDTOs!.add(PatientsAllergyReactionsDTOs( + pomrId: i.pomrid, + patientID:i.patientID, + hospitalGroupID:i.hospitalGroupID, + hospitalID:i.hospitalID, + isActive:i.isActive, + allergyReactionMappingID:i.allergyReactionMappingID, + allergyReactionID:i.allergyReactionID, + allergyReactionName: i.allergyReactionName, + severity:i.severity, + + )); + } + }); + + await widget.model!.updateAllergies(request, widget.patientInfo); + setLoader(false); + Navigator.of(context).pop(); } + setLoader(bool value) { loading = value; - setState(() { - - }); + setState(() {}); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart index ee4a3933..11f79794 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart @@ -102,8 +102,9 @@ class _UpdateAllergiesWidgetState extends State { fontWeight: FontWeight.w800, letterSpacing: -0.48, ), - selectedAllergy - .patientsAllergyReactionsDTOs!.isNotEmpty + selectedAllergy.patientsAllergyReactionsDTOs! + .isNotEmpty && + selectedAllergy.isActivePatientsAllergy! ? ListView( shrinkWrap: true, children: selectedAllergy @@ -114,6 +115,9 @@ class _UpdateAllergiesWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 5, + ), Row( children: [ AppText( @@ -128,7 +132,8 @@ class _UpdateAllergiesWidgetState extends State { reaction.severity! - 1] .name, - color:getColor(reaction.severity!), + color: getColor( + reaction.severity!), fontSize: 10, fontWeight: FontWeight.w600, letterSpacing: -0.48, @@ -138,49 +143,70 @@ class _UpdateAllergiesWidgetState extends State { ], )) .toList()) - : AppText("----"), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - SizedBox( - height: 10, - ), - TextButton.icon( - onPressed: () { - Navigator.push( - context, - FadePage( - page: - ReactionsSelectionAllergiesWidget( - model: model, - mySelectedAllergy: null, - editSelectedAllergy: selectedAllergy!, - patientInfo: widget.patientInfo, - ))); - }, - icon: SvgPicture.asset( - "assets/images/svgs/edit-icon.svg", - height: 16, - ), - label: AppText( - TranslationBase.of(context).edit, - fontSize: 12, - ), - ), - TextButton.icon( - onPressed: () { - resolveAllergy(model, selectedAllergy); - }, - icon: SvgPicture.asset( - "assets/images/svgs/resolve.svg", - height: 18, - ), - label: AppText( - TranslationBase.of(context).resolve, - fontSize: 12, - color: Color(0xff359846))) - ], - ) + : selectedAllergy.isActivePatientsAllergy! + ? AppText("----") + : AppText( + TranslationBase.of(context).resolved, + color: Colors.lightBlue, + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + selectedAllergy.isActivePatientsAllergy! && + selectedAllergy.allergyID! != 0 + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton.icon( + onPressed: () { + editAllergy(selectedAllergy, model); + }, + icon: SvgPicture.asset( + "assets/images/svgs/edit-icon.svg", + height: 16, + ), + label: AppText( + TranslationBase.of(context).edit, + fontSize: 12, + ), + ), + TextButton.icon( + onPressed: () { + resolveAllergy( + model, selectedAllergy); + }, + icon: SvgPicture.asset( + "assets/images/svgs/resolve.svg", + height: 18, + ), + label: AppText( + TranslationBase.of(context).resolve, + fontSize: 12, + color: Color(0xff359846))) + ], + ) + : selectedAllergy.allergyID! != 0 + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton.icon( + onPressed: () { + activateAllergy( + model, selectedAllergy); + }, + icon: SvgPicture.asset( + "assets/images/svgs/resolve.svg", + height: 18, + color: Color(0xffD02127), + ), + label: AppText( + TranslationBase.of(context) + .activate, + fontSize: 12, + color: Color(0xffD02127))) + ], + ) + : SizedBox() ], ); }).toList()), @@ -189,19 +215,58 @@ class _UpdateAllergiesWidgetState extends State { } resolveAllergy( - SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async{ + SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async { GifLoaderDialogUtils.showMyDialog(context); - await model.resolveAllergies(selectedAllergy, widget.patientInfo); + await model.resolveAllergies(selectedAllergy, widget.patientInfo); + await model.getAllergiesVidaPlus(widget.patientInfo); GifLoaderDialogUtils.hideDialog(context); + } + + activateAllergy( + SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.updateAllergies(selectedAllergy, widget.patientInfo); + await model.getAllergiesVidaPlus(widget.patientInfo); + GifLoaderDialogUtils.hideDialog(context); } - Color getColor(int severity){ - Map color ={ - 1:Color(0xff359846) , - 2:Color(0xFFCC9B14), - 3:Color(0xffD02127) + + Color getColor(int severity) { + Map color = { + 1: Color(0xff359846), + 2: Color(0xFFCC9B14), + 3: Color(0xffD02127) }; - return color[severity]; + return color[severity]; + } + + editAllergy( + PatientAllergiesVidaPlus selectedAllergy, SOAPViewModel model) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getEditAllergiesVidaPlus(selectedAllergy.allergyID!); + GifLoaderDialogUtils.hideDialog(context); + markSelected(selectedAllergy, model); + Navigator.push( + context, + FadePage( + page: ReactionsSelectionAllergiesWidget( + model: model, + mySelectedAllergy: model.searchAllergiesVidaPlus[0], + editSelectedAllergy: selectedAllergy!, + patientInfo: widget.patientInfo, + isEdit: true, + ))); + } + + markSelected(PatientAllergiesVidaPlus selectedAllergy, SOAPViewModel model) { + model.searchAllergiesVidaPlus[0].allergyReactionDTOs!.forEach((element) { + selectedAllergy.patientsAllergyReactionsDTOs!.forEach((element2) { + if (element.allergyReactionID == element2.allergyReactionID) { + element.isSelected = true; + element.severity =element2.severity; + } + }); + }); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart index f06810e9..480882e6 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart @@ -1,3 +1,5 @@ +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'; 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'; @@ -9,29 +11,38 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; -class AddChiefComplaint extends StatelessWidget { - final List complaints; +class AddChiefComplaint extends StatefulWidget { + final List complaints; final String selectedType; final String? firstField; final String? secondField; final String? thirdField; final PatiantInformtion patientInfo; - const AddChiefComplaint( - {super.key, - required this.complaints, - required this.selectedType, - this.firstField, - this.secondField, - this.thirdField, - required this.patientInfo - }); + const AddChiefComplaint({super.key, + required this.complaints, + required this.selectedType, + this.firstField, + this.secondField, + this.thirdField, + required this.patientInfo + }); + @override + State createState() => _AddChiefComplaintState(); +} + + +class _AddChiefComplaintState extends State { @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model){ + episodeByChiefComplaint(model); + }, builder: (_, model, w) => AppScaffold( isShowAppBar: true, + appBar: PatientSearchHeader( title: TranslationBase.of(context).addChiefComplaint ), @@ -43,21 +54,29 @@ class AddChiefComplaint extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ ComplaintSelection( - complaints: ['option1' ,'option 2'], - selectedType: selectedType, - firstField: firstField, - secondField: secondField, - thirdField: thirdField, + complaints: widget.complaints, + selectedType: widget.selectedType, + firstField: widget.firstField, + secondField:widget. secondField, + thirdField: widget.thirdField, searchData: model.searchChiefComplaintList, onSearch:(String value){ searchChiefComplaint(model, value); }, onSave: (String chiefComplaint){ - addChiefComplaint(model, chiefComplaint); + addChiefComplaint(model, chiefComplaint, context); }, + onCrossClicked: (GetChiefComplaintVidaPlus chiefComplaint){ + updateChiefComplaint(model, chiefComplaint, context); + }, ), SizedBox(height: 16,), - PreviousCheifComplaints() + PreviousChiefComplaints( + model.episodeByChiefComplaintListVidaPlus, + (List chiefComplaint){ + createCCByEpisode(model, chiefComplaint); + }, + ) ], ), ), @@ -65,13 +84,33 @@ class AddChiefComplaint extends StatelessWidget { ), ); } - addChiefComplaint(SOAPViewModel model, String CC) async{ - - await model.saveChiefComplaint(patientInfo, CC); + addChiefComplaint(SOAPViewModel model, String CC, BuildContext context) async{ + GifLoaderDialogUtils.showMyDialog(context); + await model.saveChiefComplaint(widget.patientInfo, CC); + await model.getChiefComplaint(widget.patientInfo); + GifLoaderDialogUtils.hideDialog(context); } searchChiefComplaint(SOAPViewModel model, String CC) async{ + await model.searchChiefComplaint(widget.patientInfo, CC); + + } + updateChiefComplaint(SOAPViewModel model, GetChiefComplaintVidaPlus cc, BuildContext context) async{ + GifLoaderDialogUtils.showMyDialog(context); + await model.updateChiefComplaint(widget.patientInfo, cc); + await model.getChiefComplaint(widget.patientInfo); + GifLoaderDialogUtils.hideDialog(context); + setState(() { - await model.searchChiefComplaint(patientInfo, CC); + }); + } + episodeByChiefComplaint(SOAPViewModel model) async{ + await model.episodeByChiefComplaint(widget.patientInfo); } + createCCByEpisode(model, List chiefComplaint) async{ + GifLoaderDialogUtils.showMyDialog(context); + await model.createCCByEpisode(widget.patientInfo, chiefComplaint); + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart index 6bb0ddad..3297a83b 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart @@ -1,20 +1,28 @@ +import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.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/subjective/medication/update_medication_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.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/subjective/chief_complaint/widgets/complaint_items.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; class UpdateChiefComplaints extends StatelessWidget { final List complaints; final PatiantInformtion patientInfo; + const UpdateChiefComplaints({Key? key, required this.complaints, required this.patientInfo}) : super(key: key); @override + Widget build(BuildContext context) { + TextEditingController medicationController = TextEditingController(); return BaseView( onModelReady: (model){ WidgetsBinding.instance.addPostFrameCallback((_) { @@ -30,7 +38,7 @@ class UpdateChiefComplaints extends StatelessWidget { context, MaterialPageRoute( builder: (BuildContext context) => AddChiefComplaint( - complaints: complaints, + complaints: model.getChiefComplaintListVidaPlus, patientInfo: patientInfo, selectedType: '', @@ -39,7 +47,7 @@ class UpdateChiefComplaints extends StatelessWidget { thirdField: ''), )); }, - title: "Add Chief Complaint", + title: TranslationBase.of(context).addChiefComplaint, ), SizedBox(height: 16), Container(width: MediaQuery.of(context).size.width, @@ -51,10 +59,12 @@ class UpdateChiefComplaints extends StatelessWidget { itemCount: model.getChiefComplaintListVidaPlus.length, itemBuilder: (_, index) => ComplaintItems( - complaint: model.getChiefComplaintListVidaPlus[index].chiefComplain!, - onCrossClicked: (complaints) {}) + complaint: model.getChiefComplaintListVidaPlus[index]!, + onCrossClicked: (complaints) { - )) + }) + + )), ]), )); @@ -62,4 +72,5 @@ class UpdateChiefComplaints extends StatelessWidget { getChiefComplaints(SOAPViewModel model){ model.getChiefComplaint(patientInfo); } + } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/ComplaintSelection.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/ComplaintSelection.dart index c7d437c2..fa801b4c 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/ComplaintSelection.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/ComplaintSelection.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_complaint_vidaplus.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -9,7 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class ComplaintSelection extends StatefulWidget { - final List complaints; + final List complaints; final String selectedType; final String? firstField; final String? secondField; @@ -17,7 +18,7 @@ class ComplaintSelection extends StatefulWidget { final Function(String cheifComplaint)? onSave; final Function(String value)? onSearch; final List? searchData; - + final Function(GetChiefComplaintVidaPlus)? onCrossClicked; const ComplaintSelection({super.key, required this.complaints, required this.selectedType, @@ -26,7 +27,8 @@ class ComplaintSelection extends StatefulWidget { this.thirdField, this.onSave, this.onSearch, - this.searchData + this.searchData, + this.onCrossClicked }); @override @@ -233,7 +235,7 @@ class _ComplaintSelectionState extends State { }); } - + TextEditingController searchController = TextEditingController(); Widget TextWithSelectedItems(SOAPViewModel model) { return Material( shape: RoundedRectangleBorder( @@ -265,7 +267,7 @@ class _ComplaintSelectionState extends State { TextFormField( autofocus: true, - + controller: searchController, decoration: InputDecoration( hintText: '', border: InputBorder.none, @@ -298,7 +300,9 @@ class _ComplaintSelectionState extends State { var cc = widget.searchData![index].chiefComplain; model.searchChiefComplaintList!.length =0; setState((){}); + widget.onSave!(cc!); + searchController.text =''; })); }))))]), @@ -313,8 +317,11 @@ class _ComplaintSelectionState extends State { itemBuilder: (context, index) { return ComplaintItems( - complaint: widget.complaints[index], - onCrossClicked: (complaints) {}); + complaint: widget.complaints[index]!, + isDeletable:true, + onCrossClicked: (complaints) { + widget.onCrossClicked!(complaints); + }); }) // }), ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart index 814769de..2bda8432 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart @@ -1,32 +1,63 @@ +import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -class ComplaintItems extends StatelessWidget { - final String complaint; - final Function(String) onCrossClicked; +class ComplaintItems extends StatefulWidget { + final GetChiefComplaintVidaPlus complaint; + final Function(GetChiefComplaintVidaPlus) onCrossClicked; + final bool isDeletable; const ComplaintItems( - {super.key, required this.complaint, required this.onCrossClicked}); + {super.key, required this.complaint, required this.onCrossClicked, this.isDeletable = false}); + + @override + State createState() => _ComplaintItemsState(); +} + +class _ComplaintItemsState extends State { @override Widget build(BuildContext context) { - return Container( + return Stack(children: [ Container( padding: const EdgeInsets.all(5.0), width: 120, height: 40, + margin:const EdgeInsets.all(5.0) , alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xffEAEAEA), borderRadius: BorderRadius.circular( 5, )), - child: AppText( - textOverflow: TextOverflow.ellipsis, - complaint, + child:Text( + widget.complaint.chiefComplain!, + style: TextStyle( + overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w400, + height: 1.2, fontSize: 14, - color: Color(0xFF575757), + color: Color(0xFF575757), + ), + maxLines: 1, + softWrap: false, + textAlign: TextAlign.center, + )), + widget.isDeletable ? Positioned( + top:0, + bottom: 0, + right: 10, + child: InkWell( + onTap: () { + widget.onCrossClicked(widget.complaint); + }, + child: Icon( + Icons.close, + size: 18, + color: Color(0xFFD02127), ), - ); + ), + ) :SizedBox() + ],); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.dart index 0e29f6ae..ba83eff7 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.dart @@ -28,13 +28,17 @@ class ListOfComplaintsItem extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText( name, fontWeight: FontWeight.w600, fontSize: 16, textAlign: TextAlign.start, color: Color(0xFF2E303A), + textOverflow: TextOverflow.ellipsis, + ), + SizedBox( height: 4, ), @@ -50,15 +54,23 @@ class ListOfComplaintsItem extends StatelessWidget { SizedBox( width: 4, ), - AppText( + Container( + width: MediaQuery.of(context).size.width * 0.32, + + child: AppText( createdBy, fontWeight: FontWeight.w400, - fontSize: 15, + fontSize: 12, textAlign: TextAlign.start, + textOverflow: TextOverflow.ellipsis, color: Color(0xFF2E303A), ), + ) ], ), + SizedBox( + height: 5, + ), Row( children: [ AppText( @@ -71,13 +83,19 @@ class ListOfComplaintsItem extends StatelessWidget { SizedBox( width: 4, ), - AppText( + Container( + width: MediaQuery.of(context).size.width * 0.32, + + child:AppText( createdAt, fontWeight: FontWeight.w400, textAlign: TextAlign.start, - fontSize: 15, + fontSize: 12, + textOverflow: TextOverflow.ellipsis, color: Color(0xFF2E303A), - ), + allowExpand: false, + maxLines: 1, + )), ], ) ], diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/previous_cheif_complaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/previous_cheif_complaints.dart index 06443a35..4662dd90 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/previous_cheif_complaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/previous_cheif_complaints.dart @@ -1,11 +1,16 @@ +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'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.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:quiver/time.dart'; -import '../../../../../../../widgets/shared/app_texts_widget.dart'; -class PreviousCheifComplaints extends StatelessWidget { - const PreviousCheifComplaints({super.key}); +class PreviousChiefComplaints extends StatelessWidget { + final List complaints; + final Function(List)? onSendClicked; + PreviousChiefComplaints(this.complaints,this.onSendClicked, {super.key,}); @override Widget build(BuildContext context) { @@ -18,7 +23,7 @@ class PreviousCheifComplaints extends StatelessWidget { )), color: Colors.white, child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -41,22 +46,46 @@ class PreviousCheifComplaints extends StatelessWidget { color: Color(0xFF575757), ), SizedBox( - height: 16, + height: 10, ), Flexible( child: ListView.separated( shrinkWrap: true, - itemCount: 2, - separatorBuilder: (context, index) => Divider(), + separatorBuilder: (context, index2) => Divider(), + itemCount: complaints.length, itemBuilder: (context, index) { - return ListOfComplaintsItem( - name: "name", - createdBy: "createdBy", - createdAt: "createdAt", - onSendClick: () {}); - })) + return complaints[index].patientPomrs!.isNotEmpty ? ListOfComplaintsItem( + name: getChildValue(complaints[index].patientPomrs!, 1), + createdBy: getChildValue(complaints[index].patientPomrs!,2), + createdAt: getChildValue(complaints[index].patientPomrs!, 3), + onSendClick: () { + onSendClicked!(complaints[index].patientPomrs!); + }) :SizedBox(); + }) + + + + + + ) ], ), )); } +String getChildValue(List? patientPomrs, int key) { + List value = []; + patientPomrs!.forEach((element) { + if(key ==1) { + element.chiefComplains!.forEach((element2) { + value.add(element2.chiefComplain!); + }); + }else if(key ==2) { + value.add(element.doctorName!); + }else { + value.add(element.createdOn!); + } + }); + + return value.join(" "); +} } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/add_medication.dart new file mode 100644 index 00000000..9cf67d16 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/add_medication.dart @@ -0,0 +1,454 @@ +// ignore: must_be_immutable +import 'package:autocomplete_textfield/autocomplete_textfield.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/home_medication_vp/GetSearchCurrentMedication.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_allergy.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.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/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.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/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/medication/dropdown_popup.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 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +// ignore: must_be_immutable +class AddMedication extends StatefulWidget { + final Function() addMedicationFun; + final PatiantInformtion? patientInfo; + AddMedication({Key? key, required this.addMedicationFun, this.patientInfo}) : super(key: key); + + @override + _AddMedicationState createState() => _AddMedicationState(); +} + +class _AddMedicationState extends State { + int? _selectedMedicationStrength; + int? _selectedMedicationRoute; + int? _selectedMedicationFrequency; + TextEditingController medicationController = TextEditingController(); + + TextEditingController doseController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + GetSearchCurrentMedication? _selectedMedication; + TextEditingController remark = TextEditingController(); + bool isVisible = false; + GlobalKey> key = + GlobalKey>(); + bool isFormSubmitted = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) async { + // model.onAddMedicationStart(); + }, + builder: (_, model, w) => AppScaffold( + backgroundColor: Colors.white, + baseViewModel: model, + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).addMedication, + ), + body: Container( + padding: EdgeInsets.all(15), + child: SingleChildScrollView( + child: Column( + children: [ + + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + controller: medicationController, + hintText: + TranslationBase.of(context).searchMedicineNameHere, + minLines: 1, + maxLines: 1, + isTextFieldHasSuffix: true, + validationError: isFormSubmitted && medicationController.text.isEmpty ? TranslationBase.of(context).emptyMessage : null, + suffixIcon: IconButton( + icon: model.state == ViewState.BusyLocal + ? SizedBox( + child: CircularProgressIndicator( + strokeWidth: 2, + ), + height: 10, + width: 10, + ) + : Icon( + Icons.search, + color: Colors.grey.shade600, + ), + onPressed: () { + searchMedication(model); + }, + ), + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + // ), + // ), + model.getMedicationListVP!.isNotEmpty & isVisible + ? RoundedContainer( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.60, + child: model.state == ViewState.Idle + ? ListView.builder( + itemCount: model.getMedicationListVP!.length, + itemBuilder: (context, index) { + return ListTile( + onTap: () { + selectMedication(model, index); + }, + title: AppText( + model.getMedicationListVP![index] + .formularyName!, + )); + }, + ) + : SizedBox()) + : SizedBox(), + + if (_selectedMedication != null) + Column( + children: [ + SizedBox( + height: 3, + ), + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: AppText( + _selectedMedication!.formularyName!, + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: true, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly + ], + // onClick: model.medicationDoseTimeList != null + // ? () { + // MasterKeyDailog dialog = MasterKeyDailog( + // list: model.medicationDoseTimeList, + // okText: TranslationBase.of(context).ok, + // // selectedValue: _selectedMedicationDose, + // okFunction: (selectedValue) { + // setState(() { + // _selectedMedicationDose = selectedValue; + // + // doseController.text = projectViewModel.isArabic ? _selectedMedicationDose!.nameAr! : _selectedMedicationDose!.nameEn!; + // }); + // }, + // ); + // showDialog( + // barrierDismissible: false, + // context: context, + // builder: (BuildContext context) { + // return dialog; + // }, + // ); + // } + // : null, + hintText: TranslationBase.of(context).doseDetails, + maxLines: 1, + minLines: 1, + + isTextFieldHasSuffix: false, + controller: doseController, + validationError: isFormSubmitted && doseController.text.isEmpty ? TranslationBase.of(context).emptyMessage : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.getSearchCurrentMedicationDetails! + .isNotEmpty && + model.getSearchCurrentMedicationDetails![0] + .itemStrengthDetailsDto != + null + ? () { + + DropdownPopup dialog = DropdownPopup( + medicationDetails: + model.getSearchCurrentMedicationDetails![0], + isStrength: true, + okText: TranslationBase.of(context).ok, + selectedID:model.getSearchCurrentMedicationDetails![0] + .itemStrengthDetailsDto![0] + .strengthId!, + okFunction: (int id, String value) { + _selectedMedicationStrength = id; + strengthController.text = value; + setState(() {}); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).strength, + maxLines: 1, + minLines: 1, + controller: strengthController, + // validationError: isFormSubmitted && _selectedMedicationStrength == null ? TranslationBase.of(context).emptyMessage : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + + onClick: model.getSearchCurrentMedicationDetails! + .isNotEmpty && + model.getSearchCurrentMedicationDetails![0] + .genericItemRouteDetailsEntity != + null + ? () { + + DropdownPopup dialog = DropdownPopup( + medicationDetails: + model.getSearchCurrentMedicationDetails![0], + okText: TranslationBase.of(context).ok, + isRoute: true, + selectedID: model + .getSearchCurrentMedicationDetails![0] + .genericItemRouteDetailsEntity![0] + .routeId!, + // selectedText: , + okFunction: (int id, String value) { + setState(() { + _selectedMedicationRoute = id; + routeController.text = value; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).route, + maxLines: 1, + minLines: 1, + controller: routeController, + // validationError: isFormSubmitted && _selectedMedicationRoute == null ? TranslationBase.of(context).emptyMessage : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 10, + ), + + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + + onClick: model.getSearchCurrentMedicationDetails! + .isNotEmpty && + model.getSearchCurrentMedicationDetails![0] + .genericItemFrequencyDetailsEntity != + null + ? () { + + DropdownPopup dialog = DropdownPopup( + medicationDetails: + model.getSearchCurrentMedicationDetails![0], + okText: TranslationBase.of(context).ok, + selectedID: model + .getSearchCurrentMedicationDetails![0] + .genericItemFrequencyDetailsEntity![0] + .frequencyId! , + okFunction: (int id, String value) { + _selectedMedicationFrequency = id; + frequencyController.text = value; + setState(() {}); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).frequency, + enabled: false, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: frequencyController, + + // validationError: isFormSubmitted && _selectedMedicationFrequency == null ? TranslationBase.of(context).emptyMessage : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remark, + maxLines: 4, + minLines: 4, + hasBorder: true, + inputType: TextInputType.multiline, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ) + ], + ), + ), + ), + bottomSheet: + CustomBottomSheetContainer( + label: TranslationBase.of(context).addMedication, + onTap: () { + if(medicationController.text.isNotEmpty && doseController.text.isNotEmpty){ + addMedication(model); + }else { + isFormSubmitted = true; + setState(() { + + }); + } + }, + )), + ); + } + + searchMedication(model) async { + await model.searchCurrentMedication(medicationController.text); + isVisible = true; + setState(() {}); + } + + selectMedication(SOAPViewModel model, int index) { + _selectedMedication = model.getMedicationListVP![index]; + medicationController.text = + model.getMedicationListVP![index].formularyName!; + isVisible = false; + getOtherDetails(model, model.getMedicationListVP![index]); + setState(() {}); + } + + getOtherDetails( + SOAPViewModel model, GetSearchCurrentMedication selectMedicine) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getCurrentMedicationDetails(selectMedicine.genericFormularyId!); + + GifLoaderDialogUtils.hideDialog(context); + setDefaultValues(model); + } + setDefaultValues(SOAPViewModel model){ + _selectedMedicationStrength = model.getSearchCurrentMedicationDetails![0] + .itemStrengthDetailsDto![0] + .strengthId!; + strengthController.text = model + .getSearchCurrentMedicationDetails![0] + .itemStrengthDetailsDto![0] + .strength!; + + _selectedMedicationRoute = model + .getSearchCurrentMedicationDetails![0] + .genericItemRouteDetailsEntity![0] + .routeId!; + routeController.text= model + .getSearchCurrentMedicationDetails![0] + .genericItemRouteDetailsEntity![0] + .route!; + _selectedMedicationFrequency = model + .getSearchCurrentMedicationDetails![0] + .genericItemFrequencyDetailsEntity![0] + .frequencyId!; + frequencyController.text= model + .getSearchCurrentMedicationDetails![0] + .genericItemFrequencyDetailsEntity![0] + .frequency!; + + } + + addMedication(SOAPViewModel model) async{ + Map request ={ + + "doseQuantity": doseController.text, + "frequencyId": _selectedMedicationFrequency, + "frequencyString":frequencyController.text, + "strengthId": _selectedMedicationStrength, + "strengthString": strengthController.text, + "routeId": _selectedMedicationRoute, + "routeString": routeController.text, + "remarks": remark.text, + "sentence": medicationController.text, + "formularyName": _selectedMedication!.formularyName!, + "genericFormularyId": _selectedMedication!.genericFormularyId!, + + }; + GifLoaderDialogUtils.showMyDialog(context); + + await model.addCurrentMedication(request, widget.patientInfo!); + await model.getHomeMedication(widget.patientInfo!); + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/dropdown_popup.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/dropdown_popup.dart new file mode 100644 index 00000000..07f7a617 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/dropdown_popup.dart @@ -0,0 +1,150 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.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:provider/provider.dart'; + + +class DropdownPopup extends StatefulWidget { + final GetSearchCurrentMedicationDetails? medicationDetails; + bool isStrength; + bool isRoute; + bool isFrequency; + int? selectedID; + String? selectedText; + final okText; + final Function(int selectedID, String selectedText)? okFunction; + DropdownPopup({this.medicationDetails, this.isStrength = false, this.okFunction, this.okText, this.selectedID, this.isRoute =false, this.isFrequency =false, this.selectedText }); + + @override + _DropdownPopupState createState() => _DropdownPopupState(); +} + +class _DropdownPopupState extends State { + @override + void initState() { + super.initState(); + + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return showAlertDialog(context, projectViewModel); + } + + showAlertDialog(BuildContext context, ProjectViewModel projectViewModel) { + // set up the buttons + Widget cancelButton = ElevatedButton( + child: AppText( + TranslationBase.of(context).cancel, + color: Colors.white, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3.5 : 5), + ), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = ElevatedButton( + child: AppText( + this.widget.okText, + color: Colors.white, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3.5 : 5), + ), + onPressed: () { + + // this.widget.okFunction(selectedValue); + Navigator.of(context).pop(); + }); +// set up the AlertDialog + AlertDialog alert = AlertDialog( + // title: Text(widget.title), + content: createDialogList(projectViewModel), + actions: [ + cancelButton, + continueButton, + ], + ); + return alert; + } + + Widget createDialogList(ProjectViewModel projectViewModel) { + return Container( + height: MediaQuery.of(context).size.height * 0.5, + child: SingleChildScrollView( + child: widget.isStrength ? Column( + children: [ + + ...widget.medicationDetails!.itemStrengthDetailsDto! + .map((item) => RadioListTile( + title: AppText( + '${item.strength}', + ), + groupValue: widget.selectedID!.toString(), + value: item.strengthId.toString(), + activeColor: Colors.blue.shade700, + selected: item.strengthId.toString() == widget.selectedID!.toString(), + onChanged: (val) { + widget.selectedID = item.strengthId; + widget.selectedText = item.strength; + widget.okFunction!( item.strengthId!, item.strength!); + + }, + )) + .toList() + ], + ) : + + widget.isRoute ? Column( children: [ + + ...widget.medicationDetails!.genericItemRouteDetailsEntity! + .map((item) => RadioListTile( + title: AppText( + '${item.route}', + ), + groupValue: widget.selectedID!.toString(), + value: item.routeId.toString(), + activeColor: Colors.blue.shade700, + selected: item.routeId.toString() == widget.selectedID!.toString(), + onChanged: (val) { + widget.selectedID = item.routeId; + widget.selectedText = item.route; + widget.okFunction!( item.routeId!, item.route!); + + }, + )) + .toList() + ], + ) : Column( children: [ + + ...widget.medicationDetails!.genericItemFrequencyDetailsEntity! + .map((item) => RadioListTile( + title: AppText( + '${item.frequency}', + ), + groupValue: widget.selectedID!.toString(), + value: item.frequencyId.toString(), + activeColor: Colors.blue.shade700, + selected: item.frequencyId.toString() == widget.selectedID!.toString() , + onChanged: (val) { + widget.selectedID = item.frequencyId; + widget.selectedText = item.frequency; + widget.okFunction!( item.frequencyId!, item.frequency!); + setState(() { + + }); + }, + )) + .toList() + ], + ), + ), + ); + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/update_medication_widget.dart new file mode 100644 index 00000000..91cfd08c --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/medication/update_medication_widget.dart @@ -0,0 +1,109 @@ +import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetHomeMedication.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.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/shared_soap_widgets/SOAP_open_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/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.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'; +import 'package:flutter_svg/flutter_svg.dart'; + +import 'add_medication.dart'; + +class UpdateMedicationWidget extends StatefulWidget { + final PatiantInformtion patientInfo; + UpdateMedicationWidget({ + Key? key, + required this.patientInfo, + }); + + @override + _UpdateMedicationWidgetState createState() => _UpdateMedicationWidgetState(); +} + +class _UpdateMedicationWidgetState extends State { + TextEditingController medicationController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + model.getHomeMedication(widget.patientInfo); + }, + builder: (_, model, w) => + Column( + children: [ + AddSoapItem( + title: "${TranslationBase + .of(context) + .addMedication}", + onAddSoapItemClicked: () { + Navigator.push( + context, + FadePage( + page: AddMedication( + patientInfo: widget.patientInfo, + addMedicationFun:(){ + + } + ) + + )); + // openMedicationList(context); + }, + ), + SizedBox( + height: 20, + ), + ListView( + padding: EdgeInsets.all(10), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + children: model.getHomeMedicationList!.map((medication) { + return ListTile( + trailing: TextButton.icon( + onPressed: () { + removeMedication(medication, model); + }, + icon: SvgPicture.asset( + "assets/images/svgs/delete.svg", + height: 18, + color: Color(0xffD02127), + ), + label: AppText( + TranslationBase.of(context) + .remove, + fontSize: 12, + color: Color(0xffD02127))), + title: + + AppText( + medication.prescribedItemName!, + fontSize: 12, + fontWeight: FontWeight.w800, + letterSpacing: -0.48, + ), + subtitle: AppText( + '${medication.doseQuantity!} - ${ medication.frequencyString!}', + fontSize: 10, + + ), + ); + }).toList()), + + + ] + )); + } + removeMedication(GetHomeMedicationList medication, SOAPViewModel model) async{ + GifLoaderDialogUtils.showMyDialog(context); + await model.removeCurrentMedication(medication.id!); + await model.getHomeMedication(widget.patientInfo); + GifLoaderDialogUtils.hideDialog(context); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart index a0333151..6938ec87 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart @@ -127,9 +127,14 @@ class UpdatePresentIllnessState extends State { maxLines: 25, minLines: 3, hasBorder: true, + isTextFieldHasSuffix: true, onClick: () {}, onChanged: (value) {}, onFieldSubmitted: () {}, + + suffixIcon: IconButton(icon:Icon(Icons.save_as_outlined, color: Colors.red, size: 25,), onPressed: (){ + saveHopi(model); + },), ), ])), @@ -174,9 +179,12 @@ class UpdatePresentIllnessState extends State { maxLines: 25, minLines: 3, hasBorder: true, + isTextFieldHasSuffix: true, onClick: () {}, onChanged: (value) {}, - onFieldSubmitted: () {}, + onFieldSubmitted: () {}, suffixIcon: IconButton(icon:Icon(Icons.save_as_outlined, color: Colors.red, size: 25,), onPressed: (){ + saveHopi(model); + },), ), ], ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart index 54b51c41..f496ec09 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart @@ -9,12 +9,13 @@ import 'package:doctor_app_flutter/screens/base/base_view.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/soap_utils.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/medication/update_medication_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.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/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import '../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; @@ -42,6 +43,7 @@ class _UpdateSubjectivePageVidaPlusState bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; + bool isMedicationExpand =false; TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); TextEditingController medicationController = TextEditingController(); @@ -50,73 +52,73 @@ class _UpdateSubjectivePageVidaPlusState List myAllergiesList = []; List myHistoryList = []; - getHistory(SOAPViewModel model) async { - widget.changeLoadingState(true); - if (model.patientHistoryList.isNotEmpty) { - model.patientHistoryList.forEach((element) { - if (element.historyType == - MasterKeysService.HistoryFamily.getMasterKeyService()) { - MasterKeyModel? history = model.getOneMasterKey( - masterKeys: MasterKeysService.HistoryFamily, - id: element.historyId, - ); - if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils - .generateMySelectedHistory(history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); - myHistoryList.add(mySelectedHistory); - } - } - if (element.historyType == - MasterKeysService.HistoryMedical.getMasterKeyService()) { - MasterKeyModel? history = model.getOneMasterKey( - masterKeys: MasterKeysService.HistoryMedical, - id: element.historyId, - ); - if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils - .generateMySelectedHistory(history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); - myHistoryList.add(mySelectedHistory); - } - } - if (element.historyType == - MasterKeysService.HistorySports.getMasterKeyService()) { - MasterKeyModel? history = model.getOneMasterKey( - masterKeys: MasterKeysService.HistorySports, - id: element.historyId, - ); - if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils - .generateMySelectedHistory(history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); - myHistoryList.add(mySelectedHistory); - } - } - if (element.historyType == - MasterKeysService.HistorySurgical.getMasterKeyService()) { - MasterKeyModel? history = model.getOneMasterKey( - masterKeys: MasterKeysService.HistorySurgical, - id: element.historyId, - ); - if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils - .generateMySelectedHistory(history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); - myHistoryList.add(mySelectedHistory); - } - } - }); - } - } + // getHistory(SOAPViewModel model) async { + // widget.changeLoadingState(true); + // if (model.patientHistoryList.isNotEmpty) { + // model.patientHistoryList.forEach((element) { + // if (element.historyType == + // MasterKeysService.HistoryFamily.getMasterKeyService()) { + // MasterKeyModel? history = model.getOneMasterKey( + // masterKeys: MasterKeysService.HistoryFamily, + // id: element.historyId, + // ); + // if (history != null) { + // MySelectedHistory mySelectedHistory = SoapUtils + // .generateMySelectedHistory(history: history, + // isChecked: element.isChecked, + // remark: element.remarks, + // isLocal: false); + // myHistoryList.add(mySelectedHistory); + // } + // } + // if (element.historyType == + // MasterKeysService.HistoryMedical.getMasterKeyService()) { + // MasterKeyModel? history = model.getOneMasterKey( + // masterKeys: MasterKeysService.HistoryMedical, + // id: element.historyId, + // ); + // if (history != null) { + // MySelectedHistory mySelectedHistory = SoapUtils + // .generateMySelectedHistory(history: history, + // isChecked: element.isChecked, + // remark: element.remarks, + // isLocal: false); + // myHistoryList.add(mySelectedHistory); + // } + // } + // if (element.historyType == + // MasterKeysService.HistorySports.getMasterKeyService()) { + // MasterKeyModel? history = model.getOneMasterKey( + // masterKeys: MasterKeysService.HistorySports, + // id: element.historyId, + // ); + // if (history != null) { + // MySelectedHistory mySelectedHistory = SoapUtils + // .generateMySelectedHistory(history: history, + // isChecked: element.isChecked, + // remark: element.remarks, + // isLocal: false); + // myHistoryList.add(mySelectedHistory); + // } + // } + // if (element.historyType == + // MasterKeysService.HistorySurgical.getMasterKeyService()) { + // MasterKeyModel? history = model.getOneMasterKey( + // masterKeys: MasterKeysService.HistorySurgical, + // id: element.historyId, + // ); + // if (history != null) { + // MySelectedHistory mySelectedHistory = SoapUtils + // .generateMySelectedHistory(history: history, + // isChecked: element.isChecked, + // remark: element.remarks, + // isLocal: false); + // myHistoryList.add(mySelectedHistory); + // } + // } + // }); + // } + // } getAllergies(SOAPViewModel model) async { await model.getAllergiesVidaPlus(widget.patientInfo); @@ -146,31 +148,34 @@ class _UpdateSubjectivePageVidaPlusState Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - myAllergiesList.clear(); - myHistoryList.clear(); - model.setSubjectiveCallBack(this); - await model.onUpdateSubjectStepStart(widget.patientInfo); + WidgetsBinding.instance.addPostFrameCallback((_) async { + myAllergiesList.clear(); + myHistoryList.clear(); + model.setSubjectiveCallBack(this); + // await model.onUpdateSubjectStepStart(widget.patientInfo); - if (model.patientChiefComplaintList.isNotEmpty) { - isChiefExpand = true; - complaintsController.text = Utils.parseHtmlString( - model.patientChiefComplaintList[0].chiefComplaint!); - illnessController.text = model.patientChiefComplaintList[0].hopi!; - medicationController.text = - model.patientChiefComplaintList[0].currentMedication != null - ? !(model.patientChiefComplaintList[0].currentMedication!) - .isNotEmpty - ? model.patientChiefComplaintList[0].currentMedication! + '\n \n' - : model.patientChiefComplaintList[0].currentMedication! - : ""; - } - if (widget.patientInfo.admissionNo == null) { - // await getHistory(model); + if (model.patientChiefComplaintList.isNotEmpty) { + isChiefExpand = true; + complaintsController.text = Utils.parseHtmlString( + model.patientChiefComplaintList[0].chiefComplaint!); + illnessController.text = model.patientChiefComplaintList[0].hopi!; + medicationController.text = + model.patientChiefComplaintList[0].currentMedication != null + ? !(model.patientChiefComplaintList[0].currentMedication!) + .isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication! + + '\n \n' + : model.patientChiefComplaintList[0].currentMedication! + : ""; + } + if (widget.patientInfo.admissionNo == null) { + // await getHistory(model); - await getAllergies(model); - } + await getAllergies(model); + } - widget.changeLoadingState(false); + widget.changeLoadingState(false); + }); }, builder: (_, model, w) => AppScaffold( @@ -255,6 +260,34 @@ class _UpdateSubjectivePageVidaPlusState ), isExpanded: isAllergiesExpand, ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + ExpandableSOAPWidget( + headerTitle: TranslationBase + .of(context) + .currentMedications, + onTap: () { + setState(() { + isMedicationExpand = !isMedicationExpand; + }); + }, + child: Column(children: [ + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + UpdateMedicationWidget( + patientInfo: widget.patientInfo, + ), + SizedBox( + height: 10, + ), + + ],), + isExpanded: isMedicationExpand, + ), SizedBox( height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), @@ -330,3 +363,26 @@ class _UpdateSubjectivePageVidaPlusState } } + +// +// UpdateMedicationWidget( +// medicationController: medicationController, +// ), +// SizedBox( +// height: 10, +// ), +// AppTextFieldCustom( +// hintText: TranslationBase.of(context).currentMedications, +// controller: medicationController, +// maxLines: 25, +// minLines: 7, +// hasBorder: true, +// inputType: TextInputType.multiline, +// // validationError: medicationControllerError != '' ? medicationControllerError : "", +// onClick: () {}, +// onChanged: (value) {}, +// onFieldSubmitted: () {}, +// ), +// SizedBox( +// height: 10, +// ) \ No newline at end of file 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 4daed7e3..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 @@ -176,8 +176,8 @@ class _UpdateSoapIndexVidaPlusState extends State fontWeight: FontWeight.w600, color: Colors.red[700]!, onPressed: () async { - - model.nextOnSubjectPage(model); + changePageViewIndex(1); + //model.nextOnSubjectPage(model); }, ), ); @@ -219,7 +219,8 @@ class _UpdateSoapIndexVidaPlusState extends State // padding: 10, disabled: model.state == ViewState.BusyLocal, onPressed: () async { - await model.nextOnObjectivePage(model); + changePageViewIndex(2); + // await model.nextOnObjectivePage(model); }, ), ), @@ -255,7 +256,7 @@ class _UpdateSoapIndexVidaPlusState extends State color: Colors.red[700]!, disabled: model.state == ViewState.BusyLocal, onPressed: () async { - model.nextOnAssessmentPage(model); + changePageViewIndex(3); }, ), ), @@ -293,7 +294,8 @@ class _UpdateSoapIndexVidaPlusState extends State color: Colors.red[700]!, disabled: model.progressNoteText.isEmpty, onPressed: () async { - model.nextOnPlanPage(model); + changePageViewIndex(3); + // model.nextOnPlanPage(model); }, ), ), diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 9d952a1e..9589e220 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1950,6 +1950,8 @@ class TranslationBase { 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]!; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e026f689..ab8bc62a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -15,7 +15,7 @@ import maps_launcher import path_provider_foundation import shared_preferences_foundation import speech_to_text_macos -import sqflite_darwin +import sqflite import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {