From 3c224ece41b6edcf0d1d04926593abd906218097 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Fri, 23 Apr 2021 21:50:48 +0300 Subject: [PATCH] Add replay on referral patient and add the time on the vital signs --- ios/Podfile.lock | 2 +- .../service/MyReferralPatientService.dart | 3 +- .../viewModel/patient-referral-viewmodel.dart | 9 ++ .../referral/AddReplayOnReferralPatient.dart | 121 ++++++++++++++++++ .../my-referral-inpatient-screen.dart | 2 +- ...al_sign_details_blood_pressurewideget.dart | 2 +- .../vital_sign_details_wideget.dart | 2 +- 7 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2f4607e0..878a1850 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -322,4 +322,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0.rc.1 +COCOAPODS: 1.10.1 diff --git a/lib/core/service/MyReferralPatientService.dart b/lib/core/service/MyReferralPatientService.dart index 3401130a..ae1564fd 100644 --- a/lib/core/service/MyReferralPatientService.dart +++ b/lib/core/service/MyReferralPatientService.dart @@ -43,10 +43,9 @@ class MyReferralInPatientService extends BaseService { } Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async { + hasError = false; await getDoctorProfile(); - RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); - _requestAddReferredDoctorRemarks.projectID = referral.projectID; _requestAddReferredDoctorRemarks.admissionNo = referral.admissionNo.toString(); _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 72e0facc..bfd6e9af 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -154,6 +154,15 @@ class PatientReferralViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async{ + setState(ViewState.Busy); + await _myReferralService.replay(referredDoctorRemarks,referral); + if (_myReferralService.hasError) { + error = _myReferralService.error; + setState(ViewState.ErrorLocal); + } else + getMyReferralPatientService(); + } Future responseReferral( PendingReferral pendingReferral, bool isAccepted) async { diff --git a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart new file mode 100644 index 00000000..636b42ab --- /dev/null +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -0,0 +1,121 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; +import 'package:doctor_app_flutter/core/model/note/note_model.dart'; +import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/service/MyReferralPatientService.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class AddReplayOnReferralPatient extends StatefulWidget { + final PatientReferralViewModel patientReferralViewModel; + final MyReferralPatientModel myReferralInPatientModel; + //TODO Jammal + const AddReplayOnReferralPatient( + {Key key, this.patientReferralViewModel, this.myReferralInPatientModel}) + : super(key: key); + + @override + _AddReplayOnReferralPatientState createState() => + _AddReplayOnReferralPatientState(); +} + +class _AddReplayOnReferralPatientState extends State { + + bool isSubmitted = false; + TextEditingController progressNoteController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Padding( + padding: EdgeInsets.all(0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetTitle(title: 'Replay'), + SizedBox( + height: 10.0, + ), + Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + AppTextFieldCustom( + hintText: 'Replay your responses here', + controller: progressNoteController, + maxLines: 35, + minLines: 25, + hasBorder: true, + validationError: + progressNoteController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'Submit Replay', + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () async { + setState(() { + isSubmitted = true; + }); + if (progressNoteController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.patientReferralViewModel.replay(progressNoteController.text.trim(), widget.myReferralInPatientModel); + if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.patientReferralViewModel.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast("Your Replay Added Successfully"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + } + { + Helpers.showErrorToast("You cant add only spaces"); + 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 ff12738e..cf46ad4c 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -56,7 +56,7 @@ class MyReferralInPatientScreen extends StatelessWidget { model.myReferralPatients.length, (index) => InkWell( onTap: () { - //TODO build the nwe page + //TODO Jammal build the nwe page }, child: PatientReferralItemWidget( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart index a8592350..5250ca73 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -163,7 +163,7 @@ class _VitalSignDetailsWidgetState extends State { padding: EdgeInsets.all(10), color: Colors.white, child: AppText( - '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ', + '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${DateUtils.getHour(elementDate)}', // textAlign: TextAlign.center, fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w600, diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart index c9c33e1c..169dbb13 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart @@ -121,7 +121,7 @@ class _VitalSignDetailsWidgetState extends State { padding: EdgeInsets.all(8), color: Colors.white, child: AppText( - '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ', + '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${DateUtils.getHour(elementDate)}', // textAlign: TextAlign.center, fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.w600,