From c44b3d74bb1741f35c0921aa57c2988a74185bfc Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 10 Jun 2021 17:05:03 +0300 Subject: [PATCH] reply changes --- lib/config/config.dart | 4 +- .../referral/MyReferralPatientModel.dart | 132 ++++++++-------- .../referral/AddReplayOnReferralPatient.dart | 148 +++++++++++++----- .../my-referral-inpatient-screen.dart | 82 +++++----- .../referral_patient_detail_in-paint.dart | 48 +++--- .../patient-referral-item-widget.dart | 4 +- 6 files changed, 245 insertions(+), 173 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4bbbd40e..eb946dea 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/model/referral/MyReferralPatientModel.dart b/lib/core/model/referral/MyReferralPatientModel.dart index ac069e8d..1072e098 100644 --- a/lib/core/model/referral/MyReferralPatientModel.dart +++ b/lib/core/model/referral/MyReferralPatientModel.dart @@ -64,65 +64,65 @@ class MyReferralPatientModel { MyReferralPatientModel( {this.rowID, - this.projectID, - this.lineItemNo, - this.doctorID, - this.patientID, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.roomID, - this.bedID, - this.nursingStationID, - this.description, - this.nationalityName, - this.nationalityNameN, - this.clinicDescription, - this.clinicDescriptionN, - this.referralDoctor, - this.referringDoctor, - this.referralClinic, - this.referringClinic, - this.referralStatus, - this.referralDate, - this.referringDoctorRemarks, - this.referredDoctorRemarks, - this.referralResponseOn, - this.priority, - this.frequency, - this.mAXResponseTime, - this.episodeID, - this.appointmentNo, - this.appointmentDate, - this.appointmentType, - this.patientMRN, - this.createdOn, - this.clinicID, - this.nationalityID, - this.age, - this.doctorImageURL, - this.frequencyDescription, - this.genderDescription, - this.isDoctorLate, - this.isDoctorResponse, - this.nationalityFlagURL, - this.nursingStationName, - this.priorityDescription, - this.referringClinicDescription, - this.referringDoctorName}); + this.projectID, + this.lineItemNo, + this.doctorID, + this.patientID, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomID, + this.bedID, + this.nursingStationID, + this.description, + this.nationalityName, + this.nationalityNameN, + this.clinicDescription, + this.clinicDescriptionN, + this.referralDoctor, + this.referringDoctor, + this.referralClinic, + this.referringClinic, + this.referralStatus, + this.referralDate, + this.referringDoctorRemarks, + this.referredDoctorRemarks, + this.referralResponseOn, + this.priority, + this.frequency, + this.mAXResponseTime, + this.episodeID, + this.appointmentNo, + this.appointmentDate, + this.appointmentType, + this.patientMRN, + this.createdOn, + this.clinicID, + this.nationalityID, + this.age, + this.doctorImageURL, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nationalityFlagURL, + this.nursingStationName, + this.priorityDescription, + this.referringClinicDescription, + this.referringDoctorName}); MyReferralPatientModel.fromJson(Map json) { rowID = json['RowID']; @@ -158,13 +158,19 @@ class MyReferralPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json["ReferralStatus"] is String ?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0: json["ReferralStatus"]; + referralStatus = json["ReferralStatus"] is String + ? json['ReferralStatus'] == "Accepted" + ? 46 + : json['ReferralStatus'] == "Pending" + ? 1 + : 0 + : json["ReferralStatus"]; try { referralDate = AppDateUtils.getDateTimeFromString(json['ReferralDate']); - } catch (e){ + } catch (e) { referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']); } finally { - referralDate = DateTime.now(); + referralDate = DateTime.now(); } referringDoctorRemarks = json['ReferringDoctorRemarks']; @@ -260,6 +266,6 @@ class MyReferralPatientModel { } get patientName { - return this.firstName+" "+this.lastName; + return this.firstName + " " + this.lastName; } } diff --git a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart index aadcd5f0..c246a3ad 100644 --- a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -116,14 +116,14 @@ class _AddReplayOnReferralPatientState ), ), Container( - height: replayOnReferralController.text.isNotEmpty ? 130 : 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + // height: replayOnReferralController.text.isNotEmpty ? 130 : 70, + // margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Column( children: [ replayOnReferralController.text.isEmpty ? SizedBox() : Container( - margin: EdgeInsets.all(5), + margin: EdgeInsets.all(16), child: AppButton( title: TranslationBase.of(context).clearText, onPressed: () { @@ -134,47 +134,111 @@ class _AddReplayOnReferralPatientState ), ), Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: 'Submit Reply', - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () async { - setState(() { - isSubmitted = true; - }); - if (replayOnReferralController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.patientReferralViewModel.replay( - replayOnReferralController.text.trim(), - widget.myReferralInPatientModel); - if (widget.patientReferralViewModel.state == - ViewState.ErrorLocal) { - Helpers.showErrorToast( - widget.patientReferralViewModel.error); - } else { - GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - "Your Reply Added Successfully"); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - - Navigator.push( - context, - FadePage( - page: ReplySummeryOnReferralPatient( - widget.myReferralInPatientModel, - replayOnReferralController.text.trim()), - ), - ); - } - } else { - Helpers.showErrorToast("You can't add empty reply"); + margin: EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Row( + children: [ + Expanded( + child: AppButton( + onPressed: () { + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).reject, + fontColor: Colors.white, + color: Colors.red[600], + ), + ), + SizedBox( + width: 4, + ), + Expanded( + child: AppButton( + onPressed: () async { setState(() { - isSubmitted = false; + isSubmitted = true; }); - } - })), + if (replayOnReferralController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.patientReferralViewModel.replay( + replayOnReferralController.text.trim(), + widget.myReferralInPatientModel); + if (widget.patientReferralViewModel.state == + ViewState.ErrorLocal) { + Helpers.showErrorToast( + widget.patientReferralViewModel.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast( + "Your Reply Added Successfully"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + + Navigator.push( + context, + FadePage( + page: ReplySummeryOnReferralPatient( + widget.myReferralInPatientModel, + replayOnReferralController.text.trim()), + ), + ); + } + } else { + Helpers.showErrorToast( + "You can't add empty reply"); + setState(() { + isSubmitted = false; + }); + } + }, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + ), + ], + ), + ), + // Container( + // margin: EdgeInsets.all(5), + // child: AppButton( + // title: 'Submit Reply', + // color: Color(0xff359846), + // fontWeight: FontWeight.w700, + // onPressed: () async { + // setState(() { + // isSubmitted = true; + // }); + // if (replayOnReferralController.text.isNotEmpty) { + // GifLoaderDialogUtils.showMyDialog(context); + // await widget.patientReferralViewModel.replay( + // replayOnReferralController.text.trim(), + // widget.myReferralInPatientModel); + // if (widget.patientReferralViewModel.state == + // ViewState.ErrorLocal) { + // Helpers.showErrorToast( + // widget.patientReferralViewModel.error); + // } else { + // GifLoaderDialogUtils.hideDialog(context); + // DrAppToastMsg.showSuccesToast( + // "Your Reply Added Successfully"); + // Navigator.of(context).pop(); + // Navigator.of(context).pop(); + // + // Navigator.push( + // context, + // FadePage( + // page: ReplySummeryOnReferralPatient( + // widget.myReferralInPatientModel, + // replayOnReferralController.text.trim()), + // ), + // ); + // } + // } else { + // Helpers.showErrorToast("You can't add empty reply"); + // setState(() { + // isSubmitted = false; + // }); + // } + // })), ], ), ), 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 636a596f..f4a002d6 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -27,7 +27,6 @@ class MyReferralInPatientScreen extends StatelessWidget { appBarTitle: TranslationBase.of(context).referPatient, body: Column( children: [ - Container( margin: EdgeInsets.only(top: 70), child: PatientTypeRadioWidget( @@ -62,50 +61,51 @@ class MyReferralInPatientScreen extends StatelessWidget { ], ), ) - : SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index],model), - ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic:"${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), + : Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + model.myReferralPatients.length, + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen(model.myReferralPatients[index],model), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context), + referralStatusCode: model.myReferralPatients[index].referralStatus, + patientName: model.myReferralPatients[index].patientName, + patientGender: model.myReferralPatients[index].gender, + referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate), + referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), + patientID: "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic:"${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index].referringDoctorRemarks, + nationality: model.myReferralPatients[index].nationalityName, + nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, + doctorAvatar: model.myReferralPatients[index].doctorImageURL, + referralDoctorName: model.myReferralPatients[index].referringDoctorName, + clinicDescription: model.myReferralPatients[index].referringClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), ), ), - ), - ], + ], + ), ), ), - ), + ), ], ), ), diff --git a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart index e2175bae..7f0cd146 100644 --- a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart @@ -154,7 +154,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { fontWeight: FontWeight.w700, color: referredPatient.referralStatus == 1 ? Color(0xffc4aa54) - : referredPatient.referralStatus == 46 + : referredPatient.referralStatus == 46 || referredPatient.referralStatus == 2 ? Colors.green[700] : Colors.red[700], ), @@ -548,30 +548,32 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: AppButton( - title: referredPatient.referredDoctorRemarks.isEmpty ? TranslationBase.of(context).replay : TranslationBase.of(context).edit, - color: Colors.red[700], - fontColor: Colors.white, - fontWeight: FontWeight.w700, - fontSize: 1.8, - hPadding: 8, - vPadding: 12, - onPressed: () async { - Navigator.push( - context, - SlideUpPageRoute( - widget: AddReplayOnReferralPatient( - patientReferralViewModel: patientReferralViewModel, - myReferralInPatientModel: referredPatient, - isEdited: referredPatient.referredDoctorRemarks.isNotEmpty, + if (referredPatient.referralStatus == 1) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: AppButton( + title: TranslationBase.of(context).replay, + color: Colors.red[700], + fontColor: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 1.8, + hPadding: 8, + vPadding: 12, + onPressed: () async { + Navigator.push( + context, + SlideUpPageRoute( + widget: AddReplayOnReferralPatient( + patientReferralViewModel: patientReferralViewModel, + myReferralInPatientModel: referredPatient, + isEdited: referredPatient + .referredDoctorRemarks.isNotEmpty, + ), ), - ), - ); - }, + ); + }, + ), ), - ), ], ), ), diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 02b2d241..a898e39c 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -58,7 +58,7 @@ class PatientReferralItemWidget extends StatelessWidget { child: CardWithBgWidget( bgColor: referralStatusCode == 1 ? Color(0xffc4aa54) - : referralStatusCode == 46 + : referralStatusCode == 46 || referralStatusCode == 2 ? Colors.green[700] : Colors.red[700], hasBorder: false, @@ -78,7 +78,7 @@ class PatientReferralItemWidget extends StatelessWidget { fontWeight: FontWeight.w700, color: referralStatusCode == 1 ? Color(0xffc4aa54) - : referralStatusCode == 46 + : referralStatusCode == 46 || referralStatusCode == 2 ? Colors.green[700] : Colors.red[700], ),