From f35eff1220df812e81567df4baa4c6905176ddb0 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 30 Dec 2020 15:50:59 +0200 Subject: [PATCH 1/8] working with admission request --- lib/core/service/admission-request-service.dart | 0 lib/core/viewModel/patient-admission-request-viewmodel.dart | 0 .../admission-request/admission-request-detail-screen.dart | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/core/service/admission-request-service.dart create mode 100644 lib/core/viewModel/patient-admission-request-viewmodel.dart create mode 100644 lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart diff --git a/lib/core/service/admission-request-service.dart b/lib/core/service/admission-request-service.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart new file mode 100644 index 00000000..e69de29b From 433b2933c48894bdd170b5407e8b446448b849d7 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 30 Dec 2020 15:51:36 +0200 Subject: [PATCH 2/8] working with admission request and some changes in vital signs --- lib/config/localized_values.dart | 3 + .../service/admission-request-service.dart | 5 + .../patient-admission-request-viewmodel.dart | 9 ++ .../patient-vital-sign-viewmodel.dart | 104 ++++++++++++------ lib/locator.dart | 4 + lib/routes.dart | 3 + .../admission-request-detail-screen.dart | 49 +++++++++ .../vital_sign/vital-signs-screen.dart | 22 +++- lib/util/translations_delegate_base.dart | 3 + .../profile/profile_medical_info_widget.dart | 15 ++- 10 files changed, 175 insertions(+), 42 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f2880c93..adc3c25e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -375,4 +375,7 @@ const Map> localizedValues = { 'fio2': {'en': "FIO2(%)", 'ar': 'FIO2(%)'}, 'sao2': {'en': "SAO2(%)", 'ar': 'SAO2(%)'}, 'painManagement': {'en': "Pain Management", 'ar': 'إدارة الألم'}, + 'admission': {'en': "Admission", 'ar': 'قبول'}, + 'request': {'en': "Request", 'ar': 'طلب'}, + 'admissionRequest': {'en': "Admission Request", 'ar': 'طلب قبول'}, }; diff --git a/lib/core/service/admission-request-service.dart b/lib/core/service/admission-request-service.dart index e69de29b..e98ac048 100644 --- a/lib/core/service/admission-request-service.dart +++ b/lib/core/service/admission-request-service.dart @@ -0,0 +1,5 @@ +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class AdmissionRequestService extends BaseService { + +} \ No newline at end of file diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index e69de29b..28aaae8a 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -0,0 +1,9 @@ +import 'package:doctor_app_flutter/core/service/admission-request-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class AdmissionRequestViewModel extends BaseViewModel{ + + AdmissionRequestService _admissionRequestService = locator(); +} \ No newline at end of file diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 05c98f0e..e58ad089 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -18,14 +18,16 @@ class VitalSignsViewModel extends BaseViewModel { Future getPatientArrivalList(String date, PatiantInformtion patient, {String fromDate}) async { - setState(ViewState.Busy); + // TODO when arrival list work un comment below lines + /* setState(ViewState.Busy); await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); } else { await getPatientVitalSign(patient); - } + }*/ + makeVitalSignDemoData(); } PatientArrivalEntity getPatientAppointmentEntity(PatiantInformtion patient) { @@ -60,41 +62,73 @@ class VitalSignsViewModel extends BaseViewModel { setState(ViewState.Error); } else { if (patientVitalSigns == null) { - _vitalSignService.patientVitalSigns = VitalSignData( - appointmentNo: 2016053265, - bloodPressureCuffLocation: 0, - bloodPressureCuffSize: 0, - bloodPressureHigher: 38, - bloodPressureLower: 32, - bloodPressurePatientPosition: 1, - bodyMassIndex: 31.11, - fio2: 0, - headCircumCm: 0, - heightCm: 150, - idealBodyWeightLbs: -2, - isPainManagementDone: false, - isVitalsRequired: true, - leanBodyWeightLbs: 0, - painCharacter: null, - painDuration: null, - painFrequency: null, - painLocation: null, - painScore: 0, - patientMRN: 3333274, - patientType: 1, - pulseBeatPerMinute: 0, - pulseRhythm: 0, - respirationBeatPerMinute: 0, - respirationPattern: 0, - sao2: 0, - status: 47, - temperatureCelcius: 40, - temperatureCelciusMethod: 1, - waistSizeInch: 39, - weightKg: 70, - ); + makeVitalSignDemoData(); } setState(ViewState.Idle); } } + + makeVitalSignDemoData(){ + _vitalSignService.patientVitalSigns = VitalSignData( + appointmentNo: 2016053265, + bloodPressureCuffLocation: 0, + bloodPressureCuffSize: 0, + bloodPressureHigher: 38, + bloodPressureLower: 32, + bloodPressurePatientPosition: 1, + bodyMassIndex: 31.11, + fio2: 0, + headCircumCm: 0, + heightCm: 150, + idealBodyWeightLbs: -2, + isPainManagementDone: false, + isVitalsRequired: true, + leanBodyWeightLbs: 0, + painCharacter: null, + painDuration: null, + painFrequency: null, + painLocation: null, + painScore: 0, + patientMRN: 3333274, + patientType: 1, + pulseBeatPerMinute: 0, + pulseRhythm: 0, + respirationBeatPerMinute: 0, + respirationPattern: 0, + sao2: 0, + status: 47, + temperatureCelcius: 40, + temperatureCelciusMethod: 1, + waistSizeInch: 39, + weightKg: 70, + ); + } + + String getBMI(double bodyMassIndex) { + if (bodyMassIndex <= 18.5) { + return "Underweight"; + } else if (bodyMassIndex <= 25.0) { + return "Normal"; + } else if (bodyMassIndex <= 30) { + return "Overweight"; + } else { // > 30.0 + return "Obese"; + } + } + + String getTempratureMethod(int temperatureCelciusMethod){ + // temperatureCelciusMethod ( vital sign response field )- master 2005 + if(temperatureCelciusMethod == 1){ + return "Oral"; + } else if(temperatureCelciusMethod == 2){ + return "Axilla"; + } else if(temperatureCelciusMethod == 3){ + return "Rectal"; + } else if(temperatureCelciusMethod == 4){ + return "Tympanic"; + } else if(temperatureCelciusMethod == 5){ + return "Temporal"; + } + } + } diff --git a/lib/locator.dart b/lib/locator.dart index 8bbf00b0..8c67b703 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; import 'core/service/SOAP_service.dart'; +import 'core/service/admission-request-service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; import 'core/service/patient-vital-signs-service.dart'; @@ -21,6 +22,7 @@ import 'core/service/schedule_service.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; +import 'core/viewModel/patient-admission-request-viewmodel.dart'; import 'core/viewModel/patient-vital-sign-viewmodel.dart'; import 'core/viewModel/patient-referral-viewmodel.dart'; import 'core/viewModel/referral_view_model.dart'; @@ -45,6 +47,7 @@ void setupLocator() { locator.registerLazySingleton(() => PrescriptionService()); locator.registerLazySingleton(() => ProcedureService()); locator.registerLazySingleton(() => VitalSignsService()); + locator.registerLazySingleton(() => AdmissionRequestService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -60,4 +63,5 @@ void setupLocator() { locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => ProcedureViewModel()); locator.registerFactory(() => VitalSignsViewModel()); + locator.registerFactory(() => AdmissionRequestViewModel()); } diff --git a/lib/routes.dart b/lib/routes.dart index ff0a60e9..8792e206 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -41,6 +41,7 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; +import 'screens/patients/profile/admission-request/admission-request-detail-screen.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; import 'screens/prescription/prescription_screen.dart'; @@ -81,6 +82,7 @@ const String PATIENT_INSURANCE_APPROVALS = const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String CREATE_EPISODE = 'patients/create-episode'; const String PATIENT_VITAL_SIGN = 'patients/vital-sign-data'; +const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -124,6 +126,7 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), + PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), CREATE_EPISODE: (_) => AddSOAPIndex(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart index e69de29b..dd628abf 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -0,0 +1,49 @@ +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.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-page-header-widget.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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AdmissionRequestDetailScreen extends StatefulWidget { + @override + _AdmissionRequestDetailScreenState createState() => _AdmissionRequestDetailScreenState(); +} + +class _AdmissionRequestDetailScreenState extends State { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: Column( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + ], + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).refer, + color: HexColor("#B8382B"), + onPressed: null, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart index c6b183b7..107e2e6b 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -207,6 +207,21 @@ class PatientVitalSignScreen extends StatelessWidget { color: Colors.grey.shade800, fontWeight: FontWeight.normal, ), + SizedBox( + width: 8, + ), + Container( + color: Colors.green, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 2, horizontal: 8), + child: AppText( + "${model.getBMI(model.patientVitalSigns.bodyMassIndex)}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ) ], ), ], @@ -251,7 +266,7 @@ class PatientVitalSignScreen extends StatelessWidget { SizedBox( height: 16, ), - TemperatureWidget(model.patientVitalSigns), + TemperatureWidget(model, model.patientVitalSigns), SizedBox( height: 16, ), @@ -349,9 +364,10 @@ class PatientVitalSignScreen extends StatelessWidget { } class TemperatureWidget extends StatefulWidget { + final VitalSignsViewModel model; final VitalSignData vitalSign; - TemperatureWidget(this.vitalSign); + TemperatureWidget(this.model, this.vitalSign); @override _TemperatureWidgetState createState() => _TemperatureWidgetState(); @@ -450,7 +466,7 @@ class _TemperatureWidgetState extends State { width: 8, ), AppText( - "${widget.vitalSign.temperatureCelciusMethod}", + "${widget.model.getTempratureMethod(widget.vitalSign.temperatureCelciusMethod)}", fontSize: SizeConfig.textMultiplier * 2, color: Colors.grey.shade800, fontWeight: FontWeight.normal, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 19818a0c..46f8a249 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -412,6 +412,9 @@ class TranslationBase { String get fio2 => localizedValues['fio2'][locale.languageCode]; String get sao2 => localizedValues['sao2'][locale.languageCode]; String get painManagement => localizedValues['painManagement'][locale.languageCode]; + String get admission => localizedValues['admission'][locale.languageCode]; + String get request => localizedValues['request'][locale.languageCode]; + String get admissionRequest => localizedValues['admissionRequest'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 5833f0d2..e76fe406 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -75,10 +75,17 @@ class ProfileMedicalInfoWidget extends StatelessWidget { PatientProfileButton( key: key, patient: patient, - route: PATIENT_INSURANCE_APPROVALS, - nameLine1: TranslationBase.of(context).insurance, - nameLine2: TranslationBase.of(context).approvals, - icon: 'lab.png'), + route: PATIENT_ADMISSION_REQUEST, + nameLine1: TranslationBase.of(context).admission, + nameLine2: TranslationBase.of(context).request, + icon: 'heartbeat.png'), + // PatientProfileButton( + // key: key, + // patient: patient, + // route: PATIENT_INSURANCE_APPROVALS, + // nameLine1: TranslationBase.of(context).insurance, + // nameLine2: TranslationBase.of(context).approvals, + // icon: 'lab.png'), PatientProfileButton( key: key, patient: patient, From 5142b5b6c7434efb291bb273ecba570d594bcf77 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 31 Dec 2020 13:38:47 +0200 Subject: [PATCH 3/8] finish admission request design --- lib/config/localized_values.dart | 23 + lib/core/enum/master_lookup_key.dart | 8 +- .../service/admission-request-service.dart | 5 - lib/core/service/base/lookup-service.dart | 20 +- .../patient-admission-request-service.dart | 31 ++ .../patient-admission-request-viewmodel.dart | 39 +- lib/locator.dart | 2 +- lib/routes.dart | 6 + .../admission-request-detail-screen.dart | 278 +++++++++++- .../admission-request-third-screen.dart | 208 +++++++++ .../admission-request_second-screen.dart | 402 ++++++++++++++++++ lib/util/helpers.dart | 45 ++ lib/util/translations_delegate_base.dart | 23 + 13 files changed, 1059 insertions(+), 31 deletions(-) delete mode 100644 lib/core/service/admission-request-service.dart create mode 100644 lib/core/service/patient-admission-request-service.dart create mode 100644 lib/screens/patients/profile/admission-request/admission-request-third-screen.dart create mode 100644 lib/screens/patients/profile/admission-request/admission-request_second-screen.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index adc3c25e..c84307a5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -278,6 +278,7 @@ const Map> localizedValues = { "sick-leave-days": {"en": "Sick leave days", "ar": "عدد ايام الاجازة."}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, + 'date': {'en': 'Date', 'ar': 'التاريخ'}, 'admissionNo': {'en': 'ADMISSION #: ', 'ar': 'قبول #:'}, 'losNo': {'en': 'LOS #:', 'ar': 'LOS #:'}, 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, @@ -378,4 +379,26 @@ const Map> localizedValues = { 'admission': {'en': "Admission", 'ar': 'قبول'}, 'request': {'en': "Request", 'ar': 'طلب'}, 'admissionRequest': {'en': "Admission Request", 'ar': 'طلب قبول'}, + 'patientDetails': {'en': "Patient Details", 'ar': 'تفاصيل المريض'}, + 'specialityAndDoctorDetail': {'en': "SPECIALITY AND DOCTOR DETAILS", 'ar': 'تفاصيل التخصص والطبيب'}, + 'referringDate': {'en': "Referring Date", 'ar': 'تاريخ الإحالة'}, + 'referringDoctor': {'en': "Referring Doctor", 'ar': 'دكتور الإحالة'}, + 'otherInformation': {'en': "Other Information", 'ar': 'معلومات أخرى'}, + 'expectedDays': {'en': "Expected Days", 'ar': 'الأيام المتوقعة'}, + 'expectedAdmissionDate': {'en': "Expected Admission Date", 'ar': 'تاريخ القبول المتوقع'}, + 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, + 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'حمل المريض'}, + 'treatmentLine': {'en': "Main line of treatment", 'ar': 'الخط الرئيسي للعلاج'}, + 'ward': {'en': "Ward", 'ar': 'رعاية'}, + 'preAnesthesiaReferred': {'en': "PRE ANESTHESIA REFERRED", 'ar': 'الاحالة قبل التخدير'}, + 'admissionType': {'en': "Admission Type", 'ar': 'نوع القبول'}, + 'diagnosis': {'en': "Diagnosis", 'ar': 'التشخيص'}, + 'allergies': {'en': "Allergies", 'ar': 'الحساسية'}, + 'preOperativeOrders': {'en': "Pre Operative Orders", 'ar': 'أوامر ما قبل العملية'}, + 'elementForImprovement': {'en': "Element For Improvement", 'ar': 'عنصر للتحسين'}, + 'dischargeDate': {'en': "Discharge Date", 'ar': 'تاريخ التفريغ'}, + 'dietType': {'en': "Diet Type", 'ar': 'نوع النظام الغذائي'}, + 'dietTypeRemarks': {'en': "Remarks on diet type", 'ar': 'ملاحظات على نوع النظام الغذائي'}, + 'save': {'en': "SAVE", 'ar': 'حفظ'}, + 'postPlansEstimatedCost': {'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة'}, }; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 8f5d76f8..f1ba1d46 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -10,7 +10,9 @@ enum MasterKeysService { physiotherapyGoals, DiagnosisCondition, DiagnosisType, - ICD10 + ICD10, + TemperatureMethods, + Speciality } extension SelectedMasterKeysService on MasterKeysService { @@ -51,6 +53,10 @@ extension SelectedMasterKeysService on MasterKeysService { break; case MasterKeysService.ICD10: return 2500; + case MasterKeysService.TemperatureMethods: + return 2005; + case MasterKeysService.Speciality: + return 10; break; } } diff --git a/lib/core/service/admission-request-service.dart b/lib/core/service/admission-request-service.dart deleted file mode 100644 index e98ac048..00000000 --- a/lib/core/service/admission-request-service.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; - -class AdmissionRequestService extends BaseService { - -} \ No newline at end of file diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index d677201b..df8ebc38 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -34,6 +34,8 @@ class LookupService extends BaseService { List listOfDiagnosisType = []; List listOfDiagnosisCondition = []; List listOfICD10 = []; + List listOfTemperatureMethods = []; + List listOfSpeciality = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -121,13 +123,27 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; - case MasterKeysService.ICD10: - listOfICD10.clear(); + case MasterKeysService.ICD10: + listOfICD10.clear(); entryList.forEach((v) { listOfICD10 .add(MasterKeyModel.fromJson(v)); }); break; + case MasterKeysService.TemperatureMethods: + listOfTemperatureMethods.clear(); + entryList.forEach((v) { + listOfTemperatureMethods + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.Speciality: + listOfSpeciality.clear(); + entryList.forEach((v) { + listOfSpeciality + .add(MasterKeyModel.fromJson(v)); + }); + break; } } } diff --git a/lib/core/service/patient-admission-request-service.dart b/lib/core/service/patient-admission-request-service.dart new file mode 100644 index 00000000..62932908 --- /dev/null +++ b/lib/core/service/patient-admission-request-service.dart @@ -0,0 +1,31 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; + +class AdmissionRequestService extends LookupService { + List doctorsList = []; + List specialityList = []; + + setSpecialityList() { + specialityList.clear(); + listOfSpeciality.forEach((element) { + specialityList.add(element.toJson()); + }); + } + + Future getDoctorsList() async { + hasError = false; + + await baseAppClient.post( + PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = []; + doctorsList = response['List_Doctors_All']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } +} diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index 28aaae8a..15f54e5d 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -1,9 +1,46 @@ -import 'package:doctor_app_flutter/core/service/admission-request-service.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/service/patient-admission-request-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import '../../locator.dart'; class AdmissionRequestViewModel extends BaseViewModel{ AdmissionRequestService _admissionRequestService = locator(); + + List get doctorsList => _admissionRequestService.doctorsList; + + List get speciality => _admissionRequestService.specialityList; + + String selectedLanguage; + + Future getLanguage() async { + selectedLanguage = await sharedPref.getString(APP_Language); + } + + Future getMasterLookup() async { + setState(ViewState.Busy); + await getLanguage(); + await _admissionRequestService.getMasterLookup(MasterKeysService.Speciality); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.Error); + } else { + _admissionRequestService.setSpecialityList(); + await getClinicDoctors(); + } + } + + Future getClinicDoctors() async { + setState(ViewState.Busy); + await _admissionRequestService.getDoctorsList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 8c67b703..0b932a62 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -11,7 +11,7 @@ import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; import 'core/service/SOAP_service.dart'; -import 'core/service/admission-request-service.dart'; +import 'core/service/patient-admission-request-service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; import 'core/service/patient-vital-signs-service.dart'; diff --git a/lib/routes.dart b/lib/routes.dart index 52183a63..ff03096f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -42,6 +42,8 @@ import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; import 'screens/patients/profile/admission-request/admission-request-detail-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; import 'screens/prescription/prescription_screen.dart'; @@ -84,6 +86,8 @@ const String CREATE_EPISODE = 'patients/create-episode'; const String PATIENT_VITAL_SIGN = 'patients/vital-sign-data'; const String UPDATE_EPISODE = 'patients/create-episode'; const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; +const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; +const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -129,6 +133,8 @@ var routes = { VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), + PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), + PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), CREATE_EPISODE: (_) => AddSOAPIndex(), UPDATE_EPISODE: (_) => AddSOAPIndex(isUpdate: true,), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart index dd628abf..9a474779 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -1,49 +1,285 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.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/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/patient-page-header-widget.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/dialogs/dailog-list-select.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../routes.dart'; +import 'admission-request_second-screen.dart'; + class AdmissionRequestDetailScreen extends StatefulWidget { @override - _AdmissionRequestDetailScreenState createState() => _AdmissionRequestDetailScreenState(); + _AdmissionRequestDetailScreenState createState() => + _AdmissionRequestDetailScreenState(); } -class _AdmissionRequestDetailScreenState extends State { +class _AdmissionRequestDetailScreenState + extends State { + DateTime selectedDate; + dynamic _selectedSpeciality; + dynamic _selectedDoctor; + @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) => model.getMasterLookup(), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, - body: Column( - children: [ - SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, + body: model.doctorsList != null + ? Column( children: [ - PatientPageHeaderWidget(patient), + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + decoration: + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + "Pre Admission Number :01", + null, + false), + enabled: false, + // controller: _remarksController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => _selectDate(context, model), + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.speciality, + attributeName: model.selectedLanguage == 'ar' ? 'nameAr' :'nameEn' , + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedSpeciality = + selectedValue; + }); + }); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .speciality, + _selectedSpeciality != null + ? model.selectedLanguage == 'ar' ? _selectedSpeciality['nameAr'] : _selectedSpeciality['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).doctor, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + decoration: + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), + child: InkWell( + onTap: () => null, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).referringDate, + null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Color(0xFFCCCCCC), + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + decoration: + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).referringDoctor, + null, + true, dropDownColor: Color(0xFFCCCCCC)), + enabled: false, + // controller: _remarksController, + keyboardType: TextInputType.text, + )), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: (){ + Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {'patient': patient}); + }, + ), + ), ], - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).refer, - color: HexColor("#B8382B"), - onPressed: null, - ), - ), - ], - ), - ), + ) + : Container(), + ), + ); + } + + _selectDate(BuildContext context, AdmissionRequestViewModel model) async { + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } } } diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart new file mode 100644 index 00000000..aacff6dd --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -0,0 +1,208 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.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/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/patient-page-header-widget.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:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AdmissionRequestThirdScreen extends StatefulWidget { + @override + _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); +} + +class _AdmissionRequestThirdScreenState extends State { + + final _postPlansEstimatedCostController = TextEditingController(); + final _dietTypeRemarksController = TextEditingController(); + DateTime _dischargeDate; + dynamic _selectedDietType; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + // onModelReady: (model) => model.getMasterLookup(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: model.doctorsList != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).postPlansEstimatedCost, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .postPlansEstimatedCost, + null, + false), + enabled: true, + controller: _postPlansEstimatedCostController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_dischargeDate == null) { + _dischargeDate = DateTime.now(); + } + _selectDate( + context, _dischargeDate, + (picked) { + setState(() { + _dischargeDate = picked; + }); + }); + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _dischargeDate != null + ? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: /*model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + :*/ null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).dietType, + /* _admissionType != null + ? _admissionType['DoctorName'] + :*/ null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietTypeRemarks, + null, + false), + enabled: true, + controller: _dietTypeRemarksController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).save, + color: HexColor("#B8382B"), + onPressed: null, + ), + ), + ], + ) + : Container(), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart new file mode 100644 index 00000000..52995ab4 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -0,0 +1,402 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.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/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/patient-page-header-widget.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:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestSecondScreen extends StatefulWidget { + @override + _AdmissionRequestSecondScreenState createState() => + _AdmissionRequestSecondScreenState(); +} + +class _AdmissionRequestSecondScreenState + extends State { + final _expectedDaysController = TextEditingController(); + final _treatmentLineController = TextEditingController(); + final _preOperativeOrdersController = TextEditingController(); + DateTime _expectedAdmissionDate; + bool _emergencyAdmission = false; + bool _patientPregnant = false; + bool _preAnesthesiaReferred = false; + dynamic _selectedWard; + dynamic _selectedAdmissionType; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + // onModelReady: (model) => model.getMasterLookup(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: model.doctorsList != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherInformation, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedDays, + null, + false), + enabled: true, + controller: _expectedDaysController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate( + context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; + }); + }); + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .emergencyAdmission, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _emergencyAdmission, + onChanged: (newValue) { + setState(() { + _emergencyAdmission = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .patientPregnant, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _patientPregnant, + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).treatmentLine, + null, + false), + enabled: true, + controller: _treatmentLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: /*model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + :*/ null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).ward, + /* _selectedWard != null + ? _selectedWard['DoctorName'] + :*/ null, + true), + enabled: false, + ), + ), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .preAnesthesiaReferred, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _preAnesthesiaReferred, + onChanged: (newValue) { + setState(() { + _preAnesthesiaReferred = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: /*model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + :*/ null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).admissionType, + /* _admissionType != null + ? _admissionType['DoctorName'] + :*/ null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: /*model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + :*/ null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnosis, + /* _admissionType != null + ? _admissionType['DoctorName'] + :*/ null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).preOperativeOrders, + null, + false), + enabled: true, + controller: _preOperativeOrdersController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: /*model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + :*/ null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).allergies, + /* _admissionType != null + ? _admissionType['DoctorName'] + :*/ null, + true), + enabled: false, + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: (){ + Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); + }, + ), + ), + ], + ) + : Container(), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } +} diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index c1d70cef..a2692c74 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -352,4 +352,49 @@ class Helpers { // TODO Fix it // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } + + static InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon, Color dropDownColor}) { + 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 + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: dropDownColor != null ? dropDownColor : Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + static BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor, {double borderWidth = -1}) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: borderWidth == -1 ? 2.0 : borderWidth, + )), + ); + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 46f8a249..aeba8212 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -316,6 +316,7 @@ class TranslationBase { String get admissionDetail => localizedValues['admissionDetail'][locale.languageCode]; String get dateTime => localizedValues['dateTime'][locale.languageCode]; + String get date => localizedValues['date'][locale.languageCode]; String get admissionNo => localizedValues['admissionNo'][locale.languageCode]; String get losNo => localizedValues['losNo'][locale.languageCode]; String get area => localizedValues['area'][locale.languageCode]; @@ -415,6 +416,28 @@ class TranslationBase { String get admission => localizedValues['admission'][locale.languageCode]; String get request => localizedValues['request'][locale.languageCode]; String get admissionRequest => localizedValues['admissionRequest'][locale.languageCode]; + String get patientDetails => localizedValues['patientDetails'][locale.languageCode]; + String get specialityAndDoctorDetail => localizedValues['specialityAndDoctorDetail'][locale.languageCode]; + String get referringDate => localizedValues['referringDate'][locale.languageCode]; + String get referringDoctor => localizedValues['referringDoctor'][locale.languageCode]; + String get otherInformation => localizedValues['otherInformation'][locale.languageCode]; + String get expectedDays => localizedValues['expectedDays'][locale.languageCode]; + String get expectedAdmissionDate => localizedValues['expectedAdmissionDate'][locale.languageCode]; + String get emergencyAdmission => localizedValues['emergencyAdmission'][locale.languageCode]; + String get patientPregnant => localizedValues['patientPregnant'][locale.languageCode]; + String get treatmentLine => localizedValues['treatmentLine'][locale.languageCode]; + String get ward => localizedValues['ward'][locale.languageCode]; + String get preAnesthesiaReferred => localizedValues['preAnesthesiaReferred'][locale.languageCode]; + String get admissionType => localizedValues['admissionType'][locale.languageCode]; + String get diagnosis => localizedValues['diagnosis'][locale.languageCode]; + String get allergies => localizedValues['allergies'][locale.languageCode]; + String get preOperativeOrders => localizedValues['preOperativeOrders'][locale.languageCode]; + String get elementForImprovement => localizedValues['elementForImprovement'][locale.languageCode]; + String get dischargeDate => localizedValues['dischargeDate'][locale.languageCode]; + String get dietType => localizedValues['dietType'][locale.languageCode]; + String get dietTypeRemarks => localizedValues['dietTypeRemarks'][locale.languageCode]; + String get save => localizedValues['save'][locale.languageCode]; + String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From cb4ee05b409c0f8ce21cb4e609faaf99e400c160 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 31 Dec 2020 17:52:32 +0200 Subject: [PATCH 4/8] working on ucaf --- lib/config/localized_values.dart | 1 + lib/core/service/patient-ucaf-service.dart | 5 ++++ .../viewModel/patient-ucaf-viewmodel.dart | 9 ++++++ lib/locator.dart | 4 +++ lib/routes.dart | 3 ++ .../profile/UCAF/UCAF-input-screen.dart | 28 +++++++++++++++++++ lib/util/translations_delegate_base.dart | 1 + .../profile/profile_medical_info_widget.dart | 9 ++++++ 8 files changed, 60 insertions(+) create mode 100644 lib/core/service/patient-ucaf-service.dart create mode 100644 lib/core/viewModel/patient-ucaf-viewmodel.dart create mode 100644 lib/screens/patients/profile/UCAF/UCAF-input-screen.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c84307a5..453cef8f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -401,4 +401,5 @@ const Map> localizedValues = { 'dietTypeRemarks': {'en': "Remarks on diet type", 'ar': 'ملاحظات على نوع النظام الغذائي'}, 'save': {'en': "SAVE", 'ar': 'حفظ'}, 'postPlansEstimatedCost': {'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة'}, + 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, }; diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart new file mode 100644 index 00000000..e776720c --- /dev/null +++ b/lib/core/service/patient-ucaf-service.dart @@ -0,0 +1,5 @@ +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class UcafService extends BaseService { + +} \ No newline at end of file diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart new file mode 100644 index 00000000..cf11854b --- /dev/null +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -0,0 +1,9 @@ +import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class UcafViewModel extends BaseViewModel { + + UcafService _ucafService = locator(); +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 0b932a62..7225f1d9 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -14,6 +14,7 @@ import 'core/service/SOAP_service.dart'; import 'core/service/patient-admission-request-service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; +import 'core/service/patient-ucaf-service.dart'; import 'core/service/patient-vital-signs-service.dart'; import 'core/service/patient-doctor-referral-service.dart'; import 'core/service/referral_patient_service.dart'; @@ -23,6 +24,7 @@ import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; import 'core/viewModel/patient-admission-request-viewmodel.dart'; +import 'core/viewModel/patient-ucaf-viewmodel.dart'; import 'core/viewModel/patient-vital-sign-viewmodel.dart'; import 'core/viewModel/patient-referral-viewmodel.dart'; import 'core/viewModel/referral_view_model.dart'; @@ -48,6 +50,7 @@ void setupLocator() { locator.registerLazySingleton(() => ProcedureService()); locator.registerLazySingleton(() => VitalSignsService()); locator.registerLazySingleton(() => AdmissionRequestService()); + locator.registerLazySingleton(() => UcafService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -64,4 +67,5 @@ void setupLocator() { locator.registerFactory(() => ProcedureViewModel()); locator.registerFactory(() => VitalSignsViewModel()); locator.registerFactory(() => AdmissionRequestViewModel()); + locator.registerFactory(() => UcafViewModel()); } diff --git a/lib/routes.dart b/lib/routes.dart index ff03096f..a8def67f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; @@ -88,6 +89,7 @@ const String UPDATE_EPISODE = 'patients/create-episode'; const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; +const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -149,4 +151,5 @@ var routes = { // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), + PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), }; diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart new file mode 100644 index 00000000..f48fadb0 --- /dev/null +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -0,0 +1,28 @@ +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class UCAFInputScreen extends StatefulWidget { + @override + _UCAFInputScreenState createState() => _UCAFInputScreenState(); +} + +class _UCAFInputScreenState extends State { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).ucaf, + body: Container(), + ), + ); + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7e61362b..a67463a0 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -438,6 +438,7 @@ class TranslationBase { String get dietTypeRemarks => localizedValues['dietTypeRemarks'][locale.languageCode]; String get save => localizedValues['save'][locale.languageCode]; String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; + String get ucaf => localizedValues['ucaf'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 78334e5f..dd12e6cf 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -137,6 +137,15 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).patientSick, nameLine2: TranslationBase.of(context).leave, icon: 'sick_leaves_icons.png')), + Visibility( + visible: selectedPatientType != 0 && selectedPatientType != 5, + child: PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_UCAF_REQUEST, + nameLine1: TranslationBase.of(context).patient, + nameLine2: TranslationBase.of(context).ucaf, + icon: 'lab.png')), ]); } } From 3cadd532d8cd61f21126fd9c813ac05634360e3f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Fri, 1 Jan 2021 16:38:59 +0200 Subject: [PATCH 5/8] finish Updating --- lib/core/service/SOAP_service.dart | 12 +- lib/core/viewModel/SOAP_view_model.dart | 37 +-- lib/models/SOAP/GetAssessmentReqModel.dart | 40 +++ lib/models/SOAP/GetAssessmentResModel.dart | 72 +++++ .../subjective/update_subjective_page.dart | 73 ++--- .../soap_update/update_assessment_page.dart | 296 +++++++++++------- .../soap_update/update_objective_page.dart | 9 +- 7 files changed, 341 insertions(+), 198 deletions(-) create mode 100644 lib/models/SOAP/GetAssessmentReqModel.dart create mode 100644 lib/models/SOAP/GetAssessmentResModel.dart diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 09530d50..426e0811 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.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/GetHistoryReqModel.dart'; @@ -27,6 +29,7 @@ class SOAPService extends LookupService { List patientHistoryList = []; List patientPhysicalExamList = []; List patientProgressNoteList = []; + List patientAssessmentList = []; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( @@ -266,6 +269,7 @@ class SOAPService extends LookupService { response['ProgressNoteList']['entityList'].forEach((v) { patientProgressNoteList.add(GetGetProgressNoteResModel.fromJson(v)); }); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -273,14 +277,18 @@ class SOAPService extends LookupService { } Future getPatientAssessment( - PostAssessmentRequestModel getPatientAssessmentRequestModel) async { + GetAssessmentReqModel getAssessmentReqModel) async { hasError = false; await baseAppClient.post (GET_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientAssessmentRequestModel.toJson()); + }, body: getAssessmentReqModel.toJson()); } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 8d03a04e..697e9934 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.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/GetHistoryReqModel.dart'; @@ -64,14 +66,19 @@ class SOAPViewModel extends BaseViewModel { List get patientAllergiesList => _SOAPService.patientAllergiesList; + List get patientHistoryList => _SOAPService.patientHistoryList; - List get patientPhysicalExamList => + + List get patientPhysicalExamList => _SOAPService.patientPhysicalExamList; - List get patientProgressNoteList => + List get patientProgressNoteList => _SOAPService.patientProgressNoteList; + List get patientAssessmentList => + _SOAPService.patientAssessmentList; + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); await _SOAPService.getAllergies(getAllergiesRequestModel); @@ -266,9 +273,9 @@ class SOAPViewModel extends BaseViewModel { } Future getPatientAssessment( - PostAssessmentRequestModel getPatientAssessmentRequestModel) async { + GetAssessmentReqModel getAssessmentReqModel) async { setState(ViewState.Busy); - await _SOAPService.getPatientAssessment(getPatientAssessmentRequestModel); + await _SOAPService.getPatientAssessment(getAssessmentReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.Busy); @@ -276,14 +283,12 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - // ignore: missing_return MasterKeyModel getOneMasterKey( - {@required MasterKeysService masterKeys, int id, int typeId}) { + {@required MasterKeysService masterKeys, dynamic id, int typeId}) { switch (masterKeys) { case MasterKeysService.Allergies: List result = allergiesList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -294,7 +299,6 @@ class SOAPViewModel extends BaseViewModel { case MasterKeysService.HistoryFamily: List result = historyFamilyList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -304,7 +308,6 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistoryMedical: List result = historyMedicalList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -314,7 +317,6 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistorySocial: List result = historySocialList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -324,7 +326,6 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistorySports: List result = historySocialList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -334,17 +335,13 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistorySurgical: List result = historySurgicalList.where((element) { - print(element.id == id); - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); - }).toList(); + return element.id == id;}).toList(); if (result.isNotEmpty) { return result.first; } break; case MasterKeysService.PhysicalExamination: List result = physicalExaminationList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -354,7 +351,6 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.AllergySeverity: List result = allergySeverityList.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -371,7 +367,6 @@ class SOAPViewModel extends BaseViewModel { case MasterKeysService.DiagnosisType: List result = listOfDiagnosisType.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -381,7 +376,6 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.DiagnosisCondition: List result = listOfDiagnosisCondition.where((element) { - print(element.id == id); return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); @@ -390,11 +384,8 @@ class SOAPViewModel extends BaseViewModel { } break; case MasterKeysService.ICD10: - listOfICD10.clear(); List result = listOfICD10.where((element) { - print(element.id == id); - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.code == id ; }).toList(); if (result.isNotEmpty) { return result.first; diff --git a/lib/models/SOAP/GetAssessmentReqModel.dart b/lib/models/SOAP/GetAssessmentReqModel.dart new file mode 100644 index 00000000..1085bf8c --- /dev/null +++ b/lib/models/SOAP/GetAssessmentReqModel.dart @@ -0,0 +1,40 @@ +class GetAssessmentReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + int clinicID; + int doctorID; + + GetAssessmentReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.doctorID}); + + GetAssessmentReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + return data; + } +} diff --git a/lib/models/SOAP/GetAssessmentResModel.dart b/lib/models/SOAP/GetAssessmentResModel.dart new file mode 100644 index 00000000..4d1b1b68 --- /dev/null +++ b/lib/models/SOAP/GetAssessmentResModel.dart @@ -0,0 +1,72 @@ +class GetAssessmentResModel { + int appointmentNo; + String asciiDesc; + String clinicDescription; + int clinicID; + bool complexDiagnosis; + int conditionID; + int createdBy; + String createdOn; + int diagnosisTypeID; + int doctorID; + String doctorName; + int episodeId; + String icdCode10ID; + int patientMRN; + String remarks; + + GetAssessmentResModel( + {this.appointmentNo, + this.asciiDesc, + this.clinicDescription, + this.clinicID, + this.complexDiagnosis, + this.conditionID, + this.createdBy, + this.createdOn, + this.diagnosisTypeID, + this.doctorID, + this.doctorName, + this.episodeId, + this.icdCode10ID, + this.patientMRN, + this.remarks}); + + GetAssessmentResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + asciiDesc = json['ascii_Desc']; + clinicDescription = json['clinicDescription']; + clinicID = json['clinicID']; + complexDiagnosis = json['complexDiagnosis']; + conditionID = json['conditionID']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + diagnosisTypeID = json['diagnosisTypeID']; + doctorID = json['doctorID']; + doctorName = json['doctorName']; + episodeId = json['episodeId']; + icdCode10ID = json['icdCode10ID']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['ascii_Desc'] = this.asciiDesc; + data['clinicDescription'] = this.clinicDescription; + data['clinicID'] = this.clinicID; + data['complexDiagnosis'] = this.complexDiagnosis; + data['conditionID'] = this.conditionID; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['diagnosisTypeID'] = this.diagnosisTypeID; + data['doctorID'] = this.doctorID; + data['doctorName'] = this.doctorName; + data['episodeId'] = this.episodeId; + data['icdCode10ID'] = this.icdCode10ID; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} 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 1339c2f2..2236098a 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 @@ -50,28 +50,12 @@ class _UpdateSubjectivePageState extends State { TextEditingController complaintsController = TextEditingController(); final formKey = GlobalKey(); getHistory(SOAPViewModel model) async{ - GetHistoryReqModel getHistoryMedicalReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - historyType: - MasterKeysService.HistoryMedical.getMasterKeyService()); - GetHistoryReqModel getHistorySportsReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - historyType: - MasterKeysService.HistorySports.getMasterKeyService()); - GetHistoryReqModel getHistorySurgicalReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - historyType: - MasterKeysService.HistorySurgical.getMasterKeyService()); - GetHistoryReqModel getHistoryFamilyReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - historyType: - MasterKeysService.HistoryFamily.getMasterKeyService()); - await model.getPatientHistories(getHistoryMedicalReqModel); - await model.getPatientHistories(getHistorySportsReqModel); - await model.getPatientHistories(getHistorySurgicalReqModel); - await model.getPatientHistories(getHistoryFamilyReqModel); + GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + ); + await model.getPatientHistories(getHistoryReqModel); - if(model.patientHistoryList.isNotEmpty) { + if (model.patientHistoryList.isNotEmpty) { if (model.historyFamilyList.isEmpty) { await model.getMasterLookup(MasterKeysService.HistoryFamily); } @@ -390,41 +374,27 @@ class _UpdateSubjectivePageState extends State { await postChiefComplaint(model: model); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - } else { - if (myHistoryList.length != 0) { - await postHistories(model: model, myHistoryList: myHistoryList); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - if (myAllergiesList.length != 0) { - await postAllergy(myAllergiesList: myAllergiesList, model: model); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changePageViewIndex(1); - } - } else { - widget.changePageViewIndex(1); - } - } - } else { - if (myAllergiesList.length != 0) { - await postAllergy(myAllergiesList: myAllergiesList, model: model); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changePageViewIndex(1); - } - } else { - widget.changePageViewIndex(1); - } + } + + if (myHistoryList.length != 0) { + await postHistories(model: model, myHistoryList: myHistoryList); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + if (myAllergiesList.length != 0) { + await postAllergy(myAllergiesList: myAllergiesList, model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); } } + + widget.changePageViewIndex(1); + } else { helpers.showErrorToast('Please add required field correctly'); } - widget.changePageViewIndex(1); } @@ -487,13 +457,12 @@ class _UpdateSubjectivePageState extends State { }); - if (model.patientAllergiesList.isEmpty) { + if (model.patientHistoryList.isEmpty) { await model.postHistories(postHistoriesRequestModel); } else { await model.patchHistories(postHistoriesRequestModel); } - await model.patchHistories(postHistoriesRequestModel); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); 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 61c7f20b..c25b0d5b 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -4,6 +4,7 @@ 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/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'; @@ -36,19 +37,53 @@ class UpdateAssessmentPage extends StatefulWidget { class _UpdateAssessmentPageState extends State { bool isAssessmentExpand = false; - - List assessmentList; - dynamic _referTo; - - TextEditingController remarksController = TextEditingController(); - @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) async{ + + widget.mySelectedAssessment.appointmentId =widget.patientInfo.appointmentNo; + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + await model.getPatientAssessment(getAssessmentReqModel); + if(model.patientAssessmentList.isNotEmpty){ + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } + + MasterKeyModel selectedICD = model.getOneMasterKey( + masterKeys: MasterKeysService.ICD10, + id: model.patientAssessmentList[0].icdCode10ID, + ); + widget.mySelectedAssessment.selectedICD= selectedICD; + MasterKeyModel diagnosisCondition = model.getOneMasterKey( + masterKeys: MasterKeysService.DiagnosisCondition, + id: model.patientAssessmentList[0].conditionID, + ); + + widget.mySelectedAssessment.selectedDiagnosisCondition = diagnosisCondition; + MasterKeyModel diagnosisType = model.getOneMasterKey( + masterKeys: MasterKeysService.DiagnosisType, + id: model.patientAssessmentList[0].diagnosisTypeID, + ); + + widget.mySelectedAssessment.selectedDiagnosisType = diagnosisType; + widget.mySelectedAssessment.remark = model.patientAssessmentList[0].remarks; + } + }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, + baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -58,66 +93,67 @@ class _UpdateAssessmentPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts('ASSESSMENT', - variant: + Row( + children: [ + Texts('ASSESSMENT', + variant: isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) + bold: isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); + }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) ], ), - InkWell( - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: TextFields( - hintText: "Add ASSESSMENT", - fontSize: 13.5, - onTapTextFields: () { - openAssessmentDialog(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) - .emptyMessage; - else - return null; - }), + child: TextFields( + hintText: "Add ASSESSMENT", + fontSize: 13.5, + onTapTextFields: () { + openAssessmentDialog(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) + .emptyMessage; + else + return null; + }), ), SizedBox( height: 20, @@ -242,7 +278,7 @@ class _UpdateAssessmentPageState extends State { height: 6, ), AppText( - widget.mySelectedAssessment.remark, + widget.mySelectedAssessment.remark??"", fontSize: 10, color: Colors.grey, ), @@ -263,7 +299,7 @@ class _UpdateAssessmentPageState extends State { fontSize: 16, ), AppText( - "R07.1".toUpperCase(), + widget.mySelectedAssessment.selectedICD.code.toUpperCase()??"", fontSize: 10, color: Colors.grey, ), @@ -291,44 +327,68 @@ class _UpdateAssessmentPageState extends State { isExpand: isAssessmentExpand, ), DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitAssessment(model); - }, - ), - SizedBox( - height: 30, + height: 30, + ), + AppButton( + title: TranslationBase + .of(context) + .next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitAssessment(model); + }, + ), + SizedBox( + height: 30, + ), + ], ), - ], + ), ), - ), - ), - ))); + ))); } submitAssessment(SOAPViewModel model) async { if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && - widget.mySelectedAssessment.selectedDiagnosisType != null) { - PatchAssessmentReqModel patchAssessmentReqModel = - new PatchAssessmentReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: widget.mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: - widget.mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: - widget.mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: "1", - prevIcdCode10ID: "1" - ); + widget.mySelectedAssessment.selectedDiagnosisType != null && widget.mySelectedAssessment.selectedICD !=null ) { + + if(model.patientAssessmentList.isEmpty){ + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ + new IcdCodeDetails( + remarks: widget.mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + widget.mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + widget.mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: widget.mySelectedAssessment.selectedICD.code) + ]); + + await model.postAssessment(postAssessmentRequestModel); + } else { + PatchAssessmentReqModel patchAssessmentReqModel = + PatchAssessmentReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: widget.mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + widget.mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + widget.mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: widget.mySelectedAssessment.selectedICD.code, + prevIcdCode10ID: model.patientAssessmentList[0].icdCode10ID + ); + + await model.patchAssessment(patchAssessmentReqModel); + } - await model.patchAssessment(patchAssessmentReqModel); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); @@ -363,9 +423,9 @@ class _UpdateAssessmentPageState extends State { class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final Function() addSelectedAssessment; - + final PatiantInformtion patientInfo; const AddAssessmentDetails( - {Key key, this.mySelectedAssessment, this.addSelectedAssessment}) + {Key key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo}) : super(key: key); @override @@ -376,13 +436,13 @@ class _AddAssessmentDetailsState extends State { // MasterKeyModel _selectedDiagnosisCondition; // MasterKeyModel _selectedDiagnosisType; TextEditingController remarkController = TextEditingController(); - TextEditingController appointmentIdController = TextEditingController( - text: "234567"); + TextEditingController appointmentIdController = TextEditingController(); GlobalKey key = new GlobalKey>(); @override Widget build(BuildContext context) { remarkController.text = widget.mySelectedAssessment.remark??""; + appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString(); final screenSize = MediaQuery .of(context) .size; @@ -644,7 +704,7 @@ class _AddAssessmentDetailsState extends State { class PatchAssessmentReqModel { int patientMRN; int appointmentNo; - int episodeId; + int episodeID; String icdcode10Id; String prevIcdCode10ID; int conditionId; @@ -655,7 +715,7 @@ class PatchAssessmentReqModel { PatchAssessmentReqModel( {this.patientMRN, this.appointmentNo, - this.episodeId, + this.episodeID, this.icdcode10Id, this.prevIcdCode10ID, this.conditionId, @@ -664,28 +724,28 @@ class PatchAssessmentReqModel { this.remarks}); PatchAssessmentReqModel.fromJson(Map json) { - patientMRN = json['patientMRN']; - appointmentNo = json['appointmentNo']; - episodeId = json['episodeId']; - icdcode10Id = json['icdcode10Id']; - prevIcdCode10ID = json['prevIcdCode10ID']; - conditionId = json['conditionId']; - diagnosisTypeId = json['diagnosisTypeId']; - complexDiagnosis = json['complexDiagnosis']; - remarks = json['remarks']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + icdcode10Id = json['Icdcode10Id']; + prevIcdCode10ID = json['PrevIcdCode10ID']; + conditionId = json['ConditionId']; + diagnosisTypeId = json['DiagnosisTypeId']; + complexDiagnosis = json['ComplexDiagnosis']; + remarks = json['Remarks']; } Map toJson() { final Map data = new Map(); - data['patientMRN'] = this.patientMRN; - data['appointmentNo'] = this.appointmentNo; - data['episodeId'] = this.episodeId; - data['icdcode10Id'] = this.icdcode10Id; - data['prevIcdCode10ID'] = this.prevIcdCode10ID; - data['conditionId'] = this.conditionId; - data['diagnosisTypeId'] = this.diagnosisTypeId; - data['complexDiagnosis'] = this.complexDiagnosis; - data['remarks'] = this.remarks; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['Icdcode10Id'] = this.icdcode10Id; + data['PrevIcdCode10ID'] = this.prevIcdCode10ID; + data['ConditionId'] = this.conditionId; + data['DiagnosisTypeId'] = this.diagnosisTypeId; + data['ComplexDiagnosis'] = this.complexDiagnosis; + data['Remarks'] = this.remarks; return data; } } 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 55be0be6..2a342542 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -84,8 +84,7 @@ class _UpdateObjectivePageState extends State { }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, - //TODO: retrun it back - // baseViewModel: model, + baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -379,7 +378,11 @@ class _UpdateObjectivePageState extends State { )); }); - await model.patchPhysicalExam(postPhysicalExamRequestModel); + if(model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); From f8b195e368e787a4db77d835439a11d1e49cc38e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Fri, 1 Jan 2021 17:03:59 +0200 Subject: [PATCH 6/8] parseHtmlString now working :) --- lib/util/helpers.dart | 8 ++++++++ .../subjective/update_subjective_page.dart | 8 +++++--- .../profile/soap_update/update_plan_page.dart | 4 ++-- pubspec.lock | 14 ++++++++++++++ pubspec.yaml | 3 +++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index c1d70cef..4725ca9f 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:html/parser.dart'; import '../config/size_config.dart'; import '../util/dr_app_toast_msg.dart'; @@ -352,4 +353,11 @@ class Helpers { // TODO Fix it // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } + + String parseHtmlString(String htmlString) { + final document = parse(htmlString); + final String parsedString = parse(document.body.text).documentElement.text; + + return parsedString; + } } 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 2236098a..84c0734a 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 @@ -24,6 +24,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:html/parser.dart'; class UpdateSubjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -96,7 +97,8 @@ class _UpdateSubjectivePageState extends State { } @override Widget build(BuildContext context) { - return BaseView( + + return BaseView( onModelReady: (model) async { GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, @@ -110,8 +112,8 @@ class _UpdateSubjectivePageState extends State { episodeID: widget.patientInfo.episodeNo); await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { - complaintsController.text = - model.patientChiefComplaintList[0].chiefComplaint; + complaintsController.text = helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint) + ; illnessController.text = model.patientChiefComplaintList[0].hopi; } await model.getPatientAllergy(generalGetReqForSOAP); 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 506ff103..d5ad12e9 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -63,8 +63,8 @@ class _UpdatePlanPageState extends State { await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = - model.patientProgressNoteList[0].planNote; + progressNoteController.text = helpers + .parseHtmlString(model.patientProgressNoteList[0].planNote); } }, builder: (_, model, w) => AppScaffold( diff --git a/pubspec.lock b/pubspec.lock index c6829dad..61cc667f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -239,6 +239,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.5" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.2" cupertino_icons: dependency: "direct main" description: @@ -385,6 +392,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.6" + html: + dependency: "direct main" + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+4" http: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index e15a7182..91283a89 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,6 +63,9 @@ dependencies: #Autocomplete TextField autocomplete_textfield: ^1.7.3 + # Html + html: ^0.14.0+4 + #speech to text From b60bac6d6e49af0c04d5f9c0b5781a1de99df4fc Mon Sep 17 00:00:00 2001 From: mosazaid Date: Fri, 1 Jan 2021 19:31:16 +0200 Subject: [PATCH 7/8] working on UCAF design --- lib/config/localized_values.dart | 13 + .../profile/UCAF/UCAF-input-screen.dart | 407 +++++++++++++++++- lib/util/translations_delegate_base.dart | 13 + .../profile/profile_medical_info_widget.dart | 40 +- 4 files changed, 454 insertions(+), 19 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 453cef8f..c27e8b70 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -402,4 +402,17 @@ const Map> localizedValues = { 'save': {'en': "SAVE", 'ar': 'حفظ'}, 'postPlansEstimatedCost': {'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة'}, 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, + 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, + 'durationOfIllness': {'en': "duration Of Illness", 'ar': 'مدة المرض'}, + 'chiefComplaintsAndSymptoms': {'en': "CHIEF COMPLAINTS & OTHER SYMPTOMS", 'ar': 'شكاوى الرئيس وأعراض أخرى'}, + 'patientFeelsPainInHisBackAndCough': {'en': "Patient Feels pain in his back and cough", 'ar': 'يشعر المريض بألم في ظهره ويسعل'}, + 'additionalTextComplaints': {'en': "Additional text to add about Complaints", 'ar': 'نص إضافي لإضافته حول الشكاوى'}, + 'otherConditions': {'en': "OTHER CONDITIONS", 'ar': 'شروط أخرى'}, + 'other': {'en': "Other", 'ar': 'أخرى'}, + 'how': {'en': "How", 'ar': 'كيف'}, + 'when': {'en': "When", 'ar': 'متى'}, + 'where': {'en': "Where", 'ar': 'أين'}, + 'specifyPossibleLineManagement': {'en': "Specify possible line of management", 'ar': 'حدد خط الإدارة المحتمل'}, + 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, + 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, }; diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index f48fadb0..82b01144 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -1,9 +1,16 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/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:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; class UCAFInputScreen extends StatefulWidget { @override @@ -11,6 +18,33 @@ class UCAFInputScreen extends StatefulWidget { } class _UCAFInputScreenState extends State { + bool _inPatient = false; + bool _emergencyCase = false; + final _durationOfIllnessController = TextEditingController(); + final _additionalComplaintsController = TextEditingController(); + final _otherController = TextEditingController(); + final _howController = TextEditingController(); + final _whenController = TextEditingController(); + final _whereController = TextEditingController(); + final _managementsLineController = TextEditingController(); + final _signsController = TextEditingController(); + List conditionsData = [ + {"name": "CHRONIC", "isChecked": false}, + {"name": "RTA", "isChecked": false}, + {"name": "PSYCHIATRIC", "isChecked": false}, + {"name": "WORK RELATED", "isChecked": false}, + {"name": "VACCINATION", "isChecked": false}, + {"name": "CONGENITAL", "isChecked": false}, + {"name": "INFERTILITY", "isChecked": false}, + {"name": "CHECK-UP", "isChecked": false}, + {"name": "PREGNANCY/INDICATE MP", "isChecked": false}, + {"name": "CLEANING", "isChecked": false}, + {"name": "ORTHO DONTICS", "isChecked": false}, + {"name": "SPORTS RELATED", "isChecked": false}, + {"name": "REGULAR DENTAL TREATMENT", "isChecked": false}, + {"name": "IS TRAUMA TREATMENT SPECIFY ETA", "isChecked": false}, + ]; + @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; @@ -21,8 +55,379 @@ class _UCAFInputScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: Container(), + body: SingleChildScrollView( + child: Column( + children: [ + PatientHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CheckboxListTile( + title: AppText( + TranslationBase.of(context).inPatient, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _inPatient, + onChanged: (newValue) { + setState(() { + _inPatient = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).emergencyCase, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _emergencyCase, + onChanged: (newValue) { + setState(() { + _emergencyCase = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).durationOfIllness, + null, + false), + enabled: true, + controller: _durationOfIllnessController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "BP (H/L)", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "120/80", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "37.5(C), 98.6(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "80", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).chiefComplaintsAndSymptoms, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .patientFeelsPainInHisBackAndCough, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).additionalTextComplaints, + null, + false), + enabled: true, + controller: _additionalComplaintsController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherConditions, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ...List.generate( + conditionsData.length, + (index) => CheckboxListTile( + title: AppText( + conditionsData[index]['name'], + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: conditionsData[index]['isChecked'], + onChanged: (newValue) { + setState(() { + conditionsData[index]['isChecked'] = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + )), + SizedBox( + height: 8, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).other, + null, + false), + enabled: true, + controller: _otherController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 8, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).how, + null, + false), + enabled: true, + controller: _howController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 8, + ), + Row( + children: [ + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).when, + null, + false), + enabled: true, + controller: _whenController, + keyboardType: TextInputType.text, + )), + ), + SizedBox( + width: 4, + ), + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).where, + null, + false), + enabled: true, + controller: _whereController, + keyboardType: TextInputType.text, + )), + ), + ], + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).specifyPossibleLineManagement, + null, + false), + enabled: true, + controller: _managementsLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .significantSigns, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).backAbdomen, + null, + false), + enabled: true, + controller: _signsController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: (){ + // Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); + }, + ), + ], + ), + ), + ], + ), + ), ), ); } } + +class PatientHeaderWidget extends StatelessWidget { + final PatiantInformtion patient; + + PatientHeaderWidget(this.patient); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + Row( + children: [ + AppText( + "VIP", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + SizedBox( + width: 8, + ), + AppText( + " ${patient.age}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + AppText( + "NEW VISIT", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${patient.companyName}", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + Icon( + Icons.info_outline, + color: Colors.black, + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ], + ); + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index a67463a0..213ad371 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -439,6 +439,19 @@ class TranslationBase { String get save => localizedValues['save'][locale.languageCode]; String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; String get ucaf => localizedValues['ucaf'][locale.languageCode]; + String get emergencyCase => localizedValues['emergencyCase'][locale.languageCode]; + String get durationOfIllness => localizedValues['durationOfIllness'][locale.languageCode]; + String get chiefComplaintsAndSymptoms => localizedValues['chiefComplaintsAndSymptoms'][locale.languageCode]; + String get patientFeelsPainInHisBackAndCough => localizedValues['patientFeelsPainInHisBackAndCough'][locale.languageCode]; + String get additionalTextComplaints => localizedValues['additionalTextComplaints'][locale.languageCode]; + String get otherConditions => localizedValues['otherConditions'][locale.languageCode]; + String get other => localizedValues['other'][locale.languageCode]; + String get how => localizedValues['how'][locale.languageCode]; + String get when => localizedValues['when'][locale.languageCode]; + String get where => localizedValues['where'][locale.languageCode]; + String get specifyPossibleLineManagement => localizedValues['specifyPossibleLineManagement'][locale.languageCode]; + String get significantSigns => localizedValues['significantSigns'][locale.languageCode]; + String get backAbdomen => localizedValues['backAbdomen'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 3f7baf51..35f1e586 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -43,13 +43,16 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: "Episode", route: UPDATE_EPISODE, icon: 'heartbeat.png'), - PatientProfileButton( - key: key, - patient: patient, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: PATIENT_VITAL_SIGN, - icon: 'heartbeat.png'), + Visibility( + visible: selectedPatientType == 6 || selectedPatientType == 7, + child: PatientProfileButton( + key: key, + patient: patient, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + route: PATIENT_VITAL_SIGN, + icon: 'heartbeat.png'), + ), PatientProfileButton( key: key, patient: patient, @@ -80,13 +83,16 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'heartbeat.png')), - PatientProfileButton( - key: key, - patient: patient, - route: PATIENT_ADMISSION_REQUEST, - nameLine1: TranslationBase.of(context).admission, - nameLine2: TranslationBase.of(context).request, - icon: 'heartbeat.png'), + Visibility( + visible: selectedPatientType == 6 || selectedPatientType == 7, + child: PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_ADMISSION_REQUEST, + nameLine1: TranslationBase.of(context).admission, + nameLine2: TranslationBase.of(context).request, + icon: 'heartbeat.png'), + ), // PatientProfileButton( // key: key, // patient: patient, @@ -109,9 +115,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: 'Or Procedures', icon: 'lab.png'), Visibility( - visible: selectedPatientType != 0 && - selectedPatientType != 5 && - selectedPatientType != 2, + visible: selectedPatientType == 6 || selectedPatientType == 7, child: PatientProfileButton( key: key, patient: patient, @@ -138,7 +142,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: TranslationBase.of(context).leave, icon: 'sick_leaves_icons.png')), Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, + visible: selectedPatientType == 6 || selectedPatientType == 7, child: PatientProfileButton( key: key, patient: patient, From 856777c648ccd9acff30c1bbfcff6c9887dba5c6 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Fri, 1 Jan 2021 22:04:30 +0200 Subject: [PATCH 8/8] finish updating functions --- lib/models/SOAP/GetHistoryReqModel.dart | 29 ++++++++++++++++++- lib/routes.dart | 2 +- .../patients/profile/SOAP/add_SOAP_index.dart | 2 +- .../profile/patient-page-header-widget.dart | 2 +- .../{SOAP => soap_update}/steps_widget.dart | 0 .../subjective/update_subjective_page.dart | 2 ++ .../soap_update/update_soap_index.dart | 2 +- 7 files changed, 34 insertions(+), 5 deletions(-) rename lib/widgets/patients/profile/{SOAP => soap_update}/steps_widget.dart (100%) diff --git a/lib/models/SOAP/GetHistoryReqModel.dart b/lib/models/SOAP/GetHistoryReqModel.dart index 9b852e9b..1df26690 100644 --- a/lib/models/SOAP/GetHistoryReqModel.dart +++ b/lib/models/SOAP/GetHistoryReqModel.dart @@ -1,18 +1,45 @@ class GetHistoryReqModel { int patientMRN; int historyType; + String episodeID; + String from; + String to; + int clinicID; + int doctorID; + int appointmentNo; - GetHistoryReqModel({this.patientMRN, this.historyType}); + GetHistoryReqModel( + {this.patientMRN, + this.historyType, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.doctorID, + this.appointmentNo}); GetHistoryReqModel.fromJson(Map json) { patientMRN = json['PatientMRN']; historyType = json['HistoryType']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + appointmentNo = json['AppointmentNo']; + } Map toJson() { final Map data = new Map(); data['PatientMRN'] = this.patientMRN; data['HistoryType'] = this.historyType; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; return data; } } diff --git a/lib/routes.dart b/lib/routes.dart index 1915a89d..b0dd4a7b 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -127,7 +127,7 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), - CREATE_EPISODE: (_) => AddSOAPIndex(), + CREATE_EPISODE: (_) => UpdateSoapIndex(isUpdate: true,), UPDATE_EPISODE: (_) => UpdateSoapIndex(isUpdate: true,), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 5a698af9..9b4d092d 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -15,7 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'steps_widget.dart'; +import '../soap_update/steps_widget.dart'; class AddSOAPIndex extends StatefulWidget { final bool isUpdate; diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart index 1567487d..3e870be5 100644 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -44,7 +44,7 @@ class PatientPageHeaderWidget extends StatelessWidget { height: 5, ), AppText( - patient.firstName + ' ' + patient.lastName, + patient.firstName + ' ' + patient.lastName, color: Colors.black, fontWeight: FontWeight.bold, ), diff --git a/lib/widgets/patients/profile/SOAP/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart similarity index 100% rename from lib/widgets/patients/profile/SOAP/steps_widget.dart rename to lib/widgets/patients/profile/soap_update/steps_widget.dart 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 84c0734a..d9828795 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 @@ -53,6 +53,8 @@ class _UpdateSubjectivePageState extends State { getHistory(SOAPViewModel model) async{ GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo ); await model.getPatientHistories(getHistoryReqModel); 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 744f5244..9e5dd82b 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/steps_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart';