diff --git a/lib/config/config.dart b/lib/config/config.dart index f9ef6bf8..b71679f5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -625,6 +625,8 @@ var GET_INPATIENT_ADVANCE_PAYMENT_LINK = 'Services/PayFort_Serv.svc/REST/InsertI var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder'; +var INPATIENT_DISCHARGE_MEDICATIONS = 'Services/INPs.svc/REST/chekPatientHasDischargeMedicine'; + var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn'; var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification'; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 42eef043..a8efa613 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -147,12 +147,12 @@ class BaseAppClient { } } - // body['IdentificationNo'] = 1023854217; - // body['MobileNo'] = "531940021"; - // body['PatientID'] = 3681708; //3844083 + // body['IdentificationNo'] = 1000340586; + // body['PatientID'] = 395978; //3844083 // body['TokenID'] = "@dm!n"; + // body['MobileNo'] = "531940021"; - // body['PatientID'] = 4767347; //3844083 + // body['PatientID'] = 869588; //3844083 // body['AdmissionNo'] = 2023000040; //3844083 // body['TokenID'] = "@dm!n"; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 9f8bfb45..ae3d2dfe 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -137,7 +137,7 @@ class ReportsService extends BaseService { body['ProjectID'] = projectID; body['Remarks'] = ""; body['ProcedureId'] = ""; - body['RequestType'] = 2; + body['RequestType'] = 1; body['Source'] = 2; body['Status'] = 1; body['CreatedBy'] = 102; diff --git a/lib/pages/InPatientServices/inpatient_home.dart b/lib/pages/InPatientServices/inpatient_home.dart index b19557c3..2e0f4302 100644 --- a/lib/pages/InPatientServices/inpatient_home.dart +++ b/lib/pages/InPatientServices/inpatient_home.dart @@ -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 createState() => _InPatientServicesHomeState(); +} + +class _InPatientServicesHomeState extends State { 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) { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 191e681b..2a78704c 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -270,8 +270,8 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future insertInPatientOrder(GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments, - context) async { + Future insertInPatientOrder( + GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments, context) async { Map request; request = { "ProjectID": getAdmissionInfoResponseModel.projectID, @@ -444,4 +444,42 @@ class ClinicListService extends BaseService { }, body: request, isAllowAny: true); return Future.value(localRes); } + + Future getDischargeMedicationOrder(GetAdmissionInfoResponseModel getAdmissionInfoResponseModel) async { + Map request; + request = { + "ProjectID": getAdmissionInfoResponseModel.projectID, + "ClinicID": getAdmissionInfoResponseModel.clinicID, + "DoctorID": getAdmissionInfoResponseModel.doctorID, + "AdmissionNo": getAdmissionInfoResponseModel.admissionNo + }; + + // request = { + // "ProjectID": 12, + // "VersionID": 10.8, + // "Channel": 3, + // "LanguageID": 2, + // "IPAdress": "10.20.10.20", + // "generalid": "Cs2020@2016\$2958", + // "DeviceTypeID": 2, + // "PatientType": 1, + // "PatientTypeID": 1, + // "TokenID": "@dm!n", + // "PatientID": 869588, + // "PatientOutSA": 0, + // "SessionID": "rVuK3nzN4UKN0SW95un0jQ==", + // "ClinicID": 2, + // "DoctorID": "7600", + // "AdmissionNo": 2011001258 + // }; + + dynamic localRes; + + await baseAppClient.post(INPATIENT_DISCHARGE_MEDICATIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index ece5613d..528bd740 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -736,6 +736,7 @@ class Utils { SizedBox(height: 6), Text( text, + maxLines: 1, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), SizedBox(height: 5), @@ -810,10 +811,7 @@ class Utils { return crypto.md5.convert(utf8.encode(input)).toString(); } - static String generateSignature() { - - } - + static String generateSignature() {} } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) {