Skip to content

Commit

Permalink
Show weight and height as unspecified rather than 0 (#8248)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker authored Aug 7, 2024
1 parent 203afd2 commit f3dd93d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,24 +555,35 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div id="patient-weight">
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
{props.consultationData.weight
? `${props.consultationData.weight} kg`
: "Unspecified"}
</span>
</div>
<div id="patient-height">
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
{props.consultationData.height
? `${props.consultationData.height} cm`
: "Unspecified"}
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600,
).toFixed(2)}{" "}
m<sup>2</sup>
<span className="font-semibold ">
{props.consultationData.weight &&
props.consultationData.height ? (
<>
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
</>
) : (
"Unspecified"
)}
</span>
</div>
<div>
Expand Down
22 changes: 14 additions & 8 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1084,12 +1084,18 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
<div className="flex items-center justify-between">
<FieldLabel>Body Surface Area</FieldLabel>
<span className="mb-2 text-sm font-medium text-black">
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
{state.form.weight && state.form.height ? (
<>
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
</>
) : (
"Not specified"
)}
</span>
</div>

Expand Down

0 comments on commit f3dd93d

Please sign in to comment.