From c5c86aa594e11e832b18cc6fa906ce04d7e041f7 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Sat, 30 Dec 2023 22:41:29 +0530 Subject: [PATCH 1/2] fix daily rounds vital fields not clearing (#6954) * fix daily rounds vital fields not clearing * Fix blood pressure form field and daily rounds component * Fix default blood pressure values in DailyRounds component * Fix handling of negative values in blood pressure --------- Co-authored-by: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> --- .../Common/BloodPressureFormField.tsx | 9 ++-- .../Facility/Consultations/Mews.tsx | 1 + .../Patient/DailyRoundListDetails.tsx | 10 +++- src/Components/Patient/DailyRounds.tsx | 50 +++++++++++++++---- 4 files changed, 53 insertions(+), 17 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/Facility/Consultations/Mews.tsx b/src/Components/Facility/Consultations/Mews.tsx index 6b8e7de806e..5160e42f9f2 100644 --- a/src/Components/Facility/Consultations/Mews.tsx +++ b/src/Components/Facility/Consultations/Mews.tsx @@ -26,6 +26,7 @@ const getHeartRateScore = (value?: number) => { const getSystolicBPScore = (value?: number) => { if (typeof value !== "number") return; + if (value === -1) return; if (value <= 70) return 3; if (value <= 80) return 2; diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 8f313c0a51d..0a73607d688 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -158,14 +158,20 @@ export const DailyRoundListDetails = (props: any) => { Systolic:{" "} - {dailyRoundListDetailsData.bp?.systolic ?? "-"} + {dailyRoundListDetailsData.bp?.systolic && + dailyRoundListDetailsData.bp?.systolic !== -1 + ? dailyRoundListDetailsData.bp?.systolic + : "-"}
{" "} Diastolic: - {dailyRoundListDetailsData.bp?.diastolic ?? "-"} + {dailyRoundListDetailsData.bp?.diastolic && + dailyRoundListDetailsData.bp?.diastolic !== -1 + ? dailyRoundListDetailsData.bp?.diastolic + : "-"}
diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index ec2f070aa20..c12aea42bee 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,18 @@ export const DailyRounds = (props: any) => { invalidForm = true; } return; + case "bp": + if ( + (state.form.bp?.systolic && + state.form.bp?.diastolic && + 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,21 +304,32 @@ export const DailyRounds = (props: any) => { data = { ...data, bp: - state.form.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), - mean: parseFloat( - meanArterialPressure(state.form.bp).toFixed(2) - ), + systolic: state.form.bp?.systolic + ? Number(state.form.bp?.systolic) + : -1, + diastolic: state.form.bp?.diastolic + ? Number(state.form.bp?.diastolic) + : -1, + mean: + state.form.bp?.systolic && state.form.bp?.diastolic + ? parseFloat( + meanArterialPressure(state.form.bp).toFixed(2) + ) + : -1, } - : undefined, - pulse: state.form.pulse, - resp: state.form.resp, - temperature: state.form.temperature, + : { + systolic: -1, + diastolic: -1, + mean: -1, + }, + pulse: state.form.pulse ?? null, + resp: state.form.resp ?? null, + temperature: state.form.temperature ?? null, rhythm: state.form.rhythm || 0, rhythm_detail: state.form.rhythm_detail, - ventilator_spo2: state.form.ventilator_spo2, + ventilator_spo2: state.form.ventilator_spo2 ?? null, consciousness_level: state.form.consciousness_level, }; } From f066a3659beb2ba899a226a465b06922b2207d69 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:57:23 +0530 Subject: [PATCH 2/2] Fix conditional logic in PatientInfoCard (#6955) --- src/Components/Patient/PatientInfoCard.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index c5087f13dda..eb589667ece 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -490,6 +490,7 @@ export default function PatientInfoCard(props: { key={i} className="dropdown-item-primary pointer-events-auto m-2 flex cursor-pointer items-center justify-start gap-2 rounded border-0 p-2 text-sm font-normal transition-all duration-200 ease-in-out" href={ + action[1] !== "Treatment Summary" && consultation?.admitted && !consultation?.current_bed && i === 1 @@ -498,6 +499,7 @@ export default function PatientInfoCard(props: { } onClick={() => { if ( + action[1] !== "Treatment Summary" && consultation?.admitted && !consultation?.current_bed && i === 1