Nphies integration

Dev_3.3_MedicalReportCR
haroon amjad 1 year ago
parent 2455f48fe1
commit 7c68779324

@ -604,6 +604,9 @@ var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality';
var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi';
var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi';
var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity';
var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany';
class AppGlobal { class AppGlobal {
static var context; static var context;

@ -7,6 +7,9 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/UpdateInsuranceManually.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
@ -271,7 +274,51 @@ class _BookConfirmState extends State<BookConfirm> {
}); });
} }
insertAppointment(context, DoctorList docObject, int initialSlotDuration) async{ checkPatientNphiesEligibility(DoctorList docObject, String appointmentNo, BuildContext context) {
widget.service.checkPatientNphiesEligibility(docObject.projectID).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["isNphiesMatchedWithVida"]) {
getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject);
getToDoCount();
} else {
ConfirmDialog dialog = new ConfirmDialog(
isDissmissable: false,
context: context,
confirmMessage: res['ErrorEndUserMessage'],
okText: "Update insurance",
cancelText: "Continue as cash",
okFunction: () => {openUpdateInsurance()},
cancelFunction: () => {continueAsCash(docObject, appointmentNo)});
dialog.showAlertDialog(context);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
void openUpdateInsurance() {
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
Navigator.push(context, FadePage(page: InsuranceUpdate()));
}
void continueAsCash(DoctorList docObject, String appointmentNo) {
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);
getToDoCount();
} else {
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
insertAppointment(context, DoctorList docObject, int initialSlotDuration) async {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
String logs = await sharedPref.getString('selectedLogSlots'); String logs = await sharedPref.getString('selectedLogSlots');
List<dynamic> decodedLogs = json.decode(logs); List<dynamic> decodedLogs = json.decode(logs);
@ -284,14 +331,13 @@ class _BookConfirmState extends State<BookConfirm> {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
Future.delayed(new Duration(milliseconds: 500), () { Future.delayed(new Duration(milliseconds: 500), () {
getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context);
getToDoCount();
}); });
widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs,res['AppointmentNo'], context).then((res) { widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs, res['AppointmentNo'], context).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
print("Logs Saved"); print("Logs Saved");
}else{ } else {
print("Error Saving logs"); print("Error Saving logs");
} }
}); });

@ -17,6 +17,8 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -28,6 +30,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
@ -540,7 +543,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
confirmAppointment(appo); confirmAppointment(appo);
break; break;
case 20: case 20:
getPatientShare(context, appo); // getPatientShare(context, appo);
checkPatientNphiesEligibility(context, appo);
break; break;
case 30: case 30:
getAppoQR(context, appo); getAppoQR(context, appo);
@ -837,6 +841,53 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
// getAncillaryOrders(); // getAncillaryOrders();
} }
checkPatientNphiesEligibility(context, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.checkPatientNphiesEligibility(appo.projectID).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["isNphiesMatchedWithVida"]) {
getPatientShare(context, appo);
// getToDoCount();
} else {
ConfirmDialog dialog = new ConfirmDialog(
isDissmissable: false,
context: context,
confirmMessage: res['ErrorEndUserMessage'],
okText: "Update insurance",
cancelText: "Continue as cash",
okFunction: () => {openUpdateInsurance()},
cancelFunction: () => {continueAsCash(appo)});
dialog.showAlertDialog(context);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
void openUpdateInsurance() {
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
Navigator.push(context, FadePage(page: InsuranceUpdate()));
}
void continueAsCash(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.convertPatientToCash(appo.projectID).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
getPatientShare(context, appo);
// getToDoCount();
} else {
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
getPatientShare(context, AppoitmentAllHistoryResultList appo) { getPatientShare(context, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
if (appo.isLiveCareAppointment) { if (appo.isLiveCareAppointment) {
@ -1119,7 +1170,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
error_type: res['Response_Message']); error_type: res['Response_Message']);
} }
}).catchError((err) { }).catchError((err) {
if(mounted) GifLoaderDialogUtils.hideDialog(context); if (mounted) GifLoaderDialogUtils.hideDialog(context);
print(err); print(err);
}); });
} }

@ -193,6 +193,7 @@ class _UpdateInsuranceManuallyState extends State<UpdateInsuranceManually> {
listData: list, listData: list,
selectedIndex: _selectedInsuranceCompanyIndex, selectedIndex: _selectedInsuranceCompanyIndex,
isScrollable: true, isScrollable: true,
isShowSearch: true,
onValueSelected: (index) { onValueSelected: (index) {
_selectedInsuranceCompanyIndex = index; _selectedInsuranceCompanyIndex = index;
selectedInsuranceCompanyObj = insuranceCompaniesList[index]; selectedInsuranceCompanyObj = insuranceCompaniesList[index];

@ -1757,6 +1757,32 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> checkPatientNphiesEligibility(int projectID) async {
Map<String, dynamic> request;
request = {"ProjectID": projectID};
dynamic localRes;
await baseAppClient.post(CHECK_PATIENT_NPHIES_ELIGIBILITY, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> convertPatientToCash(int projectID) async {
Map<String, dynamic> request;
request = {"ProjectID": projectID};
dynamic localRes;
await baseAppClient.post(CONVERT_PATIENT_TO_CASH, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { Future<Map> getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async {
Map<String, dynamic> request; Map<String, dynamic> request;
request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue};

@ -14,8 +14,9 @@ class ConfirmDialog {
final cancelText; final cancelText;
final Function okFunction; final Function okFunction;
final Function cancelFunction; final Function cancelFunction;
final isDissmissable;
ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @required this.okFunction, @required this.cancelFunction}); ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @required this.okFunction, @required this.cancelFunction, this.isDissmissable = true});
showAlertDialog(BuildContext context) { showAlertDialog(BuildContext context) {
Dialog alert = Dialog( Dialog alert = Dialog(
@ -35,6 +36,7 @@ class ConfirmDialog {
// show the dialog // show the dialog
showDialog( showDialog(
barrierDismissible: isDissmissable,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return alert; return alert;
@ -99,7 +101,7 @@ class Mdialog extends StatelessWidget {
child: Container( child: Container(
decoration: containerRadius(CustomColors.lightGreyColor, 12), decoration: containerRadius(CustomColors.lightGreyColor, 12),
padding: EdgeInsets.only(top: 8,bottom: 8), padding: EdgeInsets.only(top: 8,bottom: 8),
child: Center(child: Texts(cancelText)), child: Center(child: Texts(cancelText, variant: "caption3")),
), ),
), ),
), ),
@ -114,6 +116,7 @@ class Mdialog extends StatelessWidget {
child: Texts( child: Texts(
okText, okText,
color: Colors.white, color: Colors.white,
variant: "caption3",
), ),
), ),
), ),

@ -14,8 +14,9 @@ class RadioSelectionDialog extends StatefulWidget {
final List<RadioSelectionDialogModel> listData; final List<RadioSelectionDialogModel> listData;
final int selectedIndex; final int selectedIndex;
final bool isScrollable; final bool isScrollable;
final bool isShowSearch;
const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false}) : super(key: key); const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false}) : super(key: key);
@override @override
State createState() => new RadioSelectionDialogState(); State createState() => new RadioSelectionDialogState();
@ -24,10 +25,22 @@ class RadioSelectionDialog extends StatefulWidget {
class RadioSelectionDialogState extends State<RadioSelectionDialog> { class RadioSelectionDialogState extends State<RadioSelectionDialog> {
int selectedIndex; int selectedIndex;
List<RadioSelectionDialogModel> tempListData = [];
TextEditingController controller = new TextEditingController();
@override @override
void initState() { void initState() {
selectedIndex = widget.selectedIndex ?? 0; selectedIndex = widget.selectedIndex ?? 0;
super.initState(); super.initState();
addAllData();
}
addAllData() {
tempListData.clear();
for (int i = 0; i < widget.listData.length; i++) {
tempListData.add(widget.listData[i]);
}
setState(() {});
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -69,6 +82,32 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
TranslationBase.of(context).pleaseSelectFromBelowOptions, TranslationBase.of(context).pleaseSelectFromBelowOptions,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
), ),
widget.isShowSearch ? Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: controller,
onChanged: (v) {
if (v.length > 0) {
tempListData.clear();
for (int i = 0; i < widget.listData.length; i++) {
if (widget.listData[i].title.toLowerCase().contains(v.toLowerCase())) {
tempListData.add(widget.listData[i]);
}
}
} else {
addAllData();
}
setState(() {});
},
decoration: InputDecoration(
hintStyle: TextStyle(fontSize: 17),
hintText: 'Search Insurance',
suffixIcon: Icon(Icons.search),
border: InputBorder.none,
contentPadding: EdgeInsets.all(12),
),
),
) : Container(),
SizedBox(height: widget.isScrollable ? 12 : 0), SizedBox(height: widget.isScrollable ? 12 : 0),
SizedBox( SizedBox(
height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null,
@ -80,7 +119,7 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
return InkWell( return InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
selectedIndex = widget.listData[index].value; selectedIndex = tempListData[index].value;
}); });
}, },
child: Row( child: Row(
@ -90,7 +129,7 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
width: 22, width: 22,
height: 22, height: 22,
child: Radio( child: Radio(
value: widget.listData[index].value, value: tempListData[index].value,
groupValue: selectedIndex, groupValue: selectedIndex,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@ -102,7 +141,7 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
widget.listData[index].title, tempListData[index].title,
// maxLines: 2, // maxLines: 2,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56),
), ),

Loading…
Cancel
Save