From f3dd93dab3a65765c3cd1868f3cc900af5ab3874 Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Wed, 7 Aug 2024 12:58:09 +0530 Subject: [PATCH] Show weight and height as unspecified rather than 0 (#8248) --- .../ConsultationUpdatesTab.tsx | 29 +++++++++++++------ src/Components/Facility/ConsultationForm.tsx | 22 +++++++++----- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 22194b410b7..d00b77d9bca 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -555,24 +555,35 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
Weight {" - "} - {props.consultationData.weight ?? "-"} Kg + {props.consultationData.weight + ? `${props.consultationData.weight} kg` + : "Unspecified"}
Height {" - "} - {props.consultationData.height ?? "-"} cm + {props.consultationData.height + ? `${props.consultationData.height} cm` + : "Unspecified"}
Body Surface Area {" - "} - - {Math.sqrt( - (Number(props.consultationData.weight) * - Number(props.consultationData.height)) / - 3600, - ).toFixed(2)}{" "} - m2 + + {props.consultationData.weight && + props.consultationData.height ? ( + <> + {Math.sqrt( + (Number(props.consultationData.weight) * + Number(props.consultationData.height)) / + 3600, + ).toFixed(2)} + m2 + + ) : ( + "Unspecified" + )}
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index dc496d599f7..40d9741d712 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -386,8 +386,8 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { admitted: data.admitted ? String(data.admitted) : "false", admitted_to: data.admitted_to ? data.admitted_to : "", category: data.category - ? (PATIENT_CATEGORIES.find((i) => i.text === data.category)?.id ?? - "") + ? PATIENT_CATEGORIES.find((i) => i.text === data.category)?.id ?? + "" : "", patient_no: data.patient_no ?? "", OPconsultation: data.consultation_notes, @@ -1084,12 +1084,18 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
Body Surface Area - {Math.sqrt( - (Number(state.form.weight) * - Number(state.form.height)) / - 3600, - ).toFixed(2)} - m2 + {state.form.weight && state.form.height ? ( + <> + {Math.sqrt( + (Number(state.form.weight) * + Number(state.form.height)) / + 3600, + ).toFixed(2)} + m2 + + ) : ( + "Not specified" + )}