From 74294bfaf54e14add86e3fdcad91ea4312bc7026 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Jun 2021 13:23:09 +0300 Subject: [PATCH] finish fix referral --- .../referral/MyReferralPatientModel.dart | 23 ++-- .../patient-doctor-referral-service.dart | 2 +- .../referral/my-referral-detail-screen.dart | 105 +++++++++--------- .../my-referral-inpatient-screen.dart | 11 +- 4 files changed, 71 insertions(+), 70 deletions(-) diff --git a/lib/core/model/referral/MyReferralPatientModel.dart b/lib/core/model/referral/MyReferralPatientModel.dart index 09b3769e..4f00f455 100644 --- a/lib/core/model/referral/MyReferralPatientModel.dart +++ b/lib/core/model/referral/MyReferralPatientModel.dart @@ -57,20 +57,6 @@ class MyReferralPatientModel { bool isDoctorLate; bool isDoctorResponse; String nationalityFlagURL; - - - - - - - - - - - - - - String nursingStationName; String priorityDescription; String referringClinicDescription; @@ -84,6 +70,7 @@ class MyReferralPatientModel { int targetDoctorID; int sourceAppointmentNo; int targetAppointmentNo; + String remarksFromSource; MyReferralPatientModel( {this.rowID, @@ -146,7 +133,7 @@ class MyReferralPatientModel { this.priorityDescription, this.referringClinicDescription, this.referringDoctorName, - this.referalStatus, this.sourceSetupID, this.sourceAppointmentNo, this.sourceProjectId, this.targetProjectId, this.targetAppointmentNo, this.targetClinicID, this.targetSetupID, this.targetDoctorID}); + this.referalStatus, this.sourceSetupID, this.sourceAppointmentNo, this.sourceProjectId, this.targetProjectId, this.targetAppointmentNo, this.targetClinicID, this.targetSetupID, this.targetDoctorID, this.remarksFromSource}); MyReferralPatientModel.fromJson(Map json) { rowID = json['RowID']; @@ -230,7 +217,10 @@ class MyReferralPatientModel { targetClinicID = json['TargetClinicID']; targetDoctorID = json['TargetDoctorID']; sourceAppointmentNo = json['SourceAppointmentNo']; - targetAppointmentNo = json['TargetAppointmentNo']; } + targetAppointmentNo = json['TargetAppointmentNo']; + remarksFromSource = json['RemarksFromSource']; + + } Map toJson() { final Map data = new Map(); @@ -303,6 +293,7 @@ class MyReferralPatientModel { data['TargetDoctorID'] = this.targetDoctorID; data['SourceAppointmentNo'] = this.sourceAppointmentNo; data['TargetAppointmentNo'] = this.targetAppointmentNo; + data['RemarksFromSource'] = this.remarksFromSource; return data; } diff --git a/lib/core/service/patient/patient-doctor-referral-service.dart b/lib/core/service/patient/patient-doctor-referral-service.dart index cded130e..5b659631 100644 --- a/lib/core/service/patient/patient-doctor-referral-service.dart +++ b/lib/core/service/patient/patient-doctor-referral-service.dart @@ -254,7 +254,7 @@ class PatientReferralService extends LookupService { body['ProjectID'] = referralPatient.targetProjectId; body['IsAccepted'] = isAccepted; body['PatientName'] = referralPatient.patientName; - body['ReferralResponse'] = referralPatient.referringDoctorRemarks; + body['ReferralResponse'] = referralPatient.remarksFromSource; body['DoctorName'] = doctorProfile.doctorName; await baseAppClient.post( diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index b20b29bb..e5cc40da 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -361,60 +361,63 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).accept, - color: Color(0xFF4BA821), - fontColor: Colors.white, - fontSize: 1.6, - hPadding: 8, - vPadding: 12, - onPressed: () async { - await model.responseReferral(referralPatient, true); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgAccept); - Navigator.pop(context); - Navigator.pop(context); - } - }, + if (referralPatient.referralStatus != 46) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).accept, + color: Color(0xFF4BA821), + fontColor: Colors.white, + fontSize: 1.6, + hPadding: 8, + vPadding: 12, + disabled: model.state == ViewState.Busy, + onPressed: () async { + await model.responseReferral(referralPatient, true); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); + Navigator.pop(context); + Navigator.pop(context); + } + }, + ), ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).reject, - color: Color(0xFFB9382C), - fontColor: Colors.white, - fontSize: 1.6, - hPadding: 8, - vPadding: 12, - onPressed: () async { - await model.responseReferral(referralPatient, false); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgReject); - Navigator.pop(context); - Navigator.pop(context); - } - }, + SizedBox( + width: 8, ), - ), - ], + Expanded( + child: AppButton( + title: TranslationBase.of(context).reject, + color: Color(0xFFB9382C), + fontColor: Colors.white, + fontSize: 1.6, + hPadding: 8, + vPadding: 12, + disabled: model.state == ViewState.Busy, + onPressed: () async { + await model.responseReferral(referralPatient, false); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); + Navigator.pop(context); + Navigator.pop(context); + } + }, + ), + ), + ], + ), ), - ), ], )), ); diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index 48299bf2..cb6c1e5f 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -16,7 +16,12 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'my-referral-patient-screen.dart'; -class MyReferralInPatientScreen extends StatelessWidget { +class MyReferralInPatientScreen extends StatefulWidget { + @override + _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); +} + +class _MyReferralInPatientScreenState extends State { PatientType patientType = PatientType.IN_PATIENT; @override @@ -33,7 +38,9 @@ class MyReferralInPatientScreen extends StatelessWidget { margin: EdgeInsets.only(top: 70), child: PatientTypeRadioWidget( (patientType) async { - this.patientType = patientType; + setState(() { + this.patientType = patientType; + }); GifLoaderDialogUtils.showMyDialog(context); if (patientType == PatientType.IN_PATIENT) { await model.getMyReferralPatientService(localBusy: true);