From fc77784f65d36783e78a67cc62e4c1372677ad3d Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Sat, 30 Dec 2023 21:52:41 +0530 Subject: [PATCH] Fix blood pressure form field and daily rounds component --- .../Common/BloodPressureFormField.tsx | 9 +++---- src/Components/Patient/DailyRounds.tsx | 24 +++++++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/Components/Common/BloodPressureFormField.tsx b/src/Components/Common/BloodPressureFormField.tsx index ed0557ae8e3..3ff2774b900 100644 --- a/src/Components/Common/BloodPressureFormField.tsx +++ b/src/Components/Common/BloodPressureFormField.tsx @@ -21,7 +21,7 @@ export default function BloodPressureFormField(props: Props) { name: field.name, value: { ...field.value, - [event.name]: event.value, + [event.name]: event.value ?? -1, }, }); }; @@ -35,9 +35,10 @@ export default function BloodPressureFormField(props: Props) { MAP: {map.toFixed(1)} - ) : undefined, + labelSuffix: + map && map !== -1 ? ( + MAP: {map.toFixed(1)} + ) : undefined, }} >
diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 1590fcacba2..76f1e481bd1 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -62,6 +62,11 @@ const initForm: any = { rhythm_detail: "", ventilator_spo2: null, consciousness_level: "UNKNOWN", + bp: { + systolic: -1, + diastolic: -1, + mean: -1, + }, // bed: null, }; @@ -242,6 +247,15 @@ export const DailyRounds = (props: any) => { invalidForm = true; } return; + case "bp": + if ( + (state.form.bp.systolic !== -1 && state.form.bp.diastolic === -1) || + (state.form.bp.systolic === -1 && state.form.bp.diastolic !== -1) + ) { + errors.bp = "Please enter both systolic and diastolic values"; + invalidForm = true; + } + return; default: return; } @@ -287,7 +301,7 @@ export const DailyRounds = (props: any) => { data = { ...data, bp: - state.form.bp?.systolic && state.form.bp?.diastolic + state.form.bp?.systolic !== -1 && state.form.bp?.diastolic !== -1 ? { systolic: Number(state.form.bp.systolic), diastolic: Number(state.form.bp.diastolic), @@ -295,10 +309,10 @@ export const DailyRounds = (props: any) => { meanArterialPressure(state.form.bp).toFixed(2) ), } - : null, - pulse: state.form.pulse ?? null, - resp: state.form.resp ?? null, - temperature: state.form.temperature ?? null, + : undefined, + pulse: state.form.pulse, + resp: state.form.resp, + temperature: state.form.temperature, rhythm: state.form.rhythm || 0, rhythm_detail: state.form.rhythm_detail, ventilator_spo2: state.form.ventilator_spo2 ?? null,