From 6a555ace41051a71866c1d7405f518bab008d801 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 12 Nov 2024 13:48:51 +0300 Subject: [PATCH] ER Online CheckIn & InPatient CR implemented --- lib/config/localized_values.dart | 7 +++ ...EROnlineCheckInPaymentDetailsResponse.dart | 42 +++++++------- .../EROnlineCheckInBookAppointment.dart | 24 ++++---- .../EROnlineCheckIn/EROnlineCheckInHome.dart | 12 ++-- .../EROnlineCheckInPaymentDetails.dart | 58 +++++++++---------- .../InPatientServices/inpatient_home.dart | 25 ++++---- .../fragments/home_page_fragment2.dart | 15 ++++- lib/pages/login/confirm-login.dart | 4 +- lib/pages/login/login.dart | 1 + .../appointment_services/GetDoctorsList.dart | 2 +- .../clinic_services/get_clinic_service.dart | 39 +++++++++++++ lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- 12 files changed, 147 insertions(+), 86 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a30fe477..8d693bb7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1964,6 +1964,12 @@ const Map localizedValues = { "admissionReqNo": {"en": "Admission Request No", "ar": "رقم طلب القبول:"}, "dischargeDate": {"en": "Discharge Date", "ar": "تاريخ التفريغ"}, "selectAdmissionText": {"en": "Please select one of the admissions from below to view medical reports:", "ar": "يرجى تحديد أحد حالات القبول من الأسفل لعرض التقارير الطبية:"}, + "onlyAdmitted": {"en": "This service is only available for admitted patients", "ar": "هذه الخدمة متاحة فقط للمرضى المقبولين"}, + "assistYou": {"en": "How we may assist you?", "ar": "كيف يمكننا مساعدتك؟"}, + "receive": {"en": "Receive", "ar": "تجهيز"}, + "PRO": {"en": "PRO", "ar": "علاقات المرضى"}, + "patientRelationOffice": {"en": "Patient Relation Office", "ar": "علاقات المرضى"}, + "roomNo": {"en": "Room No.", "ar": "رقم الغرفة"}, "invalidEligibility": { "en": "You cannot make online payment because you are not eligible to use the provided service.", "ar": "لا يمكنك إجراء الدفع عبر الإنترنت لأنك غير مؤهل لاستخدام الخدمة المقدمة." @@ -2016,4 +2022,5 @@ const Map localizedValues = { "continueAgreeTerms": {"en": "By continuing, You agree to the above Terms and Conditions.", "ar": "من خلال المتابعة، فإنك توافق على الشروط والأحكام المذكورة أعلاه."}, "agreeText": {"en": "Agree", "ar": "أوافق"}, "ERCheckInSuccess": {"en": "Your ER Online Check-In has been successfully done.", "ar": "لقد تم تسجيل وصولك للطوارئ عبر الإنترنت بنجاح."}, + }; diff --git a/lib/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart b/lib/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart index faf4a498..884c2e0c 100644 --- a/lib/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart +++ b/lib/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart @@ -1,25 +1,25 @@ class EROnlineCheckInPaymentDetailsResponse { - num cashPrice; - num cashPriceTax; - num cashPriceWithTax; - int companyId; - String companyName; - num companyShareWithTax; - Null errCode; - int groupID; - String insurancePolicyNo; - String message; - String patientCardID; - num patientShare; - num patientShareWithTax; - num patientTaxAmount; - int policyId; - String policyName; - String procedureId; - String procedureName; - Null setupID; - int statusCode; - String subPolicyNo; + num? cashPrice; + num? cashPriceTax; + num? cashPriceWithTax; + int? companyId; + String? companyName; + num? companyShareWithTax; + dynamic errCode; + int? groupID; + String? insurancePolicyNo; + String? message; + String? patientCardID; + num? patientShare; + num? patientShareWithTax; + num? patientTaxAmount; + int? policyId; + String? policyName; + String? procedureId; + String? procedureName; + dynamic setupID; + int? statusCode; + String? subPolicyNo; EROnlineCheckInPaymentDetailsResponse( {this.cashPrice, diff --git a/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart b/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart index 1333883b..b5da50d5 100644 --- a/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart +++ b/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart @@ -21,10 +21,10 @@ class EROnlineCheckInBookAppointment extends StatefulWidget { } class _EROnlineCheckInBookAppointmentState extends State with SingleTickerProviderStateMixin { - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; List projectsList = []; final GlobalKey projectDropdownKey = GlobalKey(); - HospitalsModel selectedHospital; + HospitalsModel? selectedHospital; String projectDropdownValue = ""; @override @@ -85,13 +85,13 @@ class _EROnlineCheckInBookAppointmentState extends State( value: item, - child: new Text(item.name), + child: new Text(item.name!), ); }).toList(), onChanged: (newValue) async { setState(() { selectedHospital = newValue; - projectDropdownValue = newValue.mainProjectID.toString(); + projectDropdownValue = newValue!.mainProjectID.toString(); }); }, ), @@ -145,9 +145,9 @@ class _EROnlineCheckInBookAppointmentState extends State with SingleTickerProviderStateMixin { - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; bool _supportsNFC = false; bool isPatientArrived = false; @@ -34,7 +35,7 @@ class _EROnlineCheckInHomePageState extends State with void initState() { WidgetsBinding.instance.addPostFrameCallback((_) { // checkIfPatientHasArrived(); - checkPatientERAdvanceBalance(); + if (projectViewModel.isLogin) checkPatientERAdvanceBalance(); }); super.initState(); } @@ -48,9 +49,11 @@ class _EROnlineCheckInHomePageState extends State with return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).emergency + " ${TranslationBase.of(context).checkinOptions}", - isShowDecPage: false, + isShowDecPage: true, showNewAppBar: true, showNewAppBarTitle: true, + description: TranslationBase.of(context).HHCNotAuthMsg, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')], backgroundColor: Color(0xffF8F8F8), body: SingleChildScrollView( child: Padding( @@ -273,7 +276,7 @@ class _EROnlineCheckInHomePageState extends State with ), ), bottomSheet: Container( - height: 80, + height: projectViewModel.isLogin ? 80 : 1, color: CustomColors.white, padding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 25.0), child: isPatientArrived @@ -445,5 +448,4 @@ class _EROnlineCheckInHomePageState extends State with GifLoaderDialogUtils.hideDialog(context); }); } - } diff --git a/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart b/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart index de2f7ccc..13e5c733 100644 --- a/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart +++ b/lib/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart @@ -34,19 +34,19 @@ class EROnlineCheckInPaymentDetails extends StatefulWidget { bool isERBookAppointment = false; String projectName = ""; - EROnlineCheckInPaymentDetails({@required this.projectID, @required this.isERBookAppointment, @required this.projectName}); + EROnlineCheckInPaymentDetails({required this.projectID, required this.isERBookAppointment, required this.projectName}); @override State createState() => _EROnlineCheckInPaymentDetailsState(); } class _EROnlineCheckInPaymentDetailsState extends State with SingleTickerProviderStateMixin { - ProjectViewModel projectViewModel; - EROnlineCheckInPaymentDetailsResponse erOnlineCheckInPaymentDetailsResponse; - String selectedPaymentMethod; - String selectedInstallmentPlan; + late ProjectViewModel projectViewModel; + EROnlineCheckInPaymentDetailsResponse? erOnlineCheckInPaymentDetailsResponse; + String? selectedPaymentMethod; + String? selectedInstallmentPlan; String transID = ""; - MyInAppBrowser browser; + late MyInAppBrowser browser; @override void initState() { @@ -109,7 +109,7 @@ class _EROnlineCheckInPaymentDetailsState extends State().getProjectDetailsForPayfort(projectId: widget.projectID, serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum()).then((value) { - payfortProjectDetailsRespModel = value; + payfortProjectDetailsRespModel = value!; }); applePayInsertRequest.clientRequestID = transID; @@ -376,7 +376,7 @@ class _EROnlineCheckInPaymentDetailsState extends State().initiateApplePayWithPayfort( - customerName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", orderDescription: "ER Online Check-In Payment", - orderAmount: erOnlineCheckInPaymentDetailsResponse.patientShareWithTax, + orderAmount: erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax, merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", @@ -428,7 +428,7 @@ class _EROnlineCheckInPaymentDetailsState extends State().addPayfortApplePayResponse(projectViewModel.user.patientID, result: successResult); + await context.read().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult); GifLoaderDialogUtils.hideDialog(context); checkPaymentStatus(AppoitmentAllHistoryResultList()); }, @@ -497,7 +497,7 @@ class _EROnlineCheckInPaymentDetailsState extends State { void checkDischargeMedications(BuildContext context) { ClinicListService service = new ClinicListService(); GifLoaderDialogUtils.showMyDialog(context); - // service.getDischargeMedicationOrder(projectViewModel.getAdmissionInfoResponseModel).then((res) { - // print(res["PatientHasDischargeMedicineList"].length); - // setState(() { - // if (res["PatientHasDischargeMedicineList"].length != 0) { - // isReceivePrescriptionEnabled = true; - // } - // }); - // GifLoaderDialogUtils.hideDialog(context); - // }).catchError((err) { - // GifLoaderDialogUtils.hideDialog(context); - // print(err); - // }); + service.getDischargeMedicationOrder(projectViewModel.getAdmissionInfoResponseModel).then((res) { + print(res["PatientHasDischargeMedicineList"].length); + setState(() { + if (res["PatientHasDischargeMedicineList"].length != 0) { + isReceivePrescriptionEnabled = true; + } + }); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); } void callReceivePrescriptionAPI(BuildContext context) { @@ -298,6 +298,7 @@ class _InPatientServicesHomeState extends State { print(res['generalInstructions']); Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList))); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: TranslationBase.of(context).noGeneralInstructions); } }).catchError((err) { diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index dac4002c..b6e9f2d4 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -60,6 +60,7 @@ class _HomePageFragment2State extends State { ? hmgServices.add(HmgServices(2, TranslationBase.of(context).hospitalNavigationTitle, TranslationBase.of(context).hospitalNavigationSubtitle, "assets/images/new/indoor_nav_home.svg", isLogin)) : hmgServices.add(HmgServices(2, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(HmgServices(9, TranslationBase.of(context).emergency, TranslationBase.of(context).checkinOptions, "assets/images/new/emergency.svg", isLogin)); hmgServices.add(HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); hmgServices.add(HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); hmgServices.add(HmgServices(5, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); @@ -73,13 +74,20 @@ class _HomePageFragment2State extends State { // hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); // hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/CoronaIcon.svg", isLogin)); // hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(9, TranslationBase.of(context).emergency, TranslationBase.of(context).checkinOptions, "assets/images/new/emergency.svg", isLogin)); + + projectViewModel.isIndoorNavigationEnabled + ? hmgServices.add(HmgServices(2, TranslationBase.of(context).hospitalNavigationTitle, TranslationBase.of(context).hospitalNavigationSubtitle, "assets/images/new/indoor_nav_home.svg", isLogin)) + : hmgServices.add(HmgServices(2, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); - hmgServices.add(new HmgServices(2, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + + // hmgServices.add(new HmgServices(2, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); hmgServices.add(new HmgServices(8, TranslationBase.of(context).connectTitle, TranslationBase.of(context).connectSubtitle, "assets/images/new/reach_us.svg", isLogin)); - hmgServices.add(new HmgServices(9, TranslationBase.of(context).emergency, TranslationBase.of(context).checkinOptions, "assets/images/new/emergency.svg", isLogin)); } @override @@ -350,7 +358,8 @@ class _HomePageFragment2State extends State { itemCount: hmgServices.length, padding: EdgeInsets.zero, itemBuilder: (BuildContext context, int index) { - return ServicesView(hmgServices[index], index, true, projectViewModel, isLocked: (hmgServices[index].action == 2 && projectViewModel.isIndoorNavigationEnabled) ? !projectViewModel.havePrivilege(107) : false); + return ServicesView(hmgServices[index], index, true, projectViewModel, + isLocked: (hmgServices[index].action == 2 && projectViewModel.isIndoorNavigationEnabled) ? !projectViewModel.havePrivilege(107) : false); }, ), ), diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index dafbe327..bd5a64a6 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -754,7 +754,8 @@ class _ConfirmLogin extends State { if (hasAdmissionRequest) { if (res['MedicalInstruction'].length != 0) { getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]); - projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']); + // projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']); + projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']); projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel); projectViewModel.setPatientHasAdmissionRequest(true); } @@ -791,6 +792,7 @@ class _ConfirmLogin extends State { // GifLoaderDialogUtils.hideDialog(context); getToDoCount(); + checkIfIsInPatient(); appointmentRateViewModel .getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2) .then((value) => { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 18ed5440..64bc3ac1 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -386,6 +386,7 @@ class _Login extends State { // ), // (r) => false); getToDoCount(); + checkIfIsInPatient(); appointmentRateViewModel .getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2) .then((value) => { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 7aca2055..2b039701 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1880,7 +1880,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future autoGenerateInvoiceERClinic(int projectID, int paymentMethod, String paymentReferenceNo, num amount, String cardType, String cardNumber, String orderID, String rrn, bool isAdvanceAvailable) async { + Future autoGenerateInvoiceERClinic(int? projectID, int? paymentMethod, String? paymentReferenceNo, num? amount, String? cardType, String? cardNumber, String? orderID, String? rrn, bool isAdvanceAvailable) async { Map request; request = { "ProjectID": projectID, diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 914c5c42..ff420feb 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -495,4 +495,43 @@ class ClinicListService extends BaseService { }, body: request, isAllowAny: true); return Future.value(localRes); } + + Future getDischargeMedicationOrder(GetAdmissionInfoResponseModel getAdmissionInfoResponseModel) async { + Map request; + request = { + "ProjectID": getAdmissionInfoResponseModel.projectID, + "ClinicID": getAdmissionInfoResponseModel.clinicID, + "DoctorID": getAdmissionInfoResponseModel.doctorID, + "AdmissionNo": getAdmissionInfoResponseModel.admissionNo + }; + + // request = { + // "ProjectID": 12, + // "VersionID": 10.8, + // "Channel": 3, + // "LanguageID": 2, + // "IPAdress": "10.20.10.20", + // "generalid": "Cs2020@2016\$2958", + // "DeviceTypeID": 2, + // "PatientType": 1, + // "PatientTypeID": 1, + // "TokenID": "@dm!n", + // "PatientID": 869588, + // "PatientOutSA": 0, + // "SessionID": "rVuK3nzN4UKN0SW95un0jQ==", + // "ClinicID": 2, + // "DoctorID": "7600", + // "AdmissionNo": 2011001258 + // }; + + dynamic localRes; + + await baseAppClient.post(INPATIENT_DISCHARGE_MEDICATIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index ee68f743..6f61ac8a 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -38,9 +38,9 @@ class MyInAppBrowser extends InAppBrowser { static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS