NPHIES Eligibility check implemented in LiveCare Schedule Appointment booking

merge-update-with-lab-changes
Haroon Amjad 1 year ago
parent b042292f9a
commit 05abea2d53

@ -717,7 +717,7 @@ class _BookConfirmState extends State<BookConfirm> {
okText: "Update insurance",
cancelText: "Continue as cash",
okFunction: () => {openUpdateInsurance()},
cancelFunction: () => {continueAsCash(docObject, appointmentNo)});
cancelFunction: () => {continueAsCash(docObject, appointmentNo, false)});
dialog.showAlertDialog(context);
}
}).catchError((err) {
@ -731,12 +731,16 @@ class _BookConfirmState extends State<BookConfirm> {
Navigator.push(context, FadePage(page: InsuranceUpdate()));
}
void continueAsCash(DoctorList docObject, String appointmentNo) {
void continueAsCash(DoctorList docObject, String appointmentNo, bool isLiveCareAppointment) {
GifLoaderDialogUtils.showMyDialog(context);
widget.service.convertPatientToCash(docObject.projectID!).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
getPatientShare(context, appointmentNo, docObject.clinicID!, docObject.projectID!, docObject);
if(isLiveCareAppointment) {
getLiveCareAppointmentPatientShare(context, appointmentNo, docObject!.clinicID!, docObject.projectID!, docObject);
} else {
getPatientShare(context, appointmentNo, docObject.clinicID!, docObject.projectID!, docObject);
}
getToDoCount();
} else {
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
@ -1046,7 +1050,7 @@ class _BookConfirmState extends State<BookConfirm> {
okText: TranslationBase.of(context).updateInsuranceText,
cancelText: TranslationBase.of(context).continueCash,
okFunction: () => {openUpdateInsurance()},
cancelFunction: () => {continueAsCash(docObject, appointmentNo)});
cancelFunction: () => {continueAsCash(docObject, appointmentNo, false)});
dialog.showAlertDialog(context);
}
}
@ -1061,10 +1065,40 @@ class _BookConfirmState extends State<BookConfirm> {
}
getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {
String errorMsg = "";
widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) {
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
GifLoaderDialogUtils.hideDialog(context);
navigateToBookSuccess(context, docObject, widget.patientShareResponse, false);
isInsured = res["IsInsured"];
isEligible = res["IsEligible"];
isCash = res["IsCash"];
if (isCash) {
navigateToBookSuccess(context, docObject, widget.patientShareResponse, isCash);
} else {
if (isInsured && isEligible) {
navigateToBookSuccess(context, docObject, widget.patientShareResponse, isCash);
} else {
if (isInsured && !isEligible) {
errorMsg = TranslationBase.of(context).invalidEligibility;
} else {
errorMsg = TranslationBase.of(context).invalidInsurance;
}
ConfirmDialog dialog = new ConfirmDialog(
isDissmissable: false,
context: context,
confirmMessage: errorMsg,
okText: TranslationBase.of(context).updateInsuranceText,
cancelText: TranslationBase.of(context).continueCash,
okFunction: () => {openUpdateInsurance()},
cancelFunction: () => {continueAsCash(docObject, appointmentNo, true)});
dialog.showAlertDialog(context);
}
}
// navigateToBookSuccess(context, docObject, widget.patientShareResponse, false);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);

Loading…
Cancel
Save