diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 76724d85017..bc2e8f330a3 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -151,6 +151,7 @@ export class PatientConsultationPage { clickEditConsultationButton() { cy.get("#consultation-buttons").scrollIntoView(); + cy.get("button").contains("Manage Patient").click(); cy.get("#consultation-buttons") .contains("Edit Consultation Details") .click(); diff --git a/src/Components/Common/RelativeDateUserMention.tsx b/src/Components/Common/RelativeDateUserMention.tsx index 18fb431574f..6c5a78c7f09 100644 --- a/src/Components/Common/RelativeDateUserMention.tsx +++ b/src/Components/Common/RelativeDateUserMention.tsx @@ -6,6 +6,7 @@ function RelativeDateUserMention(props: { actionDate?: string; user?: PerformedByModel; tooltipPosition?: "top" | "bottom" | "left" | "right"; + withoutSuffix?: boolean; }) { return (
@@ -15,7 +16,9 @@ function RelativeDateUserMention(props: { > {props.actionDate ? formatDateTime(props.actionDate) : "--:--"} - {props.actionDate ? relativeDate(props.actionDate) : "--:--"} + {props.actionDate + ? relativeDate(props.actionDate, props.withoutSuffix ?? false) + : "--:--"}
{props.user && (
diff --git a/src/Components/Common/components/AccordionV2.tsx b/src/Components/Common/components/AccordionV2.tsx index ef4948d8ae3..b8fa441d277 100644 --- a/src/Components/Common/components/AccordionV2.tsx +++ b/src/Components/Common/components/AccordionV2.tsx @@ -1,5 +1,4 @@ import { useRef, useState } from "react"; -import { classNames } from "../../../Utils/utils"; export default function AccordionV2(props: { children: JSX.Element | JSX.Element[]; @@ -55,15 +54,10 @@ export default function AccordionV2(props: {
{props.children}
diff --git a/src/Components/Diagnosis/DiagnosesListAccordion.tsx b/src/Components/Diagnosis/DiagnosesListAccordion.tsx new file mode 100644 index 00000000000..5f339cabc16 --- /dev/null +++ b/src/Components/Diagnosis/DiagnosesListAccordion.tsx @@ -0,0 +1,102 @@ +import { + ActiveConditionVerificationStatuses, + ConditionVerificationStatus, + ConsultationDiagnosis, +} from "./types"; +import { useTranslation } from "react-i18next"; +import { compareBy } from "../../Utils/utils"; +import { useState } from "react"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import ButtonV2 from "../Common/components/ButtonV2"; + +interface Props { + diagnoses: ConsultationDiagnosis[]; +} + +type GroupedDiagnoses = Record< + ConditionVerificationStatus, + ConsultationDiagnosis[] +>; + +function groupDiagnoses(diagnoses: ConsultationDiagnosis[]) { + const groupedDiagnoses = {} as GroupedDiagnoses; + + for (const status of ActiveConditionVerificationStatuses) { + groupedDiagnoses[status] = diagnoses + .filter((d) => d.verification_status === status) + .sort(compareBy("is_principal")); + } + + return groupedDiagnoses; +} + +export default function DiagnosesListAccordion(props: Props) { + const [isVisible, setIsVisible] = useState(true); + const diagnoses = groupDiagnoses(props.diagnoses); + + return ( +
+
+ {!isVisible && ( + { + setIsVisible((prev) => !prev); + }} + > + + Expand Diagnoses + + )} +
+
+

+ Diagnoses +

+
+ {Object.entries(diagnoses).map( + ([status, diagnoses]) => + !!diagnoses.length && ( + + ) + )} +
+ { + setIsVisible(false); + }} + > + + Hide Diagnoses + +
+
+ ); +} + +const DiagnosesOfStatus = ({ diagnoses }: Props) => { + const { t } = useTranslation(); + + return ( +
+

+ {t(diagnoses[0].verification_status)} {t("diagnoses")}{" "} + ({t("icd11_as_recommended")}) +

+ +
+ ); +}; diff --git a/src/Components/Diagnosis/LegacyDiagnosesList.tsx b/src/Components/Diagnosis/LegacyDiagnosesList.tsx deleted file mode 100644 index 408bee7b52a..00000000000 --- a/src/Components/Diagnosis/LegacyDiagnosesList.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { useState } from "react"; -import { - ActiveConditionVerificationStatuses, - ConditionVerificationStatus, - ConsultationDiagnosis, -} from "./types"; -import { useTranslation } from "react-i18next"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import { compareBy } from "../../Utils/utils"; - -interface Props { - diagnoses: ConsultationDiagnosis[]; -} - -type GroupedDiagnoses = Record< - ConditionVerificationStatus, - ConsultationDiagnosis[] ->; - -function groupDiagnoses(diagnoses: ConsultationDiagnosis[]) { - const groupedDiagnoses = {} as GroupedDiagnoses; - - for (const status of ActiveConditionVerificationStatuses) { - groupedDiagnoses[status] = diagnoses - .filter((d) => d.verification_status === status) - .sort(compareBy("is_principal")); - } - - return groupedDiagnoses; -} - -export default function LegacyDiagnosesList(props: Props) { - const diagnoses = groupDiagnoses(props.diagnoses); - - return ( -
- {Object.entries(diagnoses).map( - ([status, diagnoses]) => - !!diagnoses.length && ( - - ) - )} -
- ); -} - -const DefaultShowLimit = 3; - -const DiagnosesOfStatus = ({ diagnoses }: Props) => { - const { t } = useTranslation(); - const [showMore, setShowMore] = useState(false); - - const queryset = showMore ? diagnoses : diagnoses.slice(0, DefaultShowLimit); - - return ( -
-

- {t(queryset[0].verification_status)} {t("diagnoses")}{" "} - ({t("icd11_as_recommended")}) -

- - - {diagnoses.length > DefaultShowLimit && ( - setShowMore(!showMore)} - className="cursor-pointer text-sm text-blue-600 hover:text-blue-300" - > - {showMore - ? t("hide") - : `... and ${diagnoses.length - queryset.length} more.`} - - )} -
- ); -}; diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 4158d7f6609..323715ccfb0 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -342,7 +342,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { from{" "} {formatDate( - props.consultationData.last_daily_round.created_at + props.consultationData.last_daily_round.taken_at )} @@ -602,58 +602,59 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { )} - -
-
-

- Body Details -

-
-
- Gender {" - "} - - {props.patientData.gender ?? "-"} - -
-
- Age {" - "} - - {props.patientData.age !== undefined // 0 is a valid age, so we need to check for undefined - ? formatAge( - props.patientData.age, - props.patientData.date_of_birth - ) - : "-"} - -
-
- Weight {" - "} - - {props.consultationData.weight ?? "-"} Kg - -
-
- Height {" - "} - - {props.consultationData.height ?? "-"} cm - -
-
- Body Surface Area {" - "} - - {Math.sqrt( - (Number(props.consultationData.weight) * - Number(props.consultationData.height)) / - 3600 - ).toFixed(2)}{" "} - m2 - -
-
- Blood Group {" - "} - - {props.patientData.blood_group ?? "-"} - +
+
+
+

+ Body Details +

+
+
+ Gender {" - "} + + {props.patientData.gender ?? "-"} + +
+
+ Age {" - "} + + {props.patientData.age !== undefined // 0 is a valid age, so we need to check for undefined + ? formatAge( + props.patientData.age, + props.patientData.date_of_birth + ) + : "-"} + +
+
+ Weight {" - "} + + {props.consultationData.weight ?? "-"} Kg + +
+
+ Height {" - "} + + {props.consultationData.height ?? "-"} cm + +
+
+ Body Surface Area {" - "} + + {Math.sqrt( + (Number(props.consultationData.weight) * + Number(props.consultationData.height)) / + 3600 + ).toFixed(2)}{" "} + m2 + +
+
+ Blood Group {" - "} + + {props.patientData.blood_group ?? "-"} + +
diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index c6cc9e02275..071e7bfc1af 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -15,7 +15,6 @@ import { statusType, useAbortableEffect } from "../../../Common/utils"; import { lazy, useCallback, useState } from "react"; import DoctorVideoSlideover from "../DoctorVideoSlideover"; import { make as Link } from "../../Common/components/Link.bs"; -import PatientInfoCard from "../../Patient/PatientInfoCard"; import { PatientModel } from "../../Patient/models"; import { formatDateTime, relativeTime } from "../../../Utils/utils"; @@ -37,8 +36,10 @@ import { ConsultationDialysisTab } from "./ConsultationDialysisTab"; import { ConsultationNeurologicalMonitoringTab } from "./ConsultationNeurologicalMonitoringTab"; import { ConsultationNutritionTab } from "./ConsultationNutritionTab"; import PatientNotesSlideover from "../PatientNotesSlideover"; -import LegacyDiagnosesList from "../../Diagnosis/LegacyDiagnosesList"; import { AssetBedModel } from "../../Assets/AssetTypes"; +import PatientInfoCard from "../../Patient/PatientInfoCard"; +import RelativeDateUserMention from "../../Common/RelativeDateUserMention"; +import DiagnosesListAccordion from "../../Diagnosis/DiagnosesListAccordion"; const Loading = lazy(() => import("../../Common/Loading")); const PageTitle = lazy(() => import("../../Common/PageTitle")); @@ -343,7 +344,7 @@ export const ConsultationDetails = (props: any) => { showAbhaProfile={qParams["show-abha-profile"] === "true"} /> -
+
{consultationData.admitted_to && (
@@ -374,71 +375,39 @@ export const ConsultationDetails = (props: any) => {
)}
- -
-
- {/*consultationData.other_symptoms && ( -
- - Other Symptoms:{" "} - - {consultationData.other_symptoms} -
- )*/} - - - - {(consultationData.treating_physician_object || - consultationData.deprecated_verified_by) && ( -
- - Treating Physician:{" "} - - {consultationData.treating_physician_object - ? `${consultationData.treating_physician_object.first_name} ${consultationData.treating_physician_object.last_name}` - : consultationData.deprecated_verified_by} - -
- )} -
-
-
+
-
- Created: - {consultationData.created_date - ? formatDateTime(consultationData.created_date) - : "--:--"}{" "} - | +
+ Created:   +
- {consultationData.created_by && ( -
- {` ${consultationData.created_by.first_name} ${consultationData.created_by.last_name} `} - {`@${consultationData.created_by.username} (${consultationData.created_by.user_type})`} -
- )}
-
- Last Modified: - {consultationData.modified_date - ? formatDateTime(consultationData.modified_date) - : "--:--"}{" "} - | +
+ Last Modified:   +
- {consultationData.last_edited_by && ( -
- {` ${consultationData.last_edited_by.first_name} ${consultationData.last_edited_by.last_name} `} - {`@${consultationData.last_edited_by.username} (${consultationData.last_edited_by.user_type})`} -
- )}
- +
+
+ +
+
diff --git a/src/Components/Facility/Consultations/Mews.tsx b/src/Components/Facility/Consultations/Mews.tsx index 14e7d7f9e63..8e109410958 100644 --- a/src/Components/Facility/Consultations/Mews.tsx +++ b/src/Components/Facility/Consultations/Mews.tsx @@ -1,6 +1,5 @@ import { DailyRoundsModel } from "../../Patient/models"; -import RecordMeta from "../../../CAREUI/display/RecordMeta"; -import { classNames } from "../../../Utils/utils"; +import { formatDateTime } from "../../../Utils/utils"; const getRespScore = (value?: number) => { if (typeof value !== "number") return; @@ -60,35 +59,45 @@ const getLOCRange = (value?: DailyRoundsModel["consciousness_level"]) => { }[value]; }; +const getBorderColor = (score: number) => { + if (score === undefined) return "border-gray-700"; + if (score <= 2) return "border-primary-500"; + if (score <= 3) return "border-yellow-300"; + if (score <= 5) return "border-warning-600"; + return "border-danger-500"; +}; + export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => { const mewsCard = (isMissing: boolean, data: string[] | number) => { if (isMissing) { return ( <> -
-

N/A

+
+
+ - +
+ MEWS
{(data as string[]).join(", ")}{" "} data is missing from the last log update. +
Last Updated: {formatDateTime(dailyRound.modified_date)}
-
- -
-
+
); } else { - const value = Number(data); return ( <> -
-

{data}

+
+
+ {data} +
+ MEWS

Resp. Rate: {dailyRound.resp} @@ -113,25 +122,10 @@ export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => { .toLowerCase()}

+ Last Updated: {formatDateTime(dailyRound.modified_date)}
-
- -
6 && "bg-danger-500" - )} - >
-
+
); } @@ -149,8 +143,7 @@ export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => { if (Object.values(scores).some((value) => value === undefined)) { return ( -
-

MEWS Score

+
{mewsCard( true, Object.entries(scores) @@ -162,8 +155,7 @@ export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => { } return ( -
-

MEWS Score

+
{mewsCard( false, Object.values(scores as Record).reduce((p, v) => p + v) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index c9d4aac916d..8cbb24c61a9 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -6,29 +6,29 @@ import { PATIENT_CATEGORIES, RESPIRATORY_SUPPORT, TELEMEDICINE_ACTIONS, -} from "../../Common/constants"; -import { ConsultationModel, PatientCategory } from "../Facility/models"; +} from "../../Common/constants.js"; +import { ConsultationModel, PatientCategory } from "../Facility/models.js"; import { Switch, Menu } from "@headlessui/react"; import { Link, navigate } from "raviger"; import { useState } from "react"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import useConfig from "../../Common/hooks/useConfig"; -import dayjs from "../../Utils/dayjs"; +import CareIcon from "../../CAREUI/icons/CareIcon.js"; +import useConfig from "../../Common/hooks/useConfig.js"; +import dayjs from "../../Utils/dayjs.js"; import { classNames, formatDate, formatDateTime } from "../../Utils/utils.js"; -import ABHAProfileModal from "../ABDM/ABHAProfileModal"; -import LinkABHANumberModal from "../ABDM/LinkABHANumberModal"; -import LinkCareContextModal from "../ABDM/LinkCareContextModal"; -import DialogModal from "../Common/Dialog"; -import ButtonV2 from "../Common/components/ButtonV2"; -import Beds from "../Facility/Consultations/Beds"; -import { PatientModel } from "./models"; +import ABHAProfileModal from "../ABDM/ABHAProfileModal.js"; +import LinkABHANumberModal from "../ABDM/LinkABHANumberModal.js"; +import LinkCareContextModal from "../ABDM/LinkCareContextModal.js"; +import DialogModal from "../Common/Dialog.js"; +import ButtonV2 from "../Common/components/ButtonV2.js"; +import Beds from "../Facility/Consultations/Beds.js"; +import { PatientModel } from "./models.js"; import request from "../../Utils/request/request.js"; import routes from "../../Redux/api.js"; import DropdownMenu from "../Common/components/Menu.js"; import { triggerGoal } from "../../Integrations/Plausible.js"; -import useAuthUser from "../../Common/hooks/useAuthUser"; +import useAuthUser from "../../Common/hooks/useAuthUser.js"; import { Mews } from "../Facility/Consultations/Mews.js"; import DischargeSummaryModal from "../Facility/DischargeSummaryModal.js"; import DischargeModal from "../Facility/DischargeModal.js"; @@ -153,83 +153,86 @@ export default function PatientInfoCard(props: { )} -
-
+
+
{/* Can support for patient picture in the future */} -
-
- {consultation?.current_bed && - consultation?.discharge_date === null ? ( -
-

- { - consultation?.current_bed?.bed_object?.location_object - ?.name - } -

-

- {consultation?.current_bed?.bed_object.name} -

-
- +
+
+
+ {consultation?.current_bed && + consultation?.discharge_date === null ? ( +
+

{ consultation?.current_bed?.bed_object?.location_object ?.name } - - {consultation?.current_bed?.bed_object.name} +

+

+ {consultation?.current_bed?.bed_object.name} +

+
+ + { + consultation?.current_bed?.bed_object?.location_object + ?.name + } + + {consultation?.current_bed?.bed_object.name} +
-
- ) : ( -
- + ) : ( +
+ +
+ )} +
+ {category && ( +
+ {category.toUpperCase()}
)} + setOpen(true)} + className="mt-1 px-[10px] py-1" + > + {bedDialogTitle} +
- {category && ( +
- {category.toUpperCase()} -
- )} - setOpen(true)} className="mt-1"> - {bedDialogTitle} - -
-
-
- {patient.name} -
-
- {patient.review_time && - !consultation?.discharge_date && - Number(consultation?.review_interval) > 0 && ( -
+ {patient.age} years • {patient.gender} +
+
+ - - {(dayjs().isBefore(patient.review_time) - ? "Review before: " - : "Review Missed: ") + - formatDateTime(patient.review_time)} -
- )} + + {consultation?.facility_name} + +
+
-
+
+
+
- {consultation?.patient_no && ( - - - {`${consultation?.suggestion === "A" ? "IP" : "OP"}: ${ - consultation?.patient_no - }`} - - - )} {medicoLegalCase && ( - + MLC )}
- {!!consultation?.discharge_date && ( -

- Discharged from CARE -

- )} -
-
- {patient.action && patient.action != 10 && ( -
-
- - {" "} - { - TELEMEDICINE_ACTIONS.find( - (i) => i.id === patient.action - )?.desc - } - -
-
- )} -
-
- Age: {patient.age} years -
-
-
-
- Gender: {patient.gender} -
+
+
+ {patient.name} +
+ {patient.age} years • {patient.gender}
- {consultation?.suggestion === "DC" && ( -
+
+
+
+ {consultation?.patient_no && ( + + + {`${consultation?.suggestion === "A" ? "IP" : "OP"}: ${ + consultation?.patient_no + }`} + + + )} + {patient.action && patient.action != 10 && (
-
- Domiciliary Care - +
+ + {" "} + { + TELEMEDICINE_ACTIONS.find( + (i) => i.id === patient.action + )?.desc + } +
+ )} +
+ {patient.blood_group && ( +
+ Blood Group: {patient.blood_group} +
+ )}
- )} -
-
-
- {[ - [ - "Respiratory Support", - RESPIRATORY_SUPPORT.find( - (resp) => - resp.text === - consultation?.last_daily_round?.ventilator_interface - )?.id ?? "UNKNOWN", - consultation?.last_daily_round?.ventilator_interface, - ], - ].map((stat, i) => { - return stat[2] && stat[1] !== "NONE" ? ( -
- {stat[0]} : {stat[1]} -
- ) : ( - "" - ); - })} -
- {consultation?.discharge_date ? ( -
-
- - { - CONSULTATION_SUGGESTION.find( - (suggestion) => - suggestion.id === consultation?.suggestion - )?.text - }{" "} - on {formatDateTime(consultation.encounter_date)}, - {consultation?.new_discharge_reason === - DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id ? ( - - {" "} - Expired on {formatDate(consultation?.death_datetime)} - - ) : ( - - {" "} - Discharged on{" "} - {formatDateTime(consultation?.discharge_date)} - + {patient.review_time && + !consultation?.discharge_date && + Number(consultation?.review_interval) > 0 && ( +
+
+ + {dayjs().isBefore(patient.review_time) + ? "Review before: " + : "Review Missed: "} + {formatDateTime(patient.review_time)} +
+
)} -
-
-
- ) : ( -
- - {consultation?.encounter_date && ( + {consultation?.suggestion === "DC" && (
- Admission on{" "} - {formatDateTime(consultation?.encounter_date)} +
+
+ + Domiciliary Care +
+
)} - {consultation?.icu_admission_date && ( -
- , ICU Admission on{" "} - {formatDateTime(consultation?.icu_admission_date)} + {!!consultation?.discharge_date && ( +

+ Discharged from CARE +

+ )} + {[ + [ + "Respiratory Support", + RESPIRATORY_SUPPORT.find( + (resp) => + resp.text === + consultation?.last_daily_round?.ventilator_interface + )?.id ?? "UNKNOWN", + consultation?.last_daily_round?.ventilator_interface, + ], + ].map((stat, i) => { + return stat[2] && stat[1] !== "NONE" ? ( +
+
+ {stat[0]} : {stat[1]} +
+
+ ) : ( + "" + ); + })} + {consultation?.discharge_date ? ( +
+
+ + + { + CONSULTATION_SUGGESTION.find( + (suggestion) => + suggestion.id === consultation?.suggestion + )?.text + } + {" "} + on {formatDateTime(consultation.encounter_date)}, + {consultation?.new_discharge_reason === "EXP" ? ( + + {" "} + Expired on{" "} + {formatDate(consultation?.death_datetime)} + + ) : ( + + {" "} + Discharged on{" "} + {formatDateTime(consultation?.discharge_date)} + + )} + +
+
+ ) : ( +
+ + {consultation?.encounter_date && ( +
+ Admission on:{" "} + {formatDateTime(consultation?.encounter_date)} +
+ )} + {consultation?.icu_admission_date && ( +
+ , ICU Admission on:{" "} + {formatDateTime(consultation?.icu_admission_date)} +
+ )} +
)} - +
+
+
+
+
+ {consultation?.diagnoses?.length + ? (() => { + const principal_diagnosis = consultation.diagnoses.find( + (diagnosis) => diagnosis.is_principal + ); + return principal_diagnosis ? ( +
+
+ Principal Diagnosis: +
+
+ {principal_diagnosis.diagnosis_object.label}{" "} + + +

+ {principal_diagnosis.verification_status} +

+
+
+
+ ) : null; + })() + : null} + {(consultation?.treating_physician_object || + consultation?.deprecated_verified_by) && ( +
+ + Treating Physician:{" "} + + {consultation?.treating_physician_object + ? `${consultation?.treating_physician_object.first_name} ${consultation?.treating_physician_object.last_name}` + : consultation?.deprecated_verified_by} + +
+ )}
- )} +
- {consultation?.last_daily_round && ( -
- -
- )} -
+ {consultation?.last_daily_round && ( +
+ +
+ )} {!!consultation?.discharge_date && ( -
+
Discharge Reason
-
+
{!consultation?.new_discharge_reason ? ( {consultation.suggestion === "OP" @@ -401,14 +472,6 @@ export default function PatientInfoCard(props: {
)} {[ - [ - `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/update`, - "Edit Consultation Details", - "pen", - patient.is_active && - consultation?.id && - !consultation?.discharge_date, - ], [ `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/daily-rounds`, "Log Update", @@ -431,7 +494,10 @@ export default function PatientInfoCard(props: { ].map( (action: any, i) => action[3] && ( -
+
- +

{action[1]}

{action?.[4]?.[0] && ( <> -

+

{action[4][1]}

@@ -474,11 +540,20 @@ export default function PatientInfoCard(props: { } + title={"Manage Patient"} + icon={} + containerClassName="w-full lg:w-auto mt-2 2xl:mt-0" >
{[ + [ + `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/update`, + "Edit Consultation Details", + "pen", + patient.is_active && + consultation?.id && + !consultation?.discharge_date, + ], [ `/patient/${patient.id}/investigation_reports`, "Investigation Summary", @@ -554,6 +629,7 @@ export default function PatientInfoCard(props: { ) )}
+
{enable_abdm && (patient.abha_number ? ( diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index b890672a6c1..916d32f5ba3 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -99,9 +99,11 @@ export const formatDate = (date: DateLike, format = DATE_FORMAT) => export const formatTime = (date: DateLike, format = TIME_FORMAT) => formatDateTime(date, format); -export const relativeDate = (date: DateLike) => { +export const relativeDate = (date: DateLike, withoutSuffix = false) => { const obj = dayjs(date); - return `${obj.fromNow()} at ${obj.format(TIME_FORMAT)}`; + return `${obj.fromNow(withoutSuffix)} ${ + withoutSuffix && "ago" + } at ${obj.format(TIME_FORMAT)}`; }; export const formatName = (user: { first_name: string; last_name: string }) => {