diff --git a/debug_info/app.android-arm.symbols b/debug_info/app.android-arm.symbols new file mode 100644 index 00000000..ff3e93b3 Binary files /dev/null and b/debug_info/app.android-arm.symbols differ diff --git a/debug_info/app.android-arm64.symbols b/debug_info/app.android-arm64.symbols new file mode 100644 index 00000000..b0d27ded Binary files /dev/null and b/debug_info/app.android-arm64.symbols differ diff --git a/debug_info/app.android-x64.symbols b/debug_info/app.android-x64.symbols new file mode 100644 index 00000000..69be506d Binary files /dev/null and b/debug_info/app.android-x64.symbols differ diff --git a/debug_info_ios/app.ios-arm64.symbols b/debug_info_ios/app.ios-arm64.symbols new file mode 100644 index 00000000..79e8852c Binary files /dev/null and b/debug_info_ios/app.ios-arm64.symbols differ diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 25fb7fb6..c5ff5d37 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 13.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index bb5920c1..47198fbc 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -506,7 +506,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.1; + MARKETING_VERSION = 1.3.99; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -637,15 +637,12 @@ ); INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.1; + MARKETING_VERSION = 1.3.99; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -679,7 +676,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.1; + MARKETING_VERSION = 1.3.99; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a6b826db..4ba725f4 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -40,7 +40,7 @@ (AppGlobal.CONTEX, listen: false).logout(); diff --git a/lib/config/config.dart b/lib/config/config.dart index 56335ddc..e7423937 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -9,9 +9,9 @@ const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/'; // const BASE_URL_LIVE_CARE = 'https://livecareuat.hmg.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; -//const BASE_URL = 'https://webservices.hmg.com/'; +const BASE_URL = 'https://webservices.hmg.com/'; // const BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; //Vida Plus URL @@ -144,6 +144,7 @@ const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcompl const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const POST_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PostAssessment'; +const IS_PRESCRIPTION_ORDER_CREATED = 'Services/DoctorApplication.svc/REST/IsPresecriptionOrderCreated'; const PATCH_ALLERGY = 'Services/DoctorApplication.svc/REST/PatchAllergies'; const PATCH_HISTORY = 'Services/DoctorApplication.svc/REST/PatchHistory'; @@ -189,7 +190,8 @@ const GET_MY_REFERRAL_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GtMyRef const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; -const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; +// const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; +const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_Async"; const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -202,6 +204,8 @@ const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptio const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; const UPDATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/UpdateProgressNoteForInPatient"; const CREATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/CreateProgressNoteForInPatient"; +const IS_PRINCIPAL_COVERED = "Services/DoctorApplication.svc/REST/IsPrincipalDiagnosisCovered"; +const GET_ICD10DISEASE = "Services/DoctorApplication.svc/REST/GetICD10DiseaseForItemId"; const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave"; const GET_MY_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GetMyOutPatient"; @@ -277,6 +281,10 @@ const DOCTOR_ER_SIGN_ASSESSMENT = "Services/DoctorApplication.svc/REST/DoctorApp const DOCTOR_SCHEDULE = "api/ScheduledSchedule/GetallSchedulebyUser"; +const DOCTOR_RADIOLOGY_CRITICAL_FINDINGS = "Services/DoctorApplication.svc/REST/FetchRadCriticalFinding"; + +const ACKNOWLEDGE_RADIOLOGY_CRITICAL_FINDINGS = "Services/DoctorApplication.svc/REST/Acknowledgeradcriticalfindings"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ @@ -309,7 +317,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 8.7; +const VERSION_ID = 8.9; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index dfdcbd8e..c31788f9 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -669,6 +669,11 @@ const Map> localizedValues = { "en": "Add Assessment Details", "ar": "أضف تفاصيل التقييم" }, + "updateAssessmentDetails": { + "en": "Update Assessment Details", + "ar":"تحديث تفاصيل التقييم" + }, + "progressNoteSOAP": {"en": "Progress Note", "ar": "ملاحظة التقدم"}, "addProgressNote": {"en": "Add Progress Note", "ar": "أضف ملاحظة التقدم"}, "createdBy": {"en": "Created By :", "ar": "أضيفت عن طريق: "}, @@ -1149,6 +1154,13 @@ const Map> localizedValues = { "doctorSchedule": {"en": "Doctor Schedule", "ar":"جدول الطبيب"}, "doctorRota": {"en": "Doctor Rota", "ar":"دوران الطبيب"}, "dateFrom": {"en": "Date From", "ar":"التاريخ من"}, - "searchFindSchedule": {"en": "Search and find out the doctor’s schedule ", "ar":"بحث ومعرفة جدول الطبيب"} + "searchFindSchedule": {"en": "Search and find out the doctor’s schedule ", "ar":"بحث ومعرفة جدول الطبيب"}, + "onePrimaryDiagnosis": {"en": "There has to be at-least 1 principal diagnosis", "ar":"يجب أن يكون هناك تشخيص رئيسي واحد على الأقل"}, + "principalDiagnosisCannot": {"en": "Principal Diagnosis cannot modify once the order created", "ar":"لا يمكن تعديل التشخيص الرئيسي بمجرد إنشاء الطلب"}, + "afterOrderCreation": {"en": "After order created, you cannot modify the principal diagnosis, Do you want to continue?", "ar":"بعد إنشاء الطلب، لا يمكنك تعديل التشخيص الأساسي، هل تريد المتابعة؟"}, + "principalCoveredOrNot": {"en": "Principal Diagnosis is not covered for this patient", "ar":"لا يتم تغطية التشخيص الرئيسي لهذا المريض"}, + "complexDiagnosis": {"en": "Complex Diagnosis", "ar":"التشخيص المعقد"}, + + }; diff --git a/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart b/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart index c52a6a51..2e35063a 100644 --- a/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart +++ b/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart @@ -1,7 +1,49 @@ -class PatchAssessmentReqModel { +class PostAssessmentRequestUpdateModel { int? patientMRN; int? appointmentNo; - int? episodeID; + int? episodeId; + String? createdByName; + int? createdBy; + List? icdCodeDetails; + + PostAssessmentRequestUpdateModel( + {this.patientMRN, + this.appointmentNo, + this.episodeId, + this.createdByName, + this.createdBy, + this.icdCodeDetails}); + + PostAssessmentRequestUpdateModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeID']; + createdByName = json['CreatedByName']; + createdBy= json['CreatedBy']; + if (json['icdCodeDetails'] != null) { + icdCodeDetails = []; + json['icdCodeDetails'].forEach((v) { + icdCodeDetails!.add(new IcdCodeDetailsUpdate.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeId; + data['CreatedByName'] = this.createdByName; + data['CreatedBy'] = this.createdBy; + if (this.icdCodeDetails != null) { + data['icdCodeDetails'] = + this.icdCodeDetails!.map((v) => v?.toJson()).toList(); + } + return data; + } +} + +class IcdCodeDetailsUpdate { String? icdcode10Id; String? prevIcdCode10ID; int? conditionId; @@ -9,40 +51,35 @@ class PatchAssessmentReqModel { bool? complexDiagnosis; String? remarks; - PatchAssessmentReqModel( - {this.patientMRN, - this.appointmentNo, - this.episodeID, - this.icdcode10Id, - this.prevIcdCode10ID, - this.conditionId, - this.diagnosisTypeId, - this.complexDiagnosis, - this.remarks}); - - PatchAssessmentReqModel.fromJson(Map json) { - patientMRN = json['PatientMRN']; - appointmentNo = json['AppointmentNo']; - episodeID = json['EpisodeID']; - icdcode10Id = json['Icdcode10Id']; - prevIcdCode10ID = json['PrevIcdCode10ID']; - conditionId = json['ConditionId']; - diagnosisTypeId = json['DiagnosisTypeId']; - complexDiagnosis = json['ComplexDiagnosis']; - remarks = json['Remarks']; + IcdCodeDetailsUpdate( + {this.icdcode10Id, + this.conditionId, + this.prevIcdCode10ID, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + IcdCodeDetailsUpdate.fromJson(Map json) { + icdcode10Id = json['icdcode10Id']; + conditionId = json['conditionId']; + prevIcdCode10ID = json['prevIcdCode10ID']; + diagnosisTypeId = json['diagnosisTypeId']; + complexDiagnosis = json['complexDiagnosis']; + remarks = json['remarks']; } Map toJson() { final Map data = new Map(); - data['PatientMRN'] = this.patientMRN; - data['AppointmentNo'] = this.appointmentNo; - data['EpisodeID'] = this.episodeID; - data['Icdcode10Id'] = this.icdcode10Id; - data['PrevIcdCode10ID'] = this.prevIcdCode10ID; - data['ConditionId'] = this.conditionId; - data['DiagnosisTypeId'] = this.diagnosisTypeId; - data['ComplexDiagnosis'] = this.complexDiagnosis; - data['Remarks'] = this.remarks; + data['icdcode10Id'] = this.icdcode10Id; + data['conditionId'] = this.conditionId; + data['prevIcdCode10ID'] = this.prevIcdCode10ID; + data['diagnosisTypeId'] = this.diagnosisTypeId; + data['complexDiagnosis'] = this.complexDiagnosis; + data['remarks'] = this.remarks; return data; } } + + + + diff --git a/lib/core/model/SOAP/master_key_model.dart b/lib/core/model/SOAP/master_key_model.dart index 0f1a4c5a..2fc37ffb 100644 --- a/lib/core/model/SOAP/master_key_model.dart +++ b/lib/core/model/SOAP/master_key_model.dart @@ -2,6 +2,8 @@ class MasterKeyModel { String? alias; String? aliasN; dynamic code; + dynamic codeId; + dynamic asciiDesc; dynamic description; dynamic detail1; dynamic detail2; @@ -20,6 +22,8 @@ class MasterKeyModel { {this.alias, this.aliasN, this.code, + this.codeId, + this.asciiDesc, this.description, this.detail1, this.detail2, @@ -39,6 +43,8 @@ class MasterKeyModel { aliasN = json['aliasN']; code = json['code']; description = json['description']; + codeId = json['codeId']; + asciiDesc = json['asciiDesc']; detail1 = json['detail1']; detail2 = json['detail2']; detail3 = json['detail3']; @@ -59,6 +65,8 @@ class MasterKeyModel { data['aliasN'] = this.aliasN; data['code'] = this.code; data['description'] = this.description; + data['codeId'] = this.codeId; + data['asciiDesc'] = this.asciiDesc; data['detail1'] = this.detail1; data['detail2'] = this.detail2; data['detail3'] = this.detail3; diff --git a/lib/core/model/dashboard/radiology_critical_finding_model.dart b/lib/core/model/dashboard/radiology_critical_finding_model.dart new file mode 100644 index 00000000..ddb1aca3 --- /dev/null +++ b/lib/core/model/dashboard/radiology_critical_finding_model.dart @@ -0,0 +1,60 @@ +class RadiologyCriticalFindingModel { + String? clinicName; + String? doctorName; + String? imageURL; + int? invoiceLineItemNo; + int? invoiceNo; + String? notificationMesssage; + int? patientId; + String? patientName; + String? procedureName; + String? reportData; + String? reportOn; + String? resultFindings; + + RadiologyCriticalFindingModel( + {this.clinicName, + this.doctorName, + this.imageURL, + this.invoiceLineItemNo, + this.invoiceNo, + this.notificationMesssage, + this.patientId, + this.patientName, + this.procedureName, + this.reportData, + this.reportOn, + this.resultFindings}); + + RadiologyCriticalFindingModel.fromJson(Map json) { + clinicName = json['clinicName']; + doctorName = json['doctorName']; + imageURL = json['imageURL']; + invoiceLineItemNo = json['invoiceLineItemNo']; + invoiceNo = json['invoiceNo']; + notificationMesssage = json['notificationMesssage']; + patientId = json['patientId']; + patientName = json['patientName']; + procedureName = json['procedureName']; + reportData = json['reportData']; + reportOn = json['reportOn']; + resultFindings = json['resultFindings']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicName'] = this.clinicName; + data['doctorName'] = this.doctorName; + data['imageURL'] = this.imageURL; + data['invoiceLineItemNo'] = this.invoiceLineItemNo; + data['invoiceNo'] = this.invoiceNo; + data['notificationMesssage'] = this.notificationMesssage; + data['patientId'] = this.patientId; + data['patientName'] = this.patientName; + data['procedureName'] = this.procedureName; + data['reportData'] = this.reportData; + data['reportOn'] = this.reportOn; + data['resultFindings'] = this.resultFindings; + return data; + } +} diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 9538c3d9..303bcd79 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -17,7 +17,8 @@ class AuthenticationService extends BaseService { List get dashboardItemsList => _imeiDetails; NewLoginInformationModel _loginInfo = NewLoginInformationModel(); - + String _errorCode =''; + String get errorCode => _errorCode; NewLoginInformationModel get loginInfo => _loginInfo; SendActivationCodeForDoctorAppResponseModel _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); @@ -105,12 +106,22 @@ class AuthenticationService extends BaseService { _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); try { await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { - _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel.fromJson(response); + if(response['ErrorCode'] =='699'){ + _errorCode = response['ErrorCode']; + hasError = true; + super.error = response['ErrorEndUserMessage']; + }else { + _errorCode =''; + _checkActivationCodeForDoctorAppRes = + CheckActivationCodeForDoctorAppResponseModel.fromJson(response); + } }, onFailure: (String error, int statusCode) { + _errorCode =''; hasError = true; super.error = error; }, body: checkActivationCodeRequestModel.toJson()); } catch (error) { + _errorCode =''; hasError = true; super.error = error.toString(); } diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index 27b5ee57..4d666070 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/dashboard/radiology_critical_finding_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/dashboard/dashboard_model.dart'; @@ -7,8 +8,12 @@ import '../../model/dashboard/doctor_schedule.dart'; class DashboardService extends BaseService { List _dashboardItemsList = []; + RadiologyCriticalFindingModel? _radiologyCriticalFindingModel; + List get dashboardItemsList => _dashboardItemsList; - + + RadiologyCriticalFindingModel? get radiologyCriticalFindingModel => _radiologyCriticalFindingModel; + bool hasVirtualClinic = false; String? sServiceID; @@ -48,4 +53,46 @@ class DashboardService extends BaseService { }, ); } + + Future acknowledgeDoctorHasRadiologyFindings(String invoiceNo, String invoiceLineItemNo) async { + hasError = false; + await getDoctorProfile(isGetProfile: true); + await baseAppClient.post( + ACKNOWLEDGE_RADIOLOGY_CRITICAL_FINDINGS, + onSuccess: (dynamic response, int statusCode) { + // _radiologyCriticalFindingModel = RadiologyCriticalFindingModel.fromJson(response["RadiologyVMEntityListInfoResponse"]["entityList"][0]); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "DoctorID": doctorProfile?.doctorID, // test user 9920 + "LoginDoctorID": doctorProfile?.doctorID, + "invoiceNo": invoiceNo, + "invoiceLineItemNo": invoiceLineItemNo, + }, + ); + } + + Future checkDoctorHasRadiologyFindings() async { + hasError = false; + await getDoctorProfile(isGetProfile: true); + await baseAppClient.post( + DOCTOR_RADIOLOGY_CRITICAL_FINDINGS, + onSuccess: (dynamic response, int statusCode) { + if(response["RadiologyVMEntityListInfoResponse"]["entityList"].length != 0) { + _radiologyCriticalFindingModel = RadiologyCriticalFindingModel.fromJson(response["RadiologyVMEntityListInfoResponse"]["entityList"][0]); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "DoctorID": doctorProfile?.doctorID, // test user 9920 + "LoginDoctorID": doctorProfile?.doctorID + }, + ); + } } diff --git a/lib/core/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index 2769ece9..c6749578 100644 --- a/lib/core/service/patient_medical_file/prescription/prescription_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescription_service.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart'; @@ -49,6 +50,8 @@ class PrescriptionService extends LookupService { List itemMedicineList = []; List itemMedicineListRoute = []; List itemMedicineListUnit = []; + List icd10CodeListByItem =[]; + bool isDiagnosisCovered =true; dynamic boxQuantity; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); @@ -373,4 +376,41 @@ class PrescriptionService extends LookupService { super.error = error; }, body: _getMedicationForInPatientRequestModel.toJson()); } + + Future isPrincipalCovered(PatiantInformtion patient) async { + hasError = false; + + await baseAppClient.post(IS_PRINCIPAL_COVERED, + body:{ + "PatientID":patient.patientId, + "EncounterNo":patient.appointmentNo ?? 0, + "EncounterType":patient.appointmentTypeId ?? 0, + "DoctorID":patient.doctorId, + }, onSuccess: (dynamic response, int statusCode) { + isDiagnosisCovered = response['IsDiagnosisCovered']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + Future getIcd10DISESECode(PatiantInformtion patient, int itemID) async { + hasError = false; + + await baseAppClient.post(GET_ICD10DISEASE, + body:{ + "PatientMRN":patient.patientId, + "ItemID":itemID, + "DoctorID":patient.doctorId, + }, onSuccess: (dynamic response, int statusCode) { + icd10CodeListByItem.clear(); + Map data = response['List_ICD10Desease']; + data['entityList'].forEach((v) { + icd10CodeListByItem.add(MasterKeyModel.fromJson(v)); + }); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } } diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index cc47775c..ab87eeb8 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_mod import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/patch_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; @@ -22,6 +21,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressN import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; +import '../../../model/SOAP/assessment/patch_assessment_req_model.dart'; +import '../../../model/patient/patiant_info_model.dart'; import '../../base/lookup-service.dart'; class SOAPService extends LookupService { @@ -33,7 +34,7 @@ class SOAPService extends LookupService { List patientAssessmentList = []; int? episodeID; - + bool isPrescriptionOrder =false; Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { hasError = false; @@ -196,9 +197,9 @@ class SOAPService extends LookupService { } Future patchAssessment( - PatchAssessmentReqModel patchAssessmentRequestModel) async { + PostAssessmentRequestUpdateModel patchAssessmentRequestModel) async { hasError = false; - await baseAppClient.post(PATCH_ASSESSMENT, + await baseAppClient.post(POST_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { @@ -317,4 +318,22 @@ class SOAPService extends LookupService { super.error = error; }, body: getEpisodeForInpatientReqModel.toJson()); } + Future isPrescriptionOrderCreated( + PatiantInformtion patientInfo) async { + hasError = false; + await baseAppClient.post(IS_PRESCRIPTION_ORDER_CREATED, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + + isPrescriptionOrder = response['IsPrescriptionCreated']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "PatientMRN":patientInfo.patientMRN, + "EncounterNo":patientInfo.appointmentNo, + "EncounterType":patientInfo.appointmentTypeId, + "DoctorID":patientInfo.doctorId, + }); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 85b68b85..90efa658 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -4,7 +4,6 @@ import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_mod import 'package:doctor_app_flutter/core/model/SOAP/Allergy/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/patch_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart'; @@ -23,19 +22,20 @@ import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/soap/SOAP_service.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; -import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; -import 'package:doctor_app_flutter/core/service/patient_medical_file/soap/SOAP_service.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; import '../../locator.dart'; +import '../model/SOAP/assessment/patch_assessment_req_model.dart'; import 'base_view_model.dart'; class SOAPViewModel extends BaseViewModel { @@ -78,8 +78,8 @@ class SOAPViewModel extends BaseViewModel { List get patientAssessmentList => _SOAPService.patientAssessmentList; - int get episodeID => _SOAPService.episodeID!; - + int? get episodeID => _SOAPService.episodeID; + bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; bool isAddProgress = true; bool isAddExamInProgress = true; String progressNoteText = ""; @@ -220,9 +220,9 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async { + Future patchAssessment(PostAssessmentRequestUpdateModel patchAssessmentRequestModel) async { setState(ViewState.BusyLocal); - await _SOAPService.patchAssessment(patchAssessmentRequestModel); + await _SOAPService.patchAssessment(patchAssessmentRequestModel!); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -622,6 +622,18 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + + Future isPrescriptionOrderCreated(PatiantInformtion patientInfo) async{ + setState(ViewState.BusyLocal); + await _SOAPService.isPrescriptionOrderCreated(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + postSubjectServices({patientInfo, String? complaintsText, String? medicationText, String? illnessText, List? myHistoryList, List? myAllergiesList}) async { List services = []; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index af282ea4..28279db7 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -37,6 +37,7 @@ enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED, UNVERIFIED } class AuthenticationViewModel extends BaseViewModel { AuthenticationService _authService = locator(); HospitalsService _hospitalsService = locator(); + get errorCode => _authService.errorCode; List get imeiDetails => _authService.dashboardItemsList; @@ -198,6 +199,7 @@ class AuthenticationViewModel extends BaseViewModel { error = _authService.error; setState(ViewState.ErrorLocal); } else { + await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes); setState(ViewState.Idle); } @@ -333,13 +335,19 @@ class AuthenticationViewModel extends BaseViewModel { getDeviceInfoFromFirebase() async { // await checkIsHuawei(); var token; + var APNSToken; _firebaseMessaging.setAutoInitEnabled(true); if (Platform.isIOS) { _firebaseMessaging.requestPermission(); } setState(ViewState.Busy); try { + if (Platform.isIOS) { + APNSToken = await _firebaseMessaging.getAPNSToken(); + print("APNS TOKEN: $APNSToken"); + } token = await _firebaseMessaging.getToken(); + print("Device TOKEN: $token"); } catch (ex) { print(ex); } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index bfee098b..3ca7d4d5 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -1,7 +1,5 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/model/dashboard/dashboard_model.dart'; -import 'package:doctor_app_flutter/core/model/dashboard/get_special_clinical_care_List_Respose_Model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/core/model/dashboard/radiology_critical_finding_model.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/doctor_reply_service.dart'; import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; @@ -9,6 +7,9 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import '../../locator.dart'; +import '../model/dashboard/dashboard_model.dart'; +import '../model/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import '../model/doctor/clinic_model.dart'; import 'authentication_view_model.dart'; import 'base_view_model.dart'; @@ -20,6 +21,8 @@ class DashboardViewModel extends BaseViewModel { List get dashboardItemsList => _dashboardService.dashboardItemsList; + RadiologyCriticalFindingModel? get radiologyCriticalFindingModel => _dashboardService.radiologyCriticalFindingModel; + bool get hasVirtualClinic => _dashboardService.hasVirtualClinic; String? get sServiceID => _dashboardService.sServiceID; @@ -37,6 +40,7 @@ class DashboardViewModel extends BaseViewModel { _dashboardService.getDashboard(), _dashboardService.checkDoctorHasLiveCare(), _specialClinicsService.getSpecialClinicalCareList(), + _dashboardService.checkDoctorHasRadiologyFindings() ]); if (_dashboardService.hasError) { @@ -70,6 +74,10 @@ class DashboardViewModel extends BaseViewModel { await _dashboardService.checkDoctorHasLiveCare(); } + Future acknowledgeRadiologyCriticalFinding(String invoiceNo, String invoiceLineItemNo) async { + await _dashboardService.acknowledgeDoctorHasRadiologyFindings(invoiceNo, invoiceLineItemNo); + } + Future getSpecialClinicalCareList() async { setState(ViewState.Busy); await _specialClinicsService.getSpecialClinicalCareList(); @@ -80,7 +88,7 @@ class DashboardViewModel extends BaseViewModel { // setState(ViewState.Idle); } - Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { + Future changeClinic(dynamic clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); await getDoctorProfile(); ClinicModel clinicModel = ClinicModel( diff --git a/lib/core/viewModel/prescription/prescription_view_model.dart b/lib/core/viewModel/prescription/prescription_view_model.dart index ab2d0c8e..1e518fbc 100644 --- a/lib/core/viewModel/prescription/prescription_view_model.dart +++ b/lib/core/viewModel/prescription/prescription_view_model.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report. import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; @@ -42,10 +43,12 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionService.prescriptionsList; - Future getItem({required int itemID}) async { + List get icd10DeseaseItems =>_prescriptionService.icd10CodeListByItem; + bool get isPrincipalCovered_ => _prescriptionService.isDiagnosisCovered; + Future getItem({int? itemID}) async { hasError = false; setState(ViewState.BusyLocal); - await _prescriptionService.getItem(itemID: itemID); + await _prescriptionService.getItem(itemID: itemID!); if (_prescriptionService.hasError) { error = _prescriptionService.error!; setState(ViewState.ErrorLocal); @@ -173,4 +176,29 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future isPrincipalCovered( + { + required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _prescriptionService.isPrincipalCovered(patient); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + Future getIcd10DISESECode( + { + required PatiantInformtion patient, int? itemID}) async { + setState(ViewState.Busy); + await _prescriptionService.getIcd10DISESECode(patient, itemID!); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 0b48c50b..6581a30d 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -29,11 +29,14 @@ import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; +import '../service/patient_medical_file/prescription/prescription_service.dart'; + class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it FilterType filterType = FilterType.Clinic; bool hasError = false; ProcedureService _procedureService = locator(); + PrescriptionService _prescriptionService = locator(); List get procedureList => _procedureService.procedureList; @@ -64,7 +67,9 @@ class ProcedureViewModel extends BaseViewModel { bool get isRadiologyVIDAPlus => _isRadiologyVIDAPlus; - Future getProcedure({required int mrn, String? patientType, int? appointmentNo, bool isLocalBusy = false}) async { + bool get isPrincipalCovered_ => _prescriptionService.isDiagnosisCovered; + + Future getProcedure({int? mrn, String? patientType, int? appointmentNo, bool isLocalBusy = false}) async { hasError = false; await getDoctorProfile(); if (isLocalBusy) @@ -457,4 +462,15 @@ class ProcedureViewModel extends BaseViewModel { items.addAll(masterList); } } + + Future isPrincipalCovered({required PatiantInformtion patient}) async { + // setState(ViewState.Busy); + await _prescriptionService.isPrincipalCovered(patient); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else { + // setState(ViewState.Idle); + } + } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 9aa9f065..3c411429 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; @@ -464,6 +465,12 @@ class _VerificationMethodsScreenState extends State { if (authenticationViewModel.state == ViewState.ErrorLocal) { Navigator.pop(context); Utils.showErrorToast(authenticationViewModel.error); + if (authenticationViewModel.errorCode == '699') { + + Navigator.pop(context); + authenticationViewModel.deleteUser(); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + } } else { await authenticationViewModel.onCheckActivationCodeSuccess(); if (value != null) { diff --git a/lib/screens/doctor_schedule/doctor_schedule.dart b/lib/screens/doctor_schedule/doctor_schedule.dart index bd5fb1fa..28cdeecb 100644 --- a/lib/screens/doctor_schedule/doctor_schedule.dart +++ b/lib/screens/doctor_schedule/doctor_schedule.dart @@ -15,6 +15,7 @@ import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/errors/error_message.dart'; import '../base/base_view.dart'; + class DoctorSchedulePage extends StatefulWidget { @override _DoctorSchedulePageState createState() => _DoctorSchedulePageState(); @@ -26,21 +27,16 @@ class _DoctorSchedulePageState extends State { double currentPage = 0; int selectedindex = 0; List weeks = []; - - // List doctorScheduleResponse = []; int weekMS = 604800 * 1000; - // DoctorList? doctorList; List freeSlots = []; bool isPageChange = false; String fromDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); - String toDate = DateFormat('yyyy-MM-dd').format(DateTime.now().add(Duration(days: 30))); - - // AppSharedPreferences sharedPref = AppSharedPreferences(); - + String toDate = + DateFormat('yyyy-MM-dd').format(DateTime.now().add(Duration(days: 30))); + int pageNo=1; @override void initState() { - // this.doctorList = widget.doctorList; super.initState(); } @@ -87,53 +83,81 @@ class _DoctorSchedulePageState extends State { children: [ IconButton( onPressed: () { - model.getDoctorRota( - fromDate, - toDate, - ); + + if(pageNo >1) { + pageNo--; + model.getDoctorRota(fromDate, toDate, + pageNo: pageNo); + } }, - icon: SvgPicture.asset('assets/images/svgs/prev.svg', height: 25, width: 10)), - IconButton(onPressed: () {}, icon: SvgPicture.asset('assets/images/svgs/next.svg', height: 25, width: 10)) + icon: SvgPicture.asset( + 'assets/images/svgs/prev.svg', + height: 25, + width: 10)), + IconButton( + onPressed: () { + pageNo++; + model.getDoctorRota(fromDate, toDate, pageNo: pageNo); + }, + icon: SvgPicture.asset( + 'assets/images/svgs/next.svg', + height: 25, + width: 10)) ], ), ], )), ], ), - model.getDoctorRotation.length == 0 - ? Center( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable, - )) - : Container( - margin: EdgeInsets.only(top: 45), - child: PageView.builder( - controller: _pageController, - itemCount: model.getDoctorRotation.length, - onPageChanged: (index) { - setState(() { - isPageChange = true; - this.currentPage = index.toDouble(); - }); - }, - itemBuilder: (context, index) { - return Container( - child: ListView.builder( - itemCount: model.getDoctorRotation[index].scheduleforuser!.length, - itemBuilder: (context, index2) => InkWell( - onTap: () { - // final weekDay = weeks[index][index2]['DayName']; - }, - child: Row( - children: [ - Expanded( - flex: 1, - child: Padding( - padding: projectViewModel.isArabic ? EdgeInsets.only(right: 17) : EdgeInsets.only(left: 17), - child: Row(children: [ - Column( - children: [ - Text(DateFormat('EEEE').format(model.getDoctorRotation[index].scheduleforuser![index2].days!) + model.getDoctorRotation.length ==0 ? Center( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable, + )) : + Container( + margin: EdgeInsets.only(top: 45), + child: PageView.builder( + controller: _pageController, + itemCount: model.getDoctorRotation.length, + onPageChanged: (index) { + setState(() { + isPageChange = true; + this.currentPage = index.toDouble(); + }); + }, + itemBuilder: (context, index) { + return model.getDoctorRotation[index] + .scheduleforuser!.length ==0 ? Center( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable, + )) : Container( + child: ListView.builder( + itemCount: model.getDoctorRotation[index] + .scheduleforuser!.length, + itemBuilder: (context, index2) => InkWell( + onTap: () { + // final weekDay = weeks[index][index2]['DayName']; + }, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: + projectViewModel.isArabic + ? EdgeInsets.only( + right: 17) + : EdgeInsets.only( + left: 17), + child: Row(children: [ + Column( + children: [ + Text(DateFormat('EEEE') + .format(model + .getDoctorRotation[ + index] + .scheduleforuser![ + index2] + .days!) // fontSize: 13, // fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500, @@ -188,13 +212,22 @@ class _DoctorSchedulePageState extends State { ), Container( height: 45, - child: ListView.builder( - itemCount: model.getDoctorRotation[index].scheduleforuser![index2]!.shiftforuser!.length, - itemBuilder: (context, index3) => Row(children: [ - Text(model.getDoctorRotation[index].scheduleforuser![index2].shiftforuser![index3].fromtimetext.toString()), - Text(" " + TranslationBase.of(context).to + " "), - Text(model.getDoctorRotation[index].scheduleforuser![index2].shiftforuser![index3].totimetext.toString()) - ]))) + child: ListView + .builder( + itemCount: model + .getDoctorRotation[ + index] + .scheduleforuser![ + index2] + .shiftforuser + !.length, + itemBuilder: (context, + index3) => + Row(children: [ + Text(model.getDoctorRotation[index].scheduleforuser![index2].shiftforuser![index3].fromtimetext.toString()), + Text(" "+TranslationBase.of(context).to +" "), + Text(model.getDoctorRotation[index].scheduleforuser![index2].shiftforuser![index3].totimetext.toString()) + ]))) // ],) ]))), @@ -218,103 +251,131 @@ class _DoctorSchedulePageState extends State { showDialog( context: context, builder: (BuildContext context) { - return StatefulBuilder(builder: (context, setState) { - return AlertDialog( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).search, - style: TextStyle(fontSize: 22), - ), - Text( - TranslationBase.of(context).searchFindSchedule, - style: TextStyle(fontSize: 16), - ) - ], - ), - content: Container( - height: 150, - child: Column(children: [ - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now().add(Duration(days: 365)), - onConfirm: (date) { - setState(() { - fromDate = DateFormat('yyyy-MM-dd').format(date); - }); - }, - ); - }, - child: Container( - padding: EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), - width: double.infinity, - height: 55, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), color: Colors.white, boxShadow: [BoxShadow(blurRadius: .26, spreadRadius: 1 * 1.5, color: Colors.black.withOpacity(.05))]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).dateFrom, - style: TextStyle(fontSize: 12), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [Text(fromDate), Icon(Icons.calendar_month_outlined)]) - ], - ))), - SizedBox( - height: 20, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now().add(Duration(days: 365)), - onConfirm: (date) { - setState(() { - toDate = DateFormat('yyyy-MM-dd').format(date); - }); - }, - ); - }, - child: Container( - padding: EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), - width: double.infinity, - height: 55, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), color: Colors.white, boxShadow: [BoxShadow(blurRadius: .26, spreadRadius: 1 * 1.5, color: Colors.black.withOpacity(.05))]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).toDate, - style: TextStyle(fontSize: 12), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [Text(toDate), Icon(Icons.calendar_month_outlined)]) - ], - ))) - ]), - ), - actions: [ - AppButton( - title: TranslationBase.of(context).search, - onPressed: () { - setState(() { - model.getDoctorRota(fromDate, toDate); - Navigator.pop(context); - }); - }, - ) - ], - ); - ; - }); + return StatefulBuilder( + builder:(context, setState) { + return + AlertDialog( + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).search, + style: TextStyle(fontSize: 22), + ), + Text( + TranslationBase.of(context).searchFindSchedule, + style: TextStyle(fontSize: 16), + ) + ], + ), + content: Container( + height: 150, + child: Column(children: [ + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now().add(Duration(days:365)), + onConfirm: (date) { + setState(() { + fromDate = DateFormat('yyyy-MM-dd').format(date); + }); + }, + ); + }, + child: Container( + padding: + EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), + width: double.infinity, + height: 55, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + boxShadow: [ + BoxShadow( + blurRadius: .26, + spreadRadius: 1 * 1.5, + color: Colors.black.withOpacity(.05)) + ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dateFrom, + style: TextStyle(fontSize: 12), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(fromDate, style: TextStyle(fontSize: 14),), + Icon(Icons.calendar_month_outlined) + ]) + ], + ))), + SizedBox(height: 20,), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now().add(Duration(days:365)), + onConfirm: (date) { + setState(() { + toDate = DateFormat('yyyy-MM-dd').format(date); + }); + }, + ); + }, + child: Container( + padding: + EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), + width: double.infinity, + height: 56, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + boxShadow: [ + BoxShadow( + blurRadius: .26, + spreadRadius: 1 * 1.5, + color: Colors.black.withOpacity(.05)) + ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).toDate, + style: TextStyle(fontSize: 12), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(toDate, style: TextStyle(fontSize: 14),), + Icon(Icons.calendar_month_outlined) + ]) + ], + ))) + ]), + ), + actions: [ + AppButton( + title:TranslationBase.of(context).search, + onPressed: () { + setState((){ + model.getDoctorRota(fromDate, toDate); + Navigator.pop(context); + }); + }, + ) + ], + ); + ; + } + ); + }, ); } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 0f6e381c..491efdd1 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -68,7 +68,14 @@ class _HomeScreenState extends State { return BaseView( onModelReady: (model) async { - model.startHomeScreenServices(projectsProvider, authenticationViewModel); + model.startHomeScreenServices(projectsProvider, authenticationViewModel).then((value) { + if (model.radiologyCriticalFindingModel != null) { + print("onModelReady radiologyCriticalFindingModel!!!"); + showRadiologyFindingDialog(model); + } else { + print("onModelReady radiologyCriticalFindingModel EMPTYYYY!!!"); + } + }); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -142,7 +149,7 @@ class _HomeScreenState extends State { )), ], ), - AppText(Utils.convertToTitleCase(item.clinicName!), + AppText(Utils.convertToTitleCase(item.clinicName), fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, fontWeight: FontWeight.bold, textAlign: TextAlign.end), ], ); @@ -151,7 +158,7 @@ class _HomeScreenState extends State { onChanged: (newValue) async { clinicId = newValue; GifLoaderDialogUtils.showMyDialog(context); - await model.changeClinic(int.parse(newValue.toString()), authenticationViewModel); + await model.changeClinic(newValue, authenticationViewModel); GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); @@ -160,7 +167,7 @@ class _HomeScreenState extends State { items: projectsProvider.doctorClinicsList.map((item) { return DropdownMenuItem( child: AppText( - Utils.convertToTitleCase(item.clinicName!), + Utils.convertToTitleCase(item.clinicName), fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, @@ -270,42 +277,33 @@ class _HomeScreenState extends State { ); } + showRadiologyFindingDialog(DashboardViewModel model) { + Utils.showConfirmationDialog(context, model.radiologyCriticalFindingModel!.notificationMesssage!, () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await model.acknowledgeRadiologyCriticalFinding(model.radiologyCriticalFindingModel!.invoiceNo.toString(), model.radiologyCriticalFindingModel!.invoiceLineItemNo.toString()); + GifLoaderDialogUtils.hideDialog(context); + }, isShowCancelButton: false); + } + List homePatientsCardsWidget(DashboardViewModel model, projectsProvider) { colorIndex = 0; - List backgroundColors = []; - backgroundColors.add( - LinearGradient( - begin: Alignment(-1.0, -2.0), - end: Alignment(1.0, 2.0), - colors: [ - AppGlobal.appRedColor, - Color(0xFFAD3B3B), - ], - ), - ); //AppGlobal.appRedColor; - backgroundColors.add( - LinearGradient( - begin: Alignment.center, - end: Alignment.center, - colors: [ - Color(0xFFC9C9C9), - Color(0xFFC9C9C9), - ], - ), - ); - backgroundColors.add( - LinearGradient( - begin: Alignment.center, - end: Alignment.center, - colors: [Color(0xFF71787E), AppGlobal.appTextColor], - ), - ); + List backgroundColors =[]; + backgroundColors.add(LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 2.0), colors: [ + AppGlobal.appRedColor, + Color(0xFFAD3B3B), + ])); //AppGlobal.appRedColor; + backgroundColors.add(LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [ + Color(0xFFC9C9C9), + Color(0xFFC9C9C9), + ])); + backgroundColors.add(LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [Color(0xFF71787E), AppGlobal.appTextColor])); List backgroundIconColors = []; backgroundIconColors.add(Colors.white12); - backgroundIconColors.add(Colors.white38); + backgroundIconColors.add( Colors.white38); backgroundIconColors.add(Colors.white10); - List textColors = []; + List textColors =[]; textColors.add(Colors.white); textColors.add(Color(0xFF353E47)); textColors.add(Colors.white); @@ -313,41 +311,39 @@ class _HomeScreenState extends State { List patientCards = []; if (model.hasVirtualClinic) { - patientCards.add( - HomePatientCard( - gradient: backgroundColors[colorIndex], - backgroundIconColor: backgroundIconColors[colorIndex], - cardIcon: DoctorApp.livecare, - textColor: textColors[colorIndex], - iconSize: 21, - text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", - onTap: () { - // TODO MOSA TEST - // PatiantInformtion patient = PatiantInformtion( - // patientStatusType: 43, - // episodeNo: 0, - // vcId: 42342, - // fullName: "mosa test", - // dateofBirth: "2000-05-01 10:42:35.790004" - // ); - // Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - // "patient": patient, - // "patientType": "0", - // "isSearch": false, - // "isInpatient": false, - // "arrivalType": "0", - // "isSearchAndOut": false, - // "isFromLiveCare": true, - // }); - Navigator.push( - context, - FadePage( - page: LiveCarePatientScreen(), - ), - ); - }, - ), - ); + patientCards.add(HomePatientCard( + gradient: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.livecare, + textColor: textColors[colorIndex], + iconSize: 21, + text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", + onTap: () { + // TODO MOSA TEST + // PatiantInformtion patient = PatiantInformtion( + // patientStatusType: 43, + // episodeNo: 0, + // vcId: 42342, + // fullName: "mosa test", + // dateofBirth: "2000-05-01 10:42:35.790004" + // ); + // Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + // "patient": patient, + // "patientType": "0", + // "isSearch": false, + // "isInpatient": false, + // "arrivalType": "0", + // "isSearchAndOut": false, + // "isFromLiveCare": true, + // }); + Navigator.push( + context, + FadePage( + page: LiveCarePatientScreen(), + ), + ); + }, + )); changeColorIndex(); } @@ -418,11 +414,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => OutPatientsScreen( - patientSearchRequestModel: PatientSearchRequestModel( - from: date, - to: date, - doctorID: authenticationViewModel.doctorProfile!.doctorID, - ), + patientSearchRequestModel: PatientSearchRequestModel(from: date, to: date, doctorID: authenticationViewModel.doctorProfile!.doctorID), ), settings: RouteSettings(name: 'OutPatientsScreen'), )); diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index 1e8b190e..2e9f0099 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/InsuranceViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/NoData.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; @@ -47,524 +48,753 @@ class _InsuranceApprovalsDetailsState extends State { ? (model) => model.getInsuranceApproval(patient, appointmentNo: patient!.appointmentNo, projectId: patient!.projectId) : (model) => model.getInsuranceApproval(patient) : null, - builder: (BuildContext context, InsuranceViewModel model, Widget? child) => AppScaffold( - isShowAppBar: true, - baseViewModel: model, - appBar: PatientProfileAppBar(patient!), - body: patient!.admissionNo != null - ? SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ServiceTitle( - title: TranslationBase.of(context).insurance22, - subTitle: TranslationBase.of(context).approvals22, - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( + builder: (BuildContext context, InsuranceViewModel model, Widget? child) => + AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBar: PatientProfileAppBar(patient!), + body: patient!.admissionNo != null + ? SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ServiceTitle( + title: TranslationBase.of(context).insurance22, + subTitle: TranslationBase.of(context).approvals22, + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - AppText( - model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != null - ? model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption ?? "" - : "", - color: model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != null - ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == "Approved" || - "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == "تمت الموافقة" - ? AppGlobal.appGreenColor - : Color(0xffD02127) - : Color(0xffD02127), - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + Row( + children: [ + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption != + null + ? model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption ?? + "" + : "", + color: model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption != + null + ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == + "Approved" || + "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == + "تمت الموافقة" + ? AppGlobal.appGreenColor + : Color(0xffD02127) + : Color(0xffD02127), + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.7, + ), + ], ), - ], - ), - Row( - children: [ - AppText( - model.insuranceApprovalInPatient[indexInsurance].doctorName!.toUpperCase(), - color: Color(0xff2E303A), - fontSize: 16, - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ) - ], - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - children: [ - Column( + Row( + children: [ + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .doctorName! + .toUpperCase(), + color: Color(0xff2E303A), + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( children: [ - Container( - height: MediaQuery.of(context).size.height * 0.065, - width: MediaQuery.of(context).size.height * 0.065, - child: CircleAvatar( - radius: SizeConfig.imageSizeMultiplier! * 12, - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Image.network( - model.insuranceApprovalInPatient[indexInsurance].doctorImage!, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: Colors.transparent, - ), - ), - ], - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, + Column( children: [ - SizedBox( - height: 25.0, - ), - CustomRow( - label: TranslationBase.of(context).clinic + ": ", - value: model.insuranceApprovalInPatient[indexInsurance].clinicName!, - ), - CustomRow( - label: TranslationBase.of(context).approvalNo + ": ", - value: model.insuranceApprovalInPatient[indexInsurance].approvalNo.toString(), - ), - CustomRow( - label: 'Unused Count:', - value: model.insuranceApprovalInPatient[indexInsurance].unUsedCount.toString(), + Container( + height: MediaQuery.of(context) + .size + .height * + 0.065, + width: MediaQuery.of(context) + .size + .height * + 0.065, + child: CircleAvatar( + radius: SizeConfig + .imageSizeMultiplier! * + 12, + // radius: (52) + child: ClipRRect( + borderRadius: + BorderRadius.circular( + 50), + child: Image.network( + model + .insuranceApprovalInPatient[ + indexInsurance] + .doctorImage!, + fit: BoxFit.fill, + width: 700, + ), + ), + backgroundColor: + Colors.transparent, + ), ), - CustomRow(label: TranslationBase.of(context).companyName + ": ", value: 'Sample'), - CustomRow( - label: TranslationBase.of(context).receiptOn + ": ", - value: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn ?? ""), isArabic: projectViewModel.isArabic)}'), - CustomRow( - label: TranslationBase.of(context).expiryDate + ": ", - value: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate ?? ""), isArabic: projectViewModel.isArabic)}'), ], ), - ), - ), - ], - ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context).procedure, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context).status, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, + Expanded( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + CustomRow( + label: TranslationBase.of( + context) + .clinic + + ": ", + value: model + .insuranceApprovalInPatient[ + indexInsurance] + .clinicName!, + ), + CustomRow( + label: TranslationBase.of( + context) + .approvalNo + + ": ", + value: model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalNo + .toString(), + ), + CustomRow( + label: 'Unused Count:', + value: model + .insuranceApprovalInPatient[ + indexInsurance] + .unUsedCount + .toString(), + ), + CustomRow( + label: TranslationBase.of( + context) + .companyName + + ": ", + value: 'Sample'), + CustomRow( + label: TranslationBase.of( + context) + .receiptOn + + ": ", + value: + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn ?? ""), isArabic: projectViewModel.isArabic)}'), + CustomRow( + label: TranslationBase.of( + context) + .expiryDate + + ": ", + value: + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate ?? ""), isArabic: projectViewModel.isArabic)}'), + ], ), ), - Expanded( - child: AppText( - TranslationBase.of(context).usageStatus, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, - ), - ) - ], - ), - ), - Divider( - color: Colors.black, + ), + ], ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model.insuranceApprovalInPatient[indexInsurance].apporvalDetails!.length, - itemBuilder: (BuildContext context, int index) { - return Container( - child: Column( - children: [ - Row( + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context) + .procedure, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.9, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context) + .status, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.9, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context) + .usageStatus, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.9, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApprovalInPatient[ + indexInsurance] + .apporvalDetails! + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Column( children: [ - Expanded( - child: Container( - child: AppText( - model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].procedureName ?? "", - textAlign: TextAlign.center, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, - letterSpacing: -0.4, - color: Color(0xff575757), - fontWeight: FontWeight.w500, + Row( + children: [ + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.procedureName ?? + "", + textAlign: + TextAlign + .center, + fontSize: + SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.7, + letterSpacing: + -0.4, + color: Color( + 0xff575757), + fontWeight: + FontWeight + .w500, + ), + ), ), - ), - ), - Expanded( - child: Container( - child: AppText( - model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].status ?? "", - textAlign: TextAlign.center, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, - letterSpacing: -0.4, - color: Color(0xff575757), - fontWeight: FontWeight.w500, + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.status ?? + "", + textAlign: + TextAlign + .center, + fontSize: + SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.7, + letterSpacing: + -0.4, + color: Color( + 0xff575757), + fontWeight: + FontWeight + .w500, + ), + ), ), - ), - ), - Expanded( - child: Container( - child: AppText( - model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].isInvoicedDesc ?? "", - textAlign: TextAlign.center, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, - letterSpacing: -0.4, - color: Color(0xff575757), - fontWeight: FontWeight.w500, + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.isInvoicedDesc ?? + "", + textAlign: + TextAlign + .center, + fontSize: + SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.7, + letterSpacing: + -0.4, + color: Color( + 0xff575757), + fontWeight: + FontWeight + .w500, + ), + ), ), - ), + ], + ), + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, ), ], ), - SizedBox( - width: 5, - ), - Divider( - color: Colors.black38, - ), - ], - ), - ); - }), + ); + }), + ), + ], ), - ], - ), + ), + ], ), - ], + ), ), - ), + ], ), - ], - ), - ), - ) - : SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - AppText( - TranslationBase.of(context).insurance22, - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', + Row( + children: [ + AppText( + TranslationBase.of(context).insurance22, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).approvals22, - fontSize: 30.0, - fontWeight: FontWeight.w700, + Row( + children: [ + AppText( + TranslationBase.of(context).approvals22, + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], ), ], ), - ], - ), - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - AppText( - model.insuranceApproval[indexInsurance].approvalStatusDescption != null ? model.insuranceApproval[indexInsurance].approvalStatusDescption ?? "" : "", - color: model.insuranceApproval[indexInsurance].approvalStatusDescption != null - ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == "Approved" - ? AppGlobal.appGreenColor - : Color(0xffD02127) - : Color(0xffD02127), + Row( + children: [ + AppText( + model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption != + null + ? model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption ?? + "" + : "", + color: model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption != + null + ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == + "Approved" + ? AppGlobal.appGreenColor + : Color(0xffD02127) + : Color(0xffD02127), + ), + ], ), - ], - ), - Row( - children: [ - AppText( - model.insuranceApproval[indexInsurance].doctorName!.toUpperCase(), - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ) - ], - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - children: [ - Column( + Row( + children: [ + AppText( + model + .insuranceApproval[indexInsurance] + .doctorName! + .toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( children: [ - Container( - height: 85.0, - width: 85.0, - child: CircleAvatar( - radius: SizeConfig.imageSizeMultiplier! * 12, - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Image.network( - model.insuranceApproval[indexInsurance].doctorImage!, - fit: BoxFit.fill, - width: 700, + Column( + children: [ + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig + .imageSizeMultiplier! * + 12, + // radius: (52) + child: ClipRRect( + borderRadius: + BorderRadius.circular( + 50), + child: Image.network( + model + .insuranceApproval[ + indexInsurance] + .doctorImage!, + fit: BoxFit.fill, + width: 700, + ), + ), + backgroundColor: + Colors.transparent, ), ), - backgroundColor: Colors.transparent, - ), + ], ), - ], - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - height: 25.0, - ), - Row( + Expanded( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, children: [ - AppText( - TranslationBase.of(context).clinic + ": ", - color: Colors.grey[500]!, - fontSize: 14, + SizedBox( + height: 25.0, ), - Expanded( - child: AppText( - model.insuranceApproval[indexInsurance].clinicName!, - fontSize: 14, - ), - ) - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).approvalNo + ": ", - color: Colors.grey[500]!, - fontSize: 14, + Row( + children: [ + AppText( + TranslationBase.of( + context) + .clinic + + ": ", + color: Colors.grey[500], + fontSize: 14, + ), + Expanded( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + .clinicName!, + fontSize: 14, + ), + ) + ], ), - AppText( - model.insuranceApproval[indexInsurance].approvalNo.toString(), - fontSize: 14, - ) - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).unusedCount + ": ", - color: Colors.grey[500]!, - fontSize: 14, + Row( + children: [ + AppText( + TranslationBase.of( + context) + .approvalNo + + ": ", + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApproval[ + indexInsurance] + .approvalNo + .toString(), + fontSize: 14, + ) + ], ), - AppText( - model.insuranceApproval[indexInsurance].unUsedCount.toString(), - fontSize: 14, - ) - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).companyName + ": ", - color: Colors.grey[500]!, + Row( + children: [ + AppText( + TranslationBase.of( + context) + .unusedCount + + ": ", + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApproval[ + indexInsurance] + .unUsedCount + .toString(), + fontSize: 14, + ) + ], ), - AppText('Sample') - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).receiptOn + ": ", - color: Colors.grey[500]!, + Row( + children: [ + AppText( + TranslationBase.of( + context) + .companyName + + ": ", + color: Colors.grey[500], + ), + AppText('Sample') + ], ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - ), + Row( + children: [ + AppText( + TranslationBase.of( + context) + .receiptOn + + ": ", + color: Colors.grey[500], + ), + Expanded( + child: AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, + ), + ), + ], ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).expiryDate + ": ", - color: Colors.grey[500]!, + Row( + children: [ + AppText( + TranslationBase.of( + context) + .expiryDate + + ": ", + color: Colors.grey[500], + ), + if (model + .insuranceApproval[ + indexInsurance] + .expiryDate != + null) + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, + ), + ], ), - if (model.insuranceApproval[indexInsurance].expiryDate != null) - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - ), ], ), - ], + ), ), - ), + ], ), - ], - ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context).procedure, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context).status, - fontWeight: FontWeight.w700, - ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context) + .procedure, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context) + .status, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context) + .usageStatus, + fontWeight: FontWeight.w700, + ), + ) + ], ), - Expanded( - child: AppText( - TranslationBase.of(context).usageStatus, - fontWeight: FontWeight.w700, - ), - ) - ], - ), - ), - Divider( - color: Colors.black, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model.insuranceApproval[indexInsurance].apporvalDetails!.length, - itemBuilder: (BuildContext context, int index) { - return Container( - child: Column( - children: [ - Row( + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: (model.insuranceApproval[indexInsurance].apporvalDetails != null && model.insuranceApproval[indexInsurance].apporvalDetails!.isNotEmpty) ? ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApproval[ + indexInsurance] + .apporvalDetails! + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Column( children: [ - Expanded( - child: Container( - child: AppText( - model.insuranceApproval[indexInsurance].apporvalDetails![index].procedureName ?? "", - textAlign: TextAlign.start, + Row( + children: [ + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.procedureName ?? + "", + textAlign: + TextAlign + .start, + ), + ), ), - ), - ), - Expanded( - child: Container( - child: AppText( - model.insuranceApproval[indexInsurance].apporvalDetails![index].status ?? "", - textAlign: TextAlign.center, + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.status ?? + "", + textAlign: + TextAlign + .center, + ), + ), ), - ), - ), - Expanded( - child: Container( - child: AppText( - model.insuranceApproval[indexInsurance].apporvalDetails![index].isInvoicedDesc ?? "", - textAlign: TextAlign.center, + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails![ + index] + ?.isInvoicedDesc ?? + "", + textAlign: + TextAlign + .center, + ), + ), ), - ), + ], + ), + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, ), ], ), - SizedBox( - width: 5, - ), - Divider( - color: Colors.black38, - ), - ], - ), - ); - }), + ); + }) : NoData(), + ), + ], ), - ], - ), + ), + ], ), - ], + ), ), - ), + ], ), - ], - ), - ), - )), + ), + )), ); } } diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 2571560b..90fef80f 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -15,7 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/errors/error_message.dart'; class LabsHomePage extends StatefulWidget { @@ -48,7 +48,10 @@ class _LabsHomePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLabs(patient!, isInpatient: false), + onModelReady: (model) { + model.getLabs(patient!, isInpatient: false); + model.isPrincipalCovered(patient: patient!); + }, builder: (context, ProcedureViewModel model, widget) => AppScaffold( baseViewModel: model, backgroundColor: Colors.grey[100]!, @@ -72,6 +75,17 @@ class _LabsHomePageState extends State { title: TranslationBase.of(context).lab, subTitle: TranslationBase.of(context).result, ), + SizedBox( + height: 20, + ), + !model.isPrincipalCovered_ + ? Center( + child: AppText( + TranslationBase.of(context).principalCoveredOrNot, + color: Colors.red, + textAlign: TextAlign.center, + )) + : SizedBox(), if ((patient!.patientStatusType != null && patient!.patientStatusType == 43) || (isFromLiveCare! && patient!.appointmentNo != null)) AddNewOrder( onTap: () { @@ -111,7 +125,7 @@ class _LabsHomePageState extends State { child: Container( width: 20, decoration: BoxDecoration( - color: model.patientLabOrdersList[index].isLiveCareAppointment! + color: model.patientLabOrdersList![index].isLiveCareAppointment! ? Colors.red[900] : !model.patientLabOrdersList[index].isInOutPatient! ? Colors.black @@ -142,27 +156,25 @@ class _LabsHomePageState extends State { margin: EdgeInsets.only(left: 20), child: DoctorCard( isNoMargin: true, - onTap: () { - Navigator.push( - context, - FadePage( - page: LaboratoryResultPage( - patientLabOrders: model.patientLabOrdersList[index], - patient: patient!, - isInpatient: isInpatient!, - arrivalType: arrivalType!, - patientType: patientType!, - ), + onTap: () => Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: model.patientLabOrdersList[index], + patient: patient!, + isInpatient: isInpatient!, + arrivalType: arrivalType!, + patientType: patientType!, ), - ); - }, - doctorName: Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName!), + ), + ), + doctorName: Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName), invoiceNO: ' ${model.patientLabOrdersList[index].invoiceNo}', - profileUrl: model.patientLabOrdersList[index].doctorImageURL!, - branch: model.patientLabOrdersList[index].projectName!, - clinic: Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription!), - appointmentDate: model.patientLabOrdersList[index].createdOn!, - orderNo: model.patientLabOrdersList[index].orderNo!, + profileUrl: model.patientLabOrdersList[index].doctorImageURL, + branch: model.patientLabOrdersList[index].projectName, + clinic: Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription), + appointmentDate: model.patientLabOrdersList[index].createdOn, + orderNo: model.patientLabOrdersList[index].orderNo, isShowTime: false, ), ), @@ -170,7 +182,7 @@ class _LabsHomePageState extends State { ), ), ), - if (model.patientLabOrdersList.isEmpty && patient!.patientStatusType != 43) + if (model.patientLabOrdersList.isEmpty && patient!.patientStatusType! != 43) Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 20878cf4..95ded378 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -17,6 +17,7 @@ import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/errors/error_message.dart'; class RadiologyHomePage extends StatefulWidget { @@ -47,7 +48,11 @@ class _RadiologyHomePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientRadOrders(patient, patientType: patientType, isInPatient: false), + onModelReady: (model) { + model.getPatientRadOrders( + patient, patientType: patientType, isInPatient: false); + model.isPrincipalCovered(patient: patient); + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100]!, @@ -70,11 +75,16 @@ class _RadiologyHomePageState extends State { title: TranslationBase.of(context).radiology, subTitle: TranslationBase.of(context).result, ), + + if (patient.patientStatusType != null && patient.patientStatusType == 43) ServiceTitle( title: TranslationBase.of(context).radiology, subTitle: TranslationBase.of(context).result, ), + SizedBox(height: 20,), + !model.isPrincipalCovered_ ? Center(child: AppText(TranslationBase.of(context).principalCoveredOrNot,color: Colors.red, textAlign: TextAlign.center, )) :SizedBox(), + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index ecddceae..6a7fdf88 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -2,14 +2,12 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/patch_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_assement.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; @@ -23,6 +21,8 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../../core/model/SOAP/Assessment/post_assessment_request_model.dart'; +import '../../../../../core/model/SOAP/assessment/patch_assessment_req_model.dart'; class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; @@ -46,6 +46,7 @@ class _AddAssessmentDetailsState extends State { GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; + bool complexDiagnosis = true; @override Widget build(BuildContext context) { @@ -95,7 +96,7 @@ class _AddAssessmentDetailsState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: BottomSheetTitle(title: TranslationBase.of(context).addAssessmentDetails), + appBar: BottomSheetTitle(title: widget.isUpdate ? TranslationBase.of(context).updateAssessmentDetails : TranslationBase.of(context).addAssessmentDetails), backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( child: Center( @@ -108,6 +109,23 @@ class _AddAssessmentDetailsState extends State { SizedBox( height: 16, ), + Row(children: [ + Checkbox( + value: complexDiagnosis, + onChanged: (bool? value) { + complexDiagnosis = value!; + setState(() {}); + }, + checkColor: Colors.white, + activeColor: Colors.green, + ), + Text( + TranslationBase.of(context).complexDiagnosis, + ), + ]), + SizedBox( + height: 16, + ), Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: AppTextFieldCustom( @@ -157,9 +175,8 @@ class _AddAssessmentDetailsState extends State { isTextFieldHasSuffix: true, suffixIcon: IconButton( onPressed: () { - print(icdNameController.text); - if (icdNameController.text.length <= 3) { - DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); + if (icdNameController.text.length <= 2) { + DrAppToastMsg.showErrorToast("Please enter 3 or more characters"); } else { model.listOfICD10!.clear(); model.callAddAssessmentLookupsServices(searchKey: icdNameController.text); @@ -172,20 +189,20 @@ class _AddAssessmentDetailsState extends State { onFieldSubmitted: () {}, )), - model.listOfICD10!.length > 0 && icdNameController.text.isNotEmpty + model.listOfICD10.length > 0 && icdNameController.text.isNotEmpty ? Container( color: Colors.white, height: MediaQuery.of(context).size.height * 0.4, //height to 9% of screen height, child: ListView.builder( shrinkWrap: true, - itemCount: model.listOfICD10!.length, + itemCount: model.listOfICD10.length, itemBuilder: (context, index) { return InkWell( - child: ListTile(title: AppText(model.listOfICD10![index].description + " / " + model.listOfICD10![index].code.toString(), fontSize: 12.0)), + child: ListTile(title: AppText(model.listOfICD10[index].description + " / " + model.listOfICD10[index].code.toString(), fontSize: 12.0)), onTap: () { - widget.mySelectedAssessment.selectedICD = model.listOfICD10![index]; - icdNameController.text = model.listOfICD10![index].description; - model.listOfICD10!.clear(); + widget.mySelectedAssessment.selectedICD = model.listOfICD10[index]; + icdNameController.text = model.listOfICD10[index].description; + model.listOfICD10.clear(); setState(() {}); }); }, @@ -369,7 +386,7 @@ class _AddAssessmentDetailsState extends State { height: 0, ) : CustomBottomSheetContainer( - label: (widget.isUpdate ? 'Update Assessment Details' : 'Add Assessment Details'), + label: (widget.isUpdate ? TranslationBase.of(context).updateAssessmentDetails : TranslationBase.of(context).addAssessmentDetails), onTap: () async { setState(() { isFormSubmitted = true; @@ -388,24 +405,31 @@ class _AddAssessmentDetailsState extends State { ); } - submitAssessment({required SOAPViewModel model, required MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { + submitAssessment({SOAPViewModel? model, MySelectedAssessment? mySelectedAssessment, bool isUpdate = false}) async { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); GifLoaderDialogUtils.showMyDialog(context); if (isUpdate) { - PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( + PostAssessmentRequestUpdateModel patchAssessmentReqModel = PostAssessmentRequestUpdateModel( patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, + episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, - remarks: mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id, - diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, - icdcode10Id: mySelectedAssessment.selectedICD!.code, - prevIcdCode10ID: mySelectedAssessment.icdCode10ID); + createdByName: doctorProfile.doctorName, + createdBy: doctorProfile.doctorID, + icdCodeDetails: [ + new IcdCodeDetailsUpdate( + remarks: mySelectedAssessment!.remark, + complexDiagnosis: complexDiagnosis, + conditionId: mySelectedAssessment!.selectedDiagnosisCondition!.id, + prevIcdCode10ID: mySelectedAssessment.icdCode10ID, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, + icdcode10Id: mySelectedAssessment.selectedICD!.code) + ]); - await model.patchAssessment(patchAssessmentReqModel); + await model?.patchAssessment(patchAssessmentReqModel); } else { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); PostAssessmentRequestModel postAssessmentRequestModel = new PostAssessmentRequestModel( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -414,16 +438,16 @@ class _AddAssessmentDetailsState extends State { createdBy: doctorProfile.doctorID, icdCodeDetails: [ new IcdCodeDetails( - remarks: mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id, + remarks: mySelectedAssessment!.remark, + complexDiagnosis: complexDiagnosis, + conditionId: mySelectedAssessment!.selectedDiagnosisCondition!.id, diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, icdcode10Id: mySelectedAssessment.selectedICD!.code) ]); - await model.postAssessment(postAssessmentRequestModel); + await model?.postAssessment(postAssessmentRequestModel); } GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { + if (model!.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 56333f4c..aa745578 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -39,7 +39,7 @@ class UpdateAssessmentPage extends StatefulWidget { class _UpdateAssessmentPageState extends State implements AssessmentCallBack { bool isAssessmentExpand = false; List mySelectedAssessmentList = []; - + bool isPrescriptionOrder =false; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -48,7 +48,7 @@ class _UpdateAssessmentPageState extends State implements onModelReady: (model) async { model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); - + await model.isPrescriptionOrderCreated(widget.patientInfo); await model.onUpdateAssessmentStepStart(widget.patientInfo); if (model.patientAssessmentList.isNotEmpty) { @@ -324,11 +324,20 @@ class _UpdateAssessmentPageState extends State implements ), InkWell( onTap: () { - openAssessmentDialog(context, isUpdate: true, assessment: assessment, model: model); + if(model.isPrescriptionOrder && assessment.selectedDiagnosisType!.id ==2) { + Utils.showErrorToast(TranslationBase.of(context).principalDiagnosisCannot); + }else{ + openAssessmentDialog( + context, isUpdate: true, + assessment: assessment, + model: model); + + } }, child: Icon( DoctorApp.edit, size: 18, + color: model.isPrescriptionOrder && assessment.selectedDiagnosisType!.id ==2 ? Colors.grey : Colors.black , ), ) ], @@ -384,9 +393,15 @@ class _UpdateAssessmentPageState extends State implements nextFunction(model) { if (mySelectedAssessmentList.isEmpty) { Utils.showErrorToast(TranslationBase.of(context).assessmentErrorMsg); - } else { + } else if(!checkPrimaryDiagnosis()) { + Utils.showErrorToast(TranslationBase.of(context).onePrimaryDiagnosis); + }else{ widget.changeLoadingState(true); widget.changePageViewIndex(3); } } + bool checkPrimaryDiagnosis(){ + List type = mySelectedAssessmentList.where((element) => element.selectedDiagnosisType!.id==2).toList(); + return type.isEmpty ? false : true; + } } diff --git a/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart index 3ea62911..aa954144 100644 --- a/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart +++ b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../widgets/dialog/confirm_dialog.dart'; import 'drug_to_drug.dart'; class AddDrugWidget extends StatefulWidget { @@ -81,40 +82,85 @@ class _AddDrugWidgetState extends State { : CustomBottomSheetContainer( label: TranslationBase.of(context).addMedication, onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - await widget.medicineModel!.postPrescription( - isLocalBusy: true, - icdCode: widget.medicineModel!.patientAssessmentList.isNotEmpty - ? widget.medicineModel!.patientAssessmentList[0].icdCode10ID!.isEmpty - ? "test" - : widget.medicineModel!.patientAssessmentList[0].icdCode10ID.toString() - : "test", - dose: widget.strength, - doseUnit: - widget.medicineModel!.itemMedicineListUnit.length == 1 ? widget.medicineModel!.itemMedicineListUnit[0]['parameterCode'].toString() : widget.units['parameterCode'].toString(), - patient: widget.patient, - doseTimeIn: widget.doseTime['id'].toString(), - model: widget.modelPrescription, - duration: widget.duration['id'].toString(), - frequency: widget.medicineModel!.itemMedicineList.length == 1 ? widget.medicineModel!.itemMedicineList[0]['parameterCode'].toString() : widget.frequency['parameterCode'].toString(), - route: - widget.medicineModel!.itemMedicineListRoute.length == 1 ? widget.medicineModel!.itemMedicineListRoute[0]['parameterCode'].toString() : widget.route['parameterCode'].toString(), - drugId: widget.selectedMedication!.itemId.toString(), - strength: widget.strength, - indication: widget.indication, - instruction: widget.instruction, - doseTime: widget.selectedDate, - ); - if (widget.medicineModel!.state == ViewState.ErrorLocal) { - GifLoaderDialogUtils.hideDialog(context); - Utils.showErrorToast(widget.medicineModel!.error); - } else if (widget.modelPrescription!.state == ViewState.Idle) { - await widget.modelPrescription!.getPrescriptionListNew(appNo: widget.patient!.appointmentNo, mrn: widget.patient!.patientMRN, isLocalBusy: true); - GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).medicationHasBeenAdded); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - } + showDialog( + context: context, + builder: (BuildContext context2) { + return ConfirmationDialog( + title: TranslationBase.of(context2).afterOrderCreation, + onTapGrant: () async { + GifLoaderDialogUtils.showMyDialog(context); + await widget.medicineModel!.postPrescription( + isLocalBusy: true, + icdCode: widget.medicineModel! + .patientAssessmentList.isNotEmpty + ? widget + .medicineModel + !.patientAssessmentList[0] + .icdCode10ID! + .isEmpty + ? "test" + : widget.medicineModel! + .patientAssessmentList![0].icdCode10ID + .toString() + : "test", + dose: widget.strength, + doseUnit: + widget.medicineModel!.itemMedicineListUnit + .length == + 1 + ? widget + .medicineModel + !.itemMedicineListUnit[0] + ['parameterCode'] + .toString() + : widget.units['parameterCode'] + .toString(), + patient: widget.patient, + doseTimeIn: widget.doseTime['id'].toString(), + model: widget.modelPrescription, + duration: widget.duration['id'].toString(), + frequency: widget.medicineModel!.itemMedicineList + .length == + 1 + ? widget.medicineModel! + .itemMedicineList![0]['parameterCode'] + .toString() + : widget.frequency['parameterCode'] + .toString(), + route: widget.medicineModel!.itemMedicineListRoute + .length == + 1 + ? widget.medicineModel! + .itemMedicineListRoute![0]['parameterCode'] + .toString() + : widget.route['parameterCode'].toString(), + drugId: + widget.selectedMedication!.itemId.toString(), + strength: widget.strength, + indication: widget.indication, + instruction: widget.instruction, + doseTime: widget.selectedDate, + ); + if (widget.medicineModel!.state == + ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Utils.showErrorToast(widget.medicineModel!.error); + } else if (widget.modelPrescription!.state == + ViewState.Idle) { + await widget.modelPrescription + !.getPrescriptionListNew( + appNo: widget.patient!.appointmentNo, + mrn: widget.patient!.patientMRN, + isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .medicationHasBeenAdded); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); + }); }, ), ); diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index e0a20b7f..53616188 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -24,6 +24,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../../../core/model/SOAP/master_key_model.dart'; import '../../../widgets/transitions/slide_up_page.dart'; import 'add_drug/add_drug_widget.dart'; @@ -49,7 +50,7 @@ class _PrescriptionFormWidgetState extends State { String? durationError; String? unitError; String? strengthError; - + String? icdCodeError; int? selectedType; TextEditingController strengthController = TextEditingController(); @@ -81,6 +82,14 @@ class _PrescriptionFormWidgetState extends State { dynamic uom; dynamic box; dynamic x; + dynamic icdCode; + TextEditingController icdNameController = TextEditingController(); + List icdCodeList =[]; + @override + void initState() { + getIcdCodeData(); + super.initState(); + } setSelectedType(int val) { setState(() { @@ -88,6 +97,10 @@ class _PrescriptionFormWidgetState extends State { }); } +getIcdCodeData() async{ + await widget.prescriptionViewModel.getIcd10DISESECode(patient: widget.patient, itemID:widget.selectedMedication.itemId ); + icdCodeList = List.from(widget.prescriptionViewModel.icd10DeseaseItems); +} onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; @@ -269,9 +282,85 @@ class _PrescriptionFormWidgetState extends State { }); }), SizedBox(height: spaceBetweenTextFields), - if (widget.medicineViewModel.patientAssessmentList.isNotEmpty) + widget.prescriptionViewModel.icd10DeseaseItems.isNotEmpty ? + // PrescriptionTextFiled( + // hintText: TranslationBase.of(context).nameOrICD, + // elementError: icdCodeError, + // element: icdCode, + // elementList: widget.prescriptionViewModel.icd10DeseaseItems, + // keyId: 'codeId', + // keyName: 'asciiDesc', + // okFunction: (selectedValue) { + // setState(() { + // icdCode = selectedValue; + // }); + // }) + + Column( + children:[ InkWell( + onTap: widget.prescriptionViewModel.icd10DeseaseItems != null + ? () { + icdCodeList = List.from(widget.prescriptionViewModel.icd10DeseaseItems); + setState(() { + icdCode = null; + icdNameController.text = ''; + }); + } + : null, + child: AppTextFieldCustom( + validationError: icdCodeError, + onChanged: (text){ + icdCodeList = List.from(widget.prescriptionViewModel.icd10DeseaseItems); + setState(() { + icdNameController.text; + }); + }, + height: Utils.getTextFieldHeight(), + onClick: widget.prescriptionViewModel.icd10DeseaseItems != null + ? () { + setState(() { + icdCode = null; + icdNameController.text = ''; + }); + } + : null, + hintText: TranslationBase.of(context).nameOrICD, + maxLines: 1, + minLines: 1, + controller: icdNameController, + enabled:true, + isTextFieldHasSuffix: true, onFieldSubmitted: () { }, + + )), + + icdCodeList.isNotEmpty && icdNameController.text.isNotEmpty ? Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.4, //height to 9% of screen height, + child:ListView.builder( + shrinkWrap: true, + itemCount:icdCodeList.length, + itemBuilder: (context, index) { + return InkWell(child:ListTile( + title: AppText( widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc + " / " + widget.prescriptionViewModel.icd10DeseaseItems[index].codeId.toString(), fontSize: 12.0)), + onTap: (){ + icdCode = widget.prescriptionViewModel.icd10DeseaseItems[index]; + icdNameController.text = widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc; + widget.medicineViewModel.patientAssessmentList[0].icdCode10ID = widget.prescriptionViewModel.icd10DeseaseItems[index].codeId; + widget.medicineViewModel.patientAssessmentList[0].asciiDesc = widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc; + icdCodeList.clear(); + setState(() { + + }); + } + ); + + }, + )) :SizedBox() + ]) + + : widget.medicineViewModel.patientAssessmentList.isNotEmpty ? Container( - height: screenSize.height * 0.070, + height: screenSize.height * 0.068, width: double.infinity, color: Colors.white, child: Row( @@ -298,8 +387,9 @@ class _PrescriptionFormWidgetState extends State { ), ], ), - ), + ) :SizedBox(), SizedBox(height: spaceBetweenTextFields), + SizedBox(height: 10,), Container( color: Colors.transparent, child: InkWell( @@ -512,6 +602,12 @@ class _PrescriptionFormWidgetState extends State { } else { strengthError = null; } + if ( icdNameController.text == "" && widget.prescriptionViewModel.icd10DeseaseItems.isNotEmpty) { + icdCodeError = TranslationBase.of(context).fieldRequired; + } else { + icdCodeError = null; + } + }); } formKey.currentState!.save(); diff --git a/lib/screens/prescription/new_prescriptions_page.dart b/lib/screens/prescription/new_prescriptions_page.dart index a793871e..ddd622c2 100644 --- a/lib/screens/prescription/new_prescriptions_page.dart +++ b/lib/screens/prescription/new_prescriptions_page.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.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/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; @@ -26,7 +27,9 @@ class NewPrescriptionsPage extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; return BaseView( onModelReady: (model) async { - model.getPrescriptionListNew(mrn: patient.patientMRN, appNo: patient.appointmentNo ?? 0); + await model.getPrescriptionListNew( + mrn: patient.patientMRN, appNo: patient.appointmentNo); + await model.isPrincipalCovered(patient: patient); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -45,6 +48,8 @@ class NewPrescriptionsPage extends StatelessWidget { SizedBox( height: 12, ), + + Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -57,7 +62,11 @@ class NewPrescriptionsPage extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) + !model.isPrincipalCovered_ ? Center(child: AppText(TranslationBase.of(context).principalCoveredOrNot,color: Colors.red, textAlign: TextAlign.center, )) :SizedBox(), + SizedBox(height: 20,), + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index ead503d6..a4cd24fc 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -14,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; +import '../../widgets/dialog/confirm_dialog.dart'; +import '../../widgets/transitions/slide_up_page.dart'; import 'entity_list_checkbox_search_widget.dart'; class AddProcedurePage extends StatefulWidget { @@ -177,26 +179,36 @@ class _AddProcedurePageState extends State { : CustomBottomSheetContainer( label: procedureType.getAddButtonTitle(context), onTap: () async { - { - GifLoaderDialogUtils.showMyDialog(context); + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( TranslationBase.of(context).fillTheMandatoryProcedureDetails, ); GifLoaderDialogUtils.hideDialog(context); return; } - GifLoaderDialogUtils.showMyDialog(context); - await widget.model.preparePostProcedure( - orderType: selectedType, - entityList: entityList, - patient: patient, - remarks: remarksController.text, - procedureType: ProcedureType.PROCEDURE, - isLocalBusy: true, + showDialog( + context: context, + builder: (BuildContext context) { + return ConfirmationDialog(title:TranslationBase.of(context).afterOrderCreation, + onTapGrant: () async{ + GifLoaderDialogUtils.showMyDialog(context); + await widget.model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text, + procedureType: ProcedureType.PROCEDURE, + isLocalBusy: true, + ); + GifLoaderDialogUtils.hideDialog(context); + }); + + }, ); - GifLoaderDialogUtils.hideDialog(context); - } + + }), ), ); diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index b48c211b..447de6f9 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -17,6 +17,7 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/material.dart'; +import '../../widgets/shared/app_texts_widget.dart'; import '../../widgets/shared/errors/error_message.dart'; import 'base_add_procedure_tab_page.dart'; @@ -37,13 +38,17 @@ class ProcedureScreen extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getProcedure( - mrn: patient.patientId, - patientType: patientType, - appointmentNo: patient.appointmentNo), - builder: - (BuildContext context, ProcedureViewModel model, Widget? child) => - AppScaffold( + onModelReady: (model) { + model.getProcedure( + mrn: patient.patientId, + patientType: patientType, + appointmentNo: patient.appointmentNo); + model.isPrincipalCovered(patient: patient); + + }, + + builder: (BuildContext context, ProcedureViewModel model, Widget? child) => + AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100]!, baseViewModel: model, @@ -91,6 +96,9 @@ class ProcedureScreen extends StatelessWidget { }, label: TranslationBase.of(context).addMoreProcedure, ), + + !model.isPrincipalCovered_ ? Center(child: AppText(TranslationBase.of(context).principalCoveredOrNot,color: Colors.red, textAlign: TextAlign.center, )) :SizedBox(), + SizedBox(height: 20,), if (model.procedureList.isNotEmpty) ListView.builder( scrollDirection: Axis.vertical, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 247f214b..e2579e3d 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1456,6 +1456,13 @@ class TranslationBase { String get dateFrom => localizedValues['dateFrom']![locale.languageCode]!; String get searchFindSchedule => localizedValues['searchFindSchedule']![locale.languageCode]!; + String get onePrimaryDiagnosis => localizedValues['onePrimaryDiagnosis']![locale.languageCode]!; + String get principalDiagnosisCannot => localizedValues['principalDiagnosisCannot']![locale.languageCode]!; + String get afterOrderCreation => localizedValues['afterOrderCreation']![locale.languageCode]!; + String get principalCoveredOrNot => localizedValues['principalCoveredOrNot']![locale.languageCode]!; + String get complexDiagnosis => localizedValues['complexDiagnosis']![locale.languageCode]!; + String get updateAssessmentDetails => + localizedValues['updateAssessmentDetails']![locale.languageCode]!; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 8c098c4b..148474f0 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -26,7 +26,7 @@ class Utils { get currentLanguage => null; - static showConfirmationDialog(BuildContext context, String message, Function okFunction) { + static showConfirmationDialog(BuildContext context, String message, Function okFunction, {bool isShowCancelButton = true}) { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -47,14 +47,18 @@ class Utils { fontColor: Colors.white, color: AppGlobal.appGreenColor, ), - AppButton( - onPressed: () { - Navigator.of(context).pop(); - }, - title: TranslationBase.of(context).cancel, - fontColor: Colors.white, - color: Colors.red[600], + SizedBox( + height: 30, ), + if (isShowCancelButton) + AppButton( + onPressed: () { + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.white, + color: Colors.red[600], + ), ], ), ], diff --git a/lib/widgets/dialog/confirm_dialog.dart b/lib/widgets/dialog/confirm_dialog.dart new file mode 100644 index 00000000..e4a65e5e --- /dev/null +++ b/lib/widgets/dialog/confirm_dialog.dart @@ -0,0 +1,40 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import '../../utils/translations_delegate_base_utils.dart'; + +class ConfirmationDialog extends StatefulWidget { + final String? title; + final Function? onTapGrant; + + ConfirmationDialog({this.title, this.onTapGrant}); + + @override + _ConfirmationDialogState createState() => _ConfirmationDialogState(); +} + +class _ConfirmationDialogState extends State { + @override + Widget build(BuildContext context) { + return AlertDialog( + title: Text("Alert"), + content: Text(widget.title!), + actions: [ + TextButton( + child: Text(TranslationBase.of(context).cancel), + onPressed: () { + Navigator.pop(context); + }, + ), + TextButton( + child: Text(TranslationBase.of(context).ok), + onPressed: () { + Navigator.pop(context); + widget.onTapGrant!(); + }, + ) + ], + ); + } +} diff --git a/lib/widgets/shared/speech-text-popup.dart b/lib/widgets/shared/speech-text-popup.dart index 5ddf6860..ee6dbd83 100644 --- a/lib/widgets/shared/speech-text-popup.dart +++ b/lib/widgets/shared/speech-text-popup.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/utils/extenstions_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -62,21 +63,7 @@ class _MyStatefulBuilderState extends State { @override void initState() { - streamSubscription = event.controller.stream.listen((p) { - if ((p['searchText'] != 'null' && - p['searchText'] != null && - p['searchText'] != "" && - isClosed == false)) { - setState(() { - searchText = p['searchText']; - SpeechToText.closeAlertDialog(context); - }); - } else if (p['searchText'] == 'null') { - setState(() { - searchText = p['searchText']; - }); - } - }); + startStreamListener(); super.initState(); } @@ -104,9 +91,7 @@ class _MyStatefulBuilderState extends State { child: Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all(width: 2, color: Colors.red)), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 2, color: Colors.red)), child: Icon( Icons.mic, color: Colors.blue, @@ -135,8 +120,7 @@ class _MyStatefulBuilderState extends State { ? Center( child: InkWell( child: Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300]!)), + decoration: BoxDecoration(border: Border.all(color: Colors.grey[300]!)), padding: EdgeInsets.all(5), child: AppText( 'Try Again', @@ -160,7 +144,23 @@ class _MyStatefulBuilderState extends State { @override void dispose() { - super.dispose(); widget.dispose(); + streamSubscription.cancel(); + super.dispose(); + } + + void startStreamListener() { + streamSubscription = event.controller.stream.listen((p) { + if ((p['searchText'] != 'null' && p['searchText'] != null && p['searchText'] != "" && isClosed == false && mounted)) { + setState(() { + searchText = p['searchText']; + // SpeechToText.closeAlertDialog(context); + }); + } else if (p['searchText'] == 'null' && mounted) { + setState(() { + searchText = p['searchText']; + }); + } + }); } } diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 00000000..e69de29b