From 6b6243232c01abcdd4a7a98b8d2bda228532ead1 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 16 May 2021 14:51:30 +0300 Subject: [PATCH 01/10] Procedure template service --- lib/config/config.dart | 5 +- .../Procedure_template_request_model.dart | 120 ++++++++++++++++++ .../procedure/procedure_templateModel.dart | 56 ++++++++ .../procedure/procedure_service.dart | 26 ++++ lib/core/viewModel/procedure_View_model.dart | 15 +++ pubspec.lock | 8 +- 6 files changed, 225 insertions(+), 5 deletions(-) create mode 100644 lib/core/model/procedure/Procedure_template_request_model.dart create mode 100644 lib/core/model/procedure/procedure_templateModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index ec8efe26..acb9e1c7 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -283,6 +283,9 @@ const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave"; const GET_MY_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GetMyOutPatient"; +const GET_PROCEDURE_TEMPLETE = + 'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet'; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ @@ -337,7 +340,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 = 6.0; +const VERSION_ID = 6.1; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/core/model/procedure/Procedure_template_request_model.dart b/lib/core/model/procedure/Procedure_template_request_model.dart new file mode 100644 index 00000000..698178e3 --- /dev/null +++ b/lib/core/model/procedure/Procedure_template_request_model.dart @@ -0,0 +1,120 @@ +class ProcedureTempleteRequestModel { + int doctorID; + String firstName; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteRequestModel( + {this.doctorID, + this.firstName, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_templateModel.dart b/lib/core/model/procedure/procedure_templateModel.dart new file mode 100644 index 00000000..3b12d646 --- /dev/null +++ b/lib/core/model/procedure/procedure_templateModel.dart @@ -0,0 +1,56 @@ +class ProcedureTempleteModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String templateName; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + ProcedureTempleteModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.templateName, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + ProcedureTempleteModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + templateName = json['TemplateName']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['TemplateName'] = this.templateName; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index b403edf0..d0d88f83 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/Procedure_template_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -19,9 +21,15 @@ class ProcedureService extends BaseService { List procedureslist = List(); List categoryList = []; + List _templateList = List(); + List get templateList => _templateList; + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = + ProcedureTempleteRequestModel(); + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, // pageSize: 10, @@ -46,6 +54,24 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); + Future getProcedureTemplate( + {int doctorId, int projectId, int clinicId}) async { + _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + hasError = false; + //insuranceApprovalInPatient.clear(); + + await baseAppClient.post(GET_PROCEDURE_TEMPLETE, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['HIS_ProcedureTemplateList'].forEach((template) { + _templateList.add(ProcedureTempleteModel.fromJson(template)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + Future getProcedure({int mrn}) async { _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 32a40e7e..aca47f10 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.da import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -48,6 +49,8 @@ class ProcedureViewModel extends BaseViewModel { List get labOrdersResultsList => _labsService.labOrdersResultsList; + List get ProcedureTemplate => + _procedureService.templateList; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -92,6 +95,18 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getProcedureTemplate() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedureTemplate(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postProcedure( PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; diff --git a/pubspec.lock b/pubspec.lock index ee31002d..1a572a0a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -573,7 +573,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -615,7 +615,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -907,7 +907,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -1098,5 +1098,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0" From 6192d9a84fb45e0191d894d859b928e68f37aa06 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 17 May 2021 15:05:08 +0300 Subject: [PATCH 02/10] working on medical-profile --- lib/client/base_app_client.dart | 26 +- lib/config/config.dart | 7 +- lib/config/localized_values.dart | 4 + .../PatientMedicalReportService.dart | 65 ++++ .../PatientMedicalReportViewModel.dart | 43 +++ lib/locator.dart | 4 + .../MedicalReport/MeidcalReportModel.dart | 60 +++ lib/routes.dart | 9 + .../admission-request_second-screen.dart | 2 +- .../AddVerifyMedicalReport.dart | 357 ++++++++++++++---- .../medical_report/MedicalReportPage.dart | 201 +++++----- .../profile_gird_for_InPatient.dart | 4 +- lib/util/translations_delegate_base.dart | 4 + 13 files changed, 601 insertions(+), 185 deletions(-) create mode 100644 lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart create mode 100644 lib/core/viewModel/PatientMedicalReportViewModel.dart create mode 100644 lib/models/patient/MedicalReport/MeidcalReportModel.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index bd4b0cd4..718a3839 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -67,11 +67,11 @@ class BaseAppClient { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) - body['PatientOutSA'] = true; - else - body['PatientOutSA'] = false; + int projectID = await sharedPref.getInt(PROJECT_ID); + if (projectID == 2 || projectID == 3) + body['PatientOutSA'] = true; + else + body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; print("URL : $url"); @@ -140,13 +140,11 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; @@ -187,7 +185,7 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - body['TokenID'] = token; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token; body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; @@ -196,7 +194,7 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; //getSe int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) + if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; else body['PatientOutSA'] = false; diff --git a/lib/config/config.dart b/lib/config/config.dart index ec8efe26..3e8bbcb5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -283,6 +283,11 @@ const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave"; const GET_MY_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GetMyOutPatient"; + +const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport"; +const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport"; +const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ @@ -337,7 +342,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 = 6.0; +const VERSION_ID = 6.1; 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 7591bfda..d22358b1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -977,4 +977,8 @@ const Map> localizedValues = { "medicalReportAdd": {"en": "Add Medical Report", "ar": "إضافة تقرير طبي"}, "medicalReportVerify": {"en": "Verify Medical Report", "ar": "تحقق من التقرير الطبي"}, "comments": {"en": "Comments", "ar": "تعليقات"}, + "createNewMedicalReport": {"en": "Create New Medical Report", "ar": "إنشاء تقرير طبي جديد"}, + "historyPhysicalFinding": {"en": "History and Physical Finding", "ar": "التاريخ والاكتشاف المادي"}, + "laboratoryPhysicalData": {"en": "Laboratory and Physical Data", "ar": "المعامل والبيانات الفيزيائية"}, + "impressionRecommendation": {"en": "Impression and Recommendation", "ar": "الانطباع والتوصية"}, }; diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart new file mode 100644 index 00000000..64cce97a --- /dev/null +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class PatientMedicalReportService extends BaseService { + List medicalReportList = []; + + Future getMedicalReportList(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, + onSuccess: (dynamic response, int statusCode) { + + medicalReportList.clear(); + if (response['DAPP_ListMedicalReportList'] != null) { + response['DAPP_ListMedicalReportList'].forEach((v) { + medicalReportList.add(MedicalReportModel.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['MedicalReportHTML'] = htmlText; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['InvoiceNo'] = medicalReport.invoiceNo; + body['LineItemNo'] = medicalReport.lineItemNo; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } +} diff --git a/lib/core/viewModel/PatientMedicalReportViewModel.dart b/lib/core/viewModel/PatientMedicalReportViewModel.dart new file mode 100644 index 00000000..8d7b5c63 --- /dev/null +++ b/lib/core/viewModel/PatientMedicalReportViewModel.dart @@ -0,0 +1,43 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; + +class PatientMedicalReportViewModel extends BaseViewModel { + PatientMedicalReportService _service = locator(); + + List get medicalReportList => _service.medicalReportList; + + Future getMedicalReportList(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _service.getMedicalReportList(patient); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); // ViewState.Error + } else + setState(ViewState.Idle); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText)async { + setState(ViewState.Busy); + await _service.insertMedicalReport(patient, htmlText); + if (_service.hasError) { + error = _service.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + setState(ViewState.Busy); + await _service.verifyMedicalReport(patient, medicalReport); + if (_service.hasError) { + error = _service.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 321b3ffa..f885d4c4 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -15,6 +15,7 @@ import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; import 'core/service/patient/ReferralService.dart'; +import 'core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; import 'core/service/patient_medical_file/medical_report/medical_file_service.dart'; import 'core/service/patient_medical_file/prescription/prescription_service.dart'; import 'core/service/patient_medical_file/procedure/procedure_service.dart'; @@ -36,6 +37,7 @@ import 'core/service/patient/referred_patient_service.dart'; import 'core/service/home/schedule_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; +import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; @@ -84,6 +86,7 @@ void setupLocator() { locator.registerLazySingleton(() => DischargedPatientService()); locator.registerLazySingleton(() => PatientInPatientService()); locator.registerLazySingleton(() => OutPatientService()); + locator.registerLazySingleton(() => PatientMedicalReportService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -110,4 +113,5 @@ void setupLocator() { locator.registerFactory(() => PrescriptionsViewModel()); locator.registerFactory(() => DischargedPatientViewModel()); locator.registerFactory(() => PatientSearchViewModel()); + locator.registerFactory(() => PatientMedicalReportViewModel()); } diff --git a/lib/models/patient/MedicalReport/MeidcalReportModel.dart b/lib/models/patient/MedicalReport/MeidcalReportModel.dart new file mode 100644 index 00000000..450b93f6 --- /dev/null +++ b/lib/models/patient/MedicalReport/MeidcalReportModel.dart @@ -0,0 +1,60 @@ +class MedicalReportModel { + String reportData; + String setupID; + int projectID; + int patientID; + String invoiceNo; + int status; + String verifiedOn; + int verifiedBy; + String editedOn; + int editedBy; + int lineItemNo; + String reportDataHtml; + + MedicalReportModel( + {this.reportData, + this.setupID, + this.projectID, + this.patientID, + this.invoiceNo, + this.status, + this.verifiedOn, + this.verifiedBy, + this.editedOn, + this.editedBy, + this.lineItemNo, + this.reportDataHtml}); + + MedicalReportModel.fromJson(Map json) { + reportData = json['ReportData']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + invoiceNo = json['InvoiceNo']; + status = json['Status']; + verifiedOn = json['VerifiedOn']; + verifiedBy = json['VerifiedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + lineItemNo = json['LineItemNo']; + reportDataHtml = json['ReportDataHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['ReportData'] = this.reportData; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['InvoiceNo'] = this.invoiceNo; + data['Status'] = this.status; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedBy'] = this.verifiedBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['LineItemNo'] = this.lineItemNo; + data['ReportDataHtml'] = this.reportDataHtml; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 2684cd82..c0168762 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -5,6 +5,9 @@ import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_pa import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart'; import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; @@ -51,6 +54,9 @@ const String UPDATE_EPISODE = 'patients/update-episode'; const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; +const String PATIENT_MEDICAL_REPORT = 'patients/medical-report'; +const String PATIENT_MEDICAL_REPORT_INSERT = 'patients/medical-report-insert'; +const String PATIENT_MEDICAL_REPORT_DETAIL = 'patients/medical-report-detail'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; const String PATIENT_ECG = 'patients/ecg'; @@ -79,6 +85,9 @@ var routes = { PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), + PATIENT_MEDICAL_REPORT: (_) => MedicalReportPage(), + PATIENT_MEDICAL_REPORT_INSERT: (_) => AddVerifyMedicalReport(), + PATIENT_MEDICAL_REPORT_DETAIL: (_) => MedicalReportDetailPage(), CREATE_EPISODE: (_) => UpdateSoapIndex( isUpdate: true, ), diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 8627d224..bea487f7 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -477,7 +477,7 @@ class _AdmissionRequestSecondScreenState Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), + color: Color(0xffEAEAEA), fontColor: Colors.black, onPressed: () { Navigator.pop(context); diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 1b33aecb..f562f7b2 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -1,8 +1,9 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -16,21 +17,25 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class AddVerifyMedicalReport extends StatefulWidget { - final MedicalReportStatus status; - - AddVerifyMedicalReport(this.status); - @override _AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState(); } class _AddVerifyMedicalReportState extends State { - stt.SpeechToText speech = stt.SpeechToText(); - var reconizedWord; + stt.SpeechToText speechHistoryFinding = stt.SpeechToText(); + stt.SpeechToText speechLaboratoryData = stt.SpeechToText(); + stt.SpeechToText speechRecommendation = stt.SpeechToText(); + var recognizedWord1; + var recognizedWord2; + var recognizedWord3; var event = RobotProvider(); - TextEditingController commentController = TextEditingController(); + TextEditingController historyFindingController = TextEditingController(); + TextEditingController laboratoryDataController = TextEditingController(); + TextEditingController recommendationController = TextEditingController(); String commentsError; + String comments2Error; + String comments3Error; @override void initState() { @@ -38,7 +43,15 @@ class _AddVerifyMedicalReportState extends State { event.controller.stream.listen((p) { if (p['startPopUp'] == 'true') { if (this.mounted) { - initSpeechState().then((value) => {onVoiceText()}); + initSpeechState().then((value) { + onVoiceText(); + }); + initSpeechState2().then((value) { + onVoiceText2(); + }); + initSpeechState3().then((value) { + onVoiceText3(); + }); } } }); @@ -48,79 +61,201 @@ class _AddVerifyMedicalReportState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + MedicalReportStatus status = routeArgs['status']; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: widget.status == MedicalReportStatus.ADD + appBarTitle: status == MedicalReportStatus.ADD ? TranslationBase.of(context).medicalReportAdd : TranslationBase.of(context).medicalReportVerify, backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: Column( children: [ Expanded( - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .sickLeaveComments, - controller: commentController, - maxLines: 30, - minLines: 20, - hasBorder: true, - validationError: commentsError, - ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * - 0.75 - : 15, - child: Column( + child: Container( + margin: EdgeInsets.all(16), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .historyPhysicalFinding, + controller: historyFindingController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: commentsError, + ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState().then( + (value) => + {onVoiceText()}); + }, + ), + ], + )), + ], + ), + Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .laboratoryPhysicalData, + controller: laboratoryDataController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: comments2Error, + ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState2().then( + (value) => + {onVoiceText2()}); + }, + ), + ], + )), + ], + ), + Stack( children: [ - IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), - onPressed: () { - initSpeechState().then( - (value) => {onVoiceText()}); - }, + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .impressionRecommendation, + controller: recommendationController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: comments3Error, ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState3().then( + (value) => + {onVoiceText3()}); + }, + ), + ], + )), ], - )), - ], + ), + ], + ), + ), ), - ], - ), + ), + ], ), ), ), Container( - margin: EdgeInsets.all(16.0), - child: AppButton( - title: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).medicalReportAdd - : TranslationBase.of(context).medicalReportVerify, - color: Color(0xff359846), - // disabled: progressNoteController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () { - setState(() { - if (commentController.text == "") { - commentsError = - TranslationBase.of(context).fieldRequired; - } else { - commentsError = null; - } - }); - }, + padding: EdgeInsets.all(16.0), + color: Colors.white, + child: Row( + children: [ + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).save + : TranslationBase.of(context).save, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () { + setState(() { + if (historyFindingController.text == "") { + commentsError = + TranslationBase.of(context).fieldRequired; + } else { + commentsError = null; + } + }); + }, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).add + : TranslationBase.of(context).verify, + color: Color(0xff359846), + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () { + setState(() { + if (historyFindingController.text == "") { + commentsError = + TranslationBase.of(context).fieldRequired; + } else { + commentsError = null; + } + }); + }, + ), + ), + ], ), ), ], @@ -131,10 +266,10 @@ class _AddVerifyMedicalReportState extends State { onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( + bool available = await speechHistoryFinding.initialize( onStatus: statusListener, onError: errorListener); if (available) { - speech.listen( + speechHistoryFinding.listen( onResult: resultListener, listenMode: stt.ListenMode.confirmation, localeId: lang == 'en' ? 'en-US' : 'ar-SA', @@ -144,6 +279,38 @@ class _AddVerifyMedicalReportState extends State { } } + onVoiceText2() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speechLaboratoryData.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speechLaboratoryData.listen( + onResult: resultListener2, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + onVoiceText3() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speechRecommendation.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speechRecommendation.listen( + onResult: resultListener3, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + void errorListener(SpeechRecognitionError error) { event.setValue({"searchText": 'null'}); //SpeechToText.closeAlertDialog(context); @@ -151,7 +318,9 @@ class _AddVerifyMedicalReportState extends State { } void statusListener(String status) { - reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord1 = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord2 = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord3 = status == 'listening' ? 'Lisening...' : 'Sorry....'; } void requestPermissions() async { @@ -161,14 +330,44 @@ class _AddVerifyMedicalReportState extends State { } void resultListener(result) { - reconizedWord = result.recognizedWords; - event.setValue({"searchText": reconizedWord}); + recognizedWord1 = result.recognizedWords; + event.setValue({"searchText": recognizedWord1}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speechHistoryFinding.stop(); + historyFindingController.text += recognizedWord1 + '\n'; + }); + } else { + print(result.finalResult); + } + } + + void resultListener2(result) { + recognizedWord2 = result.recognizedWords; + event.setValue({"searchText": recognizedWord2}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speechLaboratoryData.stop(); + laboratoryDataController.text += recognizedWord2 + '\n'; + }); + } else { + print(result.finalResult); + } + } + + void resultListener3(result) { + recognizedWord3 = result.recognizedWords; + event.setValue({"searchText": recognizedWord3}); if (result.finalResult == true) { setState(() { SpeechToText.closeAlertDialog(context); - speech.stop(); - commentController.text += reconizedWord + '\n'; + speechRecommendation.stop(); + recommendationController.text += recognizedWord3 + '\n'; }); } else { print(result.finalResult); @@ -176,7 +375,21 @@ class _AddVerifyMedicalReportState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( + bool hasSpeech = await speechHistoryFinding.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + + Future initSpeechState2() async { + bool hasSpeech = await speechLaboratoryData.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + + Future initSpeechState3() async { + bool hasSpeech = await speechRecommendation.initialize( onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 8dad1bc4..1701feac 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -1,6 +1,10 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; @@ -12,118 +16,125 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../routes.dart'; +import 'AddVerifyMedicalReport.dart'; + class MedicalReportPage extends StatelessWidget { @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; - bool isInpatient = routeArgs['isInpatient']; + String arrivalType = routeArgs['arrivalType']; ProjectViewModel projectViewModel = Provider.of(context); - //TODO Jammal - return AppScaffold( - appBar: PatientProfileHeaderNewDesignAppBar( - patient, - patient.patientType.toString() ?? '0', - patientType, - isInpatient: isInpatient, - ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "Medical", - style: "caption2", - color: Colors.black, - fontSize: 13, - ), - AppText( - "Report", - bold: true, - fontSize: 22, - ), - ], - ), - ), - AddNewOrder( - onTap: () { - }, - label: "Create New Medical Report", - ), - ...List.generate( - /*model.patientLabOrdersList.length,*/1, - (index) => CardWithBgWidget( - hasBorder: false, - bgColor: 0==0? Colors.red[700]:Colors.green[700], - widget: Column( - children: [ - Row( - children: [ - Expanded( + return BaseView( + onModelReady: (model) => model.getMedicalReportList(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType,), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).medical}", + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), + ), + AppText( + TranslationBase.of(context).report, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + color: Color(0xFF2E303A), + ) + ], + ), + ), + AddNewOrder( + onTap: () { + Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'type': MedicalReportStatus.ADD + }); + }, + label: TranslationBase.of(context).createNewMedicalReport, + ), + ...List.generate( + /*model.patientLabOrdersList.length,*/1, + (index) => CardWithBgWidget( + hasBorder: false, + bgColor: 0==0? Colors.red[700]:Colors.green[700], + widget: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('On Hold',color: Colors.red,), + AppText( + "Jammal" ?? "", + fontSize: 15, + bold: true, + ), + ], + )), + Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - AppText('On Hold',color: Colors.red,), AppText( - "Jammal" ?? "", - fontSize: 15, - bold: true, - ), - ], - )), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - AppText( - '${AppDateUtils.getHour(DateTime.now())}', + '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', + color: Colors.black, fontWeight: FontWeight.w600, - color: Colors.grey[700], fontSize: 14, ), - ], + AppText( + '${AppDateUtils.getHour(DateTime.now())}', + fontWeight: FontWeight.w600, + color: Colors.grey[700], + fontSize: 14, + ), + ], + ), ), - ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: LargeAvatar( - name: "Jammal", - url: null, + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: LargeAvatar( + name: "Jammal", + url: null, + ), + width: 55, + height: 55, ), - width: 55, - height: 55, - ), - Expanded(child: AppText("")), - Icon( - EvaIcons.eye, - ) - ], - ), - ], + Expanded(child: AppText("")), + Icon( + EvaIcons.eye, + ) + ], + ), + ], + ), ), - ), - ) - ], + ) + ], + ), ), ), ); diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 1df7d236..49fa8012 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -88,10 +88,10 @@ class ProfileGridForInPatient extends StatelessWidget { PatientProfileCardModel( TranslationBase.of(context).medical, TranslationBase.of(context).report, - HEALTH_SUMMARY, + PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', isInPatient: isInpatient, - isDisable: true), + isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 8c2bf15b..b9c64c17 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1332,6 +1332,10 @@ class TranslationBase { String get medicalReportAdd => localizedValues['medicalReportAdd'][locale.languageCode]; String get medicalReportVerify => localizedValues['medicalReportVerify'][locale.languageCode]; String get comments => localizedValues['comments'][locale.languageCode]; + String get createNewMedicalReport => localizedValues['createNewMedicalReport'][locale.languageCode]; + String get historyPhysicalFinding => localizedValues['historyPhysicalFinding'][locale.languageCode]; + String get laboratoryPhysicalData => localizedValues['laboratoryPhysicalData'][locale.languageCode]; + String get impressionRecommendation => localizedValues['impressionRecommendation'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 3b800bcd1986b9aa604d4a3f536b8ca30656297b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 17 May 2021 15:10:37 +0300 Subject: [PATCH 03/10] favourite procedure templates --- lib/config/config.dart | 2 +- .../procedures/add-favourite-procedure.dart | 0 .../procedures/add-procedure-form.dart | 590 +++++++++--------- .../procedures/add_procedure_homeScreen.dart | 215 +++++++ lib/screens/procedures/procedure_screen.dart | 3 +- 5 files changed, 516 insertions(+), 294 deletions(-) create mode 100644 lib/screens/procedures/add-favourite-procedure.dart create mode 100644 lib/screens/procedures/add_procedure_homeScreen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index acb9e1c7..5b9f594a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,7 +5,7 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index df748922..2b62d2bf 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -145,307 +145,313 @@ class _AddSelectedProcedureState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ]), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.04, ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.04, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.85, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.81, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - // onSubmitted: (_) { - // model.getProcedureCategory( - // categoryName: procedureName.text); - // }, - onClick: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + // onSubmitted: (_) { + // model.getProcedureCategory( + // categoryName: procedureName.text); + // }, + onClick: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + categoryName: + procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + categoryName: procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, + ), + ), + ], ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.02, - ), - InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, + // SizedBox( + // width: MediaQuery.of(context).size.width * 0.29, + // ), + // InkWell( + // child: Icon( + // Icons.close, + // size: 24.0, + // ), + // onTap: () { + // Navigator.pop(context); + // }, + // ), + // ], + // ), + // SizedBox( + // height: 10.0, + // ), + // Container( + // height: screenSize.height * 0.070, + // child: InkWell( + // onTap: model.categoryList != null && + // model.categoryList.length > 0 + // ? () { + // ListSelectDialog dialog = + // ListSelectDialog( + // list: model.categoryList, + // attributeName: 'categoryName', + // attributeValueId: 'categoryId', + // okText: TranslationBase.of(context).ok, + // okFunction: (selectedValue) { + // setState(() { + // selectedCategory = selectedValue; + // model.getProcedureCategory( + // categoryName: selectedCategory[ + // 'categoryName'], + // categoryID: selectedCategory[ + // 'categoryId'] <= + // 9 + // ? "0" + + // selectedCategory[ + // 'categoryId'] + // .toString() + // : selectedCategory[ + // 'categoryId'] + // .toString()); + // }); + // }, + // ); + // showDialog( + // barrierDismissible: false, + // context: context, + // builder: (BuildContext context) { + // return dialog; + // }, + // ); + // //model.getProcedureCategory(); + // } + // : null, + // child: TextField( + // decoration: textFieldSelectorDecoration( + // TranslationBase.of(context) + // .procedureCategorise, + // selectedCategory != null + // ? selectedCategory['categoryName'] + // : null, + // true, + // suffixIcon: Icon( + // Icons.search, + // color: Colors.black, + // )), + // enabled: false, + // ), + // ), + // ), + if (procedureName.text.isNotEmpty && + model.procedureList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: + // selectedCategory != null + // ? selectedCategory['categoryId'] == 02 || + // selectedCategory['categoryId'] == 03 + // ? + EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget + .model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + // : ProcedureListWidget( + // model: widget.model, + // masterList: widget.model + // .categoriesList[0].entityList, + // removeHistory: (item) { + // setState(() { + // entityList.remove(item); + // }); + // }, + // addHistory: (history) { + // setState(() { + // entityList.add(history); + // }); + // }, + // addSelectedHistories: () { + // //TODO build your fun herr + // // widget.addSelectedHistories(); + // }, + // isEntityListSelected: (master) => + // isEntityListSelected(master), + // ) + // : null, + ), + SizedBox( + height: 15.0, ), - ), - ], - ), - // SizedBox( - // width: MediaQuery.of(context).size.width * 0.29, - // ), - // InkWell( - // child: Icon( - // Icons.close, - // size: 24.0, - // ), - // onTap: () { - // Navigator.pop(context); - // }, - // ), - // ], - // ), - // SizedBox( - // height: 10.0, - // ), - // Container( - // height: screenSize.height * 0.070, - // child: InkWell( - // onTap: model.categoryList != null && - // model.categoryList.length > 0 - // ? () { - // ListSelectDialog dialog = - // ListSelectDialog( - // list: model.categoryList, - // attributeName: 'categoryName', - // attributeValueId: 'categoryId', - // okText: TranslationBase.of(context).ok, - // okFunction: (selectedValue) { - // setState(() { - // selectedCategory = selectedValue; - // model.getProcedureCategory( - // categoryName: selectedCategory[ - // 'categoryName'], - // categoryID: selectedCategory[ - // 'categoryId'] <= - // 9 - // ? "0" + - // selectedCategory[ - // 'categoryId'] - // .toString() - // : selectedCategory[ - // 'categoryId'] - // .toString()); - // }); - // }, - // ); - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: (BuildContext context) { - // return dialog; - // }, - // ); - // //model.getProcedureCategory(); - // } - // : null, - // child: TextField( - // decoration: textFieldSelectorDecoration( - // TranslationBase.of(context) - // .procedureCategorise, - // selectedCategory != null - // ? selectedCategory['categoryName'] - // : null, - // true, - // suffixIcon: Icon( - // Icons.search, - // color: Colors.black, - // )), - // enabled: false, - // ), - // ), - // ), - if (procedureName.text.isNotEmpty && - model.procedureList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: - // selectedCategory != null - // ? selectedCategory['categoryId'] == 02 || - // selectedCategory['categoryId'] == 03 - // ? - EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), + Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + ], ) - // : ProcedureListWidget( - // model: widget.model, - // masterList: widget.model - // .categoriesList[0].entityList, - // removeHistory: (item) { - // setState(() { - // entityList.remove(item); - // }); - // }, - // addHistory: (history) { - // setState(() { - // entityList.add(history); - // }); - // }, - // addSelectedHistories: () { - // //TODO build your fun herr - // // widget.addSelectedHistories(); - // }, - // isEntityListSelected: (master) => - // isEntityListSelected(master), - // ) - // : null, - ), - SizedBox( - height: 15.0, + ], + ), ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - ], - ) - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } + ), + ); + }), + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], ), - ], - ), + ), + ], ), ), ); diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/add_procedure_homeScreen.dart new file mode 100644 index 00000000..13695747 --- /dev/null +++ b/lib/screens/procedures/add_procedure_homeScreen.dart @@ -0,0 +1,215 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AddProcedureHome extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + const AddProcedureHome({Key key, this.model, this.patient}) : super(key: key); + @override + _AddProcedureHomeState createState() => + _AddProcedureHomeState(patient: patient, model: model); +} + +class _AddProcedureHomeState extends State + with SingleTickerProviderStateMixin { + _AddProcedureHomeState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + TabController _tabController; + int _activeTab = 0; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + //final routeArgs = ModalRoute.of(context).settings.arguments as Map; + //PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + return BaseView( + //onModelReady: (model) => model.getCategory(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + 'Add Procedure', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: + MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + 'All Procedures', + ), + tabWidget( + screenSize, + _activeTab == 1, + "Favorite Templates", + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddSelectedProcedure( + model: model, + patient: patient, + ), + AddSelectedProcedure( + model: model, + patient: patient, + ) + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 7e18055d..b964392e 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -104,7 +105,7 @@ class ProcedureScreen extends StatelessWidget { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddSelectedProcedure( + builder: (context) => AddProcedureHome( patient: patient, model: model, )), From 84a7f44b68ee18cfc302f1fa0a139bd00b10b32a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 17 May 2021 17:31:35 +0300 Subject: [PATCH 04/10] favourite procedure templates --- .../procedures/add-favourite-procedure.dart | 150 ++++++++++ .../procedures/add_procedure_homeScreen.dart | 7 +- .../procedures/entity_list_fav_procedure.dart | 268 ++++++++++++++++++ 3 files changed, 422 insertions(+), 3 deletions(-) create mode 100644 lib/screens/procedures/entity_list_fav_procedure.dart diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index e69de29b..a424c961 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -0,0 +1,150 @@ +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; + +class AddFavouriteProcedure extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddFavouriteProcedure({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddFavouriteProcedureState createState() => _AddFavouriteProcedureState(); +} + +class _AddFavouriteProcedureState extends State { + _AddFavouriteProcedureState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + List entityList = List(); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getProcedureTemplate(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + if (model.procedureList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: + // selectedCategory != null + // ? selectedCategory['categoryId'] == 02 || + // selectedCategory['categoryId'] == 03 + // ? + EntityListCheckboxSearchFavProceduresWidget( + model: widget.model, + masterList: widget.model.ProcedureTemplate, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + // : ProcedureListWidget( + // model: widget.model, + // masterList: widget.model + // .categoriesList[0].entityList, + // removeHistory: (item) { + // setState(() { + // entityList.remove(item); + // }); + // }, + // addHistory: (history) { + // setState(() { + // entityList.add(history); + // }); + // }, + // addSelectedHistories: () { + // //TODO build your fun herr + // // widget.addSelectedHistories(); + // }, + // isEntityListSelected: (master) => + // isEntityListSelected(master), + // ) + // : null, + ), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + ], + ) + ], + ), + ), + ); + } + + bool isEntityListSelected(ProcedureTempleteModel masterKey) { + Iterable history = entityList + .where((element) => masterKey.templateID == element.templateID); + if (history.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/add_procedure_homeScreen.dart index 13695747..de242cd7 100644 --- a/lib/screens/procedures/add_procedure_homeScreen.dart +++ b/lib/screens/procedures/add_procedure_homeScreen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-favourite-procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -147,10 +148,10 @@ class _AddProcedureHomeState extends State model: model, patient: patient, ), - AddSelectedProcedure( - model: model, + AddFavouriteProcedure( patient: patient, - ) + model: model, + ), ], ), ), diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart new file mode 100644 index 00000000..93f264ab --- /dev/null +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -0,0 +1,268 @@ +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(ProcedureTempleteModel) removeHistory; + final Function(ProcedureTempleteModel) addHistory; + final Function(ProcedureTempleteModel) addRemarks; + + final bool Function(ProcedureTempleteModel) isEntityListSelected; + final List masterList; + + EntityListCheckboxSearchFavProceduresWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected, + this.addRemarks}) + : super(key: key); + + @override + _EntityListCheckboxSearchFavProceduresWidgetState createState() => + _EntityListCheckboxSearchFavProceduresWidgetState(); +} + +class _EntityListCheckboxSearchFavProceduresWidgetState + extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.75, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: TranslationBase.of(context).searchProcedures, + suffixIcon: EvaIcons.search, + suffixIconColor: Color(0xff2B353E), + // onChanged: (value) { + // filterSearchResults(value); + // }, + hasBorder: false, + ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + ExpansionTile( + title: Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Color(0xffD02127), + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget.removeHistory( + historyInfo); + } else { + widget + .addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: AppText('sss', + fontSize: 14.0, + variant: "bodyText", + bold: true, + color: Color(0xff575757)), + ), + ), + ], + ), + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 11), + child: AppText( + TranslationBase.of( + context) + .orderType, + fontWeight: + FontWeight.w700, + color: Color(0xff2B353E), + ), + ), + ], + ), + // Row( + // children: [ + // Radio( + // activeColor: + // Color(0xFFD02127), + // value: 0, + // groupValue: selectedType, + // onChanged: (value) { + // historyInfo.type = + // setSelectedType(value) + // .toString(); + // + // historyInfo.type = + // value.toString(); + // }, + // ), + // AppText( + // 'routine', + // color: Color(0xff575757), + // fontWeight: FontWeight.w600, + // ), + // Radio( + // activeColor: + // Color(0xFFD02127), + // groupValue: selectedType, + // value: 1, + // onChanged: (value) { + // historyInfo.type = + // setSelectedType(value) + // .toString(); + // + // historyInfo.type = + // value.toString(); + // }, + // ), + // AppText( + // TranslationBase.of(context) + // .urgent, + // color: Color(0xff575757), + // fontWeight: FontWeight.w600, + // ), + // ], + // ), + ], + ), + ), + ), + SizedBox( + height: 2.0, + ), + // Padding( + // padding: EdgeInsets.symmetric( + // horizontal: 12, vertical: 12.0), + // child: TextFields( + // hintText: TranslationBase.of(context) + // .remarks, + // //controller: remarksController, + // onChanged: (value) { + // historyInfo.remarks = value; + // }, + // minLines: 3, + // maxLines: 5, + // borderWidth: 0.5, + // borderColor: Colors.grey[500], + // ), + // ), + DividerWithSpacesAround(), + ], + ), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText("Sorry , No Match", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + +// void filterSearchResults(String query) { +// List dummySearchList = List(); +// dummySearchList.addAll(widget.masterList); +// if (query.isNotEmpty) { +// List dummyListData = List(); +// dummySearchList.forEach((item) { +// if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { +// dummyListData.add(item); +// } +// }); +// setState(() { +// items.clear(); +// items.addAll(dummyListData); +// }); +// return; +// } else { +// setState(() { +// items.clear(); +// items.addAll(widget.masterList); +// }); +// } +// } +} From fa830cf4da8302b76f3c5276e0b948d2f8d3d9c9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 18 May 2021 13:21:15 +0300 Subject: [PATCH 05/10] changes --- lib/client/base_app_client.dart | 8 ++++---- lib/config/config.dart | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 718a3839..57814cf1 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -67,10 +67,10 @@ class BaseAppClient { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); - if (projectID == 2 || projectID == 3) - body['PatientOutSA'] = true; - else + // int projectID = await sharedPref.getInt(PROJECT_ID); + // if (projectID == 2 || projectID == 3) + // body['PatientOutSA'] = true; + // else body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; diff --git a/lib/config/config.dart b/lib/config/config.dart index 3e8bbcb5..83a28557 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = From 066acc404a839f28599461826590c86cd8d18b5b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 18 May 2021 16:39:01 +0300 Subject: [PATCH 06/10] Procedure template service --- lib/client/base_app_client.dart | 14 +- lib/config/config.dart | 3 + .../procedure_template_details_model.dart | 84 +++++++ ...cedure_template_details_request_model.dart | 124 ++++++++++ .../procedure/procedure_service.dart | 37 ++- lib/core/viewModel/procedure_View_model.dart | 17 +- .../procedures/add-favourite-procedure.dart | 180 +++++++------- .../procedures/entity_list_fav_procedure.dart | 221 ++++++++---------- 8 files changed, 451 insertions(+), 229 deletions(-) create mode 100644 lib/core/model/procedure/procedure_template_details_model.dart create mode 100644 lib/core/model/procedure/procedure_template_details_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index bd4b0cd4..0f2cf68c 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -43,7 +43,7 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = token ?? ''; + body['TokenID'] = "@dm!n" ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -67,11 +67,11 @@ class BaseAppClient { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) - body['PatientOutSA'] = true; - else - body['PatientOutSA'] = false; + int projectID = await sharedPref.getInt(PROJECT_ID); + if (projectID == 2 || projectID == 3) + body['PatientOutSA'] = true; + else + body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; print("URL : $url"); @@ -196,7 +196,7 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; //getSe int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) + if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; else body['PatientOutSA'] = false; diff --git a/lib/config/config.dart b/lib/config/config.dart index 5b9f594a..2410617c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -286,6 +286,9 @@ const GET_MY_OUT_PATIENT = const GET_PROCEDURE_TEMPLETE = 'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet'; +const GET_PROCEDURE_TEMPLETE_DETAILS = + "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/procedure/procedure_template_details_model.dart b/lib/core/model/procedure/procedure_template_details_model.dart new file mode 100644 index 00000000..84f97b65 --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_model.dart @@ -0,0 +1,84 @@ +class ProcedureTempleteDetailsModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String procedureID; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + String procedureName; + String procedureNameN; + String alias; + String aliasN; + String categoryID; + String subGroupID; + dynamic riskCategoryID; + + ProcedureTempleteDetailsModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.procedureID, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.procedureName, + this.procedureNameN, + this.alias, + this.aliasN, + this.categoryID, + this.subGroupID, + this.riskCategoryID}); + + ProcedureTempleteDetailsModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + alias = json['Alias']; + aliasN = json['AliasN']; + categoryID = json['CategoryID']; + subGroupID = json['SubGroupID']; + riskCategoryID = json['RiskCategoryID']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['Alias'] = this.alias; + data['AliasN'] = this.aliasN; + data['CategoryID'] = this.categoryID; + data['SubGroupID'] = this.subGroupID; + data['RiskCategoryID'] = this.riskCategoryID; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_template_details_request_model.dart b/lib/core/model/procedure/procedure_template_details_request_model.dart new file mode 100644 index 00000000..6df6fc73 --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_request_model.dart @@ -0,0 +1,124 @@ +class ProcedureTempleteDetailsRequestModel { + int doctorID; + String firstName; + int templateID; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteDetailsRequestModel( + {this.doctorID, + this.firstName, + this.templateID, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteDetailsRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + templateID = json['TemplateID']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['TemplateID'] = this.templateID; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index d0d88f83..f31bcc73 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -6,6 +6,8 @@ import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_re import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -24,11 +26,17 @@ class ProcedureService extends BaseService { List _templateList = List(); List get templateList => _templateList; + List _templateDetailsList = List(); + List get templateDetailsList => + _templateDetailsList; + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, @@ -56,7 +64,12 @@ class ProcedureService extends BaseService { Future getProcedureTemplate( {int doctorId, int projectId, int clinicId}) async { - _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + _procedureTempleteRequestModel = ProcedureTempleteRequestModel( + tokenID: "@dm!n", + patientID: 0, + searchType: 1, + editedBy: 208195, + ); hasError = false; //insuranceApprovalInPatient.clear(); @@ -69,7 +82,27 @@ class ProcedureService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: _procedureTempleteRequestModel.toJson()); + } + + Future getProcedureTemplateDetails( + {int doctorId, int projectId, int clinicId, int templateId}) async { + _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel(templateID: templateId); + hasError = false; + //insuranceApprovalInPatient.clear(); + + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['HIS_ProcedureTemplateDetailsList'].forEach((template) { + _templateDetailsList + .add(ProcedureTempleteDetailsModel.fromJson(template)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _procedureTempleteDetailsRequestModel.toJson()); } Future getProcedure({int mrn}) async { diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index aca47f10..434e108e 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -49,8 +50,10 @@ class ProcedureViewModel extends BaseViewModel { List get labOrdersResultsList => _labsService.labOrdersResultsList; - List get ProcedureTemplate => + List get procedureTemplate => _procedureService.templateList; + List get procedureTemplateDetails => + _procedureService.templateDetailsList; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -107,6 +110,18 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getProcedureTemplateDetails({int templateId}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedureTemplateDetails(templateId: templateId); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postProcedure( PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index a424c961..ee128caa 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; @@ -5,7 +6,10 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; @@ -36,103 +40,91 @@ class _AddFavouriteProcedureState extends State { Container( height: MediaQuery.of(context).size.height * 0.070, ), - if (model.procedureList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: - // selectedCategory != null - // ? selectedCategory['categoryId'] == 02 || - // selectedCategory['categoryId'] == 03 - // ? - EntityListCheckboxSearchFavProceduresWidget( - model: widget.model, - masterList: widget.model.ProcedureTemplate, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); + if (model.procedureTemplate.length != 0) + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: + // selectedCategory != null + // ? selectedCategory['categoryId'] == 02 || + // selectedCategory['categoryId'] == 03 + // ? + EntityListCheckboxSearchFavProceduresWidget( + model: widget.model, + masterList: widget.model.procedureTemplate, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + // : ProcedureListWidget( + // model: widget.model, + // masterList: widget.model + // .categoriesList[0].entityList, + // removeHistory: (item) { + // setState(() { + // entityList.remove(item); + // }); + // }, + // addHistory: (history) { + // setState(() { + // entityList.add(history); + // }); + // }, + // addSelectedHistories: () { + // //TODO build your fun herr + // // widget.addSelectedHistories(); + // }, + // isEntityListSelected: (master) => + // isEntityListSelected(master), + // ) + // : null, + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + + Navigator.pop(context); + // postProcedure( + // orderType: selectedType.toString(), + // entityList: entityList, + // patient: patient, + // model: widget.model, + // remarks: remarksController.text); }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ) - // : ProcedureListWidget( - // model: widget.model, - // masterList: widget.model - // .categoriesList[0].entityList, - // removeHistory: (item) { - // setState(() { - // entityList.remove(item); - // }); - // }, - // addHistory: (history) { - // setState(() { - // entityList.add(history); - // }); - // }, - // addSelectedHistories: () { - // //TODO build your fun herr - // // widget.addSelectedHistories(); - // }, - // isEntityListSelected: (master) => - // isEntityListSelected(master), - // ) - // : null, ), - SizedBox( - height: 15.0, + ], + ), ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - ], - ) ], ), ), diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart index 93f264ab..c052f789 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -49,6 +49,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState } List items = List(); + //List items = List(); List remarksList = List(); List typeList = List(); @@ -67,7 +68,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState NetworkBaseView( baseViewModel: widget.model, child: Container( - height: MediaQuery.of(context).size.height * 0.75, + height: MediaQuery.of(context).size.height * 0.65, child: Center( child: Container( margin: EdgeInsets.only(top: 15), @@ -77,12 +78,12 @@ class _EntityListCheckboxSearchFavProceduresWidgetState child: ListView( children: [ TextFields( - hintText: TranslationBase.of(context).searchProcedures, + hintText: 'Search Favourite templates', suffixIcon: EvaIcons.search, suffixIconColor: Color(0xff2B353E), - // onChanged: (value) { - // filterSearchResults(value); - // }, + onChanged: (value) { + filterSearchResults(value); + }, hasBorder: false, ), SizedBox( @@ -94,36 +95,37 @@ class _EntityListCheckboxSearchFavProceduresWidgetState return Column( children: [ ExpansionTile( - title: Row( - children: [ - Checkbox( - value: widget.isEntityListSelected( - historyInfo), - activeColor: Color(0xffD02127), - onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget.removeHistory( - historyInfo); - } else { - widget - .addHistory(historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: AppText('sss', - fontSize: 14.0, - variant: "bodyText", - bold: true, - color: Color(0xff575757)), + title: InkWell( + onTap: () { + widget.model + .getProcedureTemplateDetails( + templateId: + historyInfo.templateID); + }, + child: Row( + children: [ + Icon( + Icons.folder, + size: 20, + color: Color(0xff575757), ), - ), - ], + Expanded( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 0), + child: AppText( + "Procedures for " + + historyInfo.templateName, + fontSize: 16.0, + variant: "bodyText", + bold: true, + color: Color(0xff575757)), + ), + ), + ], + ), ), children: [ Container( @@ -140,60 +142,48 @@ class _EntityListCheckboxSearchFavProceduresWidgetState padding: const EdgeInsets .symmetric( horizontal: 11), - child: AppText( - TranslationBase.of( - context) - .orderType, - fontWeight: - FontWeight.w700, - color: Color(0xff2B353E), + child: Checkbox( + value: widget + .isEntityListSelected( + historyInfo), + activeColor: + Color(0xffD02127), + onChanged: + (bool newValue) { + setState(() { + if (widget + .isEntityListSelected( + historyInfo)) { + widget.removeHistory( + historyInfo); + } else { + widget.addHistory( + historyInfo); + } + }); + }), + ), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: AppText( + widget + .model + .procedureTemplate[ + 0] + .templateName, + fontSize: 14.0, + variant: "bodyText", + bold: true, + color: Color( + 0xff575757)), ), ), ], ), - // Row( - // children: [ - // Radio( - // activeColor: - // Color(0xFFD02127), - // value: 0, - // groupValue: selectedType, - // onChanged: (value) { - // historyInfo.type = - // setSelectedType(value) - // .toString(); - // - // historyInfo.type = - // value.toString(); - // }, - // ), - // AppText( - // 'routine', - // color: Color(0xff575757), - // fontWeight: FontWeight.w600, - // ), - // Radio( - // activeColor: - // Color(0xFFD02127), - // groupValue: selectedType, - // value: 1, - // onChanged: (value) { - // historyInfo.type = - // setSelectedType(value) - // .toString(); - // - // historyInfo.type = - // value.toString(); - // }, - // ), - // AppText( - // TranslationBase.of(context) - // .urgent, - // color: Color(0xff575757), - // fontWeight: FontWeight.w600, - // ), - // ], - // ), ], ), ), @@ -201,22 +191,6 @@ class _EntityListCheckboxSearchFavProceduresWidgetState SizedBox( height: 2.0, ), - // Padding( - // padding: EdgeInsets.symmetric( - // horizontal: 12, vertical: 12.0), - // child: TextFields( - // hintText: TranslationBase.of(context) - // .remarks, - // //controller: remarksController, - // onChanged: (value) { - // historyInfo.remarks = value; - // }, - // minLines: 3, - // maxLines: 5, - // borderWidth: 0.5, - // borderColor: Colors.grey[500], - // ), - // ), DividerWithSpacesAround(), ], ), @@ -235,34 +209,31 @@ class _EntityListCheckboxSearchFavProceduresWidgetState )), ), ), - SizedBox( - height: 10, - ), ], ), ); } -// void filterSearchResults(String query) { -// List dummySearchList = List(); -// dummySearchList.addAll(widget.masterList); -// if (query.isNotEmpty) { -// List dummyListData = List(); -// dummySearchList.forEach((item) { -// if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { -// dummyListData.add(item); -// } -// }); -// setState(() { -// items.clear(); -// items.addAll(dummyListData); -// }); -// return; -// } else { -// setState(() { -// items.clear(); -// items.addAll(widget.masterList); -// }); -// } -// } + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.templateName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } } From 623f2730e8651b4d943a68906a6ffcb78f6d6f61 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 18 May 2021 16:56:30 +0300 Subject: [PATCH 07/10] Procedure card design update --- lib/screens/procedures/ProcedureCard.dart | 109 +++++++++++++++++----- 1 file changed, 85 insertions(+), 24 deletions(-) diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index f18422ee..0c3d952f 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -1,4 +1,5 @@ //import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -32,7 +33,7 @@ class ProcedureCard extends StatelessWidget { return Container( width: double.maxFinite, - height: MediaQuery.of(context).size.height * .22, + //height: MediaQuery.of(context).size.height * .22, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( @@ -129,33 +130,93 @@ class ProcedureCard extends StatelessWidget { ), ], ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).doctorName + ": ", + // //color: Colors.grey, + // fontSize: 12, + // color: Colors.grey, + // ), + // AppText( + // entityList.doctorName.toString(), + // fontSize: 12, + // bold: true, + // ), + // ], + // ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).clinic + ": ", + // //color: Colors.grey, + // fontSize: 12, + // color: Colors.grey, + // ), + // AppText( + // entityList.clinicDescription ?? "", + // bold: true, + // fontSize: 12, + // ), + // ], + // ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context).doctorName + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, - ), - AppText( - entityList.doctorName.toString(), - fontSize: 12, - bold: true, + Container( + margin: EdgeInsets.only(left: 10, right: 0), + child: Image.asset( + 'assets/images/patient/ic_ref_arrow_left.png', + height: 50, + width: 30, + ), ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).clinic + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, + Container( + margin: EdgeInsets.only( + left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: Container( + width: 40, + height: 40, + child: ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + 'assets/images/male_avatar.png', + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + ))), ), - AppText( - entityList.clinicDescription ?? "", - bold: true, - fontSize: 12, + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.only( + left: 10, top: 25, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + entityList.doctorName, + fontFamily: 'Poppins', + fontWeight: FontWeight.w800, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Colors.black, + ), + if (entityList.clinicDescription != null) + AppText( + entityList.clinicDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + ), ), ], ), From deb126fdd5e2a824f5c2dd95b7011ec8b7db6c0c Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 19 May 2021 09:17:03 +0300 Subject: [PATCH 08/10] meical report changes --- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 1 + .../PatientMedicalReportService.dart | 24 +++ .../PatientMedicalReportViewModel.dart | 19 ++- .../MedicalReport/MedicalReportTemplate.dart | 60 ++++++++ .../AddVerifyMedicalReport.dart | 1 + .../medical_report/MedicalReportPage.dart | 140 ++++++++++-------- 7 files changed, 182 insertions(+), 65 deletions(-) create mode 100644 lib/models/patient/MedicalReport/MedicalReportTemplate.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index f07dc533..79343dd8 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -47,7 +47,7 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = token ?? ''; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; diff --git a/lib/config/config.dart b/lib/config/config.dart index ca81dfeb..72e2db07 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -285,6 +285,7 @@ const GET_MY_OUT_PATIENT = const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport"; +const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_GetTemplateByID"; const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport"; const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport"; diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index 64cce97a..a3ba3f6d 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -1,10 +1,12 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart'; import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; class PatientMedicalReportService extends BaseService { List medicalReportList = []; + List medicalReportTemplate = []; Future getMedicalReportList(PatiantInformtion patient) async { hasError = false; @@ -28,6 +30,28 @@ class PatientMedicalReportService extends BaseService { }, body: body, patient: patient); } + Future getMedicalReportTemplate() async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['TemplateID'] = 43; + + await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, + onSuccess: (dynamic response, int statusCode) { + + medicalReportTemplate.clear(); + if (response['DAPP_GetTemplateByIDList'] != null) { + response['DAPP_GetTemplateByIDList'].forEach((v) { + medicalReportTemplate.add(MedicalReportTemplate.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body); + } + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { hasError = false; Map body = Map(); diff --git a/lib/core/viewModel/PatientMedicalReportViewModel.dart b/lib/core/viewModel/PatientMedicalReportViewModel.dart index 8d7b5c63..9a41a253 100644 --- a/lib/core/viewModel/PatientMedicalReportViewModel.dart +++ b/lib/core/viewModel/PatientMedicalReportViewModel.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart'; import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -11,6 +12,9 @@ class PatientMedicalReportViewModel extends BaseViewModel { List get medicalReportList => _service.medicalReportList; + List get medicalReportTemplate => + _service.medicalReportTemplate; + Future getMedicalReportList(PatiantInformtion patient) async { setState(ViewState.Busy); await _service.getMedicalReportList(patient); @@ -21,7 +25,17 @@ class PatientMedicalReportViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future insertMedicalReport(PatiantInformtion patient, String htmlText)async { + Future getMedicalReportTemplate() async { + setState(ViewState.Busy); + await _service.getMedicalReportTemplate(); + if (_service.hasError) { + error = _service.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { setState(ViewState.Busy); await _service.insertMedicalReport(patient, htmlText); if (_service.hasError) { @@ -31,7 +45,8 @@ class PatientMedicalReportViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + Future verifyMedicalReport( + PatiantInformtion patient, MedicalReportModel medicalReport) async { setState(ViewState.Busy); await _service.verifyMedicalReport(patient, medicalReport); if (_service.hasError) { diff --git a/lib/models/patient/MedicalReport/MedicalReportTemplate.dart b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart new file mode 100644 index 00000000..f00e84a0 --- /dev/null +++ b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart @@ -0,0 +1,60 @@ +class MedicalReportTemplate { + String setupID; + int projectID; + int templateID; + String procedureID; + int reportType; + String templateName; + String templateNameN; + String templateText; + String templateTextN; + bool isActive; + String templateTextHtml; + String templateTextNHtml; + + MedicalReportTemplate( + {this.setupID, + this.projectID, + this.templateID, + this.procedureID, + this.reportType, + this.templateName, + this.templateNameN, + this.templateText, + this.templateTextN, + this.isActive, + this.templateTextHtml, + this.templateTextNHtml}); + + MedicalReportTemplate.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + reportType = json['ReportType']; + templateName = json['TemplateName']; + templateNameN = json['TemplateNameN']; + templateText = json['TemplateText']; + templateTextN = json['TemplateTextN']; + isActive = json['IsActive']; + templateTextHtml = json['TemplateTextHtml']; + templateTextNHtml = json['TemplateTextNHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['ReportType'] = this.reportType; + data['TemplateName'] = this.templateName; + data['TemplateNameN'] = this.templateNameN; + data['TemplateText'] = this.templateText; + data['TemplateTextN'] = this.templateTextN; + data['IsActive'] = this.isActive; + data['TemplateTextHtml'] = this.templateTextHtml; + data['TemplateTextNHtml'] = this.templateTextNHtml; + return data; + } +} diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index f562f7b2..4fd6b7dc 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -66,6 +66,7 @@ class _AddVerifyMedicalReportState extends State { MedicalReportStatus status = routeArgs['status']; return BaseView( + onModelReady: (model) => model.getMedicalReportTemplate(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 1701feac..41fcc02e 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -11,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head 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/errors/error_message.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,8 +25,8 @@ class MedicalReportPage extends StatelessWidget { @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; ProjectViewModel projectViewModel = Provider.of(context); @@ -33,7 +35,11 @@ class MedicalReportPage extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType,), + appBar: PatientProfileHeaderNewDesignAppBar( + patient, + patientType, + arrivalType, + ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( @@ -61,7 +67,8 @@ class MedicalReportPage extends StatelessWidget { ), AddNewOrder( onTap: () { - Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { + Navigator.of(context) + .pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { 'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, @@ -70,69 +77,78 @@ class MedicalReportPage extends StatelessWidget { }, label: TranslationBase.of(context).createNewMedicalReport, ), - ...List.generate( - /*model.patientLabOrdersList.length,*/1, - (index) => CardWithBgWidget( - hasBorder: false, - bgColor: 0==0? Colors.red[700]:Colors.green[700], - widget: Column( - children: [ - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('On Hold',color: Colors.red,), - AppText( - "Jammal" ?? "", - fontSize: 15, - bold: true, - ), - ], - )), - Expanded( + if (model.state == ViewState.ErrorLocal) + Container( + child: ErrorMessage(error: model.error), + ), + if (model.state != ViewState.ErrorLocal) + ...List.generate( + /*model.patientLabOrdersList.length,*/ + 1, + (index) => CardWithBgWidget( + hasBorder: false, + bgColor: 0 == 0 ? Colors.red[700] : Colors.green[700], + widget: Column( + children: [ + Row( + children: [ + Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - AppText( - '${AppDateUtils.getHour(DateTime.now())}', - fontWeight: FontWeight.w600, - color: Colors.grey[700], - fontSize: 14, - ), - ], + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'On Hold', + color: Colors.red, ), - ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: LargeAvatar( - name: "Jammal", - url: null, + AppText( + "Jammal" ?? "", + fontSize: 15, + bold: true, ), - width: 55, - height: 55, + ], + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + AppText( + '${AppDateUtils.getHour(DateTime.now())}', + fontWeight: FontWeight.w600, + color: Colors.grey[700], + fontSize: 14, + ), + ], ), - Expanded(child: AppText("")), - Icon( - EvaIcons.eye, - ) - ], - ), - ], - ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: LargeAvatar( + name: "Jammal", + url: null, + ), + width: 55, + height: 55, + ), + Expanded(child: AppText("")), + Icon( + EvaIcons.eye, + ) + ], + ), + ], ), - ) + ), + ), ], ), ), From 8cac9b6fe90b5eb123542dcfcbe5b857a178575c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 19 May 2021 13:58:48 +0300 Subject: [PATCH 09/10] add rich editor --- ios/Podfile.lock | 8 +- .../shared/text_fields/html_rich_editor.dart | 174 ++++++++++++++++++ pubspec.lock | 21 +++ pubspec.yaml | 5 + speech_to_text/example/pubspec.lock | 104 ++++------- speech_to_text/pubspec.lock | 71 +++---- 6 files changed, 263 insertions(+), 120 deletions(-) create mode 100644 lib/widgets/shared/text_fields/html_rich_editor.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 878a1850..1cf7499c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -58,6 +58,8 @@ PODS: - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter + - flutter_inappwebview (0.0.1): + - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter - GoogleDataTransport (7.5.1): @@ -151,6 +153,7 @@ DEPENDENCIES: - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) + - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) @@ -218,6 +221,8 @@ EXTERNAL SOURCES: :path: Flutter flutter_flexible_toast: :path: ".symlinks/plugins/flutter_flexible_toast/ios" + flutter_inappwebview: + :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_plugin_android_lifecycle: :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" hexcolor: @@ -285,6 +290,7 @@ SPEC CHECKSUMS: FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 + flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 @@ -322,4 +328,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0.rc.1 diff --git a/lib/widgets/shared/text_fields/html_rich_editor.dart b/lib/widgets/shared/text_fields/html_rich_editor.dart new file mode 100644 index 00000000..1d87685b --- /dev/null +++ b/lib/widgets/shared/text_fields/html_rich_editor.dart @@ -0,0 +1,174 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:html_editor_enhanced/html_editor.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../speech-text-popup.dart'; + +class HtmlRichEditor extends StatefulWidget { + HtmlRichEditor({ + key, + this.hint = "Your text here...", + this.initialText, + this.height = 400, + this.decoration, + this.darkMode = false, + this.showBottomToolbar = false, + this.toolbar, + }) : super(key: key); + final String hint; + final String initialText; + final double height; + final BoxDecoration decoration; + final bool darkMode; + final bool showBottomToolbar; + final List toolbar; + + + @override + _HtmlRichEditorState createState() => _HtmlRichEditorState(); +} + +class _HtmlRichEditorState extends State { + ProjectViewModel projectViewModel; + stt.SpeechToText speech = stt.SpeechToText(); + var recognizedWord; + var event = RobotProvider(); + + + @override + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + super.initState(); + } + + + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Stack( + children: [ + HtmlEditor( + hint: widget.hint, + height: widget.height, + initialText: widget.initialText, + showBottomToolbar: widget.showBottomToolbar, + darkMode: widget.darkMode, + decoration: widget.decoration ?? + BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.all( + Radius.circular(30.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + toolbar: widget.toolbar ?? + const [ + // Style(), + Font(buttons: [ + FontButtons.bold, + FontButtons.underline, + FontButtons.clear + ]), + // ColorBar(buttons: [ColorButtons.color]), + Paragraph(buttons: [ + ParagraphButtons.ul, + ParagraphButtons.ol, + ParagraphButtons.paragraph + ]), + // Insert(buttons: [InsertButtons.link, InsertButtons.picture, InsertButtons.video, InsertButtons.table]), + // Misc(buttons: [MiscButtons.fullscreen, MiscButtons.codeview, MiscButtons.help]) + ], + ), + Positioned( + top: + 50, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon(DoctorApp.speechtotext, + color: Colors.black, size: 35), + onPressed: () { + initSpeechState() + .then((value) => {onVoiceText()}); + }, + ), + ], + )) + ], + ); + } + + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result)async { + recognizedWord = result.recognizedWords; + event.setValue({"searchText": recognizedWord}); + String txt = await HtmlEditor.getText(); + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + HtmlEditor.setText(txt+recognizedWord); + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } +} diff --git a/pubspec.lock b/pubspec.lock index ee31002d..980a4154 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -426,6 +426,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + flutter_inappwebview: + dependency: transitive + description: + name: flutter_inappwebview + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0+4" flutter_localizations: dependency: "direct main" description: flutter @@ -518,6 +525,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.0+4" + html_editor_enhanced: + dependency: "direct main" + description: + name: html_editor_enhanced + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" http: dependency: "direct main" description: @@ -1013,6 +1027,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1+3" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 29c3f7b1..a5026871 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,6 +90,11 @@ dependencies: speech_to_text: path: speech_to_text + + + #Html Editor Enhanced + html_editor_enhanced: ^1.3.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/speech_to_text/example/pubspec.lock b/speech_to_text/example/pubspec.lock index e0e9b753..6809f75f 100644 --- a/speech_to_text/example/pubspec.lock +++ b/speech_to_text/example/pubspec.lock @@ -1,69 +1,48 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -71,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -81,13 +67,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" json_annotation: dependency: transitive description: @@ -101,14 +80,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" nested: dependency: transitive description: @@ -122,7 +101,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" permission_handler: dependency: "direct main" description: @@ -137,13 +116,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" plugin_platform_interface: dependency: transitive description: @@ -158,13 +130,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -176,7 +141,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" speech_to_text: dependency: "direct dev" description: @@ -190,56 +155,49 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.16.0 <2.0.0" diff --git a/speech_to_text/pubspec.lock b/speech_to_text/pubspec.lock index 7877604f..efc63cc7 100644 --- a/speech_to_text/pubspec.lock +++ b/speech_to_text/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.39.13" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" args: dependency: transitive description: @@ -35,14 +28,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" build: dependency: transitive description: @@ -99,13 +92,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" checked_yaml: dependency: transitive description: @@ -119,7 +119,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" code_builder: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" fixnum: dependency: transitive description: @@ -221,13 +221,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" io: dependency: transitive description: @@ -269,14 +262,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -311,7 +304,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" pedantic: dependency: transitive description: @@ -319,13 +312,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" pool: dependency: transitive description: @@ -386,21 +372,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" stream_transform: dependency: transitive description: @@ -414,21 +400,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" timing: dependency: transitive description: @@ -442,14 +428,14 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" watcher: dependency: transitive description: @@ -464,13 +450,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" yaml: dependency: transitive description: @@ -479,5 +458,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.10.0" From e1d00b87ad34a67c31a2dcddf87a2c650649ea7c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 19 May 2021 14:46:29 +0300 Subject: [PATCH 10/10] favourite template Procedure service --- .../procedure/procedure_service.dart | 4 +- lib/core/viewModel/procedure_View_model.dart | 2 + .../procedures/add-favourite-procedure.dart | 19 ++- .../procedures/entity_list_fav_procedure.dart | 129 ++++++++++-------- 4 files changed, 90 insertions(+), 64 deletions(-) diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index f31bcc73..9673b9bf 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -88,9 +88,11 @@ class ProcedureService extends BaseService { Future getProcedureTemplateDetails( {int doctorId, int projectId, int clinicId, int templateId}) async { _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel(templateID: templateId); + ProcedureTempleteDetailsRequestModel( + templateID: templateId, searchType: 1, patientID: 0); hasError = false; //insuranceApprovalInPatient.clear(); + _templateDetailsList.clear(); await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 434e108e..bf790335 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -110,7 +110,9 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } + int tempId = 0; Future getProcedureTemplateDetails({int templateId}) async { + tempId = templateId; hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index ee128caa..89a382ad 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -27,11 +28,15 @@ class _AddFavouriteProcedureState extends State { _AddFavouriteProcedureState({this.patient, this.model}); ProcedureViewModel model; PatiantInformtion patient; - List entityList = List(); + List entityList = List(); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getProcedureTemplate(), + onModelReady: (model) async { + if (model.procedureTemplate.length == 0) { + model.getProcedureTemplate(); + } + }, builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, @@ -52,12 +57,12 @@ class _AddFavouriteProcedureState extends State { EntityListCheckboxSearchFavProceduresWidget( model: widget.model, masterList: widget.model.procedureTemplate, - removeHistory: (item) { + removeFavProcedure: (item) { setState(() { entityList.remove(item); }); }, - addHistory: (history) { + addFavProcedure: (history) { setState(() { entityList.add(history); }); @@ -66,7 +71,7 @@ class _AddFavouriteProcedureState extends State { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => + isEntityFavListSelected: (master) => isEntityListSelected(master), ) // : ProcedureListWidget( @@ -131,8 +136,8 @@ class _AddFavouriteProcedureState extends State { ); } - bool isEntityListSelected(ProcedureTempleteModel masterKey) { - Iterable history = entityList + bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { + Iterable history = entityList .where((element) => masterKey.templateID == element.templateID); if (history.length > 0) { return true; diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart index c052f789..31b2a784 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -17,7 +18,12 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { final Function(ProcedureTempleteModel) addHistory; final Function(ProcedureTempleteModel) addRemarks; + final Function(ProcedureTempleteDetailsModel) removeFavProcedure; + final Function(ProcedureTempleteDetailsModel) addFavProcedure; + final Function(ProcedureTempleteDetailsModel) addProceduresRemarks; + final bool Function(ProcedureTempleteModel) isEntityListSelected; + final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; final List masterList; EntityListCheckboxSearchFavProceduresWidget( @@ -27,7 +33,11 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { this.removeHistory, this.masterList, this.addHistory, + this.addFavProcedure, + this.addProceduresRemarks, + this.removeFavProcedure, this.isEntityListSelected, + this.isEntityFavListSelected, this.addRemarks}) : super(key: key); @@ -49,7 +59,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState } List items = List(); - //List items = List(); + List itemsProcedure = List(); List remarksList = List(); List typeList = List(); @@ -128,65 +138,72 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ), ), children: [ - Container( - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( + Column( + children: widget + .model.procedureTemplateDetails + .map((itemProcedure) { + return Container( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 11), - child: Checkbox( - value: widget - .isEntityListSelected( - historyInfo), - activeColor: - Color(0xffD02127), - onChanged: - (bool newValue) { - setState(() { - if (widget - .isEntityListSelected( - historyInfo)) { - widget.removeHistory( - historyInfo); - } else { - widget.addHistory( - historyInfo); - } - }); - }), - ), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: AppText( - widget - .model - .procedureTemplate[ - 0] - .templateName, - fontSize: 14.0, - variant: "bodyText", - bold: true, - color: Color( - 0xff575757)), - ), + Row( + children: [ + Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 11), + child: Checkbox( + value: widget + .isEntityFavListSelected( + itemProcedure), + activeColor: Color( + 0xffD02127), + onChanged: (bool + newValue) { + setState(() { + if (widget + .isEntityFavListSelected( + itemProcedure)) { + widget.removeFavProcedure( + itemProcedure); + } else { + widget.addFavProcedure( + itemProcedure); + } + }); + }), + ), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: + 10, + vertical: 0), + child: AppText( + itemProcedure + .procedureName, + fontSize: 14.0, + variant: + "bodyText", + bold: true, + color: Color( + 0xff575757)), + ), + ), + ], ), ], ), - ], - ), - ), + ), + ); + }).toList(), ), SizedBox( height: 2.0,