From dbf4bf83e65451d80d9238d790f26769196e6079 Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed Date: Sat, 9 Dec 2023 20:28:08 +0530 Subject: [PATCH] add relative time --- .../Facility/Consultations/Mews.tsx | 111 ++++++++++-------- src/Components/Patient/PatientInfoCard.tsx | 2 +- 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/src/Components/Facility/Consultations/Mews.tsx b/src/Components/Facility/Consultations/Mews.tsx index a96dde9a523..7ad31d97961 100644 --- a/src/Components/Facility/Consultations/Mews.tsx +++ b/src/Components/Facility/Consultations/Mews.tsx @@ -1,5 +1,5 @@ -import useQuery from "../../../Utils/request/useQuery"; -import routes from "../../../Redux/api"; +import { DailyRoundsModel } from "../../Patient/models"; +import RecordMeta from "../../../CAREUI/display/RecordMeta"; const respRange = [ [-Infinity, 7, 2], @@ -70,59 +70,72 @@ const getIndividualScore = (value: number | undefined, ranges: any[][]) => { } }; -export const Mews = (props: { consultationId: string }) => { - const { data: dailyRoundsData } = useQuery(routes.getDailyReports, { - pathParams: { - consultationId: props.consultationId, - }, - query: { - rounds_type: "NORMAL,VENTILATOR,ICU", - limit: 1, - }, - }); - +export const Mews = (props: { lastDailyRound: DailyRoundsModel }) => { const mewsCard = (isMissing: boolean, data: string[] | number) => { if (isMissing) { return ( -
-

N/A

-
-

Missing :

-
- {typeof data !== "number" && - data.map((x, id) => {x})} + <> +
+

N/A

+
+

Missing :

+
+ {typeof data !== "number" && + data.map((x, id) => {x})} +
-
-
+
+ +
+
+ ); } else { return ( -
-

{data}

-
-

Respiratory rate : {dailyRoundsData?.results[0].resp}

-

Heart rate : {dailyRoundsData?.results[0].pulse}

-

Systolic BP : {dailyRoundsData?.results[0].bp?.systolic}

-

Temperature : {dailyRoundsData?.results[0].temperature}

-

- Consciousness Level :{" "} - {dailyRoundsData?.results[0].consciousness_level} -

+ <> +
+

{data}

+
+

Resp Rate : {props.lastDailyRound.resp}

+

Pulse : {props.lastDailyRound.pulse}

+

Sys BP : {props.lastDailyRound.bp?.systolic}

+

Temp : {props.lastDailyRound.temperature}

+

Conscious :

+

+ {props.lastDailyRound.consciousness_level + ?.split("_") + .map((x) => x[0] + x.slice(1).toLowerCase()) + .join(" ")} +

+
+
+
+ +
-
-
+ ); } }; const mewsScore = () => { - const lastDailyRound = dailyRoundsData?.results[0]; + const lastDailyRound = props.lastDailyRound; const score = { resp: getIndividualScore(lastDailyRound?.resp, respRange), @@ -154,7 +167,7 @@ export const Mews = (props: { consultationId: string }) => { score.heartRate === undefined ? "Heart rate" : "", score.systolicBloodPressure === undefined ? "Systolic BP" : "", score.temperature === undefined ? "Temperature" : "", - score.consciousnessLevel === undefined ? "Consciousness Level" : "", + score.consciousnessLevel === undefined ? "Consciousness" : "", ].filter((x) => x !== "") ); } @@ -170,15 +183,9 @@ export const Mews = (props: { consultationId: string }) => { }; return ( - <> - {dailyRoundsData?.results[0].rounds_type === "VENTILATOR" && ( -
-

- Mews Score -

- {mewsScore()} -
- )} - +
+

Mews Score

+ {mewsScore()} +
); }; diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index a54eeb93467..d2d4615de9b 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -344,7 +344,7 @@ export default function PatientInfoCard(props: {
{consultation?.last_daily_round && (
- +
)}