diff --git a/lib/config/config.dart b/lib/config/config.dart index e248f70e..b88d0f21 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -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'; @@ -202,6 +203,9 @@ 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"; 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 fb229127..7b211414 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 = new List(); + 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['icdCodeDetailsModel'] = + 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 070eab08..e0c64396 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/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index bda8907d..2cf18c4d 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(); @@ -441,4 +444,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, + "EncounterType":patient.appointmentTypeId, + "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 852029c3..05fea070 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 866321fe..9575bfad 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -18,7 +18,6 @@ import 'package:doctor_app_flutter/core/service/patient_medical_file/prescriptio import 'package:doctor_app_flutter/core/service/patient_medical_file/soap/SOAP_service.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/in_patient/get_episode_for_inpatient_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart'; @@ -37,6 +36,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjecti import 'package:flutter/material.dart'; import '../../locator.dart'; +import '../model/SOAP/assessment/patch_assessment_req_model.dart'; import 'base_view_model.dart'; class SOAPViewModel extends BaseViewModel { @@ -80,7 +80,7 @@ class SOAPViewModel extends BaseViewModel { List get patientAssessmentList => _SOAPService.patientAssessmentList; int get episodeID => _SOAPService.episodeID; - + bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; bool isAddProgress = true; bool isAddExamInProgress = true; String progressNoteText = ""; @@ -221,7 +221,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async { + Future patchAssessment(PostAssessmentRequestUpdateModel patchAssessmentRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.patchAssessment(patchAssessmentRequestModel); if (_SOAPService.hasError) { @@ -601,6 +601,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 { var services; diff --git a/lib/core/viewModel/prescription/prescription_view_model.dart b/lib/core/viewModel/prescription/prescription_view_model.dart index d5101caf..7725f223 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'; @@ -52,6 +53,8 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionService.prescriptionsList; + List get icd10DeseaseItems =>_prescriptionService.icd10CodeListByItem; + bool get isPrincipalCovered_ => _prescriptionService.isDiagnosisCovered; Future getItem({int itemID}) async { hasError = false; setState(ViewState.BusyLocal); @@ -206,4 +209,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 005d095d..05903d45 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -29,12 +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; List get valadteProcedureList => _procedureService.valadteProcedureList; @@ -63,6 +65,7 @@ class ProcedureViewModel extends BaseViewModel { bool _isRadiologyVIDAPlus = false; bool get isRadiologyVIDAPlus => _isRadiologyVIDAPlus; + bool get isPrincipalCovered_ => _prescriptionService.isDiagnosisCovered; Future getProcedure({int mrn, String patientType, int appointmentNo, bool isLocalBusy = false}) async { hasError = false; @@ -454,4 +457,16 @@ 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/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 4ac476d0..e6851456 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.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 +49,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], @@ -77,7 +81,11 @@ class _LabsHomePageState extends State { if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) - AddNewOrder( + + SizedBox(height: 20,), + !model.isPrincipalCovered_ ? Center(child: AppText(TranslationBase.of(context).principalCoveredOrNot,color: Colors.red, textAlign: TextAlign.center, )) :SizedBox(), + + AddNewOrder( onTap: () { Navigator.push( context, diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index cc419e06..aa81da3e 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -18,6 +18,7 @@ import 'package:flutter/cupertino.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 { @@ -48,7 +49,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], @@ -71,11 +76,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 af217257..ec40c9a2 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 @@ -4,7 +4,6 @@ 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/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/patch_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_assement.dart'; @@ -26,6 +25,8 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils. import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../../core/model/SOAP/assessment/patch_assessment_req_model.dart'; + class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final List mySelectedAssessmentList; @@ -48,7 +49,7 @@ class _AddAssessmentDetailsState extends State { GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; - + bool complexDiagnosis =true; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -97,7 +98,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( @@ -110,6 +111,26 @@ 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( @@ -153,11 +174,10 @@ class _AddAssessmentDetailsState extends State { maxLines: 1, minLines: 1, controller: icdNameController, - enabled: true, + enabled:true, isTextFieldHasSuffix: true, suffixIcon: IconButton( onPressed: () { - print(icdNameController.text); if (icdNameController.text.length <= 3) { DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); } else { @@ -367,7 +387,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; @@ -387,23 +407,30 @@ class _AddAssessmentDetailsState extends State { } 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, + createdByName: doctorProfile.doctorName, + createdBy: doctorProfile.doctorID, + icdCodeDetails: [ + new IcdCodeDetailsUpdate( remarks: mySelectedAssessment.remark, - complexDiagnosis: true, + complexDiagnosis: complexDiagnosis, conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + prevIcdCode10ID: mySelectedAssessment.icdCode10ID, diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: mySelectedAssessment.selectedICD.code, - prevIcdCode10ID: mySelectedAssessment.icdCode10ID); + icdcode10Id: mySelectedAssessment.selectedICD.code)]); 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, @@ -413,7 +440,7 @@ class _AddAssessmentDetailsState extends State { icdCodeDetails: [ new IcdCodeDetails( remarks: mySelectedAssessment.remark, - complexDiagnosis: true, + complexDiagnosis: complexDiagnosis, conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, icdcode10Id: mySelectedAssessment.selectedICD.code) 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 74b9a1f4..6a907b01 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 = List(); - + 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 255a3e72..f9c6df4f 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 { @@ -87,58 +88,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 cb4ebf06..58531369 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -25,6 +25,7 @@ import 'package:flutter/services.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'; @@ -48,7 +49,7 @@ class _PrescriptionFormWidgetState extends State { String durationError; String unitError; String strengthError; - + String icdCodeError; int selectedType; TextEditingController strengthController = TextEditingController(); @@ -80,6 +81,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(() { @@ -87,6 +96,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; @@ -267,9 +280,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; + }); + } + : 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; + }); + } + : null, + hintText: TranslationBase.of(context).nameOrICD, + maxLines: 1, + minLines: 1, + controller: icdNameController, + enabled:true, + isTextFieldHasSuffix: true, + + )), + + 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( @@ -292,8 +381,9 @@ class _PrescriptionFormWidgetState extends State { ), ], ), - ), + ) :SizedBox(), SizedBox(height: spaceBetweenTextFields), + SizedBox(height: 10,), Container( color: Colors.transparent, child: InkWell( @@ -499,6 +589,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 93345506..8e1ed69c 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,8 +27,9 @@ class NewPrescriptionsPage extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; return BaseView( onModelReady: (model) async { - model.getPrescriptionListNew( + await model.getPrescriptionListNew( mrn: patient.patientMRN, appNo: patient.appointmentNo); + await model.isPrincipalCovered(patient: patient); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -46,6 +48,8 @@ class NewPrescriptionsPage extends StatelessWidget { SizedBox( height: 12, ), + + Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -58,6 +62,8 @@ class NewPrescriptionsPage extends StatelessWidget { ], ), ), + !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)) diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index efb1185f..3b0515a5 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 { @@ -197,27 +199,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.toString(), - 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 23424463..31477de5 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,10 +38,15 @@ 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), + 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, @@ -90,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 462f6372..709a09d9 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1068,7 +1068,8 @@ class TranslationBase { String get addAssessmentDetails => localizedValues['addAssessmentDetails'][locale.languageCode]; - + String get updateAssessmentDetails => + localizedValues['updateAssessmentDetails'][locale.languageCode]; String get progressNoteSOAP => localizedValues['progressNoteSOAP'][locale.languageCode]; @@ -1729,6 +1730,12 @@ class TranslationBase { String get doctorRota => localizedValues['doctorRota'][locale.languageCode]; 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]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dialog/confirm_dialog.dart b/lib/widgets/dialog/confirm_dialog.dart new file mode 100644 index 00000000..284f4072 --- /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(); + }, + ) + ], + ); + } + +}