From 8652c30a24a9ae606456065904d66a57454f9401 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 15 Apr 2021 11:37:54 +0300 Subject: [PATCH 1/3] bug fix --- lib/screens/patients/patients_screen.dart | 38 ++++++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 2fa0507a..065c0bb8 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -326,7 +326,10 @@ class _PatientsScreenState extends State { } } else { if (isView == false && val2 == 1) { - lItems = res['GetPatientFileInformation_PRMList']; + lItems = res['GetPatientFileInformation_PRMList'] + .where((i) => + i['PatientTypeDescription'] == 'Permanent File') + .toList(); } else { lItems = res[SERVICES_PATIANT2[val2]]; } @@ -404,10 +407,30 @@ class _PatientsScreenState extends State { ), Container( margin: EdgeInsets.only( - top: MediaQuery.of(context).size.height * 0.35), - child: DrAppEmbeddedError( - error: TranslationBase.of(context) - .youDontHaveAnyPatient), + top: MediaQuery.of(context).size.height * 0.10), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context) + .youDontHaveAnyPatient), + ) + ], + ), + ) + // : Center( + // child: DrAppEmbeddedError( + // error: TranslationBase.of( + // context) + // .youDontHaveAnyPatient), + // ), + , ), ], ) @@ -837,6 +860,11 @@ class _PatientsScreenState extends State { DateTime.now().day + 1), 'yyyy-MM-dd'); } else if (item == 'Next Week') { + _patientSearchFormValues.From = DateUtils.convertDateToFormat( + DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day + 1), + 'yyyy-MM-dd'); + _patientSearchFormValues.To = DateUtils.convertDateToFormat( DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), From 2aba9e79f11622f89130992a7d4f5eabadd6bf1e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 15 Apr 2021 12:20:55 +0300 Subject: [PATCH 2/3] small fixes in soap and in all app. --- lib/client/base_app_client.dart | 2 +- lib/core/service/SOAP_service.dart | 2 +- lib/core/viewModel/SOAP_view_model.dart | 2 +- .../assessment/add_assessment_details.dart | 40 ++------------- .../update_assessment_page.dart | 8 +-- .../profile/soap_update/update_plan_page.dart | 50 +++++++++++-------- .../soap_update/update_soap_index.dart | 2 +- lib/widgets/shared/app_drawer_widget.dart | 9 ++-- lib/widgets/shared/network_base_view.dart | 10 ++-- 9 files changed, 51 insertions(+), 74 deletions(-) rename lib/widgets/patients/profile/soap_update/{ => assessment}/update_assessment_page.dart (99%) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 2a89b765..e503cb24 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -295,7 +295,7 @@ class BaseAppClient { } } if (error == null || error == "null" || error == "null\n") { - return "This server not work probably in this time"; + return helpers.generateContactAdminMsg(); } return error; } diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index be772515..d35736f5 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -21,7 +21,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart'; import 'base/lookup-service.dart'; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e3df5a7c..c576e566 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -25,7 +25,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; diff --git a/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart index c9e24dbc..bb331ba1 100644 --- a/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -167,7 +167,7 @@ class _AddAssessmentDetailsState extends State { height: 10, ), Container( - height: 55.0, + // height: 60.0, child: InkWell( onTap: model.listOfICD10 != null ? () { @@ -196,7 +196,7 @@ class _AddAssessmentDetailsState extends State { itemSubmitted: (item) => setState(() { widget.mySelectedAssessment .selectedICD = item; - icdNameController.text = item.code; + icdNameController.text = '${item.code.trim()}/${item.description}'; }), key: key, suggestions: model.listOfICD10, @@ -232,48 +232,14 @@ class _AddAssessmentDetailsState extends State { }); } : null, - //hasLabelText: - // icdNameController.text != '' - // ? true - // : false, - //showLabelText: true, hintText: TranslationBase.of(context) .nameOrICD, - - //fontSize: 13.5, - //readOnly: true, - //fontWeight: FontWeight.w600, maxLines: 2, minLines: 1, controller: icdNameController, - //suffixIcon: EvaIcons.search, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, - isDropDown: true, - enabled: false, - height: 55.0, + enabled: true, ) - - // TextField( - // decoration: textFieldSelectorDecoration( - // widget.mySelectedAssessment.selectedICD != - // null ? widget.mySelectedAssessment - // .selectedICD.code : "Name or ICD", - // widget.mySelectedAssessment.selectedICD != - // null ? projectViewModel.isArabic - // ? widget.mySelectedAssessment - // .selectedICD.nameAr - // : widget.mySelectedAssessment - // .selectedICD.nameEn : null, true, - // icon: EvaIcons.search), - // enabled: false, - // ), ), ), if (isFormSubmitted && diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart similarity index 99% rename from lib/widgets/patients/profile/soap_update/update_assessment_page.dart rename to lib/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart index 3ff18103..bc0fad71 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -18,10 +18,10 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import 'SOAP_open_items.dart'; -import 'SOAP_step_header.dart'; -import 'assessment/add_assessment_details.dart'; -import 'expandable_SOAP_widget.dart'; +import '../SOAP_open_items.dart'; +import '../SOAP_step_header.dart'; +import 'add_assessment_details.dart'; +import '../expandable_SOAP_widget.dart'; class UpdateAssessmentPage extends StatefulWidget { final Function changePageViewIndex; diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index dc993928..663bf91f 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -12,15 +12,11 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.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/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/expandable-widget-header-body.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; import 'SOAP_step_header.dart'; @@ -268,7 +264,6 @@ class _UpdatePlanPageState extends State { color: Colors.grey[300], fontColor: Colors.black, fontWeight: FontWeight.w600, - loading: model.state == ViewState.BusyLocal, onPressed: () async { setState(() { widget.changePageViewIndex(2); @@ -285,23 +280,34 @@ class _UpdatePlanPageState extends State { loading: model.state == ViewState.BusyLocal, disabled: progressNoteController.text.isEmpty, onPressed: () async { - - if(isAddProgress) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - setState(() { - widget.patientProgressNote.createdByName = widget.patientProgressNote.createdByName ?? doctorProfile.doctorName; - widget.patientProgressNote.editedByName = doctorProfile.doctorName; - widget.patientProgressNote.createdOn = DateTime.now().toString(); - widget.patientProgressNote.planNote = progressNoteController.text; - isAddProgress = !isAddProgress; - }); - submitPlan(model); - - } else{ - Navigator.of(context).pop(); - } - }, + if (progressNoteController.text.isNotEmpty) { + if (isAddProgress) { + Map profile = + await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = + DoctorProfileModel.fromJson(profile); + setState(() { + widget.patientProgressNote.createdByName = + widget.patientProgressNote + .createdByName ?? + doctorProfile.doctorName; + widget.patientProgressNote.editedByName = + doctorProfile.doctorName; + widget.patientProgressNote.createdOn = + DateTime.now().toString(); + widget.patientProgressNote.planNote = + progressNoteController.text; + isAddProgress = !isAddProgress; + }); + submitPlan(model); + } else { + Navigator.of(context).pop(); + } + } else { + helpers.showErrorToast(TranslationBase.of(context) + .progressNoteErrorMsg); + } + }, ), ), ], diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 78ceaec5..5166f998 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/assessment/update_assessment_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_plan_page.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index ee4e7aaf..1cb30cde 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -78,10 +78,11 @@ class _AppDrawerState extends State { if (authProvider.doctorProfile != null) InkWell( onTap: () { - Navigator.of(context).pushNamed(PROFILE, arguments: { - 'title': authProvider.doctorProfile.doctorName, - "doctorProfileall": authProvider.doctorProfile - }); + // TODO: return it back when its needed + // Navigator.of(context).pushNamed(PROFILE, arguments: { + // 'title': authProvider.doctorProfile.doctorName, + // "doctorProfileall": authProvider.doctorProfile + // }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/widgets/shared/network_base_view.dart b/lib/widgets/shared/network_base_view.dart index 8e5ba34e..f864559d 100644 --- a/lib/widgets/shared/network_base_view.dart +++ b/lib/widgets/shared/network_base_view.dart @@ -38,9 +38,13 @@ class NetworkBaseView extends StatelessWidget { children: [ SizedBox(height: 100,), Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(baseViewModel.error??''), + Center( + child: Center( + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12,right: 20, left: 30), + child: Center(child: Texts(baseViewModel.error??'' , textAlign: TextAlign.center,)), + ), + ), ) ], From 649379d88fd19f58b45c16f34749cd0fffe65035 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 15 Apr 2021 13:13:59 +0300 Subject: [PATCH 3/3] bug fix --- lib/core/viewModel/sick_leave_view_model.dart | 9 +- lib/screens/patients/patients_screen.dart | 187 +++++++++++++++--- 2 files changed, 167 insertions(+), 29 deletions(-) diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index 80f9ea1d..2c2f1579 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -89,13 +89,14 @@ class SickLeaveViewModel extends BaseViewModel { } Future getCoveringDoctors() async { - setState(ViewState.Busy); + //setState(ViewState.Busy); await _sickLeaveService.getCoveringDoctors(); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + // setState(ViewState.Error); + } + //else + // setState(ViewState.Idle); } Future addReschedule(request) async { diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 065c0bb8..482d6d80 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -394,17 +394,51 @@ class _PatientsScreenState extends State { : lItems == null || lItems.length == 0 ? Column( children: [ - if (int.parse(patientType) == 7) + Column(children: [ + SizedBox(height: 18.5), Container( - margin: EdgeInsets.only(top: 10), - child: ClinicList( - clinicId: clinicId, - onClinicChange: (newValue) { - clinicId = newValue; - changeClinic(newValue, context, model); + width: SizeConfig.screenWidth * 0.9, + height: SizeConfig.screenHeight * 0.08, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); }, + decoration: buildInputDecoration( + context, + TranslationBase.of(context) + .searchPatientName), ), ), + SizedBox( + height: 10.0, + ), + if (int.parse(patientType) == 7) + Container( + padding: EdgeInsets.all(5), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(10)), + child: ClinicList( + clinicId: clinicId, + onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + }, + )), + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context).size.height * + 0.03), + // child: _locationBar(context) + child: + SERVICES_PATIANT2[int.parse(patientType)] == + "patientArrivalList" + ? _locationBar(context, model) + : Container(), + ) + ]), Container( margin: EdgeInsets.only( top: MediaQuery.of(context).size.height * 0.10), @@ -423,14 +457,7 @@ class _PatientsScreenState extends State { ) ], ), - ) - // : Center( - // child: DrAppEmbeddedError( - // error: TranslationBase.of( - // context) - // .youDontHaveAnyPatient), - // ), - , + ), ), ], ) @@ -505,7 +532,7 @@ class _PatientsScreenState extends State { child: SERVICES_PATIANT2[ int.parse(patientType)] == "patientArrivalList" - ? _locationBar(context) + ? _locationBar(context, model) : Container(), ), // Row( @@ -778,7 +805,7 @@ class _PatientsScreenState extends State { )); } - Widget _locationBar(BuildContext _context) { + Widget _locationBar(BuildContext _context, model) { return Container( height: MediaQuery.of(context).size.height * 0.0619, width: SizeConfig.screenWidth * 0.94, @@ -829,7 +856,7 @@ class _PatientsScreenState extends State { setState(() { _activeLocation = _locations.indexOf(item); }); - filterPatient(item.toString()); + filterPatient(item.toString(), model); }), _isActive ? Container( @@ -849,7 +876,7 @@ class _PatientsScreenState extends State { ); } - filterPatient(item) { + filterPatient(item, model) { if (item == 'Tomorrow') { _patientSearchFormValues.To = DateUtils.convertDateToFormat( DateTime(DateTime.now().year, DateTime.now().month, @@ -869,13 +896,123 @@ class _PatientsScreenState extends State { DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd'); + } else { + _patientSearchFormValues.From = DateUtils.convertDateToFormat( + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); + _patientSearchFormValues.To = DateUtils.convertDateToFormat( + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); } - Navigator.of(context).pop(); - Navigator.of(context).pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": "7", - "arrivalType": "1", - "activeFilter": _activeLocation + searchPatient(model); + // Navigator.of(context).pop(); + // Navigator.of(context).pushNamed(PATIENTS, arguments: { + // "patientSearchForm": _patientSearchFormValues, + // "selectedType": "7", + // "arrivalType": "1", + // "activeFilter": _activeLocation + // }); + } + + searchPatient(model) { + GifLoaderDialogUtils.showMyDialog(context); + int val2 = int.parse(patientType); + GetPatientArrivalListRequestModel getPatientArrivalListRequestModel; + if (val2 == 7) { + getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel( + from: _patientSearchFormValues.From, + to: _patientSearchFormValues.To, + pageIndex: 0, + pageSize: 0, + patientMRN: patient.getPatientID); + } + + model + .getPatientList( + val2 == 7 ? getPatientArrivalListRequestModel.toJson() : patient, + patientType, + isView: isView) + .then((res) { + setState(() { + GifLoaderDialogUtils.hideDialog(context); + if (res != null && res['MessageStatus'] == 1) { + if (val2 == 7) { + if (res[SERVICES_PATIANT2[val2]] == null) { + _isError = true; + _isLoading = false; + this.error = error.toString(); + } else { + var localList = []; + if (res["patientArrivalList"]["entityList"] == null) { + res["patientArrivalList"]["entityList"] = []; + } + res["patientArrivalList"]["entityList"].forEach((v) { + Map mergedPatient = { + ...v, + ...v["patientDetails"] + }; + localList.add(mergedPatient); + }); + lItems = localList; + } + } else { + if (isView == false && val2 == 1) { + lItems = res['GetPatientFileInformation_PRMList'] + .where((i) => i['PatientTypeDescription'] == 'Permanent File') + .toList(); + } else { + lItems = res[SERVICES_PATIANT2[val2]]; + } + } + parsed = lItems; + responseModelList = new ModelResponse.fromJson(parsed).list; + if (val2 == 7) { + responseModelList.sort((a, b) { + if (b.startTime != null && b.startTime != null) { + try { + DateTime now = DateTime.now(); + DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm"); + String formattedDate = + DateFormat('yyyy-MM-dd ' + a.startTime).format(now); + DateTime dateTimeA = dateFormat.parse(formattedDate); + String formattedDateB = + DateFormat('yyyy-MM-dd ' + b.startTime).format(now); + DateTime dateTimeB = dateFormat.parse(formattedDateB); + var adate = dateTimeA; //a.startTime; + var bdate = dateTimeB; + return adate.compareTo(bdate); + } on Exception catch (_) { + print('never reached'); + var adate = a.startTime; //a.startTime; + var bdate = b.startTime; + return adate.compareTo(bdate); + } + } else { + var adate = convertDateFormat(a.appointmentDate); + var bdate = convertDateFormat(b.appointmentDate); + return bdate.compareTo(adate); + } + }); + } + responseModelList2 = responseModelList; + _isError = false; + } else { + _isError = true; + error = + model.error ?? res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + } + + _isLoading = false; + }); + }).catchError((error) { + GifLoaderDialogUtils.hideDialog(context); + setState(() { + _isError = true; + _isLoading = false; + this.error = error.toString(); + }); }); } }