|
|
|
@ -1,18 +1,26 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/PrescriptionReport.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
@ -20,10 +28,12 @@ class AppointmentActions extends StatefulWidget {
|
|
|
|
|
AppoitmentAllHistoryResultList appo;
|
|
|
|
|
TabController tabController;
|
|
|
|
|
final Function enableFooterButton;
|
|
|
|
|
MyInAppBrowser browser;
|
|
|
|
|
|
|
|
|
|
AppointmentActions({@required this.appo,
|
|
|
|
|
@required this.tabController,
|
|
|
|
|
@required this.enableFooterButton});
|
|
|
|
|
AppointmentActions(
|
|
|
|
|
{@required this.appo,
|
|
|
|
|
@required this.tabController,
|
|
|
|
|
@required this.enableFooterButton});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AppointmentActionsState createState() => _AppointmentActionsState();
|
|
|
|
@ -40,9 +50,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var size = MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size;
|
|
|
|
|
var size = MediaQuery.of(context).size;
|
|
|
|
|
final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2;
|
|
|
|
|
final double itemWidth = size.width / 2;
|
|
|
|
|
|
|
|
|
@ -58,58 +66,57 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
childAspectRatio: (itemWidth / itemHeight),
|
|
|
|
|
children: appoButtonsList
|
|
|
|
|
.map((e) =>
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
_handleButtonClicks(e);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 100.0,
|
|
|
|
|
margin: EdgeInsets.all(9.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.grey[400],
|
|
|
|
|
blurRadius: 2.0,
|
|
|
|
|
spreadRadius: 0.0)
|
|
|
|
|
],
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
|
|
|
|
|
child: Text(e.title,
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: new Color(0xFFc5272d),
|
|
|
|
|
letterSpacing: 1.0,
|
|
|
|
|
fontSize: 20.0)),
|
|
|
|
|
.map((e) => GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
_handleButtonClicks(e);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 100.0,
|
|
|
|
|
margin: EdgeInsets.all(9.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.grey[400],
|
|
|
|
|
blurRadius: 2.0,
|
|
|
|
|
spreadRadius: 0.0)
|
|
|
|
|
],
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
|
|
|
|
|
child: Text(e.title,
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: new Color(0xFFc5272d),
|
|
|
|
|
letterSpacing: 1.0,
|
|
|
|
|
fontSize: 20.0)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
|
|
|
|
|
child: Text(e.subtitle,
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: 1.0,
|
|
|
|
|
fontSize: 15.0)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0),
|
|
|
|
|
child: Image.asset(e.icon,
|
|
|
|
|
width: 45.0, height: 45.0),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
|
|
|
|
|
child: Text(e.subtitle,
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: 1.0,
|
|
|
|
|
fontSize: 15.0)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0),
|
|
|
|
|
child: Image.asset(e.icon,
|
|
|
|
|
width: 45.0, height: 45.0),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
.toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -133,15 +140,9 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
case "onCancelAppointment":
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.cancelAppoMsg,
|
|
|
|
|
okText: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.confirm,
|
|
|
|
|
cancelText: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.cancel_nocaps,
|
|
|
|
|
confirmMessage: TranslationBase.of(context).cancelAppoMsg,
|
|
|
|
|
okText: TranslationBase.of(context).confirm,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
okFunction: () => {cancelAppointment()},
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
@ -171,6 +172,18 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
case "radiology":
|
|
|
|
|
openAppointmentRadiology();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "prescriptions":
|
|
|
|
|
openPrescriptionReport();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "Survey":
|
|
|
|
|
rateAppointment();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "Insurance":
|
|
|
|
|
navigateToInsuranceApprovals(widget.appo.appointmentNo);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -345,18 +358,61 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
openAppointmentRadiology() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
FinalRadiology finalRadiology = new FinalRadiology();
|
|
|
|
|
service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context)
|
|
|
|
|
service
|
|
|
|
|
.getPatientRadOrders(widget.appo.appointmentNo.toString(), context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
print(res['FinalRadiologyList']);
|
|
|
|
|
print(res['FinalRadiologyList']);
|
|
|
|
|
finalRadiology =
|
|
|
|
|
new FinalRadiology.fromJson(res['FinalRadiologyList'][0]);
|
|
|
|
|
print(finalRadiology.reportData);
|
|
|
|
|
navigateToRadiologyDetails(finalRadiology);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPrescriptionReport() {
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.getPatientPrescriptionReports(widget.appo, context).then((res) {
|
|
|
|
|
res['ListPRM'].forEach((report) {
|
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report));
|
|
|
|
|
});
|
|
|
|
|
print(prescriptionReportEnhList.length);
|
|
|
|
|
if (prescriptionReportEnhList.length != 0) {
|
|
|
|
|
navigateToMedicinePrescriptionReport(
|
|
|
|
|
prescriptionReportEnhList, res['ListPRM']);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
AppToast.showErrorToast(message: "Sorry there is no data");
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToMedicinePrescriptionReport(
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList,
|
|
|
|
|
dynamic listPres) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => PrescriptionReportPage(
|
|
|
|
|
prescriptionReportEnhList: prescriptionReportEnhList,
|
|
|
|
|
listPres: listPres,
|
|
|
|
|
appo: widget.appo)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
RadiologyDetailsPage(finalRadiology: finalRadiology)))
|
|
|
|
|
.then((value) {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<void> openMap(double latitude, double longitude) async {
|
|
|
|
|
String googleUrl =
|
|
|
|
|
'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude';
|
|
|
|
@ -389,19 +445,80 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
|
|
|
|
|
askYourDoc() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.isAllowedToAskDoctor(widget.appo.doctorID, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) {
|
|
|
|
|
print(res['PatientDoctorAppointmentResultList']);
|
|
|
|
|
if (res['PatientDoctorAppointmentResultList'].length != 0) {
|
|
|
|
|
getCallRequestType();
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: TranslationBase.of(context).askDocNotAllowed);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCallRequestType() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.getCallRequestType(context).then((res) {
|
|
|
|
|
List<AskDocRequestType> requestData = new List<AskDocRequestType>();
|
|
|
|
|
res['ListReqTypes'].forEach((element) {
|
|
|
|
|
requestData.add(new AskDocRequestType.fromJson(element));
|
|
|
|
|
});
|
|
|
|
|
// print(requestData.length);
|
|
|
|
|
Utils.hideProgressDialog();
|
|
|
|
|
Future.delayed(const Duration(milliseconds: 400), () {
|
|
|
|
|
showAskDocRequestDialog(requestData);
|
|
|
|
|
});
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
Utils.hideProgressDialog();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showAskDocRequestDialog(List<AskDocRequestType> requestData) {
|
|
|
|
|
Utils.hideProgressDialog();
|
|
|
|
|
showGeneralDialog(
|
|
|
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
|
|
|
transitionBuilder: (context, a1, a2, widget) {
|
|
|
|
|
final curvedValue =
|
|
|
|
|
Curves.easeInOutBack.transform(a1.value) - 1.0;
|
|
|
|
|
return Transform(
|
|
|
|
|
transform:
|
|
|
|
|
Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
|
|
|
|
|
child: Opacity(
|
|
|
|
|
opacity: a1.value,
|
|
|
|
|
child: AskDocDialog(requestData: requestData),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
transitionDuration: Duration(milliseconds: 500),
|
|
|
|
|
barrierDismissible: true,
|
|
|
|
|
barrierLabel: '',
|
|
|
|
|
context: context,
|
|
|
|
|
pageBuilder: (context, animation1, animation2) {})
|
|
|
|
|
.then((value) {
|
|
|
|
|
print("Dialog Closed");
|
|
|
|
|
print(value);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
sendAskDocRequest(value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendAskDocRequest(int requestType) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.sendAskDocCallRequest(widget.appo, requestType.toString(), context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.askDocNotAllowed);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -409,7 +526,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID,
|
|
|
|
|
widget.appo.projectID, context)
|
|
|
|
|
widget.appo.projectID, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
@ -422,9 +539,17 @@ class _AppointmentActionsState extends State<AppointmentActions> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loading(bool flag) {
|
|
|
|
|
setState(() {
|
|
|
|
|
AppointmentDetails.isLoading = flag;
|
|
|
|
|
});
|
|
|
|
|
navigateToInsuranceApprovals(int appoNo) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context, FadePage(page: InsuranceApproval(appointmentNo: appoNo)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rateAppointment() {
|
|
|
|
|
widget.browser = new MyInAppBrowser();
|
|
|
|
|
widget.browser.openBrowser('http://hmg.com/SitePages/pso.aspx?p=' +
|
|
|
|
|
widget.appo.projectID.toString() +
|
|
|
|
|
'.' +
|
|
|
|
|
widget.appo.appointmentNo.toString() +
|
|
|
|
|
'&c=1');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|