diff --git a/lib/config/config.dart b/lib/config/config.dart index abd07c03..6c4da7b1 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'; @@ -71,7 +72,7 @@ const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; const RESPONSE_PENDING_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/CreateReferral'; + 'Services/DoctorApplication.svc/REST/RespondReferral'; const GET_PATIENT_REFERRAL = 'Services/DoctorApplication.svc/REST/GetRefferal'; @@ -191,8 +192,13 @@ const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; const DRUG_TO_DRUG = 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; +const GET_FLOORS = 'Services/DoctorApplication.svc/REST/GetFloors'; const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; +const GET_ROOM_CATEGORIES = 'Services/DoctorApplication.svc/REST/GetRoomCategories'; 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 2ded6152..c25d8fae 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': "الموافقة مطلوبة"}, @@ -592,6 +598,7 @@ const Map> localizedValues = { 'allergicTO': {'en': "ALLERGIC TO ", 'ar': " حساس من"}, 'normal': {'en': "Normal", 'ar': "عادي"}, 'abnormal': {'en': "Abnormal", 'ar': " غير عادي"}, + 'notExamined': {'en': "Not Examined", 'ar': "لم يتم الفحص"}, "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, "mass": {"en": "Mass", "ar": "كتلة"}, @@ -688,5 +695,20 @@ 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': "تفاصيل التشخيص"}, + 'referralSuccessMsgAccept': {'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح"}, + 'referralSuccessMsgReject': {'en': "Referral Rejected Successfully", 'ar': "تم رفض الإحالة بنجاح"}, + 'sickLeaveComments': {'en': "Sick leave comments", 'ar': "تعليقات إجازة مرضية"}, + 'pastMedicalHistory': {'en': "Past medical history", 'ar': "التاريخ الطبي"}, + 'pastSurgicalHistory': {'en': "Past surgical history", 'ar': "التاريخ الجراحي"}, + 'complications': {'en': "Complications", 'ar': "المضاعفات"}, + 'floor': {'en': "Floor", 'ar': "الطابق"}, + 'roomCategory': {'en': "Room category", 'ar': "فئة الغرفة"}, + 'otherDepartmentsInterventions': {'en': "Other departments interventions", 'ar': "تدخلات الأقسام الأخرى"}, + 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, + 'admissionRequestSuccessMsg': {'en': "Admission Request Created Successfully", 'ar': "تم إنشاء طلب القبول بنجاح"}, // 'icd': {'en': "ICD", 'ar': " "}, + 'orderNo': {'en': "Order No : ", '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..093c4066 100644 --- a/lib/core/service/patient-admission-request-service.dart +++ b/lib/core/service/patient-admission-request-service.dart @@ -1,14 +1,21 @@ 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 floorList = []; List wardList = []; + List roomCategoryList = []; List diagnosisTypesList = []; List allergiesLookupList = []; + List dietTypesList = []; + List icdCodes = []; + setSpecialityList() { specialityList.clear(); @@ -24,9 +31,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 +47,48 @@ 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(), + ); + } + + Future getFloors() async { + hasError = false; + + await baseAppClient.post( + GET_FLOORS, + onSuccess: (dynamic response, int statusCode) { + floorList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + floorList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map(), ); } @@ -64,6 +116,28 @@ class AdmissionRequestService extends LookupService { ); } + Future getRoomCategories() async { + hasError = false; + + await baseAppClient.post( + GET_ROOM_CATEGORIES, + onSuccess: (dynamic response, int statusCode) { + roomCategoryList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + roomCategoryList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + Future getDiagnosisTypesList() async { hasError = false; @@ -86,4 +160,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["admissionResponse"]["success"]); + }, + 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..77af017c 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -197,17 +197,19 @@ 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( RESPONSE_PENDING_REFERRAL_PATIENT, onSuccess: (dynamic response, int statusCode) { + print(response); }, onFailure: (String error, int statusCode) { hasError = true; 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..44261c26 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,45 +13,72 @@ class AdmissionRequestViewModel extends BaseViewModel{ AdmissionRequestService _admissionRequestService = locator(); + List get clinicList => _admissionRequestService.clinicList; + List get doctorsList => _admissionRequestService.doctorsList; List get speciality => _admissionRequestService.specialityList; + List get floorList => _admissionRequestService.floorList; + List get wardList => _admissionRequestService.wardList; + List get roomCategoryList => _admissionRequestService.roomCategoryList; + List get admissionTypeList => _admissionRequestService.listOfAdmissionType; List get diagnosisTypesList => _admissionRequestService.diagnosisTypesList; 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 getFloors() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getFloors(); + 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; @@ -59,8 +87,18 @@ class AdmissionRequestViewModel extends BaseViewModel{ setState(ViewState.Idle); } + Future getRoomCategories() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getRoomCategories(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getDiagnosis() async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _admissionRequestService.getDiagnosisTypesList(); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; @@ -76,8 +114,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/models/SOAP/GetPhysicalExamListResModel.dart b/lib/models/SOAP/GetPhysicalExamListResModel.dart index f9b2f44f..c97189b1 100644 --- a/lib/models/SOAP/GetPhysicalExamListResModel.dart +++ b/lib/models/SOAP/GetPhysicalExamListResModel.dart @@ -1,13 +1,19 @@ class GetPhysicalExamResModel { int appointmentNo; int createdBy; + String createdByName; String createdOn; - int editedBy; + Null editedBy; + String editedByName; String editedOn; int episodeId; int examId; + String examName; int examType; + int examinationType; + String examinationTypeName; bool isAbnormal; + bool isNew; bool isNormal; bool notExamined; int patientMRN; @@ -16,13 +22,19 @@ class GetPhysicalExamResModel { GetPhysicalExamResModel( {this.appointmentNo, this.createdBy, + this.createdByName, this.createdOn, this.editedBy, + this.editedByName, this.editedOn, this.episodeId, this.examId, + this.examName, this.examType, + this.examinationType, + this.examinationTypeName, this.isAbnormal, + this.isNew, this.isNormal, this.notExamined, this.patientMRN, @@ -31,13 +43,19 @@ class GetPhysicalExamResModel { GetPhysicalExamResModel.fromJson(Map json) { appointmentNo = json['appointmentNo']; createdBy = json['createdBy']; + createdByName = json['createdByName']; createdOn = json['createdOn']; editedBy = json['editedBy']; + editedByName = json['editedByName']; editedOn = json['editedOn']; episodeId = json['episodeId']; examId = json['examId']; + examName = json['examName']; examType = json['examType']; + examinationType = json['examinationType']; + examinationTypeName = json['examinationTypeName']; isAbnormal = json['isAbnormal']; + isNew = json['isNew']; isNormal = json['isNormal']; notExamined = json['notExamined']; patientMRN = json['patientMRN']; @@ -48,13 +66,19 @@ class GetPhysicalExamResModel { final Map data = new Map(); data['appointmentNo'] = this.appointmentNo; data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; data['createdOn'] = this.createdOn; data['editedBy'] = this.editedBy; + data['editedByName'] = this.editedByName; data['editedOn'] = this.editedOn; data['episodeId'] = this.episodeId; data['examId'] = this.examId; + data['examName'] = this.examName; data['examType'] = this.examType; + data['examinationType'] = this.examinationType; + data['examinationTypeName'] = this.examinationTypeName; data['isAbnormal'] = this.isAbnormal; + data['isNew'] = this.isNew; data['isNormal'] = this.isNormal; data['notExamined'] = this.notExamined; data['patientMRN'] = this.patientMRN; diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart index 5a717a4e..393af944 100644 --- a/lib/models/SOAP/my_selected_examination.dart +++ b/lib/models/SOAP/my_selected_examination.dart @@ -5,13 +5,17 @@ class MySelectedExamination { String remark; bool isNormal; bool isAbnormal; + bool notExamined; + bool isNew; int createdBy; MySelectedExamination( {this.selectedExamination, this.remark, - this.isNormal = true, + this.isNormal = false, this.isAbnormal = false, + this.notExamined = true, + this.isNew = true, this.createdBy}); MySelectedExamination.fromJson(Map json) { @@ -19,8 +23,10 @@ class MySelectedExamination { ? new MasterKeyModel.fromJson(json['selectedExamination']) : null; remark = json['remark']; - remark = json['isNormal']; - remark = json['isAbnormal']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + isNew = json['isNew']; createdBy = json['createdBy']; } @@ -33,6 +39,8 @@ class MySelectedExamination { data['remark'] = this.remark; data['isNormal'] = this.isNormal; data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['isNew'] = this.isNew; data['createdBy'] = this.createdBy; return data; } diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index 46a104f1..d1b64837 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -25,75 +25,91 @@ class PostPhysicalExamRequestModel { } } -class ListHisProgNotePhysicalExaminationVM { - int episodeId; - int appointmentNo; - int examType; - int examId; - int patientMRN; - bool isNormal; - bool isAbnormal; - String remarks; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - bool notExamined; - MasterKeyModel masterDescription; + class ListHisProgNotePhysicalExaminationVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + bool notExamined; + String examName; + String examinationTypeName; + int examinationType; + String remarks; + bool isNew; + int createdBy; + String createdOn; + String createdByName; + int editedBy; + String editedOn; + String editedByName; - ListHisProgNotePhysicalExaminationVM( - {this.episodeId, - this.appointmentNo, - this.examType, - this.examId, - this.patientMRN, - this.isNormal, - this.isAbnormal, - this.remarks, - this.createdBy, - this.createdOn, - this.editedBy, - this.editedOn, - this.notExamined, - this.masterDescription}); + ListHisProgNotePhysicalExaminationVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.notExamined, + this.examName, + this.examinationTypeName, + this.examinationType, + this.remarks, + this.isNew, + this.createdBy, + this.createdOn, + this.createdByName, + this.editedBy, + this.editedOn, + this.editedByName}); - ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { - episodeId = json['episodeId']; - appointmentNo = json['appointmentNo']; - examType = json['examType']; - examId = json['examId']; - patientMRN = json['patientMRN']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - remarks = json['remarks']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - editedBy = json['editedBy']; - editedOn = json['editedOn']; - notExamined = json['notExamined']; - masterDescription = json['masterDescription'] != null - ? new MasterKeyModel.fromJson(json['masterDescription']) - : null; - } + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + examName = json['examName']; + examinationTypeName = json['examinationTypeName']; + examinationType = json['examinationType']; + remarks = json['remarks']; + isNew = json['isNew']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + createdByName = json['createdByName']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + editedByName = json['editedByName']; + } - Map toJson() { - final Map data = new Map(); - data['episodeId'] = this.episodeId; - data['appointmentNo'] = this.appointmentNo; - data['examType'] = this.examType; - data['examId'] = this.examId; - data['patientMRN'] = this.patientMRN; - data['isNormal'] = this.isNormal; - data['isAbnormal'] = this.isAbnormal; - data['remarks'] = this.remarks; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['editedBy'] = this.editedBy; - data['editedOn'] = this.editedOn; - data['notExamined'] = this.notExamined; - if (this.masterDescription != null) { - data['masterDescription'] = this.masterDescription.toJson(); + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['examName'] = this.examName; + data['examinationTypeName'] = this.examinationTypeName; + data['examinationType'] = this.examinationType; + data['remarks'] = this.remarks; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['createdByName'] = this.createdByName; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['editedByName'] = this.editedByName; + return data; } - return data; } -} \ No newline at end of file diff --git a/lib/routes.dart b/lib/routes.dart index 8f2b08a4..a339e664 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -45,6 +45,7 @@ import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; import 'screens/patients/profile/admission-request/admission-request-detail-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; @@ -137,9 +138,10 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), - PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), + PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), 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/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 1e68d196..0b13bd2d 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -419,93 +419,6 @@ class _PatientSearchScreenState extends State { SizedBox( height: 10, ), - Container( - height: 40.0, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1.0, - style: BorderStyle.solid, - color: HexColor("#CCCCCC")), - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - ), - ), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: _selectedLocation, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return LOCATIONS.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text-ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - ], - ); - }).toList(); - }, - onChanged: (String newValue) { - setState(() { - _selectedLocation = newValue; - }); - if (newValue == '1') - { - _patientSearchFormValues - .PatientOutSA = false; - } - else - { - _patientSearchFormValues - .PatientOutSA = true; - } - - }, - items: LOCATIONS.map((item) { - !projectsProvider.isArabic - ? itemText2 = item['text'] - : itemText2 = item['text-ar']; - return DropdownMenuItem( - child: Text( - itemText2, - textAlign: TextAlign.end, - ), - value: item['val'], - ); - }).toList(), - )), - ), - ], - ), - ), - ), SizedBox( height: 10, ), 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-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart new file mode 100644 index 00000000..0c1f0de2 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -0,0 +1,487 @@ +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 AdmissionRequestFirstScreen extends StatefulWidget { + @override + _AdmissionRequestThirdScreenState createState() => + _AdmissionRequestThirdScreenState(); +} + +class _AdmissionRequestThirdScreenState + extends State { + final _dietTypeRemarksController = TextEditingController(); + final _sickLeaveCommentsController = TextEditingController(); + final _postMedicalHistoryController = TextEditingController(); + final _postSurgicalHistoryController = TextEditingController(); + + dynamic _selectedClinic; + dynamic _selectedDoctor; + dynamic _selectedDietType; + + bool _isSickLeaveRequired = false; + bool _patientPregnant = false; + + @override + Widget build(BuildContext context) { + 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( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: (){ + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + 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, + ), + 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, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).patientPregnant, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _patientPregnant, + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: + 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), + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .sickLeaveComments, + null, + false), + enabled: true, + controller: _sickLeaveCommentsController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.dietTypesList != null && + model.dietTypesList.length > 0 + ? () { + 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) + .pastMedicalHistory, + null, + false), + enabled: true, + controller: _postMedicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .pastSurgicalHistory, + null, + false), + enabled: true, + controller: _postSurgicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + ], + ), + ), + ], + ), + ), + ), + 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 && + _sickLeaveCommentsController.text != "" && + _postMedicalHistoryController.text != "" && + _postSurgicalHistoryController.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.isPregnant = + _patientPregnant; + model.admissionRequestData.isSickLeaveRequired = + _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = + _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = + _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = + _selectedDietType != null + ? _selectedDietType['id'] + : 0; + model.admissionRequestData.dietRemarks = + _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = + _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = + _postSurgicalHistoryController.text; + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + ), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List 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-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index aacff6dd..342d2e72 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,62 +1,187 @@ 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'; 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 _treatmentLineController = TextEditingController(); + final _complicationsController = TextEditingController(); + final _otherProceduresController = TextEditingController(); - final _postPlansEstimatedCostController = TextEditingController(); - final _dietTypeRemarksController = TextEditingController(); - DateTime _dischargeDate; - dynamic _selectedDietType; + dynamic _selectedAdmissionType; + dynamic _selectedDiagnosis; + dynamic _selectedIcd; + dynamic _selectedDiagnosisType; @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); return BaseView( - // onModelReady: (model) => model.getMasterLookup(), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, - body: model.doctorsList != null - ? Column( - children: [ - Expanded( - child: SingleChildScrollView( + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ PatientPageHeaderWidget(patient), Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).treatmentLine, + null, + false), + enabled: true, + controller: _treatmentLineController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).complications, + null, + false), + enabled: true, + controller: _complicationsController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).otherProcedure, + null, + false), + enabled: true, + controller: _otherProceduresController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.admissionTypeList != null && + model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > 0) { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).admissionType, + _selectedAdmissionType != null + ? _selectedAdmissionType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), SizedBox( height: 16, ), AppText( - TranslationBase.of(context).postPlansEstimatedCost, + TranslationBase.of(context).diagnosisDetail, fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, ), @@ -64,50 +189,105 @@ class _AdmissionRequestThirdScreenState extends State 0 + ? () { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDiagnosis().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.diagnosisTypesList.length > 0) { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .postPlansEstimatedCost, - null, - false), - enabled: true, - controller: _postPlansEstimatedCostController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnosis, + _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), 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; + 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) - .expectedAdmissionDate, - _dischargeDate != null - ? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}" + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).icd, + _selectedIcd != null + ? _selectedIcd['description'] : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + true), enabled: false, ), ), @@ -118,36 +298,59 @@ class _AdmissionRequestThirdScreenState extends State 0 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { + 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(() { - _selectedDoctor = selectedValue; + _selectedDiagnosisType = + selectedValue; }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ null, + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).dietType, - /* _admissionType != null - ? _admissionType['DoctorName'] - :*/ null, + TranslationBase.of(context).diagnoseType, + _selectedDiagnosisType != null + ? _selectedDiagnosisType['description'] + : null, true), enabled: false, ), @@ -156,53 +359,90 @@ 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, - initialDate: dateTime, - firstDate: DateTime.now(), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, + builder: (BuildContext context) { + return dialog; + }, ); - if (picked != null && picked != dateTime) { - updateDate(picked); - } } } 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..91885724 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'; @@ -30,425 +32,410 @@ class AdmissionRequestSecondScreen extends StatefulWidget { class _AdmissionRequestSecondScreenState extends State { + final _postPlansEstimatedCostController = TextEditingController(); + final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); - final _treatmentLineController = TextEditingController(); - final _preOperativeOrdersController = TextEditingController(); + final _otherDepartmentsInterventionsController = TextEditingController(); + DateTime _expectedAdmissionDate; - bool _emergencyAdmission = false; - bool _patientPregnant = false; - bool _preAnesthesiaReferred = false; + + dynamic _selectedFloor; dynamic _selectedWard; - dynamic _selectedAdmissionType; - dynamic _selectedDiagnosis; - dynamic _selectedAllergies; + dynamic _selectedRoomCategory; @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); return BaseView( 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), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).otherInformation, - 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) - .expectedDays, - null, - false), - enabled: true, - controller: _expectedDaysController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Container( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + 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, + ), + Container( height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_expectedAdmissionDate == null) { - _expectedAdmissionDate = DateTime.now(); - } - _selectDate( - context, _expectedAdmissionDate, - (picked) { - setState(() { - _expectedAdmissionDate = picked; - }); + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .estimatedCost, + null, + false), + enabled: true, + controller: _estimatedCostController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + 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( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .otherDepartmentsInterventions, + null, + false), + enabled: true, + controller: + _otherDepartmentsInterventionsController, + keyboardType: TextInputType.multiline, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context).otherInformation, + 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) + .expectedDays, + null, + false), + enabled: true, + controller: _expectedDaysController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; }); - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _expectedAdmissionDate != null - ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .emergencyAdmission, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _emergencyAdmission, - onChanged: (newValue) { - setState(() { - _emergencyAdmission = newValue; }); }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).patientPregnant, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, ), - value: _patientPregnant, - onChanged: (newValue) { - setState(() { - _patientPregnant = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .treatmentLine, - null, - false), - enabled: true, - controller: _treatmentLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.wardList != null && - model.wardList.length > 0 - ? () { + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.floorList != null && + model.floorList.length > 0 + ? () { + openListDialogField( + 'description', + 'floorID', + model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getFloors().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.floorList.length > 0) { openListDialogField('description', - 'description', model.wardList, + 'floorID', model.floorList, (selectedValue) { setState(() { - _selectedWard = selectedValue; + _selectedFloor = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () 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"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).ward, - _selectedWard != null - ? _selectedWard['description'] - : null, - true), - enabled: false, - ), - ), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .preAnesthesiaReferred, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).floor, + _selectedFloor != null + ? _selectedFloor['description'] + : null, + true), + enabled: false, ), - value: _preAnesthesiaReferred, - onChanged: (newValue) { - setState(() { - _preAnesthesiaReferred = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.admissionTypeList != null && - model.admissionTypeList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; }); - } - : () async { - await model.getMasterLookup( - MasterKeysService - .AdmissionRequestType); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > - 0) { - openListDialogField('nameEn', - 'id', model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .admissionType, - _selectedAdmissionType != null - ? _selectedAdmissionType[ - 'nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { setState(() { - _selectedDiagnosis = - selectedValue; + _selectedWard = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - await model.getDiagnosis(); - if (model.state == ViewState.Idle && - model.diagnosisTypesList - .length > - 0) { - openListDialogField( - 'nameEn', - 'id', - model.diagnosisTypesList, - (selectedValue) { - setState(() { - _selectedDiagnosis = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .diagnosis, - _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, - true), - enabled: false, - ), + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).ward, + _selectedWard != null + ? _selectedWard['description'] + : null, + true), + enabled: false, ), ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .preOperativeOrders, - null, - false), - enabled: true, - controller: _preOperativeOrdersController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null && - model.allergiesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.allergiesList, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.roomCategoryList != null && + model.roomCategoryList.length > 0 + ? () { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getRoomCategories().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.roomCategoryList.length > + 0) { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, (selectedValue) { setState(() { - _selectedAllergies = + _selectedRoomCategory = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - await model.getAllergies(); - if (model.state == ViewState.Idle && - model.allergiesList.length > - 0) { - openListDialogField('nameEn', - 'id', model.allergiesList, - (selectedValue) { - setState(() { - _selectedAllergies = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .allergies, - _selectedAllergies != null - ? _selectedAllergies['nameEn'] - : null, - true), - enabled: false, - ), + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .roomCategory, + _selectedRoomCategory != null + ? _selectedRoomCategory[ + 'description'] + : null, + true), + enabled: false, ), ), - ], - ), + ), + SizedBox( + height: 10, + ), + ], ), - ], - ), + ), + ], ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_3, - arguments: {'patient': patient}); - }, - ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () async { + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != "" && + _selectedFloor != null && + _selectedRoomCategory != + null /*_selectedWard is not required*/) { + model.admissionRequestData = admissionRequest; + + model.admissionRequestData.estimatedCost = + int.parse(_estimatedCostController.text); + model.admissionRequestData.elementsForImprovement = + _postPlansEstimatedCostController.text; + + model.admissionRequestData.expectedDays = + int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = + _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData + .otherDepartmentInterventions = + _otherDepartmentsInterventionsController.text; + model.admissionRequestData.admissionLocationID = + _selectedFloor['floorID']; + model.admissionRequestData.wardID = + _selectedWard != null + ? _selectedWard['nursingStationID'] + : 0; + model.admissionRequestData.roomCategoryID = + _selectedRoomCategory['categoryID']; + + model.admissionRequestData.admissionRequestProcedures = + []; + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, ), - ], - ) - : Container(), - ), + ), + ], + ), + )), ); } @@ -486,38 +473,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/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 41f58564..75e4c33b 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -49,7 +49,7 @@ class _LabOrdersScreenState extends State { patientID: patient.patientId, projectID: patient.projectId, tokenID: token, - patientTypeID: patient.patientType, + patientTypeID: patient.patientType??1, languageID: 2); model.getLabResultOrders(labOrdersReqModel.toJson()); @@ -143,6 +143,9 @@ class _LabOrdersScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(model + .patientLabResultOrdersList[index] + .doctorName != null ) AppText( '${model .patientLabResultOrdersList[index] @@ -171,7 +174,7 @@ class _LabOrdersScreenState extends State { MainAxisAlignment.start, children: [ AppText( - ' Invoice No :', + TranslationBase.of(context).invoiceNo, fontSize: 2 * SizeConfig .textMultiplier, @@ -187,6 +190,30 @@ class _LabOrdersScreenState extends State { color: Colors.grey[800], ), ], + ),SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${model + .patientLabResultOrdersList[index] + .orderNo}', + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + ], ) ], ), diff --git a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart index d41f388d..dd8ace01 100644 --- a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart +++ b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart @@ -37,19 +37,39 @@ class _LabResultState extends State { child: ListView( children: [ CardWithBgWidgetNew( - widget: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).invoiceNo, - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + widget: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.orderNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), - AppText( - ' ${widget.labOrders.invoiceNo}', - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).invoiceNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.invoiceNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), + ], ), ), diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 433fe232..f1f3c918 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -154,6 +154,9 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + Navigator.pop(context); } }, ), @@ -174,6 +177,9 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + Navigator.pop(context); } }, ), 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..b2a71f4b 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -91,18 +91,20 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? ReferralForm(model, screenSize) : PatientReferralItemWidget( - "${model.patientReferral[0].patientID}", - patientName: model.patientReferral[0].patientName, + "${model.patientReferral[model.patientReferral.length -1].patientID}", + patientName: model.patientReferral[model.patientReferral.length -1].patientName, referralStatus: - "${model.patientReferral[0].referralStatus}", + "${model.patientReferral[model.patientReferral.length -1].referralStatus}", isReferredTo: true, isSameBranch: model - .patientReferral[0].isReferralDoctorSameBranch, + .patientReferral[model.patientReferral.length -1].isReferralDoctorSameBranch, referralDoctorName: - model.patientReferral[0].referredByDoctorInfo, + model.patientReferral[model.patientReferral.length -1].referredByDoctorInfo, clinicDescription: null, - remark: model.patientReferral[0].remarksFromSource, - referredOn: model.patientReferral[0].referredOn, + remark: model.patientReferral[model.patientReferral.length -1].remarksFromSource, + referredOn: model.patientReferral[model.patientReferral.length -1].referredOn, + answerFromTarget: + model.patientReferral[model.patientReferral.length -1].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/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c192d7b9..813d7064 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -248,6 +248,7 @@ class TranslationBase { localizedValues['errorNoProgressNote'][locale.languageCode]; String get invoiceNo => localizedValues['invoiceNo:'][locale.languageCode]; + String get orderNo => localizedValues['orderNo'][locale.languageCode]; String get generalResult => localizedValues['generalResult'][locale.languageCode]; @@ -725,6 +726,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 +765,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 +870,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]; @@ -940,6 +947,7 @@ class TranslationBase { String get allergicTO => localizedValues['allergicTO'][locale.languageCode]; String get normal => localizedValues['normal'][locale.languageCode]; + String get notExamined => localizedValues['notExamined'][locale.languageCode]; String get abnormal => localizedValues['abnormal'][locale.languageCode]; @@ -1077,12 +1085,25 @@ 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 referralSuccessMsgAccept => localizedValues['referralSuccessMsgAccept'][locale.languageCode]; + String get referralSuccessMsgReject => localizedValues['referralSuccessMsgReject'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; - String get appointmentNumber => - localizedValues['appointmentNumber'][locale.languageCode]; + String get appointmentNumber => localizedValues['appointmentNumber'][locale.languageCode]; + String get sickLeaveComments => localizedValues['sickLeaveComments'][locale.languageCode]; + String get pastMedicalHistory => localizedValues['pastMedicalHistory'][locale.languageCode]; + String get pastSurgicalHistory => localizedValues['pastSurgicalHistory'][locale.languageCode]; + String get complications => localizedValues['complications'][locale.languageCode]; + String get floor => localizedValues['floor'][locale.languageCode]; + String get roomCategory => localizedValues['roomCategory'][locale.languageCode]; + String get otherDepartmentsInterventions => localizedValues['otherDepartmentsInterventions'][locale.languageCode]; + String get otherProcedure => localizedValues['otherProcedure'][locale.languageCode]; + String get admissionRequestSuccessMsg => localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/lab_result_widget.dart b/lib/widgets/doctor/lab_result_widget.dart index 8b2ab0c4..e897f33e 100644 --- a/lib/widgets/doctor/lab_result_widget.dart +++ b/lib/widgets/doctor/lab_result_widget.dart @@ -27,7 +27,7 @@ class _LabResultWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index ab89ab33..ee54917b 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, }); @@ -173,6 +175,7 @@ class PatientReferralItemWidget extends StatelessWidget { height: 8, ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).referralRemark, @@ -180,11 +183,13 @@ class PatientReferralItemWidget extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 12, ), - AppText( - remark, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 12, + Expanded( + child: AppText( + remark, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), ), ], ), @@ -207,6 +212,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/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index d18fdf3d..e98c2de4 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,16 +25,20 @@ class LargeAvatar extends StatelessWidget { Widget _getAvatar() { if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) { - return Center( + return CircleAvatar( + radius: + SizeConfig.imageSizeMultiplier * 12, + // radius: (52) child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius:BorderRadius.circular(50), + child: Image.network( - url.trim(), - fit: BoxFit.cover, - width: width, - height: height, + url, + fit: BoxFit.fill, + width: 700, ), ), + backgroundColor: Colors.transparent, ); } else if (name == null || name.isEmpty) { return Center( diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 542d4196..ddb7b9d6 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -491,6 +491,10 @@ class AddAssessmentDetails extends StatefulWidget { class _AddAssessmentDetailsState extends State { TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController(); + TextEditingController conditionController = TextEditingController(); + TextEditingController typeController = TextEditingController(); + TextEditingController icdNameController = TextEditingController(); + GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; @@ -501,31 +505,52 @@ class _AddAssessmentDetailsState extends State { remarkController.text = widget.mySelectedAssessment.remark ?? ""; appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString(); - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown, {IconData icon}) { - //TODO: make one Input InputDecoration for all + if(widget.isUpdate){ + if(widget.mySelectedAssessment + .selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + if(widget.mySelectedAssessment + .selectedDiagnosisType !=null) + typeController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisType + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisType + .nameEn; + if(widget.mySelectedAssessment.selectedICD !=null) + icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + } + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), + fontSize: 10, + color: Theme.of(context).hintColor, + fontWeight: FontWeight.w700), ); } return FractionallySizedBox( @@ -590,46 +615,109 @@ class _AddAssessmentDetailsState extends State { height: 10, ), Container( - height: screenSize.height * 0.070, + height: screenSize.height * 0.080, child: InkWell( - onTap: model.listOfDiagnosisType != null - ? () { - setState(() { - widget.mySelectedAssessment.selectedICD = null; - }); - } - : null, + onTap: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .nameOrICD, + widget.mySelectedAssessment.selectedICD != + null ? widget.mySelectedAssessment + .selectedICD.nameEn : null, true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() + { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text =item.code; + }), key: key, suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => new Padding( - child:Texts( suggestion.description +" / "+ suggestion.code.toString()), + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + suggestion.description + " / " + + suggestion.code.toString()), padding: EdgeInsets.all(8.0)), itemSorter: (a, b) => 1, itemFilter: (suggestion, input) => - suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.description.toLowerCase().startsWith(input.toLowerCase()) - ||suggestion.code.toLowerCase().startsWith(input.toLowerCase()) + suggestion.description.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.description.toLowerCase() + .startsWith(input.toLowerCase()) + || suggestion.code.toLowerCase().startsWith( + input.toLowerCase()) , - ): TextField( - decoration: textFieldSelectorDecoration( - widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", - widget.mySelectedAssessment.selectedICD != null ? projectViewModel.isArabic?widget.mySelectedAssessment.selectedICD.nameAr:widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - enabled: false, - ), - ), + ) + : TextFields( + onTapTextFields: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment.selectedICD = + null; + icdNameController.text = null; + }); + } + : null, + hasLabelText: icdNameController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .nameOrICD, + fontSize: 13.5, + readOnly: true, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: icdNameController, + suffixIcon: EvaIcons.search, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }) + + // TextField( + // decoration: textFieldSelectorDecoration( + // widget.mySelectedAssessment.selectedICD != + // null ? widget.mySelectedAssessment + // .selectedICD.code : "Name or ICD", + // widget.mySelectedAssessment.selectedICD != + // null ? projectViewModel.isArabic + // ? widget.mySelectedAssessment + // .selectedICD.nameAr + // : widget.mySelectedAssessment + // .selectedICD.nameEn : null, true, + // icon: EvaIcons.search), + // enabled: false, + // ), + ), ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedICD == null) + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedICD == null) CustomValidationError(), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisCondition != + TextFields( + onTapTextFields: model + .listOfDiagnosisCondition != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -643,6 +731,14 @@ class _AddAssessmentDetailsState extends State { widget.mySelectedAssessment .selectedDiagnosisCondition = selectedValue; + conditionController.text = + projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; }); }, ); @@ -655,32 +751,39 @@ class _AddAssessmentDetailsState extends State { ); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).condition, - widget.mySelectedAssessment - .selectedDiagnosisCondition != null - ? projectViewModel.isArabic?widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameAr:widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn - : null, - true), - enabled: false, - ), - ), - ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisCondition == null) + hasLabelText: conditionController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .condition, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: conditionController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == null) CustomValidationError(), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisType != null + + + TextFields( + onTapTextFields: model + .listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisType, @@ -695,6 +798,12 @@ class _AddAssessmentDetailsState extends State { widget.mySelectedAssessment .selectedDiagnosisType = selectedValue; + typeController.text = + projectViewModel.isArabic + ? selectedValue + .nameAr + : selectedValue + .nameEn; }); }, ); @@ -707,22 +816,30 @@ class _AddAssessmentDetailsState extends State { ); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).dType, - widget.mySelectedAssessment - .selectedDiagnosisType != null - ?projectViewModel.isArabic?widget.mySelectedAssessment - .selectedDiagnosisType.nameAr: widget.mySelectedAssessment - .selectedDiagnosisType.nameEn - : null, - true), - enabled: false, - ), - ), - ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisType == null) + hasLabelText: typeController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .dType, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: typeController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == null) CustomValidationError(), SizedBox( height: 10, @@ -731,17 +848,21 @@ class _AddAssessmentDetailsState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: TranslationBase.of(context).remarks, + hintText: TranslationBase + .of(context) + .remarks, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 18, minLines: 5, - hasLabelText: remarkController.text != ''?true:false, + hasLabelText: remarkController.text != + '' ? true : false, showLabelText: true, controller: remarkController, - onChanged:(value) { - widget.mySelectedAssessment.remark = remarkController.text; + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; }, validator: (value) { if (value == null) diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index 93182207..af960ff7 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -85,6 +85,8 @@ class _UpdateObjectivePageState extends State { remark: element.remarks, isNormal: element.isNormal, createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, isAbnormal: element.isAbnormal); widget.mySelectedExamination.add(tempEam); }); @@ -243,9 +245,10 @@ class _UpdateObjectivePageState extends State { onTap: () { setState(() { examination.isAbnormal = - !examination.isAbnormal; + false; examination.isNormal = - !examination.isNormal; + true; + examination.notExamined = false; }); }), SizedBox( @@ -290,12 +293,63 @@ class _UpdateObjectivePageState extends State { ), )), ), + onTap: () { + setState(() { + examination.isNormal = + false; + examination.isAbnormal = + true; + examination.notExamined = false; + }); + }),SizedBox( + width: 12, + ), + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + examination + .notExamined + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Not Examined", + style: TextStyle( + fontSize: 12, + color: + examination + .notExamined + ? Colors.white + : Colors + .black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), + ), + )), + ), onTap: () { setState(() { examination.isAbnormal = - !examination.isAbnormal; + false; examination.isNormal = - !examination.isNormal; + false; + examination.notExamined = true; }); }), ], @@ -394,13 +448,17 @@ class _UpdateObjectivePageState extends State { examType: exam.selectedExamination.typeId, isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false + // masterDescription: exam.selectedExamination, + notExamined: exam.notExamined, + examinationType: exam.isNormal?1:exam.isAbnormal?2:3, + examinationTypeName: exam.isNormal?"Normal":exam.isAbnormal?'AbNormal':"Not Examined", + isNew:exam.isNew )); }); if(model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); } else { await model.patchPhysicalExam(postPhysicalExamRequestModel); 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), ), ), ), ], ), - )); } }