ER Online Check-In CR implemented

merge-update-with-lab-changes
haroon amjad 1 year ago
parent 9a0a658083
commit b6adfb2534

@ -639,6 +639,8 @@ var AUTO_GENERATE_INVOICE_ER = 'Services/OUTPs.svc/Rest/Outp_AutoGenerateInvoice
var CHECK_IF_PATIENT_ARRIVED_ER_ONLINE_CHECKIN = 'Services/OUTPs.svc/Rest/IsPatientArrived';
var CHECK_PATIENT_ER_ADVANCE_BALANCE = 'Services/OUTPs.svc/Rest/getPatientAdvanceBalanceAmountByClinic';
var GET_PROJECT_FROM_NFC = 'Services/OUTPs.svc/Rest/GetProjectByNFC';
//PAYFORT

@ -1935,4 +1935,5 @@ const Map localizedValues = {
"selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"},
"wecare": {"en": "We Care", "ar": "نحن نهتم"},
"myinstructions": {"en": "My Instructions", "ar": "تعليماتي"},
"ERCheckInSuccess": {"en": "Your ER Online Check-In has been successfully done.", "ar": "لقد تم تسجيل وصولك للطوارئ عبر الإنترنت بنجاح."},
};

@ -1,18 +1,18 @@
class EROnlineCheckInPaymentDetailsResponse {
int cashPrice;
int cashPriceTax;
int cashPriceWithTax;
num cashPrice;
num cashPriceTax;
num cashPriceWithTax;
int companyId;
String companyName;
int companyShareWithTax;
num companyShareWithTax;
Null errCode;
int groupID;
String insurancePolicyNo;
String message;
String patientCardID;
double patientShare;
double patientShareWithTax;
double patientTaxAmount;
num patientShare;
num patientShareWithTax;
num patientTaxAmount;
int policyId;
String policyName;
String procedureId;

@ -1,6 +1,8 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart';
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
@ -31,7 +33,8 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) {
checkIfPatientHasArrived();
// checkIfPatientHasArrived();
checkPatientERAdvanceBalance();
});
super.initState();
}
@ -283,6 +286,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
showNfcReader(context, onNcfScan: (String nfcId) {
Future.delayed(const Duration(milliseconds: 100), () {
print(nfcId);
getProjectIDFromNFC(nfcId, true);
// Navigator.push(context, FadePage(page: EROnlineCheckInPaymentDetails()));
});
}, onCancel: () {
@ -309,7 +313,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
showNfcReader(context, onNcfScan: (String nfcId) {
Future.delayed(const Duration(milliseconds: 100), () {
print(nfcId);
getProjectIDFromNFC(nfcId);
getProjectIDFromNFC(nfcId, false);
});
}, onCancel: () {
Navigator.of(context).pop();
@ -340,7 +344,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
);
}
void getProjectIDFromNFC(String nfcID) {
void getProjectIDFromNFC(String nfcID, bool isArrived) {
GifLoaderDialogUtils.showMyDialog(context);
ClinicListService ancillaryOrdersService = new ClinicListService();
ancillaryOrdersService.getProjectIDFromNFC(nfcID).then((response) {
@ -349,16 +353,20 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
int projectID = response['GetProjectByNFC'][0]["ProjectID"];
String projectName = response['GetProjectByNFC'][0]["ProjectName"];
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(
context,
FadePage(
page: EROnlineCheckInPaymentDetails(
projectID: projectID,
isERBookAppointment: false,
projectName: projectName,
if (isArrived) {
autoGenerateInvoiceER(projectID);
} else {
Navigator.push(
context,
FadePage(
page: EROnlineCheckInPaymentDetails(
projectID: projectID,
isERBookAppointment: false,
projectName: projectName,
),
),
),
);
);
}
} else {
AppToast.showErrorToast(message: "Invalid NFC Card Scanned.");
}
@ -368,6 +376,47 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
});
}
autoGenerateInvoiceER(int projectID) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.autoGenerateInvoiceERClinic(projectID, 4, null, null, null, null, null, null, true).then((res) {
GifLoaderDialogUtils.hideDialog(context);
_showMyDialog(TranslationBase.of(context).ERCheckInSuccess, context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
Future<void> _showMyDialog(String message, BuildContext context) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Alert'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(message),
],
),
),
actions: <Widget>[
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
},
),
],
);
},
);
}
void checkIfPatientHasArrived() {
GifLoaderDialogUtils.showMyDialog(context);
ClinicListService ancillaryOrdersService = new ClinicListService();
@ -382,4 +431,19 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
GifLoaderDialogUtils.hideDialog(context);
});
}
void checkPatientERAdvanceBalance() {
GifLoaderDialogUtils.showMyDialog(context);
ClinicListService ancillaryOrdersService = new ClinicListService();
ancillaryOrdersService.checkPatientERAdvanceBalance(10).then((response) {
print(response["BalanceAmount"]);
isPatientArrived = response['BalanceAmount'] > 0;
GifLoaderDialogUtils.hideDialog(context);
setState(() {});
}).catchError((err) {
AppToast.showErrorToast(message: err.toString());
GifLoaderDialogUtils.hideDialog(context);
});
}
}

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart';
import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
@ -452,7 +453,12 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
GifLoaderDialogUtils.hideDialog(context);
createAdvancePayment(res, appo);
if (widget.isERBookAppointment) {
// createAdvancePayment(res, appo);
ER_createAdvancePayment(res, appo);
} else {
autoGenerateInvoiceER(res);
}
} else {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: res['Response_Message']);
@ -464,7 +470,30 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
});
}
ER_createAdvancePayment(payment_res, AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
String paymentReference = payment_res['Fort_id'].toString();
service.ER_createAdvancePayment(appo, widget.projectID.toString(), payment_res['Amount'], payment_res['Fort_id'], payment_res['PaymentMethod'], context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
addAdvancedNumberRequest(
// Utils.isVidaPlusProject(projectViewModel, widget.projectID)
// ? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
// : res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
res['ER_AdvancePaymentResponse']['AdvanceNumber'].toString(),
paymentReference,
0,
appo,
payment_res);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
createAdvancePayment(paymentRes, AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
String paymentReference = paymentRes['Fort_id'].toString();
service.HIS_createAdvancePayment(appo, widget.projectID.toString(), paymentRes['Amount'], paymentRes['Fort_id'], paymentRes['PaymentMethod'], projectViewModel.user.patientType,
@ -486,10 +515,11 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
}
addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo, paymentRes) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
if(widget.isERBookAppointment) {
GifLoaderDialogUtils.hideDialog(context);
GifLoaderDialogUtils.hideDialog(context);
if (widget.isERBookAppointment) {
AppToast.showSuccessToast(message: "Your appointment has been booked successfully. Please perform Check-In once you arrive at the hospital.");
Navigator.pop(context);
Navigator.pop(context);
@ -505,9 +535,11 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
}
autoGenerateInvoiceER(res) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.autoGenerateInvoiceERClinic(widget.projectID, 4, res['Fort_id'], res['Amount'], res['PaymentMethod'], res['CardNumber'], res['Merchant_Reference'], res['RRN'], true).then((res) {
service.autoGenerateInvoiceERClinic(widget.projectID, 4, res['Fort_id'], res['Amount'], res['PaymentMethod'], res['CardNumber'], res['Merchant_Reference'], res['RRN'], false).then((res) {
GifLoaderDialogUtils.hideDialog(context);
_showMyDialog(TranslationBase.of(context).ERCheckInSuccess, context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
@ -515,6 +547,34 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
});
}
Future<void> _showMyDialog(String message, BuildContext context) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Alert'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(message),
],
),
),
actions: <Widget>[
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
},
),
],
);
},
);
}
getEROnlineCheckInPaymentDetails() {
GifLoaderDialogUtils.showMyDialog(context);
ClinicListService ancillaryOrdersService = new ClinicListService();

@ -1427,12 +1427,12 @@ class DoctorsListService extends BaseService {
Request req = appGlobal.getPublicRequest();
request = {
"VersionID": req.VersionID,
"Channel": req.Channel,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": authUser.outSA,
"PatientTypeID": authUser.patientType,
// "VersionID": req.VersionID,
// "Channel": req.Channel,
// "IPAdress": req.IPAdress,
// "generalid": req.generalid,
// "PatientOutSA": authUser.outSA,
// "PatientTypeID": authUser.patientType,
"LanguageID": 1,
"ERAdvanceAmount": {
"ProjectId": projectID,
@ -1769,7 +1769,8 @@ class DoctorsListService extends BaseService {
request = {
"ProjectID": projectID,
"ClinicID": "10",
"PaymentMethod": paymentMethod,
// "PaymentMethod": paymentMethod,
"PaymentMethod": "VISA",
"PaymentReferenceNo": paymentReferenceNo,
"PaymentAmount": amount,
"CardType": cardType,

@ -198,6 +198,17 @@ class ClinicListService extends BaseService {
return Future.value(localRes);
}
Future<Map> checkPatientERAdvanceBalance(int clinicID) async {
Map<String, dynamic> request = {"ClinicID": clinicID};
dynamic localRes;
await baseAppClient.post(CHECK_PATIENT_ER_ADVANCE_BALANCE, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isAllowAny: true);
return Future.value(localRes);
}
Future<Map> getProjectIDFromNFC(String nfcID) async {
Map<String, dynamic> request = {"nFC_Code": nfcID};
dynamic localRes;

@ -143,7 +143,7 @@ class PayfortService extends BaseService {
String customerName,
String customerEmail,
String orderDescription,
double orderAmount,
num orderAmount,
String merchantIdentifier,
String applePayAccessCode,
String applePayShaRequestPhrase,

@ -45,7 +45,7 @@ class PayfortViewModel extends ChangeNotifier {
String customerEmail,
String orderDescription,
String merchantReference,
double orderAmount,
num orderAmount,
PayfortProjectDetailsRespModel payfortProjectDetailsRespModel,
SucceededCallback onSuccess,
FailedCallback onFailed,

@ -2920,6 +2920,7 @@ class TranslationBase {
String get selectHospitalBloodDonation => localizedValues["selectHospitalBloodDonation"][locale.languageCode];
String get wecare => localizedValues["wecare"][locale.languageCode];
String get myinstructions => localizedValues["myinstructions"][locale.languageCode];
String get ERCheckInSuccess => localizedValues["ERCheckInSuccess"][locale.languageCode];
}

Loading…
Cancel
Save