From 6bab2e0b2de76fb74a8efbc1c300bcf672bee5a9 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 14 Jan 2021 16:45:52 +0200 Subject: [PATCH] fix referral patient issue --- lib/config/localized_values.dart | 3 +++ lib/core/viewModel/SOAP_view_model.dart | 11 ++++++--- lib/models/patient/patiant_info_model.dart | 12 +++++----- lib/screens/patients/patients_screen.dart | 8 +++++-- lib/util/translations_delegate_base.dart | 3 +++ .../profile/patient-page-header-widget.dart | 6 ++++- .../profile/patient_profile_widget.dart | 2 +- .../profile/profile_medical_info_widget.dart | 10 ++++---- .../subjective/update_subjective_page.dart | 16 +++++++++---- .../soap_update/update_objective_page.dart | 24 ++++++++++++------- 10 files changed, 65 insertions(+), 30 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d60de738..12847967 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -546,4 +546,7 @@ const Map> localizedValues = { 'ar': "لا توجد تفاصيل لهذا المريض" }, 'doc': {'en': "Doc :", 'ar':" د: " }, + 'allergicTO': {'en': "ALLERGIC TO ", 'ar':" حساس من" }, + 'normal': {'en': "Normal", 'ar':"عادي" }, + 'abnormal': {'en': "Abnormal", 'ar':" غير عادي" }, }; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e3daf6e9..03500740 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -246,10 +246,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - String getAllergicNames(){ - String allergiesString=''; + String getAllergicNames(isArabic) { + String allergiesString = ''; patientAllergiesList.forEach((element) { - allergiesString += element.allergyDiseaseName+' , '; + MasterKeyModel selectedAllergy = getOneMasterKey( + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); + allergiesString += + (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn )+ ' , '; }); return allergiesString; } diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index e5b89cfa..1b3621c1 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -135,14 +135,14 @@ class PatiantInformtion { description: json["Description"]?? json["description"], clinicDescription: json["ClinicDescription"]?? json["clinicDescription"], clinicDescriptionN: json["ClinicDescriptionN"]?? json["clinicDescriptionN"], - nationalityName: json["NationalityName"]?? json["nationalityName"], - nationalityNameN: json["NationalityNameN"]?? json["nationalityNameN"], + nationalityName: json["NationalityName"]?? json["nationalityName"]??json['NationalityName'], + nationalityNameN: json["NationalityNameN"]?? json["nationalityNameN"]??json['NationalityNameN'], age: json["Age"]?? json["age"], genderDescription: json["GenderDescription"], nursingStationName: json["NursingStationName"], appointmentDate: json["AppointmentDate"]?? '', startTime: json["StartTime"], - appointmentNo :json['appointmentNo'], + appointmentNo :json['appointmentNo'] ?? json['AppointmentNo'], appointmentType :json['appointmentType'], arrivedOn :json['arrivedOn'], clinicGroupId :json['clinicGroupId'], @@ -150,12 +150,12 @@ class PatiantInformtion { dischargeStatus :json['dischargeStatus'], doctorDetails :json['doctorDetails'], endTime :json['endTime'], - episodeNo :json['episodeNo'], + episodeNo :json['episodeNo'] ?? json['EpisodeID'], fallRiskScore :json['fallRiskScore'], isSigned :json['isSigned'], medicationOrders :json['medicationOrders'], - nationality :json['nationality'], - patientMRN :json['patientMRN'], + nationality :json['nationality']??json['NationalityNameN'], + patientMRN :json['patientMRN'] ?? json['PatientMRN'], ); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 0c2a53d4..3083a779 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -486,6 +486,7 @@ class _PatientsScreenState extends State { mainAxisAlignment: MainAxisAlignment .spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: @@ -500,11 +501,14 @@ class _PatientsScreenState extends State { fontWeight: FontWeight.bold, backGroundcolor: Colors.white, ), + AppText( item.patientId.toString(), fontSize: 1.8 * SizeConfig.textMultiplier, fontWeight: FontWeight.w300, backGroundcolor: Colors.white, + ),SizedBox( + width: 10, ), ], ), @@ -513,8 +517,8 @@ class _PatientsScreenState extends State { 2.5, ), AppText( - 'NATIONALITY: ' + - item.nationalityName.toString(), + TranslationBase.of(context).nationality +" : "+( + item.nationalityName??item.nationality), fontSize: 1.8 * SizeConfig.textMultiplier, fontWeight: diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 74b13864..699267f1 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -560,6 +560,9 @@ class TranslationBase { String get addExamination => localizedValues['addExamination'][locale.languageCode]; String get patientNoDetailErrMsg => localizedValues['patientNoDetailErrMsg'][locale.languageCode]; String get doc => localizedValues['doc'][locale.languageCode]; + String get allergicTO=> localizedValues['allergicTO'][locale.languageCode]; + String get normal=> localizedValues['normal'][locale.languageCode]; + String get abnormal=> localizedValues['abnormal'][locale.languageCode]; } diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart index a6c47a7f..fd7fd0d8 100644 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -1,4 +1,5 @@ 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/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'; @@ -8,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widg 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'; +import 'package:provider/provider.dart'; class PatientPageHeaderWidget extends StatelessWidget { @@ -16,6 +18,8 @@ class PatientPageHeaderWidget extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( onModelReady: (model) async { GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( @@ -83,7 +87,7 @@ class PatientPageHeaderWidget extends StatelessWidget { NetworkBaseView( baseViewModel: model, child: model.patientAllergiesList.isNotEmpty ?AppText( - "ALLERGIC TO: "+model.getAllergicNames(), + TranslationBase.of(context).allergicTO +" : "+model.getAllergicNames(projectViewModel.isArabic), color: Color(0xFFB9382C), fontWeight: FontWeight.bold, ) : AppText(''), diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 7f49c868..a58a4a38 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -141,7 +141,7 @@ class PatientProfileWidget extends StatelessWidget { height: 4, ), AppText( - patient.nationalityName, + patient.nationalityName ??patient.nationality , fontWeight: FontWeight.normal, fontSize: 1.7 * SizeConfig.textMultiplier, ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 19989ecd..e9956453 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -36,7 +36,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { crossAxisCount: 2, childAspectRatio: 1.5, children: [ - if (int.parse(patientType) == 7) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -57,7 +57,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { isLoading: model.state == ViewState.BusyLocal, icon: 'create-episod.png' ), - if(int.parse(patientType) ==7) + if(int.parse(patientType) ==7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -101,7 +101,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'heartbeat.png'), - if (selectedPatientType == 7) + if (selectedPatientType == 7|| int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -123,7 +123,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: 'Order Test', nameLine2: 'Or Procedures', icon: 'lab.png'), - if(selectedPatientType == 7) + if(selectedPatientType == 7|| int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -159,7 +159,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { .of(context) .leave, icon: 'sick_leaves_icons.png'), - if( selectedPatientType == 7) + if( selectedPatientType == 7|| int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index de5d2d68..c998f932 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -160,10 +160,18 @@ class _UpdateSubjectivePageState extends State { masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); - MasterKeyModel selectedAllergySeverity = model.getOneMasterKey( - masterKeys: MasterKeysService.AllergySeverity, - id: element.severity, - ); + MasterKeyModel selectedAllergySeverity; + if (element.severity == 0) { + selectedAllergySeverity = MasterKeyModel( + id: 0, + typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + } else { + selectedAllergySeverity = model.getOneMasterKey( + masterKeys: MasterKeysService.AllergySeverity, + id: element.severity, + ); + } + MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, isChecked: element.isChecked, 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 9bd38666..ab1abd21 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -1,9 +1,10 @@ -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/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/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; @@ -24,6 +25,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; 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'; class UpdateObjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -38,7 +40,6 @@ class UpdateObjectivePage extends StatefulWidget { class _UpdateObjectivePageState extends State { bool isSysExaminationExpand = false; - TextEditingController remarksController = TextEditingController(); BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { @@ -55,9 +56,11 @@ class _UpdateObjectivePageState extends State { @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { + widget.mySelectedExamination.clear(); GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -165,7 +168,9 @@ class _UpdateObjectivePageState extends State { Column( children: widget.mySelectedExamination.map((examination) { - return Container( + TextEditingController remarksController= TextEditingController(text :examination.remark); + + return Container( margin: EdgeInsets.only( left: 15, right: 15, top: 15), child: Column(children: [ @@ -174,8 +179,8 @@ class _UpdateObjectivePageState extends State { MainAxisAlignment.spaceBetween, children: [ Texts( - examination - .selectedExamination.nameEn + ( examination + .selectedExamination.nameEn ) .toUpperCase(), variant: "bodyText", bold: true, @@ -212,7 +217,7 @@ class _UpdateObjectivePageState extends State { const EdgeInsets .all(8.0), child: Text( - "Normal", + TranslationBase.of(context).normal, style: TextStyle( fontSize: 12, color: @@ -262,7 +267,7 @@ class _UpdateObjectivePageState extends State { const EdgeInsets .all(8.0), child: Text( - "Abnormal", + TranslationBase.of(context).abnormal, style: TextStyle( fontSize: 12, color: @@ -315,7 +320,10 @@ class _UpdateObjectivePageState extends State { fontWeight: FontWeight.w600, maxLines: 25, minLines: 4, - // controller: remarksController, + controller: remarksController, + onChanged: (val) { + examination.remark = val; + }, validator: (value) { if (value == null) return TranslationBase.of(context)