diff --git a/lib/config/config.dart b/lib/config/config.dart index 7864a598..2195aff2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -384,6 +384,10 @@ const SET_ACCEPTED_OR_REJECTED = const GET_STP_MASTER_LIST = "Services/DoctorApplication.svc/REST/DoctorApp_GetSTPMasterList"; + +const DOCTOR_ER_SIGN_ASSESSMENT = + "Services/DoctorApplication.svc/REST/DoctorApp_DoctorERSignAssessment"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 116cab42..c9b9a9a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -93,6 +93,10 @@ const Map> localizedValues = { "en": "scan Qr code to retrieve patient profile", "ar": "مسح رمزاال QR لاسترداد ملف تعريف المريض" }, + "scanERQrCode": { + "en": "Scan Qr code to handle ER Sign In", + "ar": "امسح رمز ال ER للتعامل مع تسجيل الدخول" + }, "scanQr": {"en": "Scan Qr", "ar": "اقراء ال QR"}, "profile": {"en": "Profile", "ar": "ملفي الشخصي"}, "gender": {"en": "Gender", "ar": "الجنس"}, diff --git a/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart new file mode 100644 index 00000000..19996bd4 --- /dev/null +++ b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart @@ -0,0 +1,25 @@ +class DoctorErSignAssessmentReqModel { + String setupID; + int signInType; + int loginDoctorID; + int patientID; + + DoctorErSignAssessmentReqModel( + {this.setupID, this.signInType, this.loginDoctorID, this.patientID}); + + DoctorErSignAssessmentReqModel.fromJson(Map json) { + setupID = json['SetupID']; + signInType = json['SignInType']; + loginDoctorID = json['LoginDoctorID']; + patientID = json['PatientID']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['SignInType'] = this.signInType; + data['LoginDoctorID'] = this.loginDoctorID; + data['PatientID'] = this.patientID; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart new file mode 100644 index 00000000..9e1de604 --- /dev/null +++ b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart @@ -0,0 +1,49 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/search_drug_request_model.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/utils/date-utils.dart'; +import 'package:flutter/cupertino.dart'; + +class ERSignInService extends LookupService { + + + Future signInERPatient({DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel}) async { + + + hasError = false; + + await baseAppClient.post(DOCTOR_ER_SIGN_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: doctorErSignAssessmentReqModel.toJson()); + } + +} diff --git a/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart new file mode 100644 index 00000000..0bf10e76 --- /dev/null +++ b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:flutter/cupertino.dart'; + +class ERSignInViewModel extends BaseViewModel { + bool hasError = false; + + ERSignInService _ERSignInService = locator(); + + Future signInERPatient({int patientId, int signInType}) async { + hasError = false; + await getDoctorProfile(); + DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel = new DoctorErSignAssessmentReqModel(setupID:"010266", signInType:signInType, loginDoctorID:doctorProfile.doctorID, patientID: patientId ); + setState(ViewState.BusyLocal); + await _ERSignInService.signInERPatient(doctorErSignAssessmentReqModel: doctorErSignAssessmentReqModel); + if (_ERSignInService.hasError) { + error = _ERSignInService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + +} diff --git a/lib/locator.dart b/lib/locator.dart index 0bdfe8e9..0001354e 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,6 +1,7 @@ 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/patient/profile/discharge_summary_servive.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.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'; @@ -50,6 +51,7 @@ import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; import 'core/service/special_clinics/special_clinic_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; +import 'core/viewModel/ER_sign_in/ER_sign_in_view_model.dart'; import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; @@ -114,6 +116,8 @@ void setupLocator() { locator.registerLazySingleton(() => DischargeSummaryService()); locator.registerLazySingleton(() => VteAssessmentService()); locator.registerLazySingleton(() => InterventionMedicationService()); + locator.registerLazySingleton(() => ERSignInService()); + /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -147,4 +151,5 @@ void setupLocator() { locator.registerFactory(() => DischargeSummaryViewModel()); locator.registerFactory(() => VteAssessmentViewModel()); locator.registerFactory(() => InterventionMedicationViewModel()); + locator.registerFactory(() => ERSignInViewModel()); } diff --git a/lib/screens/ER_singin/ER_singin_screen.dart b/lib/screens/ER_singin/ER_singin_screen.dart new file mode 100644 index 00000000..0d9dbc5e --- /dev/null +++ b/lib/screens/ER_singin/ER_singin_screen.dart @@ -0,0 +1,227 @@ +import 'package:barcode_scan2/barcode_scan2.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; +import 'package:doctor_app_flutter/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../routes.dart'; +import '../base/base_view.dart'; + +Utils helpers = Utils(); + +class ErSignInScreen extends StatefulWidget { + @override + _ErSignInScreenState createState() => _ErSignInScreenState(); +} + +class _ErSignInScreenState extends State { + ProjectViewModel projectViewModel; + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientSearchHeader(title: "ER Sign In",) + , + body: Center( + child: Container( + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + AppText( + TranslationBase.of(context).startScanning, + fontSize: 18, + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + ), + SizedBox( + height: 7, + ), + AppText(TranslationBase.of(context).scanERQrCode, + fontSize: 14, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center), + SizedBox( + height: 15, + ), + Container( + height: 150, + child: Image.asset('assets/images/qr_code.png'), + ), + SizedBox( + height: 35, + ), + AppButton( + title: TranslationBase.of(context).scanQr, + onPressed: () async { + await locator().logEvent( + eventCategory: "ErSigninScreen", + eventAction: "Scan QR", + ); + _scanQrAndGetPatient(context, model); + }, + icon: Image.asset('assets/images/qr_code_white.png'), + ), + ], + ), + ), + ), + ), + ), + ); + } + + _scanQrAndGetPatient(BuildContext context, ERSignInViewModel model) async { + var result = (await BarcodeScanner.scan()).rawContent; + if (result != "") { + try{ + List listOfParams = result.split(','); + int patientID = 0; + if (listOfParams[0].length != 0) + patientID = int.parse(listOfParams[0]); + showMyDialog(context:context, firstAction: (){ + signInERPatient(context: context, model: model, patientId: patientID, signInType: 1); + } , secondAction: (){ + signInERPatient(context: context, model: model, patientId: patientID, signInType: 2); + + } ); + }catch(e){ + Utils.showErrorToast("Please Enter Valid Code"); + } + + } + } + + + signInERPatient ({BuildContext context, ERSignInViewModel model, patientId, signInType}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.signInERPatient(patientId:patientId, signInType: signInType ); + if(model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + /// TODO Elham* Create this in Utils + DrAppToastMsg.showSuccesToast("Add successfully"); + } + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + + } + + /// TODO Elham* Make this as custom Dialog + showMyDialog({BuildContext context, Function firstAction,Function secondAction, }) { + showDialog( + context: context, + builder: (ctx) => Center( + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + height: 250, + child: AppScaffold( + isShowAppBar: false, + body: Container( + color: Colors.white, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // SizedBox(height: 20,), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + "Select option", + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), + ], + ), + SizedBox( + height: 10, + ), + DividerWithSpacesAround(), + SizedBox( + height: 12, + ), + + Container( + padding: EdgeInsets.all(20), + color: Colors.white, + child: AppText( + projectViewModel.isArabic + ? "الرجاء اختيار الإجراء الذي تريد القيام به" + : 'Please choose the action you want to do ', + fontSize: 15, + textAlign: TextAlign.center, + ), + ), + + SizedBox( + height: 8, + ), + DividerWithSpacesAround(), + FractionallySizedBox( + widthFactor: 0.75, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FlatButton( + child: AppText( + "Sing In", + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), //Text("Cancel"), + onPressed: () async { + await firstAction(); + + + }), + FlatButton( + child: AppText( + "Sing Out", + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), //Text("Confirm", ), + onPressed: () async { + await secondAction(); + }) + ], + ), + ) + ], + ), + ), + ), + ), + ), + )); + } + + +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index a30c2325..b361d1fe 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.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/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/screens/ER_singin/ER_singin_screen.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart'; import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; @@ -405,6 +406,24 @@ class _HomeScreenState extends State { changeColorIndex(); } + patientCards.add(HomePatientCard( + gradient: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.qr_reader, + textColor: textColors[colorIndex], + text: "ER sign In" , + onTap: () { + Navigator.push( + context, + FadePage( + page: ErSignInScreen( + ), + ), + ); + }, + )); + changeColorIndex(); + patientCards.add(HomePatientCard( gradient: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], diff --git a/lib/screens/patients/profile/notes/note/progress_note_screen.dart b/lib/screens/patients/profile/notes/note/progress_note_screen.dart index 561faece..19882b9c 100644 --- a/lib/screens/patients/profile/notes/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/notes/note/progress_note_screen.dart @@ -592,6 +592,8 @@ class _ProgressNoteState extends State { ); } + + /// TODO Elham* Make this as custom Dialog showMyDialog({BuildContext context, Function confirmFun, String actionName}) { showDialog( context: context, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 3ffef41d..ae709ba2 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -159,6 +159,7 @@ class TranslationBase { String get startScanning => localizedValues['startScanning'][locale.languageCode]; String get scanQrCode => localizedValues['scanQrCode'][locale.languageCode]; + String get scanERQrCode => localizedValues['scanERQrCode'][locale.languageCode]; String get scanQr => localizedValues['scanQr'][locale.languageCode];