From 4f1a892be4cfb7c6918481bea998ffc3df0bb143 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 7 Jan 2021 14:37:26 +0200 Subject: [PATCH 1/4] first step form create episode --- lib/config/config.dart | 3 + lib/config/localized_values.dart | 2 +- lib/core/service/SOAP_service.dart | 13 ++ lib/core/viewModel/SOAP_view_model.dart | 13 ++ lib/models/SOAP/PostEpisodeReqModel.dart | 28 +++ lib/screens/dashboard_screen.dart | 47 +++++ lib/screens/patients/patients_screen.dart | 9 +- .../profile/patient-page-header-widget.dart | 166 ++++++++++-------- .../profile/profile_medical_info_widget.dart | 71 +++++--- 9 files changed, 254 insertions(+), 98 deletions(-) create mode 100644 lib/models/SOAP/PostEpisodeReqModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index e3163bb2..e8e0f6ce 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -132,6 +132,9 @@ const GET_PATIENT_ARRIVAL_LIST = const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; + +const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; + const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4ad53ebe..e96daef0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -295,7 +295,7 @@ const Map> localizedValues = { }, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, - "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الموضوع"}, + "empty-message": {"en": "Please enter this field", "ar": "يرجى ادخال هذا الحقل"}, 'no-sickleve-applied': { 'en': "No sick leave applied", 'ar': 'لم تطبق إجازة مرضية' diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index d1fff03b..9707dc53 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -48,6 +49,18 @@ class SOAPService extends LookupService { ); } + Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { + hasError = false; + + await baseAppClient.post(POST_EPISODE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeReqModel.toJson()); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { hasError = false; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index fff7a239..31764c45 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -13,6 +13,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -99,6 +100,17 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + + Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postEpisode(postEpisodeReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postAllergy(postAllergyRequestModel); @@ -222,6 +234,7 @@ class SOAPViewModel extends BaseViewModel { Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP) async { + setState(ViewState.Busy); await _SOAPService.getPatientAllergy(generalGetReqForSOAP); if (_SOAPService.hasError) { diff --git a/lib/models/SOAP/PostEpisodeReqModel.dart b/lib/models/SOAP/PostEpisodeReqModel.dart new file mode 100644 index 00000000..6d3ee45a --- /dev/null +++ b/lib/models/SOAP/PostEpisodeReqModel.dart @@ -0,0 +1,28 @@ +class PostEpisodeReqModel { + int appointmentNo; + int patientMRN; + int doctorID; + String vidaAuthTokenID; + + PostEpisodeReqModel( + {this.appointmentNo, + this.patientMRN, + this.doctorID, + this.vidaAuthTokenID}); + + PostEpisodeReqModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + patientMRN = json['PatientMRN']; + doctorID = json['DoctorID']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['PatientMRN'] = this.patientMRN; + data['DoctorID'] = this.doctorID; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 20f22382..dd07f6d7 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -9,9 +9,11 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.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/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -77,6 +79,25 @@ class _DashboardScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } + + var _patientSearchFormValues = PatientModel( + FirstName: "0", + MiddleName: "0", + LastName: "0", + PatientMobileNumber: "0", + PatientIdentificationID: "0", + PatientID: 0, + From: DateUtils.convertDateToFormat(DateTime. now(), 'yyyy-MM-dd').toString(), + To: DateUtils.convertDateToFormat(DateTime. now(), 'yyyy-MM-dd').toString(), + LanguageID: 2, + stamp: "2020-03-02T13:56:39.170Z", + IPAdress: "11.11.11.11", + VersionID: 1.2, + Channel: 9, + TokenID: "2Fi7HoIHB0eDyekVa6tCJg==", + SessionID: "5G0yXn0Jnq", + IsLoginForDoctorApp: true, + PatientOutSA: false); return BaseView( onModelReady: (model) => model.getDashboard(), builder: (_, model, w) => AppScaffold( @@ -957,6 +978,8 @@ class _DashboardScreenState extends State { height: 20, ), Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ DashboardItem( child: Column( @@ -984,6 +1007,30 @@ class _DashboardScreenState extends State { ), ); }, + ), + SizedBox(width: 8,), + DashboardItem( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + DoctorApp.patient, + size: 50, + ), + AppText( + TranslationBase.of(context).arrived, + color: Colors.black, + textAlign: TextAlign.center, + ) + ], + ), + hasBorder: true, + onTap: () { + Navigator.of(context).pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": "7" + }); + }, ) ], ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 602bd180..0c2a53d4 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -274,7 +274,8 @@ class _PatientsScreenState extends State { .then((res) { setState(() { _isLoading = false; - if (res['MessageStatus'] == 1) { + + if (res != null && res['MessageStatus'] == 1) { if (val2 == 7) { if (res[SERVICES_PATIANT2[val2]] == null) { _isError = true; @@ -282,6 +283,9 @@ class _PatientsScreenState extends State { this.error = error.toString(); } else { var localList = []; + if(res["patientArrivalList"]["entityList"] == null){ + res["patientArrivalList"]["entityList"] = []; + } res["patientArrivalList"]["entityList"].forEach((v) { Map mergedPatient = { ...v, @@ -289,7 +293,6 @@ class _PatientsScreenState extends State { }; localList.add(mergedPatient); }); - print(localList.toString()); lItems = localList; } } else { @@ -301,7 +304,7 @@ class _PatientsScreenState extends State { _isError = false; } else { _isError = true; - error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + error = model.error; //res['ErrorEndUserMessage'] ?? res['ErrorMessage']; } }); }).catchError((error) { diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart index 3e870be5..f4de0615 100644 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -1,92 +1,112 @@ +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +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/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; class PatientPageHeaderWidget extends StatelessWidget { final PatiantInformtion patient; - + String allergiesString=''; PatientPageHeaderWidget(this.patient); @override Widget build(BuildContext context) { - return Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).age, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 20, + return BaseView( + onModelReady: (model) async { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: patient.patientMRN, + episodeId: patient.episodeNo, + appointmentNo: patient.appointmentNo, + doctorID: '', + editedBy: ''); + await model.getPatientAllergy(generalGetReqForSOAP); + model.patientAllergiesList.forEach((element) { + allergiesString += element.allergyDiseaseName+' , '; + }); + }, + builder: (_, model, w) => Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, + ), + SizedBox( + width: 20, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + NetworkBaseView( + baseViewModel: model, + child: AppText( + "ALLERGIC TO: $allergiesString", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ), + ], ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ], + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + width: 20, ), - ) - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - width: 20, - ), - ], - ), - ); + ], + ), + )); } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 8860a7dc..34433fa7 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,7 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/routes.dart'; +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/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -22,26 +28,42 @@ class ProfileMedicalInfoWidget extends StatelessWidget { String patientType; @override Widget build(BuildContext context) { - return SliverGrid.count( + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => SliverGrid.count( crossAxisSpacing: 10, mainAxisSpacing: 20, crossAxisCount: 2, childAspectRatio: 1.5, children: [ + if (int.parse(patientType) == 7) + PatientProfileButton( + key: key, + patient: patient, + isDisable: patient.episodeNo != 0 ? true : false, + nameLine1: TranslationBase.of(context).createNew, + nameLine2: TranslationBase.of(context).episode, + route: CREATE_EPISODE, + onTap: () async { + PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( + appointmentNo: patient.appointmentNo, + patientMRN: patient.patientMRN); + await model.postEpisode(postEpisodeReqModel); + }, + isLoading: model.state == ViewState.BusyLocal, + icon: 'create-episod.png' + ), if(int.parse(patientType) ==7) PatientProfileButton( key: key, patient: patient, - nameLine1: TranslationBase.of(context).createNew, - nameLine2: TranslationBase.of(context).episode, - route: CREATE_EPISODE, - icon: 'create-episod.png'), - if(int.parse(patientType) ==7) - PatientProfileButton( - key: key, - patient: patient, - nameLine1: TranslationBase.of(context).update, - nameLine2: TranslationBase.of(context).episode, + isDisable: patient.episodeNo == 0 ? true : false, + nameLine1: TranslationBase + .of(context) + .update, + nameLine2: TranslationBase + .of(context) + .episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), if(selectedPatientType == 6 || selectedPatientType == 7) @@ -146,7 +168,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { .of(context) .ucaf, icon: 'lab.png'), - ]); + ],),); } } @@ -206,20 +228,25 @@ class PatientProfileButton extends StatelessWidget { final dynamic route; final PatiantInformtion patient; final String url = "assets/images/"; - PatientProfileButton( - {Key key, - this.patient, - this.nameLine1, - this.nameLine2, - this.icon, - this.route}) + final bool isDisable; + final bool isLoading; + final Function onTap; + + + PatientProfileButton({Key key, + this.patient, + this.nameLine1, + this.nameLine2, + this.icon, + this.route, this.isDisable = false, this.onTap, this.isLoading = false}) : super(key: key); + @override Widget build(BuildContext context) { return new Container( margin: new EdgeInsets.symmetric(horizontal: 4.0), child: InkWell( - onTap: () { + onTap: isDisable?null:onTap != null ? onTap : () { navigator(context, this.route); }, child: Column(children: [ @@ -243,6 +270,8 @@ class PatientProfileButton extends StatelessWidget { textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 2, ), + if(isLoading) + DrAppCircularProgressIndeicator() ], ), ), @@ -261,7 +290,7 @@ class PatientProfileButton extends StatelessWidget { ), decoration: BoxDecoration( // border: Border.all(), - color: Colors.white, + color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white, borderRadius: BorderRadius.all(Radius.circular(10)), border: Border.fromBorderSide(BorderSide( color: Color(0xffBBBBBB), From 175ba545e7cdd622af9590bbb7ef38255625073d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 10 Jan 2021 12:14:25 +0200 Subject: [PATCH 2/4] finish create episode --- lib/core/service/SOAP_service.dart | 3 +++ lib/core/viewModel/SOAP_view_model.dart | 2 ++ lib/widgets/patients/profile/profile_medical_info_widget.dart | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 9707dc53..e3ab61b2 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -32,6 +32,7 @@ class SOAPService extends LookupService { List patientProgressNoteList = []; List patientAssessmentList = []; + int episodeID; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, @@ -54,7 +55,9 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_EPISODE, onSuccess: (dynamic response, int statusCode) { + print("Success"); + episodeID = response['EpisodeID']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 31764c45..ebb282ef 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -79,6 +79,8 @@ class SOAPViewModel extends BaseViewModel { List get patientAssessmentList => _SOAPService.patientAssessmentList; + int get episodeID => + _SOAPService.episodeID; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 34433fa7..a614ddb4 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -49,6 +49,10 @@ class ProfileMedicalInfoWidget extends StatelessWidget { appointmentNo: patient.appointmentNo, patientMRN: patient.patientMRN); await model.postEpisode(postEpisodeReqModel); + patient.episodeNo = model.episodeID; + Navigator.of(context).pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); + + }, isLoading: model.state == ViewState.BusyLocal, icon: 'create-episod.png' From 0147e7e49b5016fd6f51b05a71238864e741783f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 10 Jan 2021 15:15:42 +0200 Subject: [PATCH 3/4] do translation, fix some bugs --- lib/config/localized_values.dart | 1 + lib/core/viewModel/SOAP_view_model.dart | 8 ++++++++ lib/util/translations_delegate_base.dart | 1 + .../patients/profile/patient-page-header-widget.dart | 11 ++++------- .../profile/profile_medical_info_widget.dart | 2 +- .../profile/soap_update/update_assessment_page.dart | 11 ++++------- .../profile/soap_update/update_objective_page.dart | 6 +++--- .../profile/soap_update/update_plan_page.dart | 12 +++++------- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e96daef0..d1c52f7a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -541,4 +541,5 @@ const Map> localizedValues = { 'physicalSystemExamination': {'en': "Physical/System Examination", 'ar':" الفحص البدني / النظام" }, 'searchExamination': {'en': "Search Examination", 'ar':"فحص البحث" }, 'addExamination': {'en': "Add Examination", 'ar':"اضافه" }, + 'doc': {'en': "Doc :", 'ar':" د: " }, }; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index ebb282ef..e3daf6e9 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -246,6 +246,14 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + String getAllergicNames(){ + String allergiesString=''; + patientAllergiesList.forEach((element) { + allergiesString += element.allergyDiseaseName+' , '; + }); + return allergiesString; + } + Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async { setState(ViewState.Busy); await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: isFirst); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e6b5dbd5..0cfd0b6f 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -558,6 +558,7 @@ class TranslationBase { String get physicalSystemExamination => localizedValues['physicalSystemExamination'][locale.languageCode]; String get searchExamination => localizedValues['searchExamination'][locale.languageCode]; String get addExamination => localizedValues['addExamination'][locale.languageCode]; + String get doc => localizedValues['doc'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart index f4de0615..a6c47a7f 100644 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -12,7 +12,6 @@ import 'package:flutter/material.dart'; class PatientPageHeaderWidget extends StatelessWidget { final PatiantInformtion patient; - String allergiesString=''; PatientPageHeaderWidget(this.patient); @override @@ -26,9 +25,7 @@ class PatientPageHeaderWidget extends StatelessWidget { doctorID: '', editedBy: ''); await model.getPatientAllergy(generalGetReqForSOAP); - model.patientAllergiesList.forEach((element) { - allergiesString += element.allergyDiseaseName+' , '; - }); + }, builder: (_, model, w) => Container( child: Column( @@ -85,11 +82,11 @@ class PatientPageHeaderWidget extends StatelessWidget { ), NetworkBaseView( baseViewModel: model, - child: AppText( - "ALLERGIC TO: $allergiesString", + child: model.patientAllergiesList.isNotEmpty ?AppText( + "ALLERGIC TO: "+model.getAllergicNames(), color: Color(0xFFB9382C), fontWeight: FontWeight.bold, - ), + ) : AppText(''), ), ], ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index a614ddb4..d3ea6048 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -94,7 +94,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), - if (selectedPatientType != 0 && selectedPatientType != 5) + if (selectedPatientType != 0 && selectedPatientType != 5 && selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 10bfc120..0cec0609 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -41,7 +41,6 @@ class _UpdateAssessmentPageState extends State { bool isAssessmentExpand = false; @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async{ @@ -152,12 +151,10 @@ class _UpdateAssessmentPageState extends State { model: model); }, readOnly: true, - // hintColor: Colors.black, suffixIcon: EvaIcons.plusCircleOutline, suffixIconColor: AppGlobal .appPrimaryColor, fontWeight: FontWeight.w600, - // controller: messageController, validator: (value) { if (value == null) return TranslationBase @@ -217,7 +214,7 @@ class _UpdateAssessmentPageState extends State { MainAxisAlignment.start, children: [ AppText( - "Appointment #: ", + TranslationBase.of(context).appointmentNo, fontWeight: FontWeight .bold, fontSize: 16, @@ -250,7 +247,7 @@ class _UpdateAssessmentPageState extends State { MainAxisAlignment.start, children: [ AppText( - "Type : ", + TranslationBase.of(context).type +':', fontWeight: FontWeight .bold, fontSize: 16, @@ -270,7 +267,7 @@ class _UpdateAssessmentPageState extends State { MainAxisAlignment.start, children: [ AppText( - "Doc : ", + TranslationBase.of(context).doc, fontWeight: FontWeight .bold, fontSize: 16, @@ -671,7 +668,7 @@ class _AddAssessmentDetailsState extends State { height: 10, ), AppButton( - title: "Add".toUpperCase(), + title: (widget.isUpdate?TranslationBase.of(context).update:TranslationBase.of(context).add).toUpperCase(), loading: model.state == ViewState.BusyLocal, onPressed: () async { widget.mySelectedAssessment.remark = diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index 0c8bece6..550a36ca 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -397,10 +397,10 @@ class _UpdateObjectivePageState extends State { widget.changePageViewIndex(2); } } else { - helpers.showErrorToast(TranslationBase.of(context).requiredMsg); - } + widget.changePageViewIndex(2); - widget.changePageViewIndex(2); + // helpers.showErrorToast(TranslationBase.of(context).requiredMsg); + } } removeExamination(MasterKeyModel masterKey) { 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 a91447d6..b8ceea79 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -51,8 +51,6 @@ class _UpdatePlanPageState extends State { @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( onModelReady: (model) async { GetGetProgressNoteReqModel getGetProgressNoteReqModel = @@ -287,13 +285,13 @@ class _UpdatePlanPageState extends State { appointmentNo: widget.patientInfo.appointmentNo, planNote: progressNoteController.text, doctorID: '', editedBy: ''); - // if(model.patientProgressNoteList.isEmpty){ + if(model.patientProgressNoteList.isEmpty){ await model.postProgressNote(postProgressNoteRequestModel); - // }else { - // await model.patchProgressNote(postProgressNoteRequestModel); - // - // } + }else { + await model.patchProgressNote(postProgressNoteRequestModel); + + } if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); From fb035cd4c9e385325357b11def3eb2279bc19ba8 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 10 Jan 2021 17:35:40 +0200 Subject: [PATCH 4/4] fix patient_search_screen.dart --- .../patients/patient_search_screen.dart | 12 ------ lib/widgets/patients/dynamic_elements.dart | 39 ++++++++++++++++--- lib/widgets/shared/app_text_form_field.dart | 5 +-- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 61eb5fcf..94102b1b 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -68,21 +68,9 @@ class _PatientSearchScreenState extends State { try { - - /* Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile)*/; if (_formKey.currentState.validate()) { _formKey.currentState.save(); - /* sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); - String token = await sharedPref.getString(TOKEN); - - _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 - _patientSearchFormValues.DoctorID = doctorProfile.doctorID; - _patientSearchFormValues.ClinicID = doctorProfile.clinicID;*/ - if ((_patientSearchFormValues.From == "0" || _patientSearchFormValues.To == "0") && _selectedType == "7") { diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 25d196d0..e6688397 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -59,22 +59,49 @@ class _DynamicElementsState extends State { @override Widget build(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration({String hintText, + String selectedText, bool isDropDown,IconData icon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ) + ; + } return LayoutBuilder( builder: (ctx, constraints) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), SizedBox( height: 10, ), AppTextFormField( - textInputType: TextInputType.number, + onTap: ()=> _presentDatePicker('_selectedFromDate'), hintText: TranslationBase.of(context).fromDate, controller: _fromDateController, inputFormatter: ONLY_DATE, - onTap: () { - _presentDatePicker('_selectedFromDate'); - }, onSaved: (value) { if (_fromDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.From = "0"; @@ -82,12 +109,14 @@ class _DynamicElementsState extends State { widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); } }, + readOnly: true, + ), SizedBox( height: 10, ), AppTextFormField( - textInputType: TextInputType.number, + readOnly: true, hintText: TranslationBase .of(context) .toDate, diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index 4c2573cd..82a273bb 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -4,10 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; -// OWNER : Ibrahim albitar -// DATE : 19-04-2020 -// DESCRIPTION : Custom Text Form Field for app. - class AppTextFormField extends FormField { AppTextFormField( {FormFieldSetter onSaved, @@ -41,6 +37,7 @@ class AppTextFormField extends FormField { obscureText: obscureText, focusNode: focusNode, keyboardType: textInputType, + readOnly: readOnly, inputFormatters: [ FilteringTextInputFormatter.allow( RegExp(inputFormatter)),