From 3335147313cfcf819db61e6db38740a7d4fd82b2 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sat, 24 Apr 2021 21:28:43 +0300 Subject: [PATCH] vital sign add oxygenation --- .../patient-vital-sign-viewmodel.dart | 6 + lib/lookups/patient_lookup.dart | 3 +- .../LineChartCurvedBloodPressure.dart | 10 +- .../vital_sign/vital_sign_details_screen.dart | 316 ++++++++++-------- .../vital_sign_item_details_screen.dart | 21 +- 5 files changed, 206 insertions(+), 150 deletions(-) diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 2f1c1c68..7bcca11c 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -25,6 +25,7 @@ class VitalSignsViewModel extends BaseViewModel { String hartRat = "0"; String respirationBeatPerMinute = "0"; String bloodPressure = "0 / 0"; + String oxygenation = "0 - 0"; Future getPatientVitalSign(PatiantInformtion patient) async { setState(ViewState.Busy); @@ -86,6 +87,11 @@ class VitalSignsViewModel extends BaseViewModel { bloodPressure == 'null') { bloodPressure = element.bloodPressure.toString(); } + if (oxygenation == "0 - 0" || + oxygenation == null || + oxygenation == 'null') { + oxygenation = "${element.sAO2.toString()} - ${element.fIO2.toString()}"; + } }); setState(ViewState.Idle); } diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 5418c357..d56e637c 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -36,5 +36,6 @@ enum vitalSignDetails { heart, PainScale, Weight, - Height + Height, + Oxygenation, } diff --git a/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart index 9c06cf13..3f9b1dd6 100644 --- a/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart +++ b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart @@ -259,6 +259,14 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), ); - return [lineChartBarData1, lineChartBarData2]; + List lineChartData = List(); + if(spots.isNotEmpty){ + lineChartData.add(lineChartBarData1); + } + if(spots2.isNotEmpty){ + lineChartData.add(lineChartBarData2); + } + return lineChartData; + // return [lineChartBarData1, lineChartBarData2]; } } diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index 0bf2fc95..88085c7e 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -278,172 +278,198 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 4), - child: GridView.count( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 6, - mainAxisSpacing: 6, - childAspectRatio: 1.0 / 1.0, - crossAxisCount: 3, - children: [ - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Height, - pageTitle: - TranslationBase.of(context).height, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16), + child: GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 6, + mainAxisSpacing: 6, + crossAxisCount: 3, + children: [ + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Height, + pageTitle: + TranslationBase.of(context).height, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), + ), + ) + : null, + child: Container( + child: VitalSignItem( + des: TranslationBase.of(context).height, + imagePath: "${assetBasePath}height.png", + lastVal: mode.heightCm, + unit: TranslationBase.of(context).cm, ), ), - ) - : null, - child: Container( + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Weight, + pageTitle: + TranslationBase.of(context).weight, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), + ), + ) + : null, child: VitalSignItem( - des: TranslationBase.of(context).height, - imagePath: "${assetBasePath}height.png", - lastVal: mode.heightCm, - unit: TranslationBase.of(context).cm, + des: TranslationBase.of(context).weight, + imagePath: "${assetBasePath}weight.png", + unit: TranslationBase.of(context).kg, + lastVal: mode.weightKg, ), ), - ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Weight, - pageTitle: - TranslationBase.of(context).weight, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Temperature, + pageTitle: TranslationBase.of(context) + .temperature, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), + ), + ) + : null, + child: Container( + child: VitalSignItem( + des: TranslationBase.of(context).temperature, + imagePath: "${assetBasePath}temperature.png", + lastVal: mode.temperatureCelcius, + unit: TranslationBase.of(context).tempC, ), ), - ) - : null, - child: VitalSignItem( - des: TranslationBase.of(context).weight, - imagePath: "${assetBasePath}weight.png", - unit: TranslationBase.of(context).kg, - lastVal: mode.weightKg, ), - ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Temperature, - pageTitle: TranslationBase.of(context) - .temperature, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.heart, + pageTitle: + TranslationBase.of(context).heart, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), ), - ), - ) - : null, - child: Container( + ) + : null, child: VitalSignItem( - des: TranslationBase.of(context).temperature, - imagePath: "${assetBasePath}temperature.png", - lastVal: mode.temperatureCelcius, - unit: TranslationBase.of(context).tempC, + des: TranslationBase.of(context).heart, + imagePath: "${assetBasePath}heart_rate.png", + lastVal: mode.hartRat, + unit: TranslationBase.of(context).bpm, ), ), - ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.heart, - pageTitle: - TranslationBase.of(context).heart, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Respiration, + pageTitle: TranslationBase.of(context) + .respirationRate, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context).respirationRate, + imagePath: "${assetBasePath}respiration_rate.png", + lastVal: mode.respirationBeatPerMinute, + unit: + TranslationBase.of(context).respirationSigns, ), - ) - : null, - child: VitalSignItem( - des: TranslationBase.of(context).heart, - imagePath: "${assetBasePath}heart_rate.png", - lastVal: mode.hartRat, - unit: TranslationBase.of(context).bpm, ), - ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Respiration, - pageTitle: TranslationBase.of(context) - .respirationRate, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.BloodPressure, + pageTitle: TranslationBase.of(context) + .bloodPressure, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context).bloodPressure, + imagePath: "${assetBasePath}blood_pressure.png", + lastVal: mode.bloodPressure, + unit: TranslationBase.of(context).sysDias, ), - ) - : null, - child: VitalSignItem( - des: TranslationBase.of(context).respirationRate, - imagePath: "${assetBasePath}respiration_rate.png", - lastVal: mode.respirationBeatPerMinute, - unit: - TranslationBase.of(context).respirationSigns, ), - ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.BloodPressure, - pageTitle: TranslationBase.of(context) - .bloodPressure, - vitalList: - mode.patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Oxygenation, + pageTitle: TranslationBase.of(context) + .oxygenation, + vitalList: + mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + ), ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context).oxygenation, + imagePath: "${assetBasePath}blood_pressure.png", + lastVal: mode.oxygenation, + unit: "%", ), - ) - : null, - child: VitalSignItem( - des: TranslationBase.of(context).bloodPressure, - imagePath: "${assetBasePath}blood_pressure.png", - lastVal: mode.bloodPressure, - unit: TranslationBase.of(context).sysDias, ), - ), - ], + ], + ), ), ), ), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart index 349120f4..57fdca16 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart @@ -141,6 +141,21 @@ class VitalSignItemDetailsScreen extends StatelessWidget { }, ]; + break; + case vitalSignDetails.Oxygenation: + VSchart = [ + { + 'name': 'Oxygenation', + 'nameAr': 'الأوكسجين', + 'title1': 'Date', + 'title2': 'SAO2', + 'title3': 'FIO2', + 'title2Ar': 'SAO2', + 'title3Ar': 'FIO2', + 'viewKey': 'O2', + }, + ]; + break; case vitalSignDetails.Weight: VSchart = [ @@ -211,7 +226,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { ); if (vitalListTemp.length != 0 && - chartInfo['viewKey'] == 'BloodPressure') { + chartInfo['viewKey'] == 'BloodPressure' || chartInfo['viewKey'] == 'O2') { return VitalSingChartBloodPressure( vitalList: vitalList, name: projectViewModel.isArabic @@ -224,8 +239,8 @@ class VitalSignItemDetailsScreen extends StatelessWidget { title3: projectViewModel.isArabic ? chartInfo['title3Ar'] : chartInfo['title3'], - viewKey1: 'BloodPressureHigher', - viewKey2: 'BloodPressureLower', + viewKey1: chartInfo['viewKey'] == 'BloodPressure' ? 'BloodPressureHigher' : 'SAO2', + viewKey2: chartInfo['viewKey'] == 'BloodPressure' ? 'BloodPressureLower' : 'FIO2', ); }