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..890b24d6 --- /dev/null +++ b/lib/core/viewModel/PatientMuseViewModel.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientMuseResultsModel.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(); + + List get patientMuseResultsModelList => _patientMuseService.patientMuseResultsModelList; + + 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/routes.dart b/lib/routes.dart index fe280d40..210396fe 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_page.dart'; +import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; 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/insurance_approvals_screen.dart'; @@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_pat import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen_history.dart'; import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_soap_index.dart'; @@ -95,6 +97,7 @@ const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; +const String PATIENT_ECG = 'patients/ecg'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -106,6 +109,7 @@ const String ORDER_PROCEDURE = 'procedure/procedure'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; const String ADD_SICKLEAVE = 'add-sickleave'; +const String SHOW_SICKLEAVE = 'show-sickleave'; const String RADIOLOGY = 'radiology'; //todo: change the routing way. var routes = { @@ -159,6 +163,7 @@ var routes = { // LIVECARE_END_DIALOG: (_) => EndCallDialogBox(), PATIENT_SICKLEAVE: (_) => SickLeaveScreen(), ADD_SICKLEAVE: (_) => AddSickLeavScreen(), + SHOW_SICKLEAVE: (_) => ShowSickLeaveScreen(), ORDER_PRESCRIPTION: (_) => NewPrescriptionScreen(), ORDER_PRESCRIPTION_HISTORY: (_) => NewPrescriptionHistoryScreen(), ORDER_PROCEDURE: (_) => ProcedureScreen(), @@ -167,4 +172,5 @@ var routes = { MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), + PATIENT_ECG: (_) => ECGPage(), }; diff --git a/lib/screens/patients/ECGPage.dart b/lib/screens/patients/ECGPage.dart new file mode 100644 index 00000000..ba76c031 --- /dev/null +++ b/lib/screens/patients/ECGPage.dart @@ -0,0 +1,49 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientMuseViewModel.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/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class ECGPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return BaseView( + onModelReady: (model) => model.getECGPatient( + patientType: patient.patientType, + patientOutSA: 0, + patientID: patient.patientId), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: 'ECG', + body: ListView.builder( + itemCount: model.patientMuseResultsModelList.length, + itemBuilder: (context, index) => InkWell( + onTap: () async { + await launch( + model.patientMuseResultsModelList[index].imageURL); + }, + child: Container( + width: double.infinity, + margin: EdgeInsets.all(5), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey,width: 2) + ), + child: Center( + child: Texts( + "${model.patientMuseResultsModelList[index].createdOnDateTime}"), + ), + ), + )), + ), + ); + } +} diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 1437a583..5b108999 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -26,7 +26,7 @@ import 'package:provider/provider.dart'; class PatientProfileScreen extends StatelessWidget { PatiantInformtion patient; bool isFromSearch = false; - + //TODO change it @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; diff --git a/lib/screens/sick-leave/show-sickleave.dart b/lib/screens/sick-leave/show-sickleave.dart new file mode 100644 index 00000000..c3bd3178 --- /dev/null +++ b/lib/screens/sick-leave/show-sickleave.dart @@ -0,0 +1,133 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_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/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.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/patients/profile/patient-page-header-widget.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_bgNew_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class ShowSickLeaveScreen extends StatelessWidget { + PatiantInformtion patient; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getSickLeave(patient.patientMRN ?? patient.patientId), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: SingleChildScrollView( + child: Column( + children: [ + PatientPageHeaderWidget(patient), + Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of(context) + .hold + : item.status == 2 + ? TranslationBase.of( + context) + .active + : TranslationBase.of( + context) + .all, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .leaveStartDate + + ' ', + fontWeight: FontWeight.bold, + ), + Flexible( + child: Text( + item.startDate, + overflow: TextOverflow.ellipsis, + )) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of(context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks ?? "", + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ) + ], + ), + ), + ), + ); + } + + +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index a3f84804..5b4d5593 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -87,6 +87,20 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), + PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_ECG, + nameLine1: TranslationBase.of(context).patient, + nameLine2: "ECG", + icon: 'lab.png'), + PatientProfileButton( + key: key, + patient: patient, + route: SHOW_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, + icon: 'sick_leaves_icons.png'), ], ), ); 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"