diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 602ed1b9..91401655 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -49,7 +49,7 @@ const Map> localizedValues = { 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, - 'referPatient': {'en': 'Refer Patient', 'ar': 'إحالة مريض'}, + 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, @@ -666,4 +666,12 @@ const Map> localizedValues = { 'en': "You have to add chief complaint fields correctly .", 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" }, + 'referralStatus': { + 'en': "Referral Status : ", + 'ar': "حالة الإحالة :" + }, + 'referralRemark': { + 'en': "Referral Remark : ", + 'ar': "ملاحظة الإحالة :" + }, }; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index a1fc73fb..abe39224 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -131,7 +131,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.responseReferral(pendingReferral, isAccepted); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 4e656d6d..2def78db 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import '../../locator.dart'; @@ -13,7 +14,9 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignsService _vitalSignService = locator(); VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - List get patientVitalSignsHistory => _vitalSignService.patientVitalSignsHistory; + + List get patientVitalSignsHistory => + _vitalSignService.patientVitalSignsHistory; String heightCm = "0"; String weightKg = "0"; @@ -34,8 +37,16 @@ class VitalSignsViewModel extends BaseViewModel { } } - Future getPatientVitalSignHistory(PatiantInformtion patient, String from, String to) async { + Future getPatientVitalSignHistory( + PatiantInformtion patient, String from, String to) async { setState(ViewState.Busy); + if (from == null || from == "0") { + from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + if (to == null || to == "0") { + to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + await _vitalSignService.getPatientVitalSignsHistory(patient, from, to); if (_vitalSignService.hasError) { error = _vitalSignService.error; @@ -48,9 +59,7 @@ class VitalSignsViewModel extends BaseViewModel { if (weightKg == "0" || weightKg == null || weightKg == 'null') { weightKg = element.weightKg.toString(); } - if (bodyMax == "0" || - bodyMax == null || - bodyMax == 'null') { + if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') { bodyMax = element.bodyMassIndex.toString(); } if (temperatureCelcius == "0" || @@ -84,24 +93,24 @@ class VitalSignsViewModel extends BaseViewModel { return "Normal"; } else if (bodyMassIndex <= 30) { return "Overweight"; - } else { // > 30.0 + } else { + // > 30.0 return "Obese"; } } - String getTempratureMethod(int temperatureCelciusMethod){ - // temperatureCelciusMethod ( vital sign response field )- master 2005 - if(temperatureCelciusMethod == 1){ + String getTempratureMethod(int temperatureCelciusMethod) { + // temperatureCelciusMethod ( vital sign response field )- master 2005 + if (temperatureCelciusMethod == 1) { return "Oral"; - } else if(temperatureCelciusMethod == 2){ + } else if (temperatureCelciusMethod == 2) { return "Axilla"; - } else if(temperatureCelciusMethod == 3){ + } else if (temperatureCelciusMethod == 3) { return "Rectal"; - } else if(temperatureCelciusMethod == 4){ + } else if (temperatureCelciusMethod == 4) { return "Tympanic"; - } else if(temperatureCelciusMethod == 5){ + } else if (temperatureCelciusMethod == 5) { return "Temporal"; } } - } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index a0cb98b3..9d3c9f00 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; 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/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; @@ -144,8 +146,11 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: () { - model.responseReferral(pendingReferral, true); + handler: () async { + await model.responseReferral(pendingReferral, true); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast(model.error); + } }, ), ), @@ -160,8 +165,11 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: () { - model.responseReferral(pendingReferral, false); + handler: () async { + await model.responseReferral(pendingReferral, true); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast(model.error); + } }, ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 2c3be5b1..43a51237 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1036,6 +1036,10 @@ class TranslationBase { String get chiefComplaintErrorMsg => localizedValues['chiefComplaintErrorMsg'][locale.languageCode]; + String get referralStatus => + localizedValues['referralStatus'][locale.languageCode]; + String get referralRemark => + localizedValues['referralRemark'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 17f33793..fb8276c8 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -37,25 +37,36 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Center( child: AppText( - "${patientName}", + patientName != null ? "${patientName}" : "", color: Colors.black, fontWeight: FontWeight.bold, fontSize: 16, ), ), if (referralStatus != null) - Container( - color: Color(0xFF4BA821), - padding: EdgeInsets.all(4), - child: AppText( - referralStatus - /*referralStatus == "46" - ? TranslationBase.of(context).approved - : TranslationBase.of(context).rejected*/, - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, - ), + Row( + children: [ + AppText( + TranslationBase.of(context).referralStatus, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Container( + color: Color(0xFF4BA821), + padding: EdgeInsets.all(4), + child: AppText( + referralStatus + /*referralStatus == "46" + ? TranslationBase.of(context).approved + : TranslationBase.of(context).rejected*/ + , + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ], ), SizedBox( height: 8, @@ -83,11 +94,26 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( height: 8, ), - AppText( - "${TranslationBase.of(context).dr} $referralDoctorName", - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 12, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).referralDoctor} : ", + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Expanded( + child: AppText( + referralDoctorName != null + ? "${TranslationBase.of(context).dr} $referralDoctorName" + : "", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ], ), SizedBox( height: 8, @@ -112,11 +138,21 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( height: 8, ), - AppText( - remark, - color: Colors.grey, - fontWeight: FontWeight.normal, - fontSize: 12, + Row( + children: [ + AppText( + TranslationBase.of(context).referralRemark, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + remark, + color: Colors.grey, + fontWeight: FontWeight.normal, + fontSize: 12, + ), + ], ), SizedBox( height: 16,