Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IP Days Chip in Patient List and Patient Dashboard #7252

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import RecordMeta from "../../CAREUI/display/RecordMeta";
import SearchInput from "../Form/SearchInput";
import SortDropdownMenu from "../Common/SortDropdown";
import SwitchTabs from "../Common/components/SwitchTabs";
import { formatPatientAge, parsePhoneNumber } from "../../Utils/utils.js";
import {
daysUntilToday,
formatPatientAge,
parsePhoneNumber,
} from "../../Utils/utils.js";
import useFilters from "../../Common/hooks/useFilters";
import { useTranslation } from "react-i18next";
import Page from "../Common/components/Page.js";
Expand Down Expand Up @@ -584,6 +588,15 @@ export const PatientManager = () => {
text="Readmission"
/>
)}
{patient.last_consultation &&
patient.last_consultation?.suggestion === "A" && (
<Chip
size="small"
variant="primary"
startIcon="l-clock-three"
text={`${daysUntilToday(patient.last_consultation?.encounter_date)}`}
/>
)}
{patient.disease_status === "POSITIVE" && (
<Chip
size="small"
Expand Down
24 changes: 24 additions & 0 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import useConfig from "../../Common/hooks/useConfig.js";
import dayjs from "../../Utils/dayjs.js";
import {
classNames,
daysUntilToday,
formatDate,
formatDateTime,
formatPatientAge,
Expand Down Expand Up @@ -470,11 +471,34 @@ export default function PatientInfoCard(props: {
className="col-span-2 flex w-full flex-col items-center justify-center gap-2 px-4 py-1 lg:col-span-1 2xl:flex-row"
id="consultation-buttons"
>
{patient.last_consultation &&
patient.last_consultation?.suggestion === "A" && (
<div className="flex flex-col items-center">
<div className="col-span-1 flex w-full justify-center bg-white px-4 lg:flex-row">
<div
className={
"flex h-7 w-7 items-center justify-center rounded-full border-2"
}
>
<span className="text-sm font-semibold">
{daysUntilToday(
patient.last_consultation?.encounter_date,
)}
</span>
</div>
</div>
<span className="mt-1 text-xs font-medium text-gray-700">
IP Days
</span>
</div>
)}

{consultation?.last_daily_round && (
<div className="col-span-1 flex w-full justify-center bg-white px-4 lg:flex-row">
<Mews dailyRound={consultation?.last_daily_round} />
</div>
)}

{!!consultation?.discharge_date && (
<div className="flex min-w-max flex-col items-center justify-center">
<div className="text-sm font-normal leading-5 text-gray-500">
Expand Down
5 changes: 5 additions & 0 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,8 @@ export const properRoundOf = (value: number) => {
}
return value.toFixed(2);
};

export function daysUntilToday(inputDate: Date | string) {
const date = dayjs(inputDate);
return dayjs().diff(date, "day");
}
Loading