Skip to content

Commit

Permalink
Fix blood pressure form field and daily rounds component
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Dec 30, 2023
1 parent 641d334 commit fc77784
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/Components/Common/BloodPressureFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
};
Expand All @@ -35,9 +35,10 @@ export default function BloodPressureFormField(props: Props) {
<FormField
field={{
...field,
labelSuffix: map ? (
<span className="font-medium">MAP: {map.toFixed(1)}</span>
) : undefined,
labelSuffix:
map && map !== -1 ? (
<span className="font-medium">MAP: {map.toFixed(1)}</span>
) : undefined,
}}
>
<div className="flex flex-row items-center">
Expand Down
24 changes: 19 additions & 5 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const initForm: any = {
rhythm_detail: "",
ventilator_spo2: null,
consciousness_level: "UNKNOWN",
bp: {
systolic: -1,
diastolic: -1,
mean: -1,
},
// bed: null,
};

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -287,18 +301,18 @@ 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),
mean: parseFloat(
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,
Expand Down

0 comments on commit fc77784

Please sign in to comment.