From 72c948371aeb0bbef634f23255f47058e4ee617c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 24 Oct 2021 13:56:15 +0300 Subject: [PATCH] finish the nursing progress_note_screen --- lib/config/config.dart | 3 + .../GetNursingProgressNoteRequestModel.dart | 30 +++ .../GetNursingProgressNoteResposeModel.dart | 36 +++ lib/core/service/patient/patient_service.dart | 27 +- lib/core/viewModel/patient_view_model.dart | 16 ++ lib/routes.dart | 8 +- .../note/progress_note_screen.dart | 13 +- .../profile/{ => notes}/note/update_note.dart | 0 .../nursing_note/nursing_note_screen.dart | 240 ++++++++++++++++++ .../operation_report/operation_report.dart | 1 - .../profile_gird_for_InPatient.dart | 7 + 11 files changed, 370 insertions(+), 11 deletions(-) create mode 100644 lib/core/model/note/GetNursingProgressNoteRequestModel.dart create mode 100644 lib/core/model/note/GetNursingProgressNoteResposeModel.dart rename lib/screens/patients/profile/{ => notes}/note/progress_note_screen.dart (99%) rename lib/screens/patients/profile/{ => notes}/note/update_note.dart (100%) create mode 100644 lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index f17693e0..5bc953f2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -348,6 +348,9 @@ const GET_EPISODE_FOR_INPATIENT = const GET_OPERATION_REPORT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; +const NURSING_PROGRESS_NOTE = + "Services/DoctorApplication.svc/REST/DoctorApp_GetNursingProgressNote"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/note/GetNursingProgressNoteRequestModel.dart b/lib/core/model/note/GetNursingProgressNoteRequestModel.dart new file mode 100644 index 00000000..4335053c --- /dev/null +++ b/lib/core/model/note/GetNursingProgressNoteRequestModel.dart @@ -0,0 +1,30 @@ +import 'package:doctor_app_flutter/config/config.dart'; + +class GetNursingProgressNoteRequestModel { + int patientID; + int admissionNo; + int patientTypeID; + int patientType; + String setupID; + + GetNursingProgressNoteRequestModel( + {this.patientID, this.admissionNo, this.patientTypeID = 1, this.patientType = 1, this.setupID }); + + GetNursingProgressNoteRequestModel.fromJson(Map json) { + patientID = json['PatientID']; + admissionNo = json['AdmissionNo']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + setupID = json['SetupID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['AdmissionNo'] = this.admissionNo; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['SetupID'] = this.setupID; + return data; + } +} diff --git a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart new file mode 100644 index 00000000..55ede866 --- /dev/null +++ b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart @@ -0,0 +1,36 @@ +class GetNursingProgressNoteResposeModel { + String notes; + dynamic conditionType; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + GetNursingProgressNoteResposeModel( + {this.notes, + this.conditionType, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + GetNursingProgressNoteResposeModel.fromJson(Map json) { + notes = json['Notes']; + conditionType = json['ConditionType']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['Notes'] = this.notes; + data['ConditionType'] = this.conditionType; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index 25e9481b..26ec11ad 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; +import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteResposeModel.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/model/patient_muse/PatientSearchRequestModel.dart'; @@ -51,11 +53,14 @@ class PatientService extends BaseService { List get labResultList => _labResultList; - // TODO: replace var with model List _patientProgressNoteList = []; List get patientProgressNoteList => _patientProgressNoteList; + List _patientNursingProgressNoteList = []; + + List get patientNursingProgressNoteList => _patientNursingProgressNoteList; + // TODO: replace var with model var _insuranceApporvalsList = []; @@ -465,4 +470,24 @@ class PatientService extends BaseService { body: _doctorsByClinicIdRequest.toJson(), ); } + + + Future getNursingProgressNote(GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel) async { + hasError = false; + + await baseAppClient.post( + NURSING_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + _patientNursingProgressNoteList = []; + response['List_NursingProgressNote'].forEach((v) { + _patientNursingProgressNoteList.add( GetNursingProgressNoteResposeModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getNursingProgressNoteRequestModel.toJson(), + ); + } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 5bc6250f..24d1479d 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; +import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteResposeModel.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/model/patient_muse/PatientSearchRequestModel.dart'; @@ -41,6 +43,7 @@ class PatientViewModel extends BaseViewModel { get insuranceApporvalsList => _patientService.insuranceApporvalsList; List get patientProgressNoteList => _patientService.patientProgressNoteList; + List get patientNursingProgressNoteList => _patientService.patientNursingProgressNoteList; List get clinicsList => _patientService.clinicsList; @@ -284,4 +287,17 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getNursingProgressNote(GetNursingProgressNoteRequestModel requestModel) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _patientService.getNursingProgressNote(requestModel); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/routes.dart b/lib/routes.dart index 9c8f35f8..8e6d346d 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -9,7 +9,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/notes/note/progress_note_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/operation_report/operation_report.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; @@ -27,7 +28,6 @@ import 'landing_page.dart'; import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; -import 'screens/patients/profile/note/progress_note_screen.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; @@ -69,6 +69,7 @@ const String ADD_SICKLEAVE = 'add-sickleave'; const String RADIOLOGY_PATIENT = 'radiology-patient'; const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String GET_OPERATION_REPORT = 'operation-report'; +const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; //todo: change the routing way. var routes = { @@ -112,5 +113,6 @@ var routes = { // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), - GET_OPERATION_REPORT: (_) => OperationReportScreen(), + + NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), }; diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/notes/note/progress_note_screen.dart similarity index 99% rename from lib/screens/patients/profile/note/progress_note_screen.dart rename to lib/screens/patients/profile/notes/note/progress_note_screen.dart index fb31511d..52a1b0e0 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/notes/note/progress_note_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.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/AnalyticsService.dart'; @@ -6,13 +7,17 @@ import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/locator.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/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/notes/note/update_note.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -21,11 +26,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import '../../../../config/shared_pref_kay.dart'; -import '../../../../models/patient/patiant_info_model.dart'; -import '../../../../util/dr_app_shared_pref.dart'; -import '../../../../widgets/shared/app_scaffold_widget.dart'; -import '../../../../widgets/shared/app_texts_widget.dart'; + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); diff --git a/lib/screens/patients/profile/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart similarity index 100% rename from lib/screens/patients/profile/note/update_note.dart rename to lib/screens/patients/profile/notes/note/update_note.dart diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart new file mode 100644 index 00000000..d00e1b54 --- /dev/null +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -0,0 +1,240 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.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/AnalyticsService.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.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/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/notes/note/update_note.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + +class NursingProgressNoteScreen extends StatefulWidget { + const NursingProgressNoteScreen({Key key}) : super(key: key); + + @override + _ProgressNoteState createState() => _ProgressNoteState(); +} + +class _ProgressNoteState extends State { + List notesList; + var filteredNotesList; + bool isDischargedPatient = false; + AuthenticationViewModel authenticationViewModel; + ProjectViewModel projectViewModel; + + getProgressNoteList(BuildContext context, PatientViewModel model, + {bool isLocalBusy = false}) async { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); + + print(type); + GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel = + GetNursingProgressNoteRequestModel( + admissionNo: int.parse(patient.admissionNo), + patientTypeID: patient.patientType, + patientID: patient.patientId, setupID: "010266"); + model.getNursingProgressNote(getNursingProgressNoteRequestModel); + } + + @override + Widget build(BuildContext context) { + authenticationViewModel = Provider.of(context); + projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + if (routeArgs.containsKey('isDischargedPatient')) + isDischargedPatient = routeArgs['isDischargedPatient']; + return BaseView( + onModelReady: (model) => getProgressNoteList(context, model), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // appBarTitle: TranslationBase.of(context).progressNote, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: model.patientNursingProgressNoteList == null || + model.patientNursingProgressNoteList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).errorNoProgressNote) + : Container( + color: Colors.grey[200], + child: Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + itemCount: + model.patientNursingProgressNoteList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: Colors.black38, + widget: Column( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.60, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .createdBy, + fontSize: 10, + ), + Expanded( + child: AppText( + model + .patientNursingProgressNoteList[ + index] + .createdBy + .toString() ?? + '', + fontWeight: + FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + ], + ), + ), + Column( + children: [ + AppText( + model + .patientNursingProgressNoteList[ + index] + .createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils + .getDateTimeFromServerFormat(model + .patientNursingProgressNoteList[ + index] + .createdOn), + isArabic: + projectViewModel + .isArabic, + isMonthShort: true) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.now(), + isArabic: + projectViewModel + .isArabic), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + AppText( + model + .patientNursingProgressNoteList[ + index] + .createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils + .getDateTimeFromServerFormat(model + .patientNursingProgressNoteList[ + index] + .createdOn)) + : AppDateUtils.getHour( + DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + ], + crossAxisAlignment: + CrossAxisAlignment.end, + ) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + child: AppText( + model + .patientNursingProgressNoteList[ + index] + .notes, + fontSize: 10, + isCopyable: true, + ), + ), + ]) + ], + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ); + }), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 04b271b5..b00259e4 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -9,7 +9,6 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dart'; import 'package:doctor_app_flutter/screens/patients/profile/operation_report/update_operation_report.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 4c4fe12e..bc1deb07 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -133,6 +133,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Nursing", + "Progress Note", + NURSING_PROGRESS_NOTE, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding(