Skip to content

Commit

Permalink
Fix handling of negative values in blood pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Dec 30, 2023
1 parent 0c96c90 commit ab0d571
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/Components/Facility/Consultations/Mews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,20 @@ export const DailyRoundListDetails = (props: any) => {
<span className="font-semibold leading-relaxed">
Systolic:{" "}
</span>
{dailyRoundListDetailsData.bp?.systolic ?? "-"}
{dailyRoundListDetailsData.bp?.systolic &&
dailyRoundListDetailsData.bp?.systolic !== -1
? dailyRoundListDetailsData.bp?.systolic
: "-"}
</div>
<div className="flex">
{" "}
<span className="font-semibold leading-relaxed">
Diastolic:
</span>
{dailyRoundListDetailsData.bp?.diastolic ?? "-"}
{dailyRoundListDetailsData.bp?.diastolic &&
dailyRoundListDetailsData.bp?.diastolic !== -1
? dailyRoundListDetailsData.bp?.diastolic
: "-"}
</div>
</div>
</div>
Expand Down
28 changes: 19 additions & 9 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,10 @@ export const DailyRounds = (props: any) => {
return;
case "bp":
if (
(state.form.bp.systolic !== -1 && state.form.bp.diastolic === -1) ||
(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";
Expand Down Expand Up @@ -303,20 +306,27 @@ export const DailyRounds = (props: any) => {
bp:
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,
}
: {
systolic: -1,
diastolic: -1,
mean: -1,
},
pulse: state.form.pulse,
resp: state.form.resp,
temperature: state.form.temperature,
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 ?? null,
Expand Down

0 comments on commit ab0d571

Please sign in to comment.