From e7e4aad9624d3eeb5a810704a95453f0964eb73b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sun, 21 Mar 2021 09:09:37 +0200 Subject: [PATCH] add ECG service --- ios/Podfile.lock | 2 +- lib/config/config.dart | 3 + lib/core/model/PatientMuseResultsModel.dart | 64 +++++++++++++++++++ lib/core/service/PatientMuseService.dart | 28 ++++++++ lib/core/viewModel/PatientMuseViewModel.dart | 23 +++++++ lib/locator.dart | 4 ++ .../profile/patient_profile_screen.dart | 2 +- lib/screens/sick-leave/add-sickleave.dart | 1 + .../profile/profile_medical_info_widget.dart | 2 +- pubspec.lock | 6 +- 10 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 lib/core/model/PatientMuseResultsModel.dart create mode 100644 lib/core/service/PatientMuseService.dart create mode 100644 lib/core/viewModel/PatientMuseViewModel.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9c86879d..46d7599e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -292,4 +292,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0.rc.1 +COCOAPODS: 1.10.1 diff --git a/lib/config/config.dart b/lib/config/config.dart index 35c35ef3..4ba98b6b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -212,6 +212,9 @@ const GET_PROCEDURE_VALIDATION = const GET_BOX_QUANTITY = 'Services/DoctorApplication.svc/REST/CalculateBoxQuantity'; +///GET ECG +const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/PatientMuseResultsModel.dart b/lib/core/model/PatientMuseResultsModel.dart new file mode 100644 index 00000000..8b10de83 --- /dev/null +++ b/lib/core/model/PatientMuseResultsModel.dart @@ -0,0 +1,64 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class PatientMuseResultsModel { + int rowID; + String setupID; + int projectID; + String orderNo; + int lineItemNo; + int patientType; + int patientID; + String procedureID; + dynamic reportData; + String imageURL; + String createdBy; + String createdOn; + DateTime createdOnDateTime; + + PatientMuseResultsModel( + {this.rowID, + this.setupID, + this.projectID, + this.orderNo, + this.lineItemNo, + this.patientType, + this.patientID, + this.procedureID, + this.reportData, + this.imageURL, + this.createdBy, + this.createdOn}); + + PatientMuseResultsModel.fromJson(Map json) { + rowID = json['RowID']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + orderNo = json['OrderNo']; + lineItemNo = json['LineItemNo']; + patientType = json['PatientType']; + patientID = json['PatientID']; + procedureID = json['ProcedureID']; + reportData = json['ReportData']; + imageURL = json['ImageURL']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + createdOnDateTime = DateUtils.getDateTimeFromServerFormat(json['CreatedOn']); + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['OrderNo'] = this.orderNo; + data['LineItemNo'] = this.lineItemNo; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ProcedureID'] = this.procedureID; + data['ReportData'] = this.reportData; + data['ImageURL'] = this.imageURL; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/core/service/PatientMuseService.dart b/lib/core/service/PatientMuseService.dart new file mode 100644 index 00000000..891029c3 --- /dev/null +++ b/lib/core/service/PatientMuseService.dart @@ -0,0 +1,28 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/PatientMuseResultsModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientMuseService extends BaseService { + List patientMuseResultsModelList = List(); + + getECGPatient({int patientType, int patientOutSA,int patientID}) async { + Map body = Map(); + body['PatientType'] = patientType; + body['PatientOutSA'] = patientOutSA; + body['PatientID'] = patientID; + await baseAppClient.post( + GET_ECG, + onSuccess: (dynamic response, int statusCode) { + patientMuseResultsModelList.clear(); + response['HIS_GetPatientMuseResultsList'].forEach((v) { + patientMuseResultsModelList.add(PatientMuseResultsModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } +} diff --git a/lib/core/viewModel/PatientMuseViewModel.dart b/lib/core/viewModel/PatientMuseViewModel.dart new file mode 100644 index 00000000..3f5e82ed --- /dev/null +++ b/lib/core/viewModel/PatientMuseViewModel.dart @@ -0,0 +1,23 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/PatientMuseService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientMuseViewModel extends BaseViewModel { + + PatientMuseService _patientMuseService = locator(); + + getECGPatient({int patientType, int patientOutSA, int patientID}) async { + setState(ViewState.Busy); + await _patientMuseService.getECGPatient( + patientID: patientID, + patientOutSA: patientOutSA, + patientType: patientType); + if (_patientMuseService.hasError) { + error = _patientMuseService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index f939effc..3a5b94b2 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/PatientMuseService.dart'; import 'core/service/SOAP_service.dart'; import 'core/service/patient-admission-request-service.dart'; import 'core/service/doctor_reply_service.dart'; @@ -25,6 +26,7 @@ import 'core/service/patient-doctor-referral-service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; +import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; @@ -58,6 +60,7 @@ void setupLocator() { locator.registerLazySingleton(() => AdmissionRequestService()); locator.registerLazySingleton(() => UcafService()); locator.registerLazySingleton(() => AuthService()); + locator.registerLazySingleton(() => PatientMuseService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -77,4 +80,5 @@ void setupLocator() { locator.registerFactory(() => AdmissionRequestViewModel()); locator.registerFactory(() => UcafViewModel()); locator.registerFactory(() => MedicalFileViewModel()); + locator.registerFactory(() => PatientMuseViewModel()); } diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index ba42173e..24b59f8e 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -27,7 +27,7 @@ class PatientProfileScreen extends StatelessWidget { PatiantInformtion patient; - + //TODO change it @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index ad74b760..a0546d98 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -17,6 +17,7 @@ import 'package:hexcolor/hexcolor.dart'; class AddSickLeavScreen extends StatelessWidget { PatiantInformtion patient; + //TODO jammal @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 9bd2230d..c2b2d8a4 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -28,7 +28,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { String from; String to; - + //TODO change it PatiantInformtion patient; String patientType; @override diff --git a/pubspec.lock b/pubspec.lock index 909670db..d044f1fb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -573,7 +573,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -844,7 +844,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -986,5 +986,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0"