diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d121dd87..78c5d833 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -590,4 +590,11 @@ const Map> localizedValues = { 'allergicTO': {'en': "ALLERGIC TO ", 'ar':" حساس من" }, 'normal': {'en': "Normal", 'ar':"عادي" }, 'abnormal': {'en': "Abnormal", 'ar':" غير عادي" }, + 'nameOrICD': {'en': "Name or ICD", 'ar':"الاسم او  ICD" }, + 'dType': {'en': "Type", 'ar':"النوع" }, + 'addAssessmentDetails': {'en': "Add Assessment Details", 'ar':"أضف تفاصيل التقييم" }, + 'progressNoteSOAP': {'en': "Progress Note", 'ar':"ملاحظة التقدم" }, + 'addProgressNote': {'en': "Add Progress Note", 'ar':"أضف ملاحظة التقدم" }, + 'createdBy': {'en': "Created By :", 'ar':"أضيفت : " }, + 'editedBy': {'en': "Edited By :", 'ar':"عدلت : " }, }; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index e3ab61b2..abb832c7 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -29,7 +29,7 @@ class SOAPService extends LookupService { List patientAllergiesList = []; List patientHistoryList = []; List patientPhysicalExamList = []; - List patientProgressNoteList = []; + List patientProgressNoteList = []; List patientAssessmentList = []; int episodeID; @@ -284,7 +284,7 @@ class SOAPService extends LookupService { print("Success"); patientProgressNoteList.clear(); response['ProgressNoteList']['entityList'].forEach((v) { - patientProgressNoteList.add(GetGetProgressNoteResModel.fromJson(v)); + patientProgressNoteList.add(GetPatientProgressNoteResModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 03500740..1ff23a18 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -74,7 +74,7 @@ class SOAPViewModel extends BaseViewModel { List get patientPhysicalExamList => _SOAPService.patientPhysicalExamList; - List get patientProgressNoteList => + List get patientProgressNoteList => _SOAPService.patientProgressNoteList; List get patientAssessmentList => @@ -253,6 +253,7 @@ class SOAPViewModel extends BaseViewModel { masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); + if(selectedAllergy != null) allergiesString += (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn )+ ' , '; }); diff --git a/lib/models/SOAP/GetGetProgressNoteResModel.dart b/lib/models/SOAP/GetGetProgressNoteResModel.dart index bbc184f1..ce6c0a12 100644 --- a/lib/models/SOAP/GetGetProgressNoteResModel.dart +++ b/lib/models/SOAP/GetGetProgressNoteResModel.dart @@ -1,15 +1,39 @@ -class GetGetProgressNoteResModel { +class GetPatientProgressNoteResModel { int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + String dName; + String editedByName; + String editedOn; int episodeId; + String mName; int patientMRN; String planNote; - GetGetProgressNoteResModel( - {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); + GetPatientProgressNoteResModel( + {this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.dName, + this.editedByName, + this.editedOn, + this.episodeId, + this.mName, + this.patientMRN, + this.planNote}); - GetGetProgressNoteResModel.fromJson(Map json) { + GetPatientProgressNoteResModel.fromJson(Map json) { appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + dName = json['dName']; + editedByName = json['editedByName']; + editedOn = json['editedOn']; episodeId = json['episodeId']; + mName = json['mName']; patientMRN = json['patientMRN']; planNote = json['planNote']; } @@ -17,7 +41,14 @@ class GetGetProgressNoteResModel { Map toJson() { final Map data = new Map(); data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['dName'] = this.dName; + data['editedByName'] = this.editedByName; + data['editedOn'] = this.editedOn; data['episodeId'] = this.episodeId; + data['mName'] = this.mName; data['patientMRN'] = this.patientMRN; data['planNote'] = this.planNote; return data; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index dd72e58a..c1e9b1b8 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -616,6 +616,21 @@ class TranslationBase { String get patientNoDetailErrMsg => localizedValues['patientNoDetailErrMsg'][locale.languageCode]; + String get nameOrICD => + localizedValues['nameOrICD'][locale.languageCode]; + + String get dType => + localizedValues['dType'][locale.languageCode]; + String get addAssessmentDetails => + localizedValues['addAssessmentDetails'][locale.languageCode]; + String get progressNoteSOAP => + localizedValues['progressNoteSOAP'][locale.languageCode]; + String get addProgressNote => + localizedValues['addProgressNote'][locale.languageCode]; + String get createdBy => + localizedValues['createdBy'][locale.languageCode]; + String get editedBy => + localizedValues['editedBy'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { 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 05813d82..5c0dbc4c 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -1,15 +1,16 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.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/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.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/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -22,6 +23,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body. import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; import 'custom_validation_error.dart'; @@ -44,6 +46,7 @@ class _UpdateAssessmentPageState extends State { bool isAssessmentExpand = false; @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async{ @@ -78,19 +81,23 @@ class _UpdateAssessmentPageState extends State { masterKeys: MasterKeysService.DiagnosisCondition, id: element.conditionID, ); - MySelectedAssessment temMySelectedAssessment = MySelectedAssessment( - appointmentId: element.appointmentNo, - remark: element.remarks, - selectedDiagnosisType: diagnosisType, - selectedDiagnosisCondition: diagnosisCondition, - selectedICD: selectedICD, - doctorID: element.doctorID, - doctorName: element.doctorName, - createdBy: element.createdBy, - icdCode10ID: element.icdCode10ID - ); + if(diagnosisCondition !=null &&diagnosisType !=null && diagnosisCondition!=null) { + MySelectedAssessment temMySelectedAssessment = MySelectedAssessment( + appointmentId: element.appointmentNo, + remark: element.remarks, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: element.doctorID, + doctorName: element.doctorName, + createdBy: element.createdBy, + createdOn: element.createdOn, + icdCode10ID: element.icdCode10ID + ); + + widget.mySelectedAssessmentList.add(temMySelectedAssessment); + } - widget.mySelectedAssessmentList.add(temMySelectedAssessment); }); } @@ -197,13 +204,14 @@ class _UpdateAssessmentPageState extends State { CrossAxisAlignment.start, children: [ AppText( - "12".toUpperCase(), + + assessment.createdOn !=null?DateTime.parse(assessment.createdOn).day.toString():DateTime.now().day, fontWeight: FontWeight .bold, fontSize: 16, ), AppText( - "DEC".toUpperCase(), + Helpers.getMonth(assessment.createdOn !=null?DateTime.parse(assessment.createdOn).month:DateTime.now().month).toUpperCase(), fontSize: 10, color: Colors.grey, ), @@ -239,7 +247,9 @@ class _UpdateAssessmentPageState extends State { MainAxisAlignment.start, children: [ AppText( - assessment + projectViewModel.isArabic?assessment + .selectedDiagnosisCondition + .nameAr : assessment .selectedDiagnosisCondition .nameEn, fontWeight: FontWeight @@ -253,13 +263,15 @@ class _UpdateAssessmentPageState extends State { MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).type +':', + TranslationBase.of(context).dType+':', fontWeight: FontWeight .bold, fontSize: 16, ), AppText( - assessment + projectViewModel.isArabic?assessment + .selectedDiagnosisType + .nameAr:assessment .selectedDiagnosisType .nameEn, fontSize: 10, @@ -438,6 +450,8 @@ class _AddAssessmentDetailsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + remarkController.text = widget.mySelectedAssessment.remark ?? ""; appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString(); @@ -498,7 +512,7 @@ class _AddAssessmentDetailsState extends State { height: 16, ), AppText( - "Add Assessment Details".toUpperCase(), + TranslationBase.of(context).addAssessmentDetails.toUpperCase(), fontWeight: FontWeight.bold, fontSize: 16, ), @@ -538,7 +552,7 @@ class _AddAssessmentDetailsState extends State { } : null, child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration("Name or ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), + decoration: textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), key: key, suggestions: model.listOfICD10, @@ -553,7 +567,7 @@ class _AddAssessmentDetailsState extends State { ): TextField( decoration: textFieldSelectorDecoration( widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", - widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), + widget.mySelectedAssessment.selectedICD != null ? projectViewModel.isArabic?widget.mySelectedAssessment.selectedICD.nameAr:widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), enabled: false, ), ), @@ -595,10 +609,12 @@ class _AddAssessmentDetailsState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - "Condition", + TranslationBase.of(context).condition, widget.mySelectedAssessment .selectedDiagnosisCondition != null - ? widget.mySelectedAssessment + ? projectViewModel.isArabic?widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr:widget.mySelectedAssessment .selectedDiagnosisCondition .nameEn : null, @@ -645,10 +661,11 @@ class _AddAssessmentDetailsState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - "Type", + TranslationBase.of(context).dType, widget.mySelectedAssessment .selectedDiagnosisType != null - ? widget.mySelectedAssessment + ?projectViewModel.isArabic?widget.mySelectedAssessment + .selectedDiagnosisType.nameAr: widget.mySelectedAssessment .selectedDiagnosisType.nameEn : null, true), @@ -764,7 +781,8 @@ class _AddAssessmentDetailsState extends State { if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + helpers + .showErrorToast(model.error); } else { mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; 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 d0e91c8d..437b86f3 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -3,9 +3,11 @@ 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/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.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/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -22,8 +24,14 @@ class UpdatePlanPage extends StatefulWidget { final Function changePageViewIndex; final PatiantInformtion patientInfo; final Function changeLoadingState; + GetPatientProgressNoteResModel patientProgressNote; - UpdatePlanPage({Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState}); + UpdatePlanPage( + {Key key, + this.changePageViewIndex, + this.patientInfo, + this.changeLoadingState, + this.patientProgressNote}); @override _UpdatePlanPageState createState() => _UpdatePlanPageState(); @@ -32,7 +40,6 @@ class UpdatePlanPage extends StatefulWidget { class _UpdatePlanPageState extends State { bool isProgressNoteExpand = false; - List progressNoteList; TextEditingController progressNoteController = TextEditingController(text: null); @@ -64,6 +71,12 @@ class _UpdatePlanPageState extends State { if (model.patientProgressNoteList.isNotEmpty) { progressNoteController.text = helpers .parseHtmlString(model.patientProgressNoteList[0].planNote); + widget.patientProgressNote.planNote = progressNoteController.text; + widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; + widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; + widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; + widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; + } widget.changeLoadingState(false); }, @@ -87,7 +100,9 @@ class _UpdatePlanPageState extends State { children: [ Row( children: [ - Texts('Progress Note', + Texts(TranslationBase + .of(context) + .progressNoteSOAP, variant: isProgressNoteExpand ? "bodyText" : '', bold: isProgressNoteExpand ? true : false, color: Colors.black), @@ -115,22 +130,24 @@ class _UpdatePlanPageState extends State { ), Column( children: [ - if(model.patientProgressNoteList.isEmpty || progressNoteController.text !='') - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Progress Note", - fontSize: 13.5, - onTapTextFields: () { - openProgressNote(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, + if(model.patientProgressNoteList.isEmpty) + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase + .of(context) + .addProgressNote, + fontSize: 13.5, + onTapTextFields: () { + openProgressNote(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, validator: (value) { if (value == null) return TranslationBase.of(context) @@ -161,12 +178,14 @@ class _UpdatePlanPageState extends State { CrossAxisAlignment.start, children: [ AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, + + widget.patientProgressNote.createdOn !=null?DateTime.parse(widget.patientProgressNote.createdOn).day.toString():DateTime.now().day.toString(), + fontWeight: FontWeight + .bold, fontSize: 16, ), AppText( - "DEC".toUpperCase(), + Helpers.getMonth(widget.patientProgressNote.createdOn !=null?(DateTime.parse(widget.patientProgressNote.createdOn).month):DateTime.now().month).toUpperCase(), fontSize: 10, color: Colors.grey, ), @@ -209,12 +228,12 @@ class _UpdatePlanPageState extends State { MainAxisAlignment.start, children: [ AppText( - "Created By : ", + TranslationBase.of(context).createdBy, fontWeight: FontWeight.bold, fontSize: 16, ), AppText( - "Anas Abdullah on 12 De", + widget.patientProgressNote.createdByName??"", fontSize: 10, color: Colors.grey, ), @@ -225,12 +244,12 @@ class _UpdatePlanPageState extends State { MainAxisAlignment.start, children: [ AppText( - "Edited By : ", + TranslationBase.of(context).editedBy, fontWeight: FontWeight.bold, fontSize: 16, ), AppText( - "Rahim on 13 Dec", + widget.patientProgressNote.editedByName??"", fontSize: 10, color: Colors.grey, ), @@ -321,7 +340,7 @@ class _UpdatePlanPageState extends State { height: 16, ), AppText( - "Add Progress Note", + TranslationBase.of(context).addProgressNote, fontWeight: FontWeight.bold, fontSize: 16, ), @@ -331,7 +350,7 @@ class _UpdatePlanPageState extends State { Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: TextFields( - hintText: "Add progress note here", + hintText: TranslationBase.of(context).addProgressNote, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -350,7 +369,7 @@ class _UpdatePlanPageState extends State { height: 10, ), AppButton( - title: "Add".toUpperCase(), + title: TranslationBase.of(context).add.toUpperCase(), onPressed: () { setState(() { print(progressNoteController.text); 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 8235f55a..7b68b4f3 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; @@ -33,6 +34,8 @@ class _UpdateSoapIndexState extends State List myHistoryList = List(); List mySelectedExamination = List(); List mySelectedAssessment = List(); + + GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -126,6 +129,7 @@ class _UpdateSoapIndexState extends State UpdatePlanPage( changePageViewIndex: changePageViewIndex, patientInfo: patient, + patientProgressNote: patientProgressNote, changeLoadingState:changeLoadingState )