|
|
|
@ -23,9 +23,23 @@ import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
import '../../models/InPatientServices/get_inpatient_advance_requests_response_model.dart';
|
|
|
|
|
import '../../models/InPatientServices/get_medical_instructions_response_model.dart';
|
|
|
|
|
|
|
|
|
|
class InPatientServicesHome extends StatelessWidget {
|
|
|
|
|
class InPatientServicesHome extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
State<InPatientServicesHome> createState() => _InPatientServicesHomeState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _InPatientServicesHomeState extends State<InPatientServicesHome> {
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
InPatientAdvanceResponseModel inPatientAdvanceResponseModel;
|
|
|
|
|
bool isReceivePrescriptionEnabled = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
checkDischargeMedications(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -170,16 +184,16 @@ class InPatientServicesHome extends StatelessWidget {
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// Navigator.push(context, FadePage(page: AdvancePaymentPage()));
|
|
|
|
|
receivePrescriptionAPI(context);
|
|
|
|
|
if (isReceivePrescriptionEnabled) receivePrescriptionAPI(context);
|
|
|
|
|
},
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: "Receive",
|
|
|
|
|
imagePath: 'receive_prescription.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).prescriptions,
|
|
|
|
|
width: 50.0,
|
|
|
|
|
height: 40.0,
|
|
|
|
|
isInPatient: true,
|
|
|
|
|
),
|
|
|
|
|
title: "Receive",
|
|
|
|
|
imagePath: 'receive_prescription.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).prescriptions,
|
|
|
|
|
width: 50.0,
|
|
|
|
|
height: 40.0,
|
|
|
|
|
isInPatient: true,
|
|
|
|
|
isEnable: isReceivePrescriptionEnabled),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
@ -203,16 +217,42 @@ class InPatientServicesHome extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void receivePrescriptionAPI(BuildContext context) {
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
AlertDialogBox(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: TranslationBase.of(context).successSendReport,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
okFunction: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
AlertDialogBox.closeAlertDialog(context);
|
|
|
|
|
callReceivePrescriptionAPI(context);
|
|
|
|
|
}).showAlertDialog(context);
|
|
|
|
|
|
|
|
|
|
// ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// confirmMessage: TranslationBase.of(context).successSendReport,
|
|
|
|
|
// okText: TranslationBase.of(context).ok,
|
|
|
|
|
// cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
// okFunction: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// cancelFunction: () => {});
|
|
|
|
|
// dialog.showAlertDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void checkDischargeMedications(BuildContext context) {
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.getDischargeMedicationOrder(projectViewModel.getAdmissionInfoResponseModel).then((res) {
|
|
|
|
|
print(res["PatientHasDischargeMedicineList"].length);
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res["PatientHasDischargeMedicineList"].length != 0) {
|
|
|
|
|
isReceivePrescriptionEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void callReceivePrescriptionAPI(BuildContext context) {
|
|
|
|
|