From 64b5652c8dfeb8c53bc9657b69bc48ab5b9bdf3b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 25 Oct 2021 09:47:50 +0300 Subject: [PATCH 1/6] Pending Orders Service --- lib/config/config.dart | 3 + lib/core/service/pending_order_service.dart | 36 +++++++++ .../viewModel/pednding_orders_view_model.dart | 26 +++++++ lib/locator.dart | 4 + .../pending_order_request_model.dart | 76 +++++++++++++++++++ .../pending_orders/pending_orders_model.dart | 15 ++++ lib/routes.dart | 3 + .../operation_report/operation_report.dart | 2 +- .../pending_orders/pending_orders_screen.dart | 64 ++++++++++++++++ .../profile_gird_for_InPatient.dart | 7 ++ 10 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 lib/core/service/pending_order_service.dart create mode 100644 lib/core/viewModel/pednding_orders_view_model.dart create mode 100644 lib/models/pending_orders/pending_order_request_model.dart create mode 100644 lib/models/pending_orders/pending_orders_model.dart create mode 100644 lib/screens/patients/profile/pending_orders/pending_orders_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index f17693e0..53a8f55e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -348,6 +348,9 @@ const GET_EPISODE_FOR_INPATIENT = const GET_OPERATION_REPORT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; +const GET_PENDING_ORDERS = + "Services/DoctorApplication.svc/REST/DoctorApp_GetPendingOrdersForInPatient"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/service/pending_order_service.dart b/lib/core/service/pending_order_service.dart new file mode 100644 index 00000000..3e6fa497 --- /dev/null +++ b/lib/core/service/pending_order_service.dart @@ -0,0 +1,36 @@ +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/pending_orders/pending_order_request_model.dart'; +import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart'; + +class PendingOrderService extends BaseService { + List get _pendingOrderList => List(); + List get pendingOrderList => _pendingOrderList; + + Future getPendingOrders( + {PendingOrderRequestModel pendingOrderRequestModel, + int patientId, + int admissionNo}) async { + pendingOrderRequestModel = PendingOrderRequestModel( + patientID: patientId, + admissionNo: admissionNo, + patientTypeID: 1, + patientType: 1, + ); + + hasError = false; + await baseAppClient.post(GET_PENDING_ORDERS, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + _pendingOrderList.clear(); + response['List_PendingOrders'].forEach( + (v) { + _pendingOrderList.add(PendingOrderModel.fromJson(v)); + }, + ); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: pendingOrderRequestModel.toJson()); + } +} diff --git a/lib/core/viewModel/pednding_orders_view_model.dart b/lib/core/viewModel/pednding_orders_view_model.dart new file mode 100644 index 00000000..fd66413b --- /dev/null +++ b/lib/core/viewModel/pednding_orders_view_model.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/pending_order_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart'; + +class PendingOrdersViewModel extends BaseViewModel { + bool hasError = false; + PendingOrderService _pendingOrderService = locator(); + + List get pendingOrdersList => + _pendingOrderService.pendingOrderList; + + Future getPendingOrders({int patientId, int admissionNo}) async { + hasError = false; + setState(ViewState.Busy); + await _pendingOrderService.getPendingOrders( + patientId: patientId, admissionNo: admissionNo); + if (_pendingOrderService.hasError) { + error = _pendingOrderService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index b5f651eb..4544f923 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,11 +1,13 @@ import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; import 'package:doctor_app_flutter/core/service/operation_report_servive.dart'; +import 'package:doctor_app_flutter/core/service/pending_order_service.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/operation_report_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; @@ -103,6 +105,7 @@ void setupLocator() { locator.registerLazySingleton(() => VideoCallService()); locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); + locator.registerLazySingleton(() => PendingOrderService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -132,4 +135,5 @@ void setupLocator() { locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => OperationReportViewModel()); + locator.registerFactory(() => PendingOrdersViewModel()); } diff --git a/lib/models/pending_orders/pending_order_request_model.dart b/lib/models/pending_orders/pending_order_request_model.dart new file mode 100644 index 00000000..c69cf780 --- /dev/null +++ b/lib/models/pending_orders/pending_order_request_model.dart @@ -0,0 +1,76 @@ +class PendingOrderRequestModel { + bool isDentalAllowedBackend; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int deviceTypeID; + String tokenID; + int patientID; + int admissionNo; + String sessionID; + int projectID; + String setupID; + bool patientOutSA; + int patientType; + int patientTypeID; + + PendingOrderRequestModel( + {this.isDentalAllowedBackend, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.deviceTypeID, + this.tokenID, + this.patientID, + this.admissionNo, + this.sessionID, + this.projectID, + this.setupID, + this.patientOutSA, + this.patientType, + this.patientTypeID}); + + PendingOrderRequestModel.fromJson(Map json) { + isDentalAllowedBackend = json['isDentalAllowedBackend']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientID = json['PatientID']; + admissionNo = json['AdmissionNo']; + sessionID = json['SessionID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientID'] = this.patientID; + data['AdmissionNo'] = this.admissionNo; + data['SessionID'] = this.sessionID; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/models/pending_orders/pending_orders_model.dart b/lib/models/pending_orders/pending_orders_model.dart new file mode 100644 index 00000000..89525369 --- /dev/null +++ b/lib/models/pending_orders/pending_orders_model.dart @@ -0,0 +1,15 @@ +class PendingOrderModel { + String notes; + + PendingOrderModel({this.notes}); + + PendingOrderModel.fromJson(Map json) { + notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['Notes'] = this.notes; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 9c8f35f8..619dd9b6 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/medical_report/Medic 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/operation_report/operation_report.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/pending_orders/pending_orders_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'; import 'package:doctor_app_flutter/screens/patients/profile/referral/refer-patient-screen-in-patient.dart'; @@ -69,6 +70,7 @@ const String ADD_SICKLEAVE = 'add-sickleave'; const String RADIOLOGY_PATIENT = 'radiology-patient'; const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String GET_OPERATION_REPORT = 'operation-report'; +const String PENDING_ORDERS = 'pending-orders'; //todo: change the routing way. var routes = { @@ -113,4 +115,5 @@ var routes = { PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), GET_OPERATION_REPORT: (_) => OperationReportScreen(), + PENDING_ORDERS: (_) => PendingOrdersScreen(), }; diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 04b271b5..9a9fd15f 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -93,7 +93,7 @@ class _ProgressNoteState extends State { body: model.operationReportList == null || model.operationReportList.length == 0 ? DrAppEmbeddedError( - error: TranslationBase.of(context).errorNoProgressNote) + error: TranslationBase.of(context).noDataAvailable) : Container( color: Colors.grey[200], child: Column( diff --git a/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart new file mode 100644 index 00000000..a03ca3c5 --- /dev/null +++ b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart @@ -0,0 +1,64 @@ +import 'package:doctor_app_flutter/core/viewModel/pednding_orders_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/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:flutter/material.dart'; + +class PendingOrdersScreen extends StatelessWidget { + const PendingOrdersScreen({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + bool isInpatient = routeArgs['isInpatient']; + return BaseView( + onModelReady: (model) => model.getPendingOrders( + patientId: patient.patientMRN, + admissionNo: int.parse(patient.admissionNo)), + builder: + (BuildContext context, PendingOrdersViewModel model, Widget child) => + AppScaffold( + appBar: PatientProfileAppBar( + patient, + isInpatient: isInpatient, + ), + isShowAppBar: true, + baseViewModel: model, + appBarTitle: "Pending Orders", + body: model.pendingOrdersList == null || + model.pendingOrdersList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).noDataAvailable) + : Container( + child: ListView.builder( + itemCount: model.pendingOrdersList.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Color(0xFF707070), width: 0.30), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: + AppText(model.pendingOrdersList[index].notes), + ), + ), + ); + })), + ), + ); + } +} 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 4c4fe12e..8b6fc6f2 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 @@ -133,6 +133,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Pending", + "Orders", + PENDING_ORDERS, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding( From b21acfd2c655d67e4ff0a4e6dbfafbfc2c12667e Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 25 Oct 2021 10:56:25 +0300 Subject: [PATCH 2/6] fix route issues --- lib/routes.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes.dart b/lib/routes.dart index c5048c56..46602d53 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -115,7 +115,7 @@ var routes = { // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), - + GET_OPERATION_REPORT: (_) => OperationReportScreen(), NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), }; From 45f4aa9a22404a78d3b579ebaca2e30c729c9962 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 25 Oct 2021 11:09:03 +0300 Subject: [PATCH 3/6] fix issues related to design --- .../profile/diagnosis/diagnosis_screen.dart | 2 +- .../nursing_note/nursing_note_screen.dart | 2 +- .../operation_report/operation_report.dart | 18 +----------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart index 5751896e..2abc55ea 100644 --- a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart +++ b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart @@ -92,7 +92,7 @@ class _ProgressNoteState extends State { widthFactor: 0.95, child: CardWithBgWidget( hasBorder: false, - bgColor: Colors.black38, + bgColor: Colors.transparent, widget: Column( children: [ Column( diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart index d00e1b54..d683bab4 100644 --- a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -94,7 +94,7 @@ class _ProgressNoteState extends State { widthFactor: 0.95, child: CardWithBgWidget( hasBorder: false, - bgColor: Colors.black38, + bgColor: Colors.transparent, widget: Column( children: [ Column( diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 14ebbc86..7ce54b7d 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -127,23 +127,7 @@ class _ProgressNoteState extends State { widthFactor: 0.95, child: CardWithBgWidget( hasBorder: false, - bgColor: model.operationReportList[index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model.operationReportList[index] - .createdBy - ? Color(0xFFCC9B14) - : model.operationReportList[index] - .status == - 4 - ? Colors.red.shade700 - : model.operationReportList[index] - .status == - 2 - ? Colors.green[600] - : Color(0xFFCC9B14), + bgColor: Colors.white, widget: Column( children: [ Column( From ae0c588d3200786d543eb2a0f5c6f5843becc27c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 26 Oct 2021 08:51:42 +0300 Subject: [PATCH 4/6] get admission orders --- lib/config/config.dart | 3 + lib/core/service/pending_order_service.dart | 44 ++- .../viewModel/pednding_orders_view_model.dart | 17 + .../admission_orders_model.dart | 52 +++ .../admission_orders_request_model.dart | 76 ++++ lib/routes.dart | 3 + .../admission_orders_screen.dart | 351 ++++++++++++++++++ .../profile_gird_for_InPatient.dart | 7 + 8 files changed, 547 insertions(+), 6 deletions(-) create mode 100644 lib/models/admisson_orders/admission_orders_model.dart create mode 100644 lib/models/admisson_orders/admission_orders_request_model.dart create mode 100644 lib/screens/patients/profile/admission-orders/admission_orders_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 53a8f55e..dba66264 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -351,6 +351,9 @@ const GET_OPERATION_REPORT = const GET_PENDING_ORDERS = "Services/DoctorApplication.svc/REST/DoctorApp_GetPendingOrdersForInPatient"; +const GET_ADMISSION_ORDERS = + "/Services/DoctorApplication.svc/REST/DoctorApp_GetAdmissionOrders"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/service/pending_order_service.dart b/lib/core/service/pending_order_service.dart index 3e6fa497..e6f35bb8 100644 --- a/lib/core/service/pending_order_service.dart +++ b/lib/core/service/pending_order_service.dart @@ -1,22 +1,27 @@ 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/admisson_orders/admission_orders_model.dart'; +import 'package:doctor_app_flutter/models/admisson_orders/admission_orders_request_model.dart'; import 'package:doctor_app_flutter/models/pending_orders/pending_order_request_model.dart'; import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart'; class PendingOrderService extends BaseService { - List get _pendingOrderList => List(); + List _pendingOrderList = List(); List get pendingOrderList => _pendingOrderList; + List _admissionOrderList = List(); + List get admissionOrderList => _admissionOrderList; + Future getPendingOrders( {PendingOrderRequestModel pendingOrderRequestModel, int patientId, int admissionNo}) async { pendingOrderRequestModel = PendingOrderRequestModel( - patientID: patientId, - admissionNo: admissionNo, - patientTypeID: 1, - patientType: 1, - ); + patientID: patientId, + admissionNo: admissionNo, + patientTypeID: 1, + patientType: 1, + setupID: "010266"); hasError = false; await baseAppClient.post(GET_PENDING_ORDERS, @@ -33,4 +38,31 @@ class PendingOrderService extends BaseService { super.error = error; }, body: pendingOrderRequestModel.toJson()); } + + Future getAdmissionOrders( + {AdmissionOrdersRequestModel admissionOrdersRequestModel, + int patientId, + int admissionNo}) async { + admissionOrdersRequestModel = AdmissionOrdersRequestModel( + patientID: patientId, + admissionNo: admissionNo, + patientTypeID: 1, + patientType: 1, + setupID: "010266"); + + hasError = false; + await baseAppClient.post(GET_ADMISSION_ORDERS, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + //admissionOrderList.clear(); + response['List_AdmissionOrders'].forEach( + (v) { + _admissionOrderList.add(AdmissionOrdersModel.fromJson(v)); + }, + ); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: admissionOrdersRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/pednding_orders_view_model.dart b/lib/core/viewModel/pednding_orders_view_model.dart index fd66413b..3f3e92be 100644 --- a/lib/core/viewModel/pednding_orders_view_model.dart +++ b/lib/core/viewModel/pednding_orders_view_model.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/pending_order_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/admisson_orders/admission_orders_model.dart'; import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart'; class PendingOrdersViewModel extends BaseViewModel { @@ -11,6 +12,9 @@ class PendingOrdersViewModel extends BaseViewModel { List get pendingOrdersList => _pendingOrderService.pendingOrderList; + List get admissionOrderList => + _pendingOrderService.admissionOrderList; + Future getPendingOrders({int patientId, int admissionNo}) async { hasError = false; setState(ViewState.Busy); @@ -23,4 +27,17 @@ class PendingOrdersViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getAdmissionOrders({int patientId, int admissionNo}) async { + hasError = false; + setState(ViewState.Busy); + await _pendingOrderService.getAdmissionOrders( + patientId: patientId, admissionNo: admissionNo); + if (_pendingOrderService.hasError) { + error = _pendingOrderService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/models/admisson_orders/admission_orders_model.dart b/lib/models/admisson_orders/admission_orders_model.dart new file mode 100644 index 00000000..caea4d15 --- /dev/null +++ b/lib/models/admisson_orders/admission_orders_model.dart @@ -0,0 +1,52 @@ +class AdmissionOrdersModel { + int procedureID; + String procedureName; + String procedureNameN; + int orderNo; + int doctorID; + int clinicID; + String createdOn; + int createdBy; + String editedOn; + int editedBy; + + AdmissionOrdersModel( + {this.procedureID, + this.procedureName, + this.procedureNameN, + this.orderNo, + this.doctorID, + this.clinicID, + this.createdOn, + this.createdBy, + this.editedOn, + this.editedBy}); + + AdmissionOrdersModel.fromJson(Map json) { + procedureID = json['ProcedureID']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + orderNo = json['OrderNo']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['ProcedureID'] = this.procedureID; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['OrderNo'] = this.orderNo; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + return data; + } +} diff --git a/lib/models/admisson_orders/admission_orders_request_model.dart b/lib/models/admisson_orders/admission_orders_request_model.dart new file mode 100644 index 00000000..897bb8f8 --- /dev/null +++ b/lib/models/admisson_orders/admission_orders_request_model.dart @@ -0,0 +1,76 @@ +class AdmissionOrdersRequestModel { + bool isDentalAllowedBackend; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int deviceTypeID; + String tokenID; + int patientID; + int admissionNo; + String sessionID; + int projectID; + String setupID; + bool patientOutSA; + int patientType; + int patientTypeID; + + AdmissionOrdersRequestModel( + {this.isDentalAllowedBackend, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.deviceTypeID, + this.tokenID, + this.patientID, + this.admissionNo, + this.sessionID, + this.projectID, + this.setupID, + this.patientOutSA, + this.patientType, + this.patientTypeID}); + + AdmissionOrdersRequestModel.fromJson(Map json) { + isDentalAllowedBackend = json['isDentalAllowedBackend']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientID = json['PatientID']; + admissionNo = json['AdmissionNo']; + sessionID = json['SessionID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientID'] = this.patientID; + data['AdmissionNo'] = this.admissionNo; + data['SessionID'] = this.sessionID; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 619dd9b6..03b35346 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/admission-orders/admission_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.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'; @@ -71,6 +72,7 @@ const String RADIOLOGY_PATIENT = 'radiology-patient'; const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String GET_OPERATION_REPORT = 'operation-report'; const String PENDING_ORDERS = 'pending-orders'; +const String ADMISSION_ORDERS = 'admission-orders'; //todo: change the routing way. var routes = { @@ -116,4 +118,5 @@ var routes = { ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), GET_OPERATION_REPORT: (_) => OperationReportScreen(), PENDING_ORDERS: (_) => PendingOrdersScreen(), + ADMISSION_ORDERS: (_) => AdmissionOrdersScreen(), }; diff --git a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart new file mode 100644 index 00000000..b55aad9a --- /dev/null +++ b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart @@ -0,0 +1,351 @@ +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.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/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class AdmissionOrdersScreen extends StatefulWidget { + const AdmissionOrdersScreen({Key key}) : super(key: key); + + @override + _AdmissionOrdersScreenState createState() => _AdmissionOrdersScreenState(); +} + +class _AdmissionOrdersScreenState extends State { + bool isDischargedPatient = false; + + AuthenticationViewModel authenticationViewModel; + + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + authenticationViewModel = Provider.of(context); + projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String arrivalType = routeArgs['arrivalType']; + if (routeArgs.containsKey('isDischargedPatient')) + isDischargedPatient = routeArgs['isDischargedPatient']; + return BaseView( + onModelReady: (model) => model.getAdmissionOrders( + admissionNo: 2014005178, patientId: patient.patientMRN), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + //appBarTitle: TranslationBase.of(context).progressNote, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: model.admissionOrderList == null || + model.admissionOrderList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).noDataAvailable) + : Container( + color: Colors.grey[200], + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(12.0), + child: Column( + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).admission, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).orders, + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ), + ), + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.admissionOrderList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + // bgColor: model.admissionOrderList[index] + // .status == + // 1 && + // authenticationViewModel + // .doctorProfile.doctorID != + // model + // .patientProgressNoteList[ + // index] + // .createdBy + // ? Color(0xFFCC9B14) + // : model.patientProgressNoteList[index] + // .status == + // 4 + // ? Colors.red.shade700 + // : model.patientProgressNoteList[index] + // .status == + // 2 + // ? Colors.green[600] + // : Color(0xFFCC9B14), + widget: Column( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + width: 10, + ), + SizedBox( + width: 10, + ) + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.60, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .createdBy + .toString(), + fontSize: 10, + ), + Expanded( + child: AppText( + model + .admissionOrderList[ + index] + .createdBy + .toString() ?? + '', + fontWeight: + FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .procedureName + .toString(), + fontSize: 10, + ), + Expanded( + child: AppText( + model + .admissionOrderList[ + index] + .procedureName + .toString() ?? + '', + fontWeight: + FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .orderNo + .toString(), + fontSize: 10, + ), + Expanded( + child: AppText( + model + .admissionOrderList[ + index] + .orderNo + .toString() ?? + '', + fontWeight: + FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + // Row( + // crossAxisAlignment: + // CrossAxisAlignment + // .start, + // children: [ + // AppText( + // TranslationBase.of( + // context) + // .createdBy + // .toString(), + // fontSize: 10, + // ), + // Expanded( + // child: AppText( + // model + // .admissionOrderList[ + // index] + // .createdBy + // .toString() ?? + // '', + // fontWeight: + // FontWeight.w600, + // fontSize: 12, + // isCopyable: true, + // ), + // ), + // ], + // ), + ], + ), + ), + Column( + children: [ + AppText( + model + .admissionOrderList[ + index] + .createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils + .getDateTimeFromServerFormat(model + .admissionOrderList[ + index] + .createdOn), + isArabic: + projectViewModel + .isArabic, + isMonthShort: true) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.now(), + isArabic: + projectViewModel + .isArabic), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + AppText( + model + .admissionOrderList[ + index] + .createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils + .getDateTimeFromServerFormat(model + .admissionOrderList[ + index] + .createdOn)) + : AppDateUtils.getHour( + DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + ], + crossAxisAlignment: + CrossAxisAlignment.end, + ) + ], + ), + SizedBox( + height: 8, + ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // children: [ + // Expanded( + // child: AppText( + // model + // .admissionOrderList[ + // index] + // .notes, + // fontSize: 10, + // isCopyable: true, + // ), + // ), + // ]) + ], + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ); + }), + ), + ), + ], + ), + ), + ), + ); + } +} 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 8b6fc6f2..598c8fc3 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 @@ -140,6 +140,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Admission", + "Orders", + ADMISSION_ORDERS, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding( From 9b87ea8c2289d5b8eb6fd26e63495c77423df6f4 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 26 Oct 2021 08:57:06 +0300 Subject: [PATCH 5/6] get admission orders --- lib/routes.dart | 2 +- .../operation_report/operation_report.dart | 64 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lib/routes.dart b/lib/routes.dart index 6dfc2b1f..489ed512 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -31,7 +31,7 @@ import 'landing_page.dart'; import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; -import 'screens/patients/profile/note/progress_note_screen.dart'; + import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 7ce54b7d..5e41092d 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -89,36 +89,36 @@ class _ProgressNoteState extends State { patient, isInpatient: true, ), - body: - Container( - color: Colors.grey[200], - child: Column( - children: [ - AddNewOrder( - onTap: () async { - await locator().logEvent( - eventCategory: "Operation Report Screen", - eventAction: "Update Operation Report ", - ); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => UpdateOperationReport( - operationReportViewModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - ), - settings: RouteSettings(name: 'UpdateNoteOrder'), - ), - ); - }, - label: TranslationBase.of(context).operationReports, + body: Container( + color: Colors.grey[200], + child: Column( + children: [ + AddNewOrder( + onTap: () async { + await locator().logEvent( + eventCategory: "Operation Report Screen", + eventAction: "Update Operation Report ", + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => UpdateOperationReport( + operationReportViewModel: model, + patient: patient, + visitType: widget.visitType, + isUpdate: false, ), - model.operationReportList == null || - model.operationReportList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase.of(context).errorNoProgressNote):Expanded( + settings: RouteSettings(name: 'UpdateNoteOrder'), + ), + ); + }, + label: TranslationBase.of(context).operationReports, + ), + model.operationReportList == null || + model.operationReportList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).errorNoProgressNote) + : Expanded( child: Container( child: ListView.builder( itemCount: model.operationReportList.length, @@ -532,9 +532,9 @@ class _ProgressNoteState extends State { }), ), ), - ], - ), - ), + ], + ), + ), ), ); } From 7b8312fe260a1ad8205bdf55e47c06c51363e383 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 26 Oct 2021 11:57:19 +0300 Subject: [PATCH 6/6] make register patient feature --- assets/images/patient_register.png | Bin 0 -> 969 bytes lib/config/localized_values.dart | 4 +- .../patient/PatientRegisterService.dart | 5 + .../viewModel/PatientRegisterViewModel.dart | 8 + lib/locator.dart | 4 + lib/screens/home/home_patient_card.dart | 47 ++-- lib/screens/home/home_screen.dart | 23 +- .../profile/UCAF/page-stepper-widget.dart | 12 +- .../register_patient/RegisterPatientPage.dart | 212 ++++++++++++++++++ .../RegisterSearchPatientPage.dart | 201 +++++++++++++++++ lib/util/translations_delegate_base.dart | 2 + .../text_fields/app-textfield-custom.dart | 1 + 12 files changed, 496 insertions(+), 23 deletions(-) create mode 100644 assets/images/patient_register.png create mode 100644 lib/core/service/patient/PatientRegisterService.dart create mode 100644 lib/core/viewModel/PatientRegisterViewModel.dart create mode 100644 lib/screens/patients/register_patient/RegisterPatientPage.dart create mode 100644 lib/screens/patients/register_patient/RegisterSearchPatientPage.dart diff --git a/assets/images/patient_register.png b/assets/images/patient_register.png new file mode 100644 index 0000000000000000000000000000000000000000..c55935bc90aff3c7976a51d5cb5d7dcaa8a4df60 GIT binary patch literal 969 zcmb`GUr19?9LK-sp1ZMocjxZi3=GFwYlJToO^ArVayVH9)wIwgVw-ah>0EP>FFgoJ zF9m}L@=b&&iLxU4_cX#FLNsedX%A7o1U+a}2$8qnQO1mn2>Kq*IUj!i&hMPdHD8%; zq3;ey!e9(wG+@4yY9gV~(f!eV;mF?RWrtJ+lB5H@>0CD2(&TIJIP4R)l46PeOo`Xn zsqVLzqB`(AxQ734CZ#LcpP-<5nz<|;PR(`^SEg2YKyZA8&kD}AMMD%bLR^zt#qm{q zGMC9w%wrLs$Yce-A>Ps3b3&XYBs$iT>4UAbx6|~XA5pZRiTJ;&{GNTIz_zad&zEiS zVc_l%P&He&1x5hpY2eOuCYFsYHzU(3b$0`wF9VJa!2J|ZJ4=n0bIaf24|nxZj)(5q zMl!cGwD&U&n40SwJLbRc zI#b=gZhCw&9>SBh`R1Kh7H{8MTsqG;^Wo49b>hqR?+;mZ@PquoS-jdh7WlNM^3=r* G=Ifu<+MR^} literal 0 HcmV?d00001 diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b711124f..93c3a2de 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -710,5 +710,7 @@ const Map> localizedValues = { "ar":"نوع الطلب"}, "special": {"en": "Special", "ar": "خاص"}, "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} , - "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"} + "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"}, + "registerNewPatient": {"en": "Register\nNew Patient", "ar": "تسجيل\n مريض جديد"}, + "registeraPatient": {"en": "Register a Patient", "ar": "تسجيل المريض"}, }; diff --git a/lib/core/service/patient/PatientRegisterService.dart b/lib/core/service/patient/PatientRegisterService.dart new file mode 100644 index 00000000..a7013a3c --- /dev/null +++ b/lib/core/service/patient/PatientRegisterService.dart @@ -0,0 +1,5 @@ +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientRegisterService extends BaseService{ + +} \ No newline at end of file diff --git a/lib/core/viewModel/PatientRegisterViewModel.dart b/lib/core/viewModel/PatientRegisterViewModel.dart new file mode 100644 index 00000000..43aa7500 --- /dev/null +++ b/lib/core/viewModel/PatientRegisterViewModel.dart @@ -0,0 +1,8 @@ +import 'package:doctor_app_flutter/core/service/patient/PatientRegisterService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientRegisterViewModel extends BaseViewModel { + PatientRegisterService _service = locator(); +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index b5f651eb..04266041 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -23,6 +23,7 @@ import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; +import 'core/service/patient/PatientRegisterService.dart'; import 'core/service/patient/ReferralService.dart'; import 'core/service/patient/out_patient_service.dart'; import 'core/service/patient/patient-doctor-referral-service.dart'; @@ -49,6 +50,7 @@ import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; +import 'core/viewModel/PatientRegisterViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; @@ -103,6 +105,7 @@ void setupLocator() { locator.registerLazySingleton(() => VideoCallService()); locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); + locator.registerLazySingleton(() => PatientRegisterService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -132,4 +135,5 @@ void setupLocator() { locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => OperationReportViewModel()); + locator.registerFactory(() => PatientRegisterViewModel()); } diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index b388a7e2..a0d0bce7 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; class HomePatientCard extends StatelessWidget { final Color backgroundColor; final IconData cardIcon; + final String cardIconImage; final Color backgroundIconColor; final String text; final Color textColor; @@ -15,11 +16,12 @@ class HomePatientCard extends StatelessWidget { HomePatientCard({ @required this.backgroundColor, @required this.backgroundIconColor, - @required this.cardIcon, + this.cardIcon, + this.cardIconImage, @required this.text, @required this.textColor, @required this.onTap, - this.iconSize = 30, + this.iconSize = 30, }); @override @@ -38,24 +40,41 @@ class HomePatientCard extends StatelessWidget { children: [ Container( margin: EdgeInsets.only(top: 18, left: 10), - color:Colors.transparent, - - child: Icon( - cardIcon, - size: iconSize * 2, - color: backgroundIconColor, - ), + color: Colors.transparent, + child: cardIcon != null + ? Icon( + cardIcon, + size: iconSize * 2, + color: backgroundIconColor, + ) + : IconButton( + icon: Image.asset( + 'assets/images/patient_register.png', + width: iconSize * 2, + height: iconSize * 2, + fit: BoxFit.fill, + ), + iconSize: iconSize * 2, + color: backgroundIconColor, + onPressed: () => null, + ), ), Container( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - cardIcon, - size: iconSize, - color: textColor, - ), + cardIcon != null + ? Icon( + cardIcon, + size: iconSize, + color: textColor, + ) + : Image.asset( + cardIconImage, + height: iconSize, + width: iconSize, + ), SizedBox( height: 4, ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 495a70b0..1ab61717 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/screens/patients/In_patient/in_patient_screen import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterPatientPage.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -254,8 +255,8 @@ class _HomeScreenState extends State { else Container( child: ErrorMessage( - error: model.error, - )), + error: model.error, + )), FractionallySizedBox( // widthFactor: 0.90, child: Container( @@ -313,7 +314,6 @@ class _HomeScreenState extends State { ), ) ]), - ]), ), ); @@ -396,6 +396,23 @@ class _HomeScreenState extends State { )); changeColorIndex(); + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIconImage: 'assets/images/patient_register.png', + textColor: textColors[colorIndex], + text: TranslationBase.of(context).registerNewPatient, + onTap: () { + Navigator.push( + context, + FadePage( + page: RegisterPatientPage(), + ), + ); + }, + )); + changeColorIndex(); + patientCards.add(HomePatientCard( backgroundColor: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], diff --git a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart index da0381ed..6d9838f4 100644 --- a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart +++ b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart @@ -16,8 +16,9 @@ class PageStepperWidget extends StatelessWidget { final int stepsCount; final int currentStepIndex; final Size screenSize; + final List stepsTitles; - PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize}); + PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize, this.stepsTitles}); @override Widget build(BuildContext context) { @@ -33,10 +34,10 @@ class PageStepperWidget extends StatelessWidget { for (int i = 1; i <= stepsCount; i++) if (i == currentStepIndex) StepWidget(i, true, i == stepsCount, i < currentStepIndex, - dividerWidth) + dividerWidth, stepsTitles: stepsTitles,) else StepWidget(i, false, i == stepsCount, i < currentStepIndex, - dividerWidth) + dividerWidth, stepsTitles: stepsTitles,) ], ) ], @@ -52,9 +53,10 @@ class StepWidget extends StatelessWidget { final bool isFinalStep; final bool isStepFinish; final double dividerWidth; + final List stepsTitles; StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, - this.dividerWidth); + this.dividerWidth, {this.stepsTitles}); @override Widget build(BuildContext context) { @@ -106,7 +108,7 @@ class StepWidget extends StatelessWidget { height: 8, ), AppText( - "${TranslationBase.of(context).step} $index", + stepsTitles == null ? "${TranslationBase.of(context).step} $index" : "${stepsTitles[index - 1]}", fontWeight: FontWeight.bold, color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black, fontFamily: 'Poppins', diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart new file mode 100644 index 00000000..ab85d820 --- /dev/null +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -0,0 +1,212 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.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:flutter/material.dart'; + +import 'RegisterSearchPatientPage.dart'; + +class RegisterPatientPage extends StatefulWidget { + const RegisterPatientPage({Key key}) : super(key: key); + + @override + _RegisterPatientPageState createState() => _RegisterPatientPageState(); +} + +class _RegisterPatientPageState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + bool _isLoading = false; + + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + setState(() { + _currentIndex = pageIndex; + }); + } + + void changeLoadingState(bool isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + void initState() { + _controller = new PageController(); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + isLoading: _isLoading, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).registeraPatient, + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + PageStepperWidget( + stepsCount: 3, + currentStepIndex: _currentIndex + 1, + screenSize: screenSize, + stepsTitles: [ + "Search", + "Activation", + "Confirmation", + ], + ), + SizedBox( + height: 10, + ), + Expanded( + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + RegisterSearchPatientPage(), + ]), + ), + ), + ], + ), + )), + _isLoading + ? Container( + height: 0, + ) + : pagerButtons(model), + ], + ), + ), + ); + } + + Widget pagerButtons(PatientRegisterViewModel model) { + switch (_currentIndex) { + case 2: + return Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).noteConfirm, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFF359846), + color: Color(0xFF359846), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () {}, + ), + ), + ), + ], + ), + ); + default: + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).next, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () { + changePageViewIndex(_currentIndex + 1); + }, + ), + ), + ), + ], + ), + ); + } + } +} diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart new file mode 100644 index 00000000..3aafe5bd --- /dev/null +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -0,0 +1,201 @@ +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/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/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/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class RegisterSearchPatientPage extends StatefulWidget { + const RegisterSearchPatientPage({Key key}) : super(key: key); + + @override + _RegisterSearchPatientPageState createState() => + _RegisterSearchPatientPageState(); +} + +class _RegisterSearchPatientPageState extends State { + String countryError; + dynamic _selectedCountry; + + final _phoneController = TextEditingController(); + String phoneError; + + final _idController = TextEditingController(); + String idError; + + DateTime _birthDate; + String birthdateError; + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + children: [ + Expanded( + child: Container( + width: double.infinity, + margin: EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "Please enter mobile number or Identification number", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.w800, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Country", + isTextFieldHasSuffix: true, + validationError: countryError, + dropDownText: _selectedCountry != null + ? _selectedCountry['nameEn'] + : null, + enabled: false, + /*onClick: model.dietTypesList != null && model.dietTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { + setState(() { + _selectedCountry = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getDietTypes(patient.patientId) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.dietTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { + setState(() { + _selectedCountry = selectedValue; + }); + }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); + } + },*/ + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Phone Number", + inputType: TextInputType.phone, + controller: _phoneController, + validationError: phoneError, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "ID Number", + inputType: TextInputType.phone, + controller: _idController, + validationError: idError, + ), + SizedBox( + height: 12, + ), + AppText( + "Calender", + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w800, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Birthdate", + dropDownText: _birthDate != null + ? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy-MM-dd")}" + : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: birthdateError, + suffixIcon: IconButton( + icon: Icon( + Icons.calendar_today, + color: Colors.black, + ), + onPressed: null, + ), + onClick: () { + if (_birthDate == null) { + _birthDate = DateTime.now(); + } + _selectDate(context, _birthDate, (picked) { + setState(() { + _birthDate = picked; + }); + }); + }, + ), + ], + ), + ), + ), + ), + ], + ), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 59f66811..58e17a94 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1106,6 +1106,8 @@ class TranslationBase { String get requestType => localizedValues['requestType'][locale.languageCode]; String get allClinic => localizedValues['allClinic'][locale.languageCode]; String get notReplied => localizedValues['notReplied'][locale.languageCode]; + String get registerNewPatient => localizedValues['registerNewPatient'][locale.languageCode]; + String get registeraPatient => localizedValues['registeraPatient'][locale.languageCode]; } diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index cd97c8d4..086375bb 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -146,6 +146,7 @@ class _AppTextFieldCustomState extends State { ? TextAlign.right : TextAlign.left, focusNode: _focusNode, + textAlignVertical: TextAlignVertical.center, decoration: TextFieldsUtils .textFieldSelectorDecoration( widget.hintText, null, true),