diff --git a/lib/config/config.dart b/lib/config/config.dart index abd07c03..765874b4 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -25,6 +25,7 @@ const PATIENT_GET_LIST_REFERAL_URL = const PATIENT_GET_CLINIC_BY_PROJECT_URL = "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; +const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics"; //const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo'; @@ -193,6 +194,9 @@ const DRUG_TO_DRUG = const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; const GET_DIAGNOSIS_TYPES = 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; +const GET_DIET_TYPES = 'Services/DoctorApplication.svc/REST/DietTypes'; +const GET_ICD_CODES = 'Services/DoctorApplication.svc/REST/GetICDCodes'; +const POST_ADMISSION_REQUEST = 'Services/DoctorApplication.svc/REST/PostAdmissionRequest'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cbd6436c..697900bf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -425,7 +425,8 @@ const Map> localizedValues = { 'en': "Expected Admission Date", 'ar': 'تاريخ القبول المتوقع' }, - 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, + // 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, + 'isSickLeaveRequired': {'en': "Is Sick Leave Required", 'ar': 'هل الإجازة المرضية مطلوبة'}, 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'حمل المريض'}, 'treatmentLine': { 'en': "Main line of treatment", @@ -458,6 +459,10 @@ const Map> localizedValues = { 'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة' }, + 'postPlans': { + 'en': "POST PLANS", + 'ar': 'خطط البريد' + }, 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, 'durationOfIllness': {'en': "duration Of Illness", 'ar': 'مدة المرض'}, @@ -530,6 +535,7 @@ const Map> localizedValues = { 'condition': {'en': "Condition", 'ar': "الحالة"}, 'id': {'en': "ID", 'ar': "بطاقة هوية"}, 'quantity': {'en': "Quantity", 'ar': "الكمية"}, + 'durDays': {'en': "Dur.(days)", 'ar': "الفترة(أيام)"}, 'codeNo': {'en': "Code #", 'ar': "# الرمز"}, 'covered': {'en': "Covered", 'ar': "مغطى"}, 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, @@ -689,5 +695,8 @@ const Map> localizedValues = { 'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"}, 'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"}, + 'referralResponse': {'en': "Referral Response : ", 'ar': " : استجابة الإحالة"}, + 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, + 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 889be9a7..25e40d3b 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -21,6 +21,7 @@ enum MasterKeysService { MedicationIndications, AdmissionRequestType, + DiagnosisSelectionType, } extension SelectedMasterKeysService on MasterKeysService { @@ -86,6 +87,9 @@ extension SelectedMasterKeysService on MasterKeysService { case MasterKeysService.AdmissionRequestType: return 2019; break; + case MasterKeysService.DiagnosisSelectionType: + return 2024; + break; } } } diff --git a/lib/core/model/admissionRequest/admission-request.dart b/lib/core/model/admissionRequest/admission-request.dart new file mode 100644 index 00000000..1ab5a990 --- /dev/null +++ b/lib/core/model/admissionRequest/admission-request.dart @@ -0,0 +1,200 @@ +class AdmissionRequest { + int patientMRN; + int admitToClinic; + bool isPregnant; + int pregnancyWeeks; + int pregnancyType; + int noOfBabies; + int mrpDoctorID; + String admissionDate; + int expectedDays; + int admissionType; + int admissionLocationID; + int roomCategoryID; + int wardID; + bool isSickLeaveRequired; + String sickLeaveComments; + bool isTransport; + String transportComments; + bool isPhysioAppointmentNeeded; + String physioAppointmentComments; + bool isOPDFollowupAppointmentNeeded; + String opdFollowUpComments; + bool isDietType; + int dietType; + String dietRemarks; + bool isPhysicalActivityModification; + String physicalActivityModificationComments; + int orStatus; + String mainLineOfTreatment; + int estimatedCost; + String elementsForImprovement; + bool isPackagePatient; + String complications; + String otherDepartmentInterventions; + String otherProcedures; + String pastMedicalHistory; + String pastSurgicalHistory; + List admissionRequestDiagnoses; + List admissionRequestProcedures; + int appointmentNo; + int episodeID; + int admissionRequestNo; + + AdmissionRequest( + {this.patientMRN, + this.admitToClinic, + this.isPregnant, + this.pregnancyWeeks = 0, + this.pregnancyType = 0, + this.noOfBabies = 0, + this.mrpDoctorID, + this.admissionDate, + this.expectedDays, + this.admissionType, + this.admissionLocationID = 0, + this.roomCategoryID = 0, + this.wardID, + this.isSickLeaveRequired, + this.sickLeaveComments = "", + this.isTransport = false, + this.transportComments = "", + this.isPhysioAppointmentNeeded = false, + this.physioAppointmentComments = "", + this.isOPDFollowupAppointmentNeeded = false, + this.opdFollowUpComments = "", + this.isDietType, + this.dietType, + this.dietRemarks, + this.isPhysicalActivityModification = false, + this.physicalActivityModificationComments = "", + this.orStatus = 1, + this.mainLineOfTreatment, + this.estimatedCost, + this.elementsForImprovement, + this.isPackagePatient = false, + this.complications = "", + this.otherDepartmentInterventions = "", + this.otherProcedures = "", + this.pastMedicalHistory = "", + this.pastSurgicalHistory = "", + this.admissionRequestDiagnoses, + this.admissionRequestProcedures, + this.appointmentNo, + this.episodeID, + this.admissionRequestNo}); + + AdmissionRequest.fromJson(Map json) { + patientMRN = json['patientMRN']; + admitToClinic = json['admitToClinic']; + isPregnant = json['isPregnant']; + pregnancyWeeks = json['pregnancyWeeks']; + pregnancyType = json['pregnancyType']; + noOfBabies = json['noOfBabies']; + mrpDoctorID = json['mrpDoctorID']; + admissionDate = json['admissionDate']; + expectedDays = json['expectedDays']; + admissionType = json['admissionType']; + admissionLocationID = json['admissionLocationID']; + roomCategoryID = json['roomCategoryID']; + wardID = json['wardID']; + isSickLeaveRequired = json['isSickLeaveRequired']; + sickLeaveComments = json['sickLeaveComments']; + isTransport = json['isTransport']; + transportComments = json['transportComments']; + isPhysioAppointmentNeeded = json['isPhysioAppointmentNeeded']; + physioAppointmentComments = json['physioAppointmentComments']; + isOPDFollowupAppointmentNeeded = json['isOPDFollowupAppointmentNeeded']; + opdFollowUpComments = json['opdFollowUpComments']; + isDietType = json['isDietType']; + dietType = json['dietType']; + dietRemarks = json['dietRemarks']; + isPhysicalActivityModification = json['isPhysicalActivityModification']; + physicalActivityModificationComments = + json['physicalActivityModificationComments']; + orStatus = json['orStatus']; + mainLineOfTreatment = json['mainLineOfTreatment']; + estimatedCost = json['estimatedCost']; + elementsForImprovement = json['elementsForImprovement']; + isPackagePatient = json['isPackagePatient']; + complications = json['complications']; + otherDepartmentInterventions = json['otherDepartmentInterventions']; + otherProcedures = json['otherProcedures']; + pastMedicalHistory = json['pastMedicalHistory']; + pastSurgicalHistory = json['pastSurgicalHistory']; + if (json['admissionRequestDiagnoses'] != null) { + admissionRequestDiagnoses = new List(); + json['admissionRequestDiagnoses'].forEach((v) { + admissionRequestDiagnoses.add(v); + // admissionRequestDiagnoses + // .add(new AdmissionRequestDiagnoses.fromJson(v)); + }); + } + if (json['admissionRequestProcedures'] != null) { + admissionRequestProcedures = new List(); + json['admissionRequestProcedures'].forEach((v) { + admissionRequestProcedures.add(v); + // admissionRequestProcedures + // .add(new AdmissionRequestProcedures.fromJson(v)); + }); + } + appointmentNo = json['appointmentNo']; + episodeID = json['episodeID']; + admissionRequestNo = json['admissionRequestNo']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['admitToClinic'] = this.admitToClinic; + data['isPregnant'] = this.isPregnant; + data['pregnancyWeeks'] = this.pregnancyWeeks; + data['pregnancyType'] = this.pregnancyType; + data['noOfBabies'] = this.noOfBabies; + data['mrpDoctorID'] = this.mrpDoctorID; + data['admissionDate'] = this.admissionDate; + data['expectedDays'] = this.expectedDays; + data['admissionType'] = this.admissionType; + data['admissionLocationID'] = this.admissionLocationID; + data['roomCategoryID'] = this.roomCategoryID; + data['wardID'] = this.wardID; + data['isSickLeaveRequired'] = this.isSickLeaveRequired; + data['sickLeaveComments'] = this.sickLeaveComments; + data['isTransport'] = this.isTransport; + data['transportComments'] = this.transportComments; + data['isPhysioAppointmentNeeded'] = this.isPhysioAppointmentNeeded; + data['physioAppointmentComments'] = this.physioAppointmentComments; + data['isOPDFollowupAppointmentNeeded'] = + this.isOPDFollowupAppointmentNeeded; + data['opdFollowUpComments'] = this.opdFollowUpComments; + data['isDietType'] = this.isDietType; + data['dietType'] = this.dietType; + data['dietRemarks'] = this.dietRemarks; + data['isPhysicalActivityModification'] = + this.isPhysicalActivityModification; + data['physicalActivityModificationComments'] = + this.physicalActivityModificationComments; + data['orStatus'] = this.orStatus; + data['mainLineOfTreatment'] = this.mainLineOfTreatment; + data['estimatedCost'] = this.estimatedCost; + data['elementsForImprovement'] = this.elementsForImprovement; + data['isPackagePatient'] = this.isPackagePatient; + data['complications'] = this.complications; + data['otherDepartmentInterventions'] = this.otherDepartmentInterventions; + data['otherProcedures'] = this.otherProcedures; + data['pastMedicalHistory'] = this.pastMedicalHistory; + data['pastSurgicalHistory'] = this.pastSurgicalHistory; + if (this.admissionRequestDiagnoses != null) { + data['admissionRequestDiagnoses'] = this.admissionRequestDiagnoses; + // this.admissionRequestDiagnoses.map((v) => v.toJson()).toList(); + } + if (this.admissionRequestProcedures != null) { + data['admissionRequestProcedures'] = + this.admissionRequestProcedures.map((v) => v.toJson()).toList(); + } + data['appointmentNo'] = this.appointmentNo; + data['episodeID'] = this.episodeID; + data['admissionRequestNo'] = this.admissionRequestNo; + return data; + } +} diff --git a/lib/core/model/admissionRequest/clinic-model.dart b/lib/core/model/admissionRequest/clinic-model.dart new file mode 100644 index 00000000..05d34645 --- /dev/null +++ b/lib/core/model/admissionRequest/clinic-model.dart @@ -0,0 +1,33 @@ +class Clinic { + int clinicGroupID; + String clinicGroupName; + int clinicID; + String clinicNameArabic; + String clinicNameEnglish; + + Clinic( + {this.clinicGroupID, + this.clinicGroupName, + this.clinicID, + this.clinicNameArabic, + this.clinicNameEnglish}); + + Clinic.fromJson(Map json) { + clinicGroupID = json['clinicGroupID']; + clinicGroupName = json['clinicGroupName']; + clinicID = json['clinicID']; + clinicNameArabic = json['clinicNameArabic']; + clinicNameEnglish = json['clinicNameEnglish']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicGroupID'] = this.clinicGroupID; + data['clinicGroupName'] = this.clinicGroupName; + data['clinicID'] = this.clinicID; + data['clinicNameArabic'] = this.clinicNameArabic; + data['clinicNameEnglish'] = this.clinicNameEnglish; + return data; + } + +} \ No newline at end of file diff --git a/lib/core/model/prescription_model.dart b/lib/core/model/prescription_model.dart index 9fcf3050..49001673 100644 --- a/lib/core/model/prescription_model.dart +++ b/lib/core/model/prescription_model.dart @@ -57,6 +57,8 @@ class EntityList { dynamic status; dynamic stopDate; dynamic uom; + dynamic pharmacistRemarks; + dynamic refill; EntityList( {this.appointmentNo, @@ -87,7 +89,9 @@ class EntityList { this.startDate, this.status, this.stopDate, - this.uom}); + this.uom, + this.pharmacistRemarks, + this.refill}); EntityList.fromJson(Map json) { appointmentNo = json['appointmentNo']; @@ -119,6 +123,8 @@ class EntityList { status = json['status']; stopDate = json['stopDate']; uom = json['uom']; + pharmacistRemarks = json['pharmacistRemarks']; + refill = json['refill']; } Map toJson() { @@ -152,6 +158,8 @@ class EntityList { data['status'] = this.status; data['stopDate'] = this.stopDate; data['uom'] = this.uom; + data['pharmacistRemarks'] = this.pharmacistRemarks; + data['refill'] = this.refill; return data; } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 0c361003..998949d7 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:flutter/cupertino.dart'; @@ -17,6 +18,7 @@ class LookupService extends BaseService { List medicationFrequencyList = []; List medicationDoseTimeList = []; List medicationIndicationsList = []; + List patientAssessmentList = []; List get historyFamilyList => _historyFamilyList; List _historyFamilyList = []; @@ -45,6 +47,7 @@ class LookupService extends BaseService { List listOfTemperatureMethods = []; List listOfSpeciality = []; List listOfAdmissionType = []; + List listOfDiagnosisSelectionTypes = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -191,6 +194,13 @@ class LookupService extends BaseService { listOfAdmissionType.add(v); }); break; + case MasterKeysService.DiagnosisSelectionType: + listOfDiagnosisSelectionTypes.clear(); + entryList.forEach((v) { + // listOfAdmissionType.add(MasterKeyModel.fromJson(v)); + listOfDiagnosisSelectionTypes.add(v); + }); + break; } } } diff --git a/lib/core/service/medicine_service.dart b/lib/core/service/medicine_service.dart index f205dab1..44b380d6 100644 --- a/lib/core/service/medicine_service.dart +++ b/lib/core/service/medicine_service.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; import 'package:doctor_app_flutter/models/pharmacies/pharmacies_List_request_model.dart'; import 'package:doctor_app_flutter/models/pharmacies/pharmacies_items_request_model.dart'; @@ -10,6 +12,8 @@ class MedicineService extends BaseService { get pharmacyItemsList => _pharmacyItemsList; get pharmaciesList => _pharmaciesList; + List patientAssessmentList = []; + PharmaciesItemsRequestModel _itemsRequestModel = PharmaciesItemsRequestModel(); PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); diff --git a/lib/core/service/patient-admission-request-service.dart b/lib/core/service/patient-admission-request-service.dart index dca7b60d..c287c160 100644 --- a/lib/core/service/patient-admission-request-service.dart +++ b/lib/core/service/patient-admission-request-service.dart @@ -1,14 +1,18 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class AdmissionRequestService extends LookupService { + List clinicList = []; List doctorsList = []; List specialityList = []; List wardList = []; List diagnosisTypesList = []; List allergiesLookupList = []; + List dietTypesList = []; + List icdCodes = []; setSpecialityList() { specialityList.clear(); @@ -24,9 +28,12 @@ class AdmissionRequestService extends LookupService { }); } - Future getDoctorsList() async { + Future getDoctorsList(int clinicId) async { hasError = false; + Map body = Map(); + body['ClinicID'] = clinicId; + await baseAppClient.post( PATIENT_GET_DOCTOR_BY_CLINIC_URL, onSuccess: (dynamic response, int statusCode) { @@ -37,6 +44,26 @@ class AdmissionRequestService extends LookupService { hasError = true; super.error = error; }, + body: body, + ); + } + + Future getClinics() async { + hasError = false; + + await baseAppClient.post( + GET_CLINICS, + onSuccess: (dynamic response, int statusCode) { + clinicList.clear(); + if (response['listClinics'] != null && + response['listClinics']['entityList'] != null) { + clinicList.addAll(response['listClinics']['entityList']); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map(), ); } @@ -86,4 +113,74 @@ class AdmissionRequestService extends LookupService { body: Map(), ); } + + Future getDietTypesList() async { + hasError = false; + + await baseAppClient.post( + GET_DIET_TYPES, + onSuccess: (dynamic response, int statusCode) { + dietTypesList.clear(); + if (response['DietTypeList'] != null && + response['DietTypeList']['entityList'] != null) { + response['DietTypeList']['entityList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + dietTypesList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getICDCodes(int patientMrn) async { + hasError = false; + + Map body = Map(); + body['PatientMRN'] = patientMrn; + body['isPatientDiagnosisOnly'] = true; + + await baseAppClient.post( + GET_ICD_CODES, + onSuccess: (dynamic response, int statusCode) { + icdCodes.clear(); + if (response['ICDCodesList'] != null) { + icdCodes.addAll(response['ICDCodesList']); + // response['ICDCodesList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + // icdCodes.add(v); + // }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future makeAdmissionRequest(AdmissionRequest admissionRequest) async{ + hasError = false; + + Map body = Map(); + body['AdmissionRequestViewModel'] = admissionRequest.toJson(); + + await baseAppClient.post( + POST_ADMISSION_REQUEST, + onSuccess: (dynamic response, int statusCode) { + print(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + } diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index f452cfb6..69f8e5e5 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -197,12 +197,13 @@ class PatientReferralService extends LookupService { DoctorProfileModel doctorProfile = await getDoctorProfile(); Map body = Map(); - body['IsAccepted'] = isAccepted; - body['AppointmentNo'] = pendingReferral.sourceAppointmentNo; body['PatientMRN'] = pendingReferral.patientID; + body['AppointmentNo'] = pendingReferral.sourceAppointmentNo; + body['SetupID'] = pendingReferral.sourceSetupID; + body['ProjectID'] = pendingReferral.sourceProjectId; + body['IsAccepted'] = isAccepted; body['PatientName'] = pendingReferral.patientName; body['ReferralResponse'] = pendingReferral.remarksFromSource; - body['SetupID'] = pendingReferral.sourceSetupID; body['DoctorName'] = doctorProfile.doctorName; await baseAppClient.post( diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index e7ecc9f2..429e78a9 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; @@ -14,6 +15,7 @@ class UcafService extends LookupService { VitalSignData patientVitalSigns; List patientAssessmentList = []; List orderProcedureList = []; + PrescriptionModel prescriptionList; Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; @@ -81,6 +83,25 @@ class UcafService extends LookupService { }, body: body); } + Future getPrescription(PatiantInformtion patient) async { + hasError = false; + + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + hasError = false; + prescriptionList = null; + await baseAppClient.post(GET_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + prescriptionList = PrescriptionModel.fromJson(response['PrescriptionList']); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getOrderProcedures(PatiantInformtion patient) async { hasError = false; Map body = Map(); diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index b7f9e80e..4258ee81 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; @@ -30,6 +32,21 @@ class PrescriptionService extends LookupService { PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel(); + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + hasError = false; + await baseAppClient.post(GET_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getAssessmentReqModel.toJson()); + } Future getPrescription({int mrn}) async { _prescriptionReqModel = PrescriptionReqModel(patientMRN: mrn); diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 5b7c2f6a..f57de2b3 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/core/service/medicine_service.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -28,6 +30,8 @@ class MedicineViewModel extends BaseViewModel { _prescriptionService.medicationIndicationsList; get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; + List get patientAssessmentList => + _prescriptionService.patientAssessmentList; List get allMedicationList => _prescriptionService.allMedicationList; @@ -52,6 +56,17 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + setState(ViewState.Busy); + await _prescriptionService.getPatientAssessment(getAssessmentReqModel); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getMedicationStrength() async { setState(ViewState.Busy); await _prescriptionService diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index d427eb67..5b079512 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; import 'package:doctor_app_flutter/core/service/patient-admission-request-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; @@ -12,6 +13,8 @@ class AdmissionRequestViewModel extends BaseViewModel{ AdmissionRequestService _admissionRequestService = locator(); + List get clinicList => _admissionRequestService.clinicList; + List get doctorsList => _admissionRequestService.doctorsList; List get speciality => _admissionRequestService.specialityList; @@ -24,33 +27,44 @@ class AdmissionRequestViewModel extends BaseViewModel{ List get allergiesList => _admissionRequestService.allergiesLookupList; - String selectedLanguage; + List get dietTypesList => _admissionRequestService.dietTypesList; - Future getLanguage() async { - selectedLanguage = await sharedPref.getString(APP_Language); - } + List get icdCodes => _admissionRequestService.icdCodes; + + List get listOfDiagnosisSelectionTypes => _admissionRequestService.listOfDiagnosisSelectionTypes; + + AdmissionRequest admissionRequestData; Future getSpecialityList() async { - await getLanguage(); await getMasterLookup(MasterKeysService.Speciality); if (!_admissionRequestService.hasError) { _admissionRequestService.setSpecialityList(); - await getClinicDoctors(); + await getClinicDoctors(1); } } - Future getClinicDoctors() async { - setState(ViewState.Busy); - await _admissionRequestService.getDoctorsList(); + Future getClinics() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getClinics(); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getClinicDoctors(int clinicId) async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getDoctorsList(clinicId); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } Future getWards() async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _admissionRequestService.getWardList(); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; @@ -60,7 +74,7 @@ class AdmissionRequestViewModel extends BaseViewModel{ } Future getDiagnosis() async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _admissionRequestService.getDiagnosisTypesList(); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; @@ -76,8 +90,38 @@ class AdmissionRequestViewModel extends BaseViewModel{ } } - Future getMasterLookup(MasterKeysService keysService) async { + Future getDietTypes() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getDietTypesList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getICDCodes(int patientMrn) async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getICDCodes(patientMrn); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future makeAdmissionRequest() async{ setState(ViewState.Busy); + await _admissionRequestService.makeAdmissionRequest(admissionRequestData); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getMasterLookup(MasterKeysService keysService) async { + setState(ViewState.BusyLocal); await _admissionRequestService.getMasterLookup(keysService); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index ae8fc96f..f48ef485 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; @@ -29,10 +30,18 @@ class UcafViewModel extends BaseViewModel { List get diagnosisConditions => _ucafService.listOfDiagnosisCondition; + PrescriptionModel get prescriptionList => _ucafService.prescriptionList; + List get orderProcedures => _ucafService.orderProcedureList; String selectedLanguage; + resetDataInFirst(){ + _ucafService.patientAssessmentList = []; + _ucafService.orderProcedureList = []; + _ucafService.prescriptionList = null; + } + Future getLanguage() async { selectedLanguage = await sharedPref.getString(APP_Language); } @@ -90,6 +99,19 @@ class UcafViewModel extends BaseViewModel { } } + Future getPrescription(PatiantInformtion patient) async { + if (prescriptionList == null) { + setState(ViewState.Busy); + await _ucafService.getPrescription(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + MasterKeyModel findMasterDataById( {@required MasterKeysService masterKeys, dynamic id}) { switch (masterKeys) { diff --git a/lib/routes.dart b/lib/routes.dart index 8f2b08a4..6c5fc954 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -137,9 +137,10 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), - PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), + PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestThirdScreen(), PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), + // PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), CREATE_EPISODE: (_) => UpdateSoapIndex(isUpdate: true,), UPDATE_EPISODE: (_) => UpdateSoapIndex( isUpdate: true, diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 71955b0c..f4b26f6a 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; @@ -35,6 +36,7 @@ class _UcafDetailScreenState extends State { return BaseView( onModelReady: (model) async { + model.resetDataInFirst(); await model.getLanguage(); await model.getPatientAssessment(patient); }, @@ -54,8 +56,8 @@ class _UcafDetailScreenState extends State { height: 10, ), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), child: Column( children: [ treatmentStepsBar( @@ -63,7 +65,8 @@ class _UcafDetailScreenState extends State { SizedBox( height: 16, ), - ...getSelectedTreatmentStepItem(context, model), + ...getSelectedTreatmentStepItem( + context, model), ], ), ), @@ -73,8 +76,7 @@ class _UcafDetailScreenState extends State { ), ), Container( - margin: - EdgeInsets.symmetric(vertical: 8, horizontal: 16), + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), child: BorderedButton( TranslationBase.of(context).save, hasBorder: true, @@ -85,21 +87,22 @@ class _UcafDetailScreenState extends State { textColor: Colors.white, fontSize: SizeConfig.textMultiplier * 2.0, handler: () async { - await model.postUCAF(patient); - if(model.state == ViewState.Idle){ - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).postUcafSuccessMsg); - Navigator.of(context).popUntil((route){ - return route.settings.name == PATIENTS_PROFILE; - }); - } else { - DrAppToastMsg.showErrorToast(model.error); - } + await model.postUCAF(patient); + if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).postUcafSuccessMsg); + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + } else { + DrAppToastMsg.showErrorToast(model.error); + } }, ), ), Container( - margin: - EdgeInsets.only(left: 16, right: 16, top: 0.0, bottom: 8), + margin: EdgeInsets.only( + left: 16, right: 16, top: 0.0, bottom: 8), child: BorderedButton( TranslationBase.of(context).cancel, hasBorder: true, @@ -110,10 +113,9 @@ class _UcafDetailScreenState extends State { textColor: HexColor("#B8382B"), fontSize: SizeConfig.textMultiplier * 2.2, handler: () { - Navigator.of(context).popUntil((route){ + Navigator.of(context).popUntil((route) { return route.settings.name == PATIENTS_PROFILE; }); - }, ), ), @@ -164,7 +166,7 @@ class _UcafDetailScreenState extends State { if (__treatmentSteps.indexOf(item) == 0) { await model.getPatientAssessment(patient); } else if (__treatmentSteps.indexOf(item) == 1) { - print("call Medications"); + await model.getPrescription(patient); } if (__treatmentSteps.indexOf(item) == 2) { await model.getOrderProcedures(patient); @@ -198,7 +200,14 @@ class _UcafDetailScreenState extends State { } break; case 1: - return [...List.generate(2, (index) => MedicationWidget()).toList()]; + return [ + ...List.generate( + model.prescriptionList != null + ? model.prescriptionList.entityList.length + : 0, + (index) => MedicationWidget( + model, model.prescriptionList.entityList[index])).toList() + ]; break; case 2: if (model.orderProcedures != null) { @@ -326,6 +335,11 @@ class DiagnosisWidget extends StatelessWidget { } class MedicationWidget extends StatelessWidget { + final UcafViewModel model; + final EntityList prescription; + + MedicationWidget(this.model, this.prescription); + @override Widget build(BuildContext context) { return Column( @@ -339,7 +353,7 @@ class MedicationWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "6", + "${prescription.medicineCode}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -352,7 +366,7 @@ class MedicationWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "35.6", + "${prescription.medicationPrice}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -365,7 +379,24 @@ class MedicationWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "3", + "${prescription.quantity}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).durDays}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${prescription.doseDurationDays}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -378,7 +409,7 @@ class MedicationWidget extends StatelessWidget { children: [ Expanded( child: AppText( - "EVE SKIN CREAM WITH HONEY -170GM", + "${prescription.medicationName}", fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -392,7 +423,7 @@ class MedicationWidget extends StatelessWidget { children: [ Expanded( child: AppText( - "Every other day for 5 days", + "${prescription.doseDetail}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 9b9ae5a5..d4c1b803 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -233,7 +233,7 @@ class _UCAFInputScreenState extends State { controller: _additionalComplaintsController, keyboardType: TextInputType.multiline, minLines: 1, - maxLines: 15, + maxLines: 20, )), SizedBox( height: 16, diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart index 76ce6e2b..23e33db3 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; import '../../../../routes.dart'; @@ -32,6 +34,7 @@ class _AdmissionRequestDetailScreenState final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getSpecialityList(), @@ -124,7 +127,7 @@ class _AdmissionRequestDetailScreenState ListSelectDialog( list: model.speciality, attributeName: - model.selectedLanguage == 'ar' + projectViewModel.isArabic ? 'nameAr' : 'nameEn', attributeValueId: 'id', @@ -151,8 +154,7 @@ class _AdmissionRequestDetailScreenState TranslationBase.of(context) .speciality, _selectedSpeciality != null - ? model.selectedLanguage == - 'ar' + ? projectViewModel.isArabic ? _selectedSpeciality[ 'nameAr'] : _selectedSpeciality[ diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index aacff6dd..f5dbf704 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -1,29 +1,43 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; class AdmissionRequestThirdScreen extends StatefulWidget { @override - _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); + _AdmissionRequestThirdScreenState createState() => + _AdmissionRequestThirdScreenState(); } -class _AdmissionRequestThirdScreenState extends State { - +class _AdmissionRequestThirdScreenState + extends State { final _postPlansEstimatedCostController = TextEditingController(); final _dietTypeRemarksController = TextEditingController(); - DateTime _dischargeDate; + final _estimatedCostController = TextEditingController(); + + // DateTime _dischargeDate; + dynamic _selectedClinic; + dynamic _selectedDoctor; dynamic _selectedDietType; @override @@ -31,162 +45,364 @@ class _AdmissionRequestThirdScreenState extends State( - // onModelReady: (model) => model.getMasterLookup(), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, body: model.doctorsList != null ? Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), + children: [ + Expanded( + child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).postPlansEstimatedCost, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), + PatientPageHeaderWidget(patient), Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .postPlansEstimatedCost, - null, - false), - enabled: true, - controller: _postPlansEstimatedCostController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_dischargeDate == null) { - _dischargeDate = DateTime.now(); - } - _selectDate( - context, _dischargeDate, - (picked) { - setState(() { - _dischargeDate = picked; - }); - }); - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _dischargeDate != null - ? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}" + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.clinicList != null && + model.clinicList.length > 0 + ? () { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getClinics().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.clinicList.length > 0) { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .clinic, + _selectedClinic != null + ? _selectedClinic[ + 'clinicGroupName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null + ? model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils + .showMyDialog(context); + await model + .getClinicDoctors( + _selectedClinic[ + 'clinicID']) + .then((_) => + GifLoaderDialogUtils + .hideDialog( + context)); + if (model.state == + ViewState.Idle && + model.doctorsList.length > + 0) { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + } : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context) + .postPlansEstimatedCost, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .estimatedCost, + null, + false), + enabled: true, + controller: _estimatedCostController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: /*model.doctorsList != null && - model.doctorsList.length > 0 + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).postPlans, + null, + false), + enabled: true, + controller: _postPlansEstimatedCostController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + /* Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_dischargeDate == null) { + _dischargeDate = DateTime.now(); + } + _selectDate(context, _dischargeDate, + (picked) { + setState(() { + _dischargeDate = picked; + }); + }); + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _dischargeDate != null + ? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ),*/ + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.dietTypesList != null && + model.dietTypesList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ null, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).dietType, - /* _admissionType != null - ? _admissionType['DoctorName'] - :*/ null, - true), - enabled: false, - ), + openListDialogField('nameEn', 'id', + model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDietTypes().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.dietTypesList.length > + 0) { + openListDialogField('nameEn', + 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietType, + _selectedDietType != null + ? _selectedDietType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietTypeRemarks, + null, + false), + enabled: true, + controller: _dietTypeRemarksController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + ], ), ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietTypeRemarks, - null, - false), - enabled: true, - controller: _dietTypeRemarksController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), ], ), ), - ], - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).save, - color: HexColor("#B8382B"), - onPressed: null, - ), - ), - ], - ) + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + model.admissionRequestData = AdmissionRequest(); + if (_selectedClinic != null && + _selectedDoctor != null && + _estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "") { + model.admissionRequestData.patientMRN = patient.patientMRN; + model.admissionRequestData.appointmentNo = patient.appointmentNo; + model.admissionRequestData.episodeID = patient.episodeNo; + model.admissionRequestData.admissionRequestNo = 0; + + model.admissionRequestData.admitToClinic = _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = _selectedDoctor['DoctorID']; + model.admissionRequestData.estimatedCost = int.parse(_estimatedCostController.text); + model.admissionRequestData.elementsForImprovement = _postPlansEstimatedCostController.text; + model.admissionRequestData.isDietType = _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0; + model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text; + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: {'patient': patient, 'admission-data' : model.admissionRequestData}); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ) : Container(), ), ); @@ -205,4 +421,25 @@ class _AdmissionRequestThirdScreenState extends State list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } } diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index b65b7f43..2ffd5455 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -15,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -32,20 +34,29 @@ class _AdmissionRequestSecondScreenState extends State { final _expectedDaysController = TextEditingController(); final _treatmentLineController = TextEditingController(); - final _preOperativeOrdersController = TextEditingController(); + + // final _preOperativeOrdersController = TextEditingController(); DateTime _expectedAdmissionDate; - bool _emergencyAdmission = false; + + // bool _emergencyAdmission = false; + bool _isSickLeaveRequired = false; bool _patientPregnant = false; - bool _preAnesthesiaReferred = false; + + // bool _preAnesthesiaReferred = false; dynamic _selectedWard; dynamic _selectedAdmissionType; dynamic _selectedDiagnosis; - dynamic _selectedAllergies; + dynamic _selectedIcd; + dynamic _selectedDiagnosisType; + + // dynamic _selectedAllergies; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + AdmissionRequest admissionRequest = routeArgs['admission-data']; + final screenSize = MediaQuery.of(context).size; ProjectViewModel projectViewModel = Provider.of(context); @@ -134,6 +145,7 @@ class _AdmissionRequestSecondScreenState SizedBox( height: 10, ), +/* CheckboxListTile( title: AppText( TranslationBase.of(context) @@ -151,6 +163,24 @@ class _AdmissionRequestSecondScreenState ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), ), +*/ + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .isSickLeaveRequired, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _isSickLeaveRequired, + onChanged: (newValue) { + setState(() { + _isSickLeaveRequired = newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), CheckboxListTile( title: AppText( TranslationBase.of(context).patientPregnant, @@ -199,7 +229,11 @@ class _AdmissionRequestSecondScreenState }); } : () async { - await model.getWards(); + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); if (model.state == ViewState.Idle && model.wardList.length > 0) { openListDialogField('description', @@ -230,7 +264,7 @@ class _AdmissionRequestSecondScreenState ), ), ), - CheckboxListTile( + /* CheckboxListTile( title: AppText( TranslationBase.of(context) .preAnesthesiaReferred, @@ -246,6 +280,9 @@ class _AdmissionRequestSecondScreenState controlAffinity: ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), + ),*/ + SizedBox( + height: 10, ), Container( height: screenSize.height * 0.070, @@ -263,9 +300,15 @@ class _AdmissionRequestSecondScreenState }); } : () async { - await model.getMasterLookup( - MasterKeysService - .AdmissionRequestType); + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup( + MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils + .hideDialog(context)); if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) { @@ -303,6 +346,17 @@ class _AdmissionRequestSecondScreenState SizedBox( height: 10, ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).diagnosisDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), Container( height: screenSize.height * 0.070, child: InkWell( @@ -319,7 +373,11 @@ class _AdmissionRequestSecondScreenState }); } : () async { - await model.getDiagnosis(); + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDiagnosis().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); if (model.state == ViewState.Idle && model.diagnosisTypesList .length > @@ -360,6 +418,133 @@ class _AdmissionRequestSecondScreenState height: 10, ), Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.icdCodes != null && + model.icdCodes.length > 0 + ? () { + openListDialogField('description', + 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getICDCodes(patient.patientMRN) + .then((_) => + GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.icdCodes.length > 0) { + openListDialogField('description', + 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).icd, + _selectedIcd != null + ? _selectedIcd['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisSelectionTypes != + null && + model.listOfDiagnosisSelectionTypes + .length > + 0 + ? () { + openListDialogField( + 'description', + 'code', + model + .listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup( + MasterKeysService + .DiagnosisSelectionType) + .then((_) => + GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.listOfDiagnosisSelectionTypes + .length > + 0) { + openListDialogField( + 'description', + 'code', + model + .listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .diagnoseType, + _selectedDiagnosisType != null + ? _selectedDiagnosisType[ + 'description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + /*Container( child: TextField( decoration: Helpers.textFieldSelectorDecoration( @@ -425,7 +610,7 @@ class _AdmissionRequestSecondScreenState enabled: false, ), ), - ), + ),*/ ], ), ), @@ -436,12 +621,48 @@ class _AdmissionRequestSecondScreenState Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: AppButton( - title: TranslationBase.of(context).next, + title: TranslationBase.of(context).save, color: HexColor("#B8382B"), - onPressed: () { - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_3, - arguments: {'patient': patient}); + onPressed: () async { + if (_expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _treatmentLineController.text != "" && + _selectedWard != null && + _selectedAdmissionType != null && + _selectedDiagnosis != null && + _selectedIcd != null && + _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; + + model.admissionRequestData.expectedDays = int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired; + model.admissionRequestData.isPregnant = _patientPregnant; + model.admissionRequestData.mainLineOfTreatment = _treatmentLineController.text; + model.admissionRequestData.wardID = 0; + model.admissionRequestData.admissionType = _selectedAdmissionType['id']; + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription' : _selectedDiagnosis['nameEn'], + 'diagnosisType' : _selectedDiagnosis['id'], + 'icdCode' : _selectedIcd['code'], + 'icdCodeDescription' : _selectedIcd['description'], + 'type' : _selectedDiagnosisType['code'], + 'remarks' : "", + 'isActive' : true, + } + ]; + model.admissionRequestData.admissionRequestDiagnoses = admissionRequestDiagnoses; + model.admissionRequestData.admissionRequestProcedures = []; + await model.makeAdmissionRequest(); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast( + model.error); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } }, ), ), @@ -486,38 +707,4 @@ class _AdmissionRequestSecondScreenState }, ); } - -/* - onTap: model.wardList != null && - model.wardList.length > 0 - ? () { - openListDialogField('description', - 'description', model.wardList, - (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } - : () async { - await model.getWards(); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField('description', - 'description', model.wardList, - (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - */ } diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index ab2beaf8..5e749011 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -73,6 +73,8 @@ class MyReferralPatientScreen extends StatelessWidget { remark: model.pendingReferral[index].remarksFromSource, referredOn: model.pendingReferral[index].referredOn, + answerFromTarget: + model.pendingReferral[index].answerFromTarget, infoIcon: InkWell( onTap: () { Navigator.of(context) diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index a3d74430..3903b46a 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -103,6 +103,8 @@ class _PatientMakeReferralScreenState extends State { clinicDescription: null, remark: model.patientReferral[0].remarksFromSource, referredOn: model.patientReferral[0].referredOn, + answerFromTarget: + model.patientReferral[0].answerFromTarget, ), ], ), @@ -271,7 +273,8 @@ class _PatientMakeReferralScreenState extends State { attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', usingSearch: true, - hintSearchText: TranslationBase.of(context).clinicSearch, + hintSearchText: + TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -321,7 +324,8 @@ class _PatientMakeReferralScreenState extends State { attributeName: 'DoctorName', attributeValueId: 'DoctorID', usingSearch: true, - hintSearchText: TranslationBase.of(context).doctorSearch, + hintSearchText: + TranslationBase.of(context).doctorSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -380,9 +384,9 @@ class _PatientMakeReferralScreenState extends State { TranslationBase.of(context).remarks, null, false), enabled: true, controller: _remarksController, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) - ], + // inputFormatters: [ + // FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) + // ], keyboardType: TextInputType.text, minLines: 4, maxLines: 6, @@ -406,53 +410,6 @@ class _PatientMakeReferralScreenState extends State { setState(() { appointmentDate = picked; }); - /* model - .getPatientArrivalList(DateUtils.convertStringToDateFormat( - appointmentDate.toString(), "yyyy-MM-dd")) - .then((_) { - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - return; - } - if (model.patientArrivalList != null && - model.patientArrivalList.length > 0) { - List appointments = model.getAppointmentsByPatientName( - "${patient.firstName} ${patient.middleName} ${patient.lastName}"); - if (appointments.length > 0) { - ListSelectDialog dialog = ListSelectDialog( - list: appointments, - attributeName: 'appointmentNo', - attributeValueId: 'appointmentNo', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedPatientArrivalEntity = - PatientArrivalEntity.fromJson(selectedValue); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } else { - setState(() { - _selectedPatientArrivalEntity = null; - }); - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).noAppointmentsErrorMsg); - } - } else { - setState(() { - _selectedPatientArrivalEntity = null; - }); - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).noAppointmentsErrorMsg); - } - });*/ } } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index a8279634..80d77f3e 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart'; @@ -47,6 +48,7 @@ postProcedure( PrescriptionViewModel model, DateTime doseTime, String doseUnit, + String icdCode, PatiantInformtion patient}) async { PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); @@ -66,7 +68,7 @@ postProcedure( frequency: frequency.isEmpty ? 1 : int.parse(frequency), remarks: instruction, approvalRequired: true, - icdcode10Id: "test2", + icdcode10Id: icdCode.toString(), doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), duration: duration.isEmpty ? 1 : int.parse(duration), doseStartDate: doseTime.toIso8601String())); @@ -126,6 +128,7 @@ class _PrescriptionFormWidgetState extends State { dynamic doseTime; dynamic indication; dynamic units; + dynamic x; List indicationList; String routeInatial = 'By Mouth'; @@ -175,20 +178,35 @@ class _PrescriptionFormWidgetState extends State { Widget build(BuildContext context) { ListSelectDialog drugDialog; final screenSize = MediaQuery.of(context).size; + // final routeArgs = ModalRoute.of(context).settings.arguments as Map; // patient = routeArgs['patient']; return BaseView( onModelReady: (model) async { + x = model.patientAssessmentList.map((element) { + return element.icdCode10ID; + }); + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patient.patientMRN, + episodeID: widget.patient.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: widget.patient.appointmentNo); await model.getMedicationList(); await model.getMedicationStrength(); await model.getMedicationDuration(); await model.getMedicationRoute(); await model.getMedicationFrequency(); await model.getMedicationDoseTime(); - await model.getMedicationIndications(); + //await model.getMedicationIndications(); + await model.getPatientAssessment(getAssessmentReqModel); }, - builder: (BuildContext context, MedicineViewModel model, Widget child) => + builder: ( + BuildContext context, + MedicineViewModel model, + Widget child, + ) => NetworkBaseView( baseViewModel: model, child: DraggableScrollableSheet( @@ -198,7 +216,7 @@ class _PrescriptionFormWidgetState extends State { builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( - height: 980, + height: 1010, child: Padding( padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), @@ -298,22 +316,13 @@ class _PrescriptionFormWidgetState extends State { AppText('Order Type'), Radio( activeColor: Color(0xFFB9382C), - value: 0, + value: 1, groupValue: selectedType, onChanged: (value) { setSelectedType(value); }, ), Text('Regular'), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text('Urgent'), ], ), ), @@ -534,46 +543,57 @@ class _PrescriptionFormWidgetState extends State { ), ), SizedBox(height: spaceBetweenTextFileds), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: indicationList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: indicationList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) + //model.patientAssessmentList.forEach((element) { }). + Column( + children: model.patientAssessmentList + .map((element) { + return Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: indicationList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: indicationList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of( + context) .ok, - okFunction: (selectedValue) { - setState(() { - indication = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .indication, - indication != null - ? indication['name'] - : null, - true), - enabled: false, - ), - ), + okFunction: (selectedValue) { + setState(() { + indication = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + element.icdCode10ID + .toString(), + indication != null + ? indication['name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ); + }).toList(), ), + SizedBox(height: spaceBetweenTextFileds), Container( height: screenSize.height * 0.070, @@ -677,7 +697,6 @@ class _PrescriptionFormWidgetState extends State { // openDrugToDrug(); if (route == null || frequency == null || - indication == null || doseTime == null || duration == null || selectedDate == null || @@ -690,30 +709,54 @@ class _PrescriptionFormWidgetState extends State { if (formKey.currentState.validate()) { Navigator.pop(context); { + // var x = model + // .patientAssessmentList + // .map((value) => + // value.icdCode10ID) + // .toList() + // .join(','); postProcedure( - dose: strengthController.text, - doseUnit: - units['id'].toString(), - patient: widget.patient, - doseTimeIn: - doseTime['id'].toString(), - model: widget.model, - duration: - duration['id'].toString(), - frequency: frequency['id'] - .toString(), - route: route['id'].toString(), - drugId: _selectedMedication - .itemId - .toString(), - strength: - strengthController.text, - indication: - indicationController.text, - instruction: - instructionController - .text, - doseTime: selectedDate); + icdCode: model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString(), + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: strengthController.text, + doseUnit: + units['id'].toString(), + patient: widget.patient, + doseTimeIn: + doseTime['id'].toString(), + model: widget.model, + duration: + duration['id'].toString(), + frequency: + frequency['id'].toString(), + route: route['id'].toString(), + drugId: _selectedMedication + .itemId + .toString(), + strength: + strengthController.text, + indication: + indicationController.text, + instruction: + instructionController.text, + doseTime: selectedDate, + ); } } { diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index c7c4c60e..5a212f56 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -181,6 +181,13 @@ class _NewPrescriptionScreenState extends State { (index) => Container( child: Column( children: [ + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.022, + ), Row( mainAxisAlignment: MainAxisAlignment @@ -193,7 +200,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.23, + 0.33, width: MediaQuery.of( context) .size @@ -232,7 +239,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.3019, + 0.3899, width: MediaQuery.of( context) .size @@ -328,7 +335,7 @@ class _NewPrescriptionScreenState extends State { ], ), SizedBox( - height: 3.0, + height: 10.0, ), Row( children: [ @@ -351,7 +358,29 @@ class _NewPrescriptionScreenState extends State { ], ), SizedBox( - height: 18.0, + height: + 5.0), + Row( + children: [ + AppText( + 'pharmacist Remarks : ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: AppText( + model.prescriptionList[0].entityList[index].pharmacistRemarks == null + ? "" + : model.prescriptionList[0].entityList[index].pharmacistRemarks, + fontSize: 15.0), + ) + ], + ), + SizedBox( + height: 20.0, ), Row( children: [ @@ -376,21 +405,23 @@ class _NewPrescriptionScreenState extends State { ) ], ), + SizedBox( + height: 8.0, + ), Row( children: [ Expanded( child: Container( height: - 30, + 25, child: AppText( - model - .prescriptionList[0] - .entityList[index] - .remarks, + model.prescriptionList[0].entityList[index].remarks == null + ? "" + : model.prescriptionList[0].entityList[index].remarks, fontSize: - 11.5, + 12.5, ), ), ), @@ -400,13 +431,6 @@ class _NewPrescriptionScreenState extends State { height: 10.0, ), - Divider( - height: 0, - thickness: - 1.0, - color: Colors - .grey, - ), // SizedBox( // height: 40, // ), @@ -418,7 +442,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.05, + 0.16, width: MediaQuery.of( context) .size @@ -432,32 +456,31 @@ class _NewPrescriptionScreenState extends State { .edit), onTap: () { updatePrescriptionForm( - doseUnit: - model.prescriptionList[0].entityList[index].doseDailyUnitID - .toString(), - doseStreangth: - model.prescriptionList[0].entityList[index].doseDailyQuantity - .toString(), - duration: - model.prescriptionList[0].entityList[index].doseDurationDays - .toString(), - startDate: - model.prescriptionList[0].entityList[index].startDate - .toString(), - dose: model + drugNameGeneric: model .prescriptionList[ 0] .entityList[ index] - .doseTimingID + .medicationName, + doseUnit: model.prescriptionList[0].entityList[index].doseDailyUnitID + .toString(), + doseStreangth: model.prescriptionList[0].entityList[index].doseDailyQuantity + .toString(), + duration: model.prescriptionList[0].entityList[index].doseDurationDays .toString(), - frequency: model + startDate: + model.prescriptionList[0].entityList[index].startDate + .toString(), + dose: model .prescriptionList[ 0] .entityList[ index] - .frequencyID + .doseTimingID .toString(), + frequency: + model.prescriptionList[0].entityList[index].frequencyID + .toString(), rouat: model .prescriptionList[ 0] @@ -484,6 +507,11 @@ class _NewPrescriptionScreenState extends State { ), ], ), + Divider( + height: 0, + thickness: 1.0, + color: Colors.grey, + ), ], ), ), diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 5c7c6e76..714659ac 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -1,6 +1,8 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; @@ -8,6 +10,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -31,6 +34,7 @@ class UpdatePrescriptionForm extends StatefulWidget { final String enteredRemarks; final String startDate; final String frequency; + final String drugNameGeneric; final PrescriptionViewModel model; UpdatePrescriptionForm( @@ -46,7 +50,8 @@ class UpdatePrescriptionForm extends StatefulWidget { this.doseUnit, this.enteredRemarks, this.frequency, - this.model}); + this.model, + this.drugNameGeneric}); @override _UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState(); } @@ -62,6 +67,9 @@ class _UpdatePrescriptionFormState extends State { dynamic frequencyUpdate; dynamic updatedDuration; dynamic units; + GetMedicationResponseModel newSelectedMedication; + GlobalKey key = + new GlobalKey>(); @override void initState() { @@ -80,7 +88,7 @@ class _UpdatePrescriptionFormState extends State { await model.getMedicationRoute(); await model.getMedicationFrequency(); await model.getMedicationDoseTime(); - await model.getMedicationIndications(); + //await model.getMedicationIndications(); route = model.getLookupById(model.medicationRouteList, widget.route); doseTime = model.getLookupById(model.medicationDoseTimeList, widget.dose); @@ -96,13 +104,13 @@ class _UpdatePrescriptionFormState extends State { NetworkBaseView( baseViewModel: model, child: DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 0.99, minChildSize: 0.6, builder: (BuildContext context, ScrollController scrollController) { return Container( - height: MediaQuery.of(context).size.height * 1.0, + height: MediaQuery.of(context).size.height * 1.3, child: Form( child: Padding( padding: EdgeInsets.symmetric( @@ -119,6 +127,78 @@ class _UpdatePrescriptionFormState extends State { ), Column( children: [ + // Container( + // height: MediaQuery.of(context).size.height * + // 0.070, + // child: InkWell( + // onTap: model.allMedicationList != null + // ? () { + // setState(() { + // newSelectedMedication = null; + // }); + // } + // : null, + // child: newSelectedMedication == null + // ? AutoCompleteTextField< + // GetMedicationResponseModel>( + // decoration: + // textFieldSelectorDecoration( + // widget.drugNameGeneric, + // newSelectedMedication != null + // ? newSelectedMedication + // .genericName + // : null, + // true, + // ), + // itemSubmitted: (item) => setState( + // () => newSelectedMedication = + // item), + // key: key, + // suggestions: + // model.allMedicationList, + // itemBuilder: (context, + // suggestion) => + // new Padding( + // child: Texts(suggestion + // .description + + // '/' + + // suggestion.genericName), + // padding: + // EdgeInsets.all(8.0)), + // itemSorter: (a, b) => 1, + // itemFilter: (suggestion, input) => + // suggestion.genericName + // .toLowerCase() + // .startsWith( + // input.toLowerCase()) || + // suggestion.description + // .toLowerCase() + // .startsWith( + // input.toLowerCase()) || + // suggestion.keywords + // .toLowerCase() + // .startsWith( + // input.toLowerCase()), + // ) + // : TextField( + // decoration: + // textFieldSelectorDecoration( + // TranslationBase.of(context) + // .searchMedicineNameHere, + // newSelectedMedication != null + // ? newSelectedMedication + // .description + + // ('${newSelectedMedication.genericName}') + // : null, + // true, + // ), + // enabled: false, + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), Container( height: MediaQuery.of(context).size.height * 0.060, @@ -128,13 +208,16 @@ class _UpdatePrescriptionFormState extends State { Container( width: MediaQuery.of(context).size.width * - 0.500, + 0.4900, + height: + MediaQuery.of(context).size.height * + 0.55, child: TextFields( inputFormatters: [ LengthLimitingTextInputFormatter(4) ], - hintText: TranslationBase.of(context) - .strength, + hintText: widget.doseStreangth, + fontSize: 15.0, controller: strengthController, keyboardType: TextInputType.number, onChanged: (String value) { @@ -521,6 +604,7 @@ class _UpdatePrescriptionFormState extends State { updatePrescription( {PrescriptionViewModel model, int drugId, + String newDrugId, String frequencyId, String remarks, String dose, @@ -585,6 +669,7 @@ class _UpdatePrescriptionFormState extends State { void updatePrescriptionForm( {context, String drugName, + String drugNameGeneric, int drugId, String remarks, PrescriptionViewModel model, @@ -619,6 +704,7 @@ void updatePrescriptionForm( route: rouat, startDate: startDate, model: model, + drugNameGeneric: drugNameGeneric, ); }); } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index ca126609..bb897351 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -195,6 +195,13 @@ class _ProcedureScreenState extends State { (index) => Container( child: Column( children: [ + SizedBox( + height: + MediaQuery.of(context) + .size + .height * + 0.022, + ), Row( mainAxisAlignment: MainAxisAlignment @@ -298,17 +305,20 @@ class _ProcedureScreenState extends State { FontWeight .w700, fontSize: - 15.0, + 14.0, ), - AppText( - model.procedureList[0].entityList[index].orderType == - 1 - ? 'Regular' - : 'Urgent', - fontSize: - 13.0, - color: Color( - 0xFFB9382C), + Expanded( + child: + AppText( + model.procedureList[0].entityList[index].orderType == + 1 + ? 'Regular' + : 'Urgent', + fontSize: + 13.0, + color: Color( + 0xFFB9382C), + ), ), ], ), @@ -391,7 +401,7 @@ class _ProcedureScreenState extends State { height: MediaQuery.of(context) .size .height * - 0.052, + 0.047, width: MediaQuery.of(context) .size .width * @@ -413,12 +423,6 @@ class _ProcedureScreenState extends State { height: 20.0, ), - Divider( - height: 1.0, - thickness: 1.0, - color: - Colors.grey, - ) // SizedBox( // height: 40, // ), @@ -468,9 +472,14 @@ class _ProcedureScreenState extends State { ) ], ), - ) + ), ], ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), ], ), ), diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 8ed40dc3..c1dc31f3 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -86,165 +86,184 @@ class _UpdateProcedureWidgetState extends State { (BuildContext context, ProcedureViewModel model, Widget child) => NetworkBaseView( baseViewModel: model, - child: Container( - height: MediaQuery.of(context).size.height * 0.95, - child: Form( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.procedureName.toUpperCase(), - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 30.0, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.categoryList != null && - model.categoryList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.categoryList, - attributeName: 'categoryName', - attributeValueId: 'categoryId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.procedureName.toUpperCase(), + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 30.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = + selectedValue; + model.getProcedureCategory( + categoryName: + selectedCategory[ + 'categoryName']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget + .model.categoriesList[0].entityList, + removeHistory: (item) { setState(() { - selectedCategory = selectedValue; - model.getProcedureCategory( - categoryName: selectedCategory[ - 'categoryName']); + entityList.remove(item); }); }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; + addHistory: (history) { + setState(() { + entityList.add(history); + }); }, - ); - //model.getProcedureCategory(); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).procedureCategorise, - selectedCategory != null - ? selectedCategory['categoryName'] - : null, - true, - suffixIcon: Icon( - Icons.search, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ), + ), + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: widget.remarks, + fontSize: 15.0, + controller: widget.remarksController, + maxLines: 3, + minLines: 2, + ), + ), + SizedBox( + height: 50.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .updateProcedure + .toUpperCase(), + onPressed: () { + Navigator.pop(context); + updateProcedure( + orderType: selectedType.toString(), + categorieId: widget.categoryId, + procedureId: widget.procedureId, + entityList: entityList, + patient: widget.patient, + model: widget.model, + remarks: + widget.remarksController.text); + // authorizationForm(context); + }, + ), + ], + ), + ), + ], ), ), - Container( - child: Row( - children: [ - AppText(TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).regular), - ], - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: widget.remarks, - controller: widget.remarksController, - maxLines: 5, - minLines: 3, - ), - ), - SizedBox( - height: 50.0, - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .updateProcedure - .toUpperCase(), - onPressed: () { - Navigator.pop(context); - updateProcedure( - orderType: selectedType.toString(), - categorieId: widget.categoryId, - procedureId: widget.procedureId, - entityList: entityList, - patient: widget.patient, - model: widget.model, - remarks: widget.remarksController.text); - // authorizationForm(context); - }, - ), - ], - ), - ), - ], - ), - ), - )), + )), + ); + }), ), ); }); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 25102e3d..d5daf67c 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -639,68 +639,153 @@ class _RescheduleLeaveScreen extends State { model2.coveringDoctors.length > 0 ? Expanded( // add Expanded to have your dropdown button fill remaining space - child: - DropdownButtonHideUnderline( - child: DropdownButton( - focusColor: Colors.grey, - isExpanded: true, - value: doctorID == null - ? model2 - .coveringDoctors[0] - ['doctorID'] - .toString() - : doctorID, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model2 - .coveringDoctors - .map((item) { - return Row( - mainAxisSize: - MainAxisSize.max, - children: [ - AppText( - projectsProvider - .isArabic - ? item[ - 'doctorNameN'] - : item[ - 'doctorName'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - doctorID = newValue; - }) - }, + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: + InputDecoration( + contentPadding: + EdgeInsets.all( + 0), + border: InputBorder + .none), + //maxHeight: 300, items: model2 .coveringDoctors .map((item) { - return DropdownMenuItem< - String>( - value: item['doctorID'] - .toString(), + return projectsProvider + .isArabic + ? item['doctorNameN'] + : item['doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors + .forEach((newVal) => { + if (newVal['doctorName'] == + item || + newVal['doctorName'] == + item) + { + doctorID = + newVal[ + 'DoctorID'] + } + }); + }, + selectedItem: + getSelectedDoctor( + model2), + showSearchBox: true, + searchBoxDecoration: + InputDecoration( + border: + OutlineInputBorder(), + contentPadding: + EdgeInsets.fromLTRB( + 12, 12, 8, 0), + labelText: + "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: BoxDecoration( + color: Theme.of(context) + .primaryColorDark, + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 20), + topRight: + Radius.circular( + 20), + ), + ), + child: Center( child: Text( - projectsProvider - .isArabic - ? item[ - 'doctorNameN'] - : item[ - 'doctorName'], - textAlign: - TextAlign.start, + '', + style: TextStyle( + fontSize: 24, + fontWeight: + FontWeight.bold, + color: Colors.white, + ), ), - ); - }).toList(), - )), + ), + ), + popupShape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(24), + topRight: + Radius.circular(24), + ), + ), + ), + // DropdownButtonHideUnderline( + // child: DropdownButton( + // focusColor: Colors.grey, + // isExpanded: true, + // value: doctorID == null + // ? model2 + // .coveringDoctors[0] + // ['doctorID'] + // .toString() + // : doctorID, + // iconSize: 40, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext context) { + // return model2 + // .coveringDoctors + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize.max, + // children: [ + // AppText( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // fontSize: SizeConfig + // .textMultiplier * + // 2.1, + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: (newValue) => { + // setState(() { + // doctorID = newValue; + // }) + // }, + // items: model2 + // .coveringDoctors + // .map((item) { + // return DropdownMenuItem< + // String>( + // value: item['doctorID'] + // .toString(), + // child: Text( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // textAlign: + // TextAlign.start, + // ), + // ); + // }).toList(), + // )), ) : SizedBox(), ], @@ -775,6 +860,7 @@ class _RescheduleLeaveScreen extends State { toDate = _toDateController2.text; fromDate = _toDateController.text; this.reason = widget.updateData.reasonId.toString(); + doctorID = widget.updateData.coveringDoctorId; } }); } @@ -910,4 +996,19 @@ class _RescheduleLeaveScreen extends State { } }); } + + getSelectedDoctor(model2) { + var doctorName; + if (doctorID == null) + return projectsProvider.isArabic + ? model2.coveringDoctors[0]['doctorNameN'] + : model2.coveringDoctors[0]['doctorName']; + else { + model2.coveringDoctors.forEach((newVal) => { + if (newVal['doctorID'].toString() == doctorID) + {doctorName = newVal['doctorName']} + }); + return doctorName; + } + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index a3c058a8..30585015 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -725,6 +725,8 @@ class TranslationBase { String get emergencyAdmission => localizedValues['emergencyAdmission'][locale.languageCode]; + String get isSickLeaveRequired => + localizedValues['isSickLeaveRequired'][locale.languageCode]; String get patientPregnant => localizedValues['patientPregnant'][locale.languageCode]; @@ -762,6 +764,8 @@ class TranslationBase { String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; + String get postPlans => + localizedValues['postPlans'][locale.languageCode]; String get ucaf => localizedValues['ucaf'][locale.languageCode]; @@ -865,6 +869,8 @@ class TranslationBase { String get quantity => localizedValues['quantity'][locale.languageCode]; + String get durDays => localizedValues['durDays'][locale.languageCode]; + String get codeNo => localizedValues['codeNo'][locale.languageCode]; String get covered => localizedValues['covered'][locale.languageCode]; @@ -1078,6 +1084,9 @@ class TranslationBase { localizedValues['clinicSearch'][locale.languageCode]; String get doctorSearch => localizedValues['doctorSearch'][locale.languageCode]; + String get referralResponse => localizedValues['referralResponse'][locale.languageCode]; + String get estimatedCost => localizedValues['estimatedCost'][locale.languageCode]; + String get diagnosisDetail => localizedValues['diagnosisDetail'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index ab89ab33..5924c89c 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -12,6 +12,7 @@ class PatientReferralItemWidget extends StatelessWidget { final String clinicDescription; final String remark; final String referredOn; + final String answerFromTarget; final Widget infoIcon; PatientReferralItemWidget( @@ -24,6 +25,7 @@ class PatientReferralItemWidget extends StatelessWidget { this.clinicDescription, this.remark, this.referredOn, + this.answerFromTarget, this.infoIcon, }); @@ -207,6 +209,27 @@ class PatientReferralItemWidget extends StatelessWidget { ), ], ), + if (answerFromTarget != null) + SizedBox( + height: 8, + ), + if (answerFromTarget != null) + Row( + children: [ + AppText( + TranslationBase.of(context).referralResponse, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + answerFromTarget != "" ? answerFromTarget : '-', + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ], + ), SizedBox( height: 16, ), diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 8563bb41..d2807a26 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -76,7 +76,8 @@ class TextFields extends StatefulWidget { this.hintColor, this.hasBorder = true, this.onTapTextFields, - this.hasLabelText = false, this.showLabelText= false}) + this.hasLabelText = false, + this.showLabelText = false}) : super(key: key); final String hintText; @@ -233,22 +234,21 @@ class _TextFieldsState extends State { maxLines: widget.maxLines ?? 1, maxLengthEnforced: widget.maxLengthEnforced, initialValue: widget.initialValue, - onChanged: (value){ - if(widget.showLabelText) { - if((value== null || value =='' )) { + onChanged: (value) { + if (widget.showLabelText) { + if ((value == null || value == '')) { setState(() { widget.hasLabelText = false; }); - }else{ + } else { setState(() { widget.hasLabelText = true; }); } } - widget.onChanged(value); - } , + }, focusNode: _focusNode, maxLength: widget.maxLength ?? null, controller: widget.controller, @@ -258,10 +258,8 @@ class _TextFieldsState extends State { autofocus: widget.autoFocus ?? false, validator: widget.validator, onSaved: widget.onSaved, - style: Theme.of(context) - .textTheme - .bodyText1 - .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + style: Theme.of(context).textTheme.bodyText1.copyWith( + fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ WhitelistingTextInputFormatter.digitsOnly, @@ -271,33 +269,27 @@ class _TextFieldsState extends State { decoration: InputDecoration( labelText: widget.hasLabelText ? widget.hintText : null, labelStyle: TextStyle( - fontSize: widget.fontSize, fontWeight: widget.fontWeight, - color: widget.hintColor ?? Theme - .of(context) - .hintColor, + color: widget.hintColor ?? Theme.of(context).hintColor, ), counterText: "", hintText: widget.hintText, hintStyle: TextStyle( fontSize: widget.fontSize, fontWeight: widget.fontWeight, - color: widget.hintColor ?? Theme - .of(context) - .hintColor, + color: widget.hintColor ?? Theme.of(context).hintColor, ), contentPadding: widget.padding != null ? widget.padding : EdgeInsets.symmetric( - vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, - horizontal: 16.0), + vertical: + (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, + horizontal: 16.0), filled: true, fillColor: widget.bare ? Colors.transparent - : Theme - .of(context) - .backgroundColor, + : Theme.of(context).backgroundColor, suffixIcon: _buildSuffixIcon(), prefixIcon: widget.prefixIcon, errorStyle: TextStyle( @@ -305,48 +297,53 @@ class _TextFieldsState extends State { fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), errorBorder: OutlineInputBorder( - borderSide: widget.hasBorder ? BorderSide( - color: Theme - .of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 1.0) : BorderSide( - color: Colors.transparent, width: 0), - borderRadius: widget.hasBorder ? BorderRadius.circular( - widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0),), + borderSide: widget.hasBorder + ? BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), + ), focusedErrorBorder: OutlineInputBorder( - borderSide: widget.hasBorder ? BorderSide( - color: Theme - .of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 1.0) : BorderSide( - color: Colors.transparent, width: 0), + borderSide: widget.hasBorder + ? BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), focusedBorder: OutlineInputBorder( - borderSide: widget.hasBorder ? BorderSide( - color: Colors.grey, width: 1.0) : BorderSide( - color: Colors.transparent, width: 0), - borderRadius: widget.hasBorder ? BorderRadius.circular( - widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0),), + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), + ), disabledBorder: OutlineInputBorder( - borderSide: widget.hasBorder ? BorderSide( - color: Colors.grey, width: 1.0) : BorderSide( - color: Colors.transparent, width: 0), - borderRadius: widget.hasBorder ? BorderRadius.circular( - widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0)), + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0)), enabledBorder: OutlineInputBorder( - borderSide: widget.hasBorder ? BorderSide( - color: Colors.grey, width: 1.0) : BorderSide( - color: Colors.transparent, width: 0), - borderRadius: widget.hasBorder ? BorderRadius.circular( - widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0), + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), ), ), ), ], ), - )); } }