diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index e2890f0cc79..623faad2717 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -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"; @@ -584,6 +588,15 @@ export const PatientManager = () => { text="Readmission" /> )} + {patient.last_consultation && + patient.last_consultation?.suggestion === "A" && ( + + )} {patient.disease_status === "POSITIVE" && ( + {patient.last_consultation && + patient.last_consultation?.suggestion === "A" && ( +
+
+
+ + {daysUntilToday( + patient.last_consultation?.encounter_date, + )} + +
+
+ + IP Days + +
+ )} + {consultation?.last_daily_round && (
)} + {!!consultation?.discharge_date && (
diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index 2bcf47ab134..3130a8d4045 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -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"); +}