From 7a1690e4ecb7d5481e2cf750a157d1c34c77a3b6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 21 Jan 2025 14:39:21 +0300 Subject: [PATCH] CR Implementation completed. --- lib/config/localized_values.dart | 3 +- .../ancillary_order_list_model.dart | 213 +++++++++++++++++- .../ancillaryOrdersDetails.dart | 2 +- lib/pages/ToDoList/ToDo.dart | 111 ++++++--- lib/uitl/translations_delegate_base.dart | 2 +- 5 files changed, 282 insertions(+), 49 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7bfb0397..2d2f275b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1800,7 +1800,8 @@ const Map localizedValues = { "ancillaryOrdersPaymentConfirm": {"en": "Are you sure you want to make payment for selected orders?", "ar": "هل أنت متأكد أنك تريد سداد قيمة الطلبات المختارة؟"}, "successRegister": {"en": "Your account has been created.", "ar": "لقد تم إنشاء حسابك."}, "pharmacyLiveCare": {"en": "Pharmacy LiveCare", "ar": "لايف كير صيدلية"}, - "ancillaryOrderPaymentSuccess": {"en": "Your payment for selected orders has been made successfully.", "ar": "تم سداد دفعتك للطلبات المحددة بنجاح."}, + "ancillaryOrderPaymentSuccess": {"en": "Your payment for selected orders has been made successfully. Please Check-In once you arrive into the hospital.", "ar": "لقد تم الدفع بنجاح للطلبات المحددة. يرجى تسجيل الدخول بمجرد وصولك إلى المستشفى.."}, + "ancillaryOrderCheckInSuccess": {"en": "Your Check-In for selected ancillary order has been done successfully. Please proceed to the waiting area. Your Queue No. is: ", "ar": "لقد تم تسجيل وصولك بنجاح للطلب الإضافي المحدد. يرجى الانتقال إلى منطقة الانتظار. رقم صف الانتظار الخاص بك هو: "}, "connectTitle": {"en": "Connect", "ar": "تواصل"}, "connectSubtitle": {"en": "With us", "ar": "معنا"}, "covidConsent": { diff --git a/lib/models/anicllary-orders/ancillary_order_list_model.dart b/lib/models/anicllary-orders/ancillary_order_list_model.dart index f29ddd62..ccb359a3 100644 --- a/lib/models/anicllary-orders/ancillary_order_list_model.dart +++ b/lib/models/anicllary-orders/ancillary_order_list_model.dart @@ -10,11 +10,21 @@ class AncillaryOrdersListModel { String? setupID; int? statusCode; - AncillaryOrdersListModel({this.ancillaryOrderList, this.errCode, this.message, this.patientID, this.patientName, this.patientType, this.projectID, this.projectName, this.setupID, this.statusCode}); + AncillaryOrdersListModel( + {this.ancillaryOrderList, + this.errCode, + this.message, + this.patientID, + this.patientName, + this.patientType, + this.projectID, + this.projectName, + this.setupID, + this.statusCode}); AncillaryOrdersListModel.fromJson(Map json) { if (json['AncillaryOrderList'] != null) { - ancillaryOrderList = []; + ancillaryOrderList = []; json['AncillaryOrderList'].forEach((v) { ancillaryOrderList!.add(new AncillaryOrderList.fromJson(v)); }); @@ -22,7 +32,7 @@ class AncillaryOrdersListModel { errCode = json['ErrCode']; message = json['Message']; patientID = json['PatientID']; - patientName = json['PatientName'] != null ? json['PatientName'] : ""; + patientName = json['PatientName']; patientType = json['PatientType']; projectID = json['ProjectID']; projectName = json['ProjectName']; @@ -33,7 +43,8 @@ class AncillaryOrdersListModel { Map toJson() { final Map data = new Map(); if (this.ancillaryOrderList != null) { - data['AncillaryOrderList'] = this.ancillaryOrderList!.map((v) => v.toJson()).toList(); + data['AncillaryOrderList'] = + this.ancillaryOrderList!.map((v) => v.toJson()).toList(); } data['ErrCode'] = this.errCode; data['Message'] = this.message; @@ -49,42 +60,224 @@ class AncillaryOrdersListModel { } class AncillaryOrderList { + List? ancillaryProcedureListModels; String? appointmentDate; int? appointmentNo; int? clinicID; String? clinicName; int? doctorID; String? doctorName; + bool? isCheckInAllow; + bool? isQueued; String? orderDate; int? orderNo; - bool? isAllowCheckIn; - String? procedureIDs; - AncillaryOrderList({this.appointmentDate, this.appointmentNo, this.clinicID, this.clinicName, this.doctorID, this.doctorName, this.orderDate, this.orderNo, this.isAllowCheckIn, this.procedureIDs}); + AncillaryOrderList( + {this.ancillaryProcedureListModels, + this.appointmentDate, + this.appointmentNo, + this.clinicID, + this.clinicName, + this.doctorID, + this.doctorName, + this.isCheckInAllow, + this.isQueued, + this.orderDate, + this.orderNo}); AncillaryOrderList.fromJson(Map json) { + if (json['AncillaryProcedureListModels'] != null) { + ancillaryProcedureListModels = []; + json['AncillaryProcedureListModels'].forEach((v) { + ancillaryProcedureListModels! + .add(new AncillaryProcedureListModels.fromJson(v)); + }); + } appointmentDate = json['AppointmentDate']; appointmentNo = json['AppointmentNo']; clinicID = json['ClinicID']; - clinicName = json['ClinicName'] != null ? json['ClinicName'] : ""; + clinicName = json['ClinicName']; doctorID = json['DoctorID']; doctorName = json['DoctorName']; + isCheckInAllow = json['IsCheckInAllow']; + isQueued = json['IsQueued']; orderDate = json['OrderDate']; orderNo = json['OrderNo']; - isAllowCheckIn = json['IsCheckInAllow']; - procedureIDs = json['ProcedureIds'] != null ? json['ProcedureIds'] : ""; } Map toJson() { final Map data = new Map(); + if (this.ancillaryProcedureListModels != null) { + data['AncillaryProcedureListModels'] = + this.ancillaryProcedureListModels!.map((v) => v.toJson()).toList(); + } data['AppointmentDate'] = this.appointmentDate; data['AppointmentNo'] = this.appointmentNo; data['ClinicID'] = this.clinicID; data['ClinicName'] = this.clinicName; data['DoctorID'] = this.doctorID; data['DoctorName'] = this.doctorName; + data['IsCheckInAllow'] = this.isCheckInAllow; + data['IsQueued'] = this.isQueued; data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; return data; } } + +class AncillaryProcedureListModels { + int? ancillaryProcedureId; + int? appointmentNo; + int? approvalLineItemNo; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + bool? isActive; + int? orderLineItemNo; + int? orderNo; + int? patientID; + String? procedureID; + int? projectID; + + AncillaryProcedureListModels( + {this.ancillaryProcedureId, + this.appointmentNo, + this.approvalLineItemNo, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.isActive, + this.orderLineItemNo, + this.orderNo, + this.patientID, + this.procedureID, + this.projectID}); + + AncillaryProcedureListModels.fromJson(Map json) { + ancillaryProcedureId = json['AncillaryProcedureId']; + appointmentNo = json['AppointmentNo']; + approvalLineItemNo = json['ApprovalLineItemNo']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + isActive = json['IsActive']; + orderLineItemNo = json['OrderLineItemNo']; + orderNo = json['OrderNo']; + patientID = json['PatientID']; + procedureID = json['ProcedureID']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['AncillaryProcedureId'] = this.ancillaryProcedureId; + data['AppointmentNo'] = this.appointmentNo; + data['ApprovalLineItemNo'] = this.approvalLineItemNo; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['IsActive'] = this.isActive; + data['OrderLineItemNo'] = this.orderLineItemNo; + data['OrderNo'] = this.orderNo; + data['PatientID'] = this.patientID; + data['ProcedureID'] = this.procedureID; + data['ProjectID'] = this.projectID; + return data; + } +} + + +// class AncillaryOrdersListModel { +// List? ancillaryOrderList; +// dynamic errCode; +// String? message; +// int? patientID; +// String? patientName; +// int? patientType; +// int? projectID; +// String? projectName; +// String? setupID; +// int? statusCode; +// +// AncillaryOrdersListModel({this.ancillaryOrderList, this.errCode, this.message, this.patientID, this.patientName, this.patientType, this.projectID, this.projectName, this.setupID, this.statusCode}); +// +// AncillaryOrdersListModel.fromJson(Map json) { +// if (json['AncillaryOrderList'] != null) { +// ancillaryOrderList = []; +// json['AncillaryOrderList'].forEach((v) { +// ancillaryOrderList!.add(new AncillaryOrderList.fromJson(v)); +// }); +// } +// errCode = json['ErrCode']; +// message = json['Message']; +// patientID = json['PatientID']; +// patientName = json['PatientName'] != null ? json['PatientName'] : ""; +// patientType = json['PatientType']; +// projectID = json['ProjectID']; +// projectName = json['ProjectName']; +// setupID = json['SetupID']; +// statusCode = json['StatusCode']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// if (this.ancillaryOrderList != null) { +// data['AncillaryOrderList'] = this.ancillaryOrderList!.map((v) => v.toJson()).toList(); +// } +// data['ErrCode'] = this.errCode; +// data['Message'] = this.message; +// data['PatientID'] = this.patientID; +// data['PatientName'] = this.patientName; +// data['PatientType'] = this.patientType; +// data['ProjectID'] = this.projectID; +// data['ProjectName'] = this.projectName; +// data['SetupID'] = this.setupID; +// data['StatusCode'] = this.statusCode; +// return data; +// } +// } +// +// class AncillaryOrderList { +// String? appointmentDate; +// int? appointmentNo; +// int? clinicID; +// String? clinicName; +// int? doctorID; +// String? doctorName; +// String? orderDate; +// int? orderNo; +// bool? isAllowCheckIn; +// String? procedureIDs; +// +// AncillaryOrderList({this.appointmentDate, this.appointmentNo, this.clinicID, this.clinicName, this.doctorID, this.doctorName, this.orderDate, this.orderNo, this.isAllowCheckIn, this.procedureIDs}); +// +// AncillaryOrderList.fromJson(Map json) { +// appointmentDate = json['AppointmentDate']; +// appointmentNo = json['AppointmentNo']; +// clinicID = json['ClinicID']; +// clinicName = json['ClinicName'] != null ? json['ClinicName'] : ""; +// doctorID = json['DoctorID']; +// doctorName = json['DoctorName']; +// orderDate = json['OrderDate']; +// orderNo = json['OrderNo']; +// isAllowCheckIn = json['IsCheckInAllow']; +// procedureIDs = json['ProcedureIds'] != null ? json['ProcedureIds'] : ""; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['AppointmentDate'] = this.appointmentDate; +// data['AppointmentNo'] = this.appointmentNo; +// data['ClinicID'] = this.clinicID; +// data['ClinicName'] = this.clinicName; +// data['DoctorID'] = this.doctorID; +// data['DoctorName'] = this.doctorName; +// data['OrderDate'] = this.orderDate; +// data['OrderNo'] = this.orderNo; +// return data; +// } +// } diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 6c7590ca..881c5e0d 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -887,7 +887,7 @@ class _AnicllaryOrdersState extends State with SingleTic showAlertDialog(dynamic invoiceNo, dynamic projectID) { AlertDialogBox( context: context, - confirmMessage: TranslationBase.of(context).ancillaryOrderPaymentSuccess + invoiceNo.toString(), + confirmMessage: TranslationBase.of(context).ancillaryOrderPaymentSuccess, okText: TranslationBase.of(context).ok, okFunction: () { AlertDialogBox.closeAlertDialog(context); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 168162f1..efdfaf0a 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -44,6 +44,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/bottom_sheet.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; @@ -453,7 +454,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { isLiveCareAppointment: false, date: DateUtil.convertStringToDate(ancillaryLists[0].ancillaryOrderList![index].orderDate), isSortByClinic: true, - isAllowCheckInAncillary: ancillaryLists[0].ancillaryOrderList![index].isAllowCheckIn!, + isAllowCheckInAncillary: ancillaryLists[0].ancillaryOrderList![index].isCheckInAllow!, onAncillaryCheckInTap: () { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.doctorTitle = TranslationBase.of(context).dr.toString(); @@ -468,7 +469,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { appo.actualDoctorRate = 0; appo.noOfPatientsRate = 0; - navigateToQR(context, "", new PatientShareResponse(), appo, true); + ShowAncillaryOrderOnlineCheckInBottomSheet(ancillaryLists[0].ancillaryOrderList![index], ancillaryLists[0].projectID!); }, ); }, @@ -1179,7 +1180,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { patientShareResponse.clinicID = appo.clinicID; patientShareResponse.projectID = appo.projectID; patientShareResponse.isFollowup = appo.isFollowup; - navigateToQR(context, "", patientShareResponse, appo, false); + navigateToQR(context, "", patientShareResponse, appo); projectViewModel.analytics.todoList.to_do_list_check_in(appo); // } else { // Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); @@ -1193,7 +1194,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { }); } - Future navigateToQR(context, String appoQR, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appintment, bool isAncillaryOrderCheckIn) async { + ShowAncillaryOrderOnlineCheckInBottomSheet(AncillaryOrderList ancillaryOrderList, int projectID) { showMyBottomSheet(context, callBackFunc: () {}, child: Padding( @@ -1210,8 +1211,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GridView( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (MediaQuery.of(context).size.width < 550) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 12), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 550) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 12), children: [ attendanceMethod(TranslationBase.of(context).scanNFC, "assets/images/nfc/contactless.svg", true, () { if (_supportsNFC) { @@ -1219,6 +1220,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { print(nfcId); + autoGenerateInvoice(ancillaryOrderList, projectID); // getProjectIDFromNFC(nfcId, true); // Navigator.push(context, FadePage(page: EROnlineCheckInPaymentDetails())); }); @@ -1235,28 +1237,28 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { print(onlineCheckInQRCode); + autoGenerateInvoice(ancillaryOrderList, projectID); // getProjectIDFromNFC(onlineCheckInQRCode, true); // sendNfcCheckInRequest(onlineCheckInQRCode, 2); } else {} }), - attendanceMethod(TranslationBase.of(context).checkInViaLocation, "assets/images/new/services/location.svg", true, () {}) + attendanceMethod(TranslationBase.of(context).checkInViaLocation, "assets/images/new/services/location.svg", true, () { + startLocationCheckIn(ancillaryOrderList, projectID); + }) ], ), ], ), )); + } - // Navigator.push(context, FadePage(page: QRCode(patientShareResponse: patientShareResponse, appoQR: appoQR, appointment: appintment, isAncillaryOrderCheckIn: isAncillaryOrderCheckIn))) - // .then((value) { - // if (isAncillaryOrderCheckIn) { - // Utils.showErrorToast("isAncillaryOrderCheckIn"); - // } else { - // getPatientAppointmentHistory(); - // } - // }); + Future navigateToQR(context, String appoQR, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appintment) async { + Navigator.push(context, FadePage(page: QRCode(patientShareResponse: patientShareResponse, appoQR: appoQR, appointment: appintment))).then((value) { + getPatientAppointmentHistory(); + }); } - startLocationCheckIn() async { + startLocationCheckIn(AncillaryOrderList ancillaryOrderList, int projectID) async { GifLoaderDialogUtils.showMyDialog(context); locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(callBack: (value) { @@ -1265,6 +1267,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { print(dist); if (dist <= projectDetailListModel.geofenceRadius!) { GifLoaderDialogUtils.hideDialog(context); + autoGenerateInvoice(ancillaryOrderList, projectID); // sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!, 2); } else { GifLoaderDialogUtils.hideDialog(context); @@ -1678,6 +1681,42 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { }); } + autoGenerateInvoice(AncillaryOrderList ancillaryOrderList, int projectID) { + List selectedProcListAPI = []; + + ancillaryOrderList.ancillaryProcedureListModels!.forEach((element) { + selectedProcListAPI.add({ + "ApprovalLineItemNo": element.approvalLineItemNo, + "OrderLineItemNo": element.orderLineItemNo, + "ProcedureID": element.procedureID, + }); + }); + + GifLoaderDialogUtils.showMyDialog(context); + + DoctorsListService service = new DoctorsListService(); + service.autoGenerateAncillaryOrdersInvoice(ancillaryOrderList.orderNo, projectID, ancillaryOrderList.appointmentNo, selectedProcListAPI, projectViewModel.isArabic ? 1 : 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + showAlertDialog(res['AncillaryOrderInvoiceList'][0]['InvoiceNo']); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + showAlertDialog(dynamic queueNo) { + AlertDialogBox( + context: context, + confirmMessage: TranslationBase.of(context).ancillaryOrderCheckInSuccess + queueNo.toString(), + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); + }).showAlertDialog(context); + } + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); @@ -1699,27 +1738,27 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => InkWell( - onTap: () { - Navigator.pop(context); - onPress(); - }, - child: Container( - decoration: containerColorRadiusBorderWidth(Colors.white, 15, CustomColors.darkGreyColor, 1), - clipBehavior: Clip.antiAlias, - padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: SvgPicture.asset(image, color: Colors.black, alignment: Alignment.topLeft)), - Text( - title, - style: TextStyle(color: Colors.black, fontSize: 14, letterSpacing: -0.68, fontWeight: FontWeight.bold), + onTap: () { + Navigator.pop(context); + onPress(); + }, + child: Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 15, CustomColors.darkGreyColor, 1), + clipBehavior: Clip.antiAlias, + padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: SvgPicture.asset(image, color: Colors.black, alignment: Alignment.topLeft)), + Text( + title, + style: TextStyle(color: Colors.black, fontSize: 14, letterSpacing: -0.68, fontWeight: FontWeight.bold), + ), + // title.toText17(isBold: true, color: Colors.white), + ], ), - // title.toText17(isBold: true, color: Colors.white), - ], - ), - ), - ); + ), + ); ancillaryOrdersDetails(item, projectId) { Navigator.push( diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 3ce068fb..ed38ca45 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -3044,7 +3044,7 @@ class TranslationBase { String get download => localizedValues["download"][locale.languageCode]; String get share => localizedValues["share"][locale.languageCode]; - + String get ancillaryOrderCheckInSuccess => localizedValues["ancillaryOrderCheckInSuccess"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {