Skip to content

Commit

Permalink
Merge branch 'develop' into HideAssetType#6789
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 committed Feb 7, 2024
2 parents 086b6a3 + 26a74a9 commit b01cfbb
Show file tree
Hide file tree
Showing 14 changed files with 527 additions and 468 deletions.
1 change: 1 addition & 0 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions src/Components/Assets/AssetType/HL7Monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ const HL7Monitor = (props: HL7MonitorProps) => {
};

if (isLoading) return <Loading />;

const socketUrl = `wss://${
middlewareHostname || resolvedMiddleware?.hostname
}/observations/${localipAddress}`;

return (
<div className="mx-auto flex w-full xl:mt-8">
<div className="mx-auto flex flex-col gap-4 xl:flex-row-reverse">
Expand Down Expand Up @@ -126,13 +131,12 @@ const HL7Monitor = (props: HL7MonitorProps) => {
)}

{assetType === "HL7MONITOR" && (
<HL7PatientVitalsMonitor
socketUrl={`wss://${resolvedMiddleware?.hostname}/observations/${localipAddress}`}
/>
<HL7PatientVitalsMonitor key={socketUrl} socketUrl={socketUrl} />
)}
{assetType === "VENTILATOR" && (
<VentilatorPatientVitalsMonitor
socketUrl={`wss://${resolvedMiddleware?.hostname}/observations/${localipAddress}`}
key={socketUrl}
socketUrl={socketUrl}
/>
)}
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Common/RelativeDateUserMention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function RelativeDateUserMention(props: {
actionDate?: string;
user?: PerformedByModel;
tooltipPosition?: "top" | "bottom" | "left" | "right";
withoutSuffix?: boolean;
}) {
return (
<div className="flex flex-row flex-wrap items-center justify-center ">
Expand All @@ -15,7 +16,9 @@ function RelativeDateUserMention(props: {
>
{props.actionDate ? formatDateTime(props.actionDate) : "--:--"}
</span>
{props.actionDate ? relativeDate(props.actionDate) : "--:--"}
{props.actionDate
? relativeDate(props.actionDate, props.withoutSuffix ?? false)
: "--:--"}
</div>
{props.user && (
<div className="tooltip">
Expand Down
12 changes: 3 additions & 9 deletions src/Components/Common/components/AccordionV2.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useRef, useState } from "react";
import { classNames } from "../../../Utils/utils";

export default function AccordionV2(props: {
children: JSX.Element | JSX.Element[];
Expand Down Expand Up @@ -55,15 +54,10 @@ export default function AccordionV2(props: {
</button>
</div>
<div
className={classNames("transition-all duration-500 ease-in-out")}
className={`transition-all duration-500 ease-in-out ${
toggle ? "overflow-visible" : "h-0 overflow-hidden"
}`}
ref={contentEl}
style={
toggle
? {
overflow: "visible",
}
: { height: "0px", overflow: "hidden" }
}
>
{props.children}
</div>
Expand Down
102 changes: 102 additions & 0 deletions src/Components/Diagnosis/DiagnosesListAccordion.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<div className="flex justify-between">
{!isVisible && (
<ButtonV2
className="text-md w-full p-0 font-semibold text-black hover:bg-gray-200"
ghost
onClick={() => {
setIsVisible((prev) => !prev);
}}
>
<CareIcon icon="l-angle-down" className="h-7" />
Expand Diagnoses
</ButtonV2>
)}
</div>
<div
className={`transition-all duration-500 ease-in-out ${
isVisible ? "overflow-visible" : "h-0 overflow-hidden"
}`}
>
<h3 className="my-2 text-lg font-semibold leading-relaxed text-gray-900">
Diagnoses
</h3>
<div className="grid grid-cols-1 items-start gap-2 lg:grid-cols-2 2xl:grid-cols-3">
{Object.entries(diagnoses).map(
([status, diagnoses]) =>
!!diagnoses.length && (
<DiagnosesOfStatus key={status} diagnoses={diagnoses} />
)
)}
</div>
<ButtonV2
className="text-md w-full rounded-lg p-0 text-gray-600 hover:bg-gray-200"
ghost
onClick={() => {
setIsVisible(false);
}}
>
<CareIcon icon="l-angle-up" className="h-7" />
Hide Diagnoses
</ButtonV2>
</div>
</div>
);
}

const DiagnosesOfStatus = ({ diagnoses }: Props) => {
const { t } = useTranslation();

return (
<div>
<h2 className="text-sm font-semibold">
{t(diagnoses[0].verification_status)} {t("diagnoses")}{" "}
<span>({t("icd11_as_recommended")})</span>
</h2>
<ul className="text-sm">
{diagnoses.map((diagnosis) => (
<li key={diagnosis.id} className="flex items-center gap-2">
<span>{diagnosis.diagnosis_object?.label}</span>
</li>
))}
</ul>
</div>
);
};
87 changes: 0 additions & 87 deletions src/Components/Diagnosis/LegacyDiagnosesList.tsx

This file was deleted.

107 changes: 54 additions & 53 deletions src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from{" "}
{formatDate(
props.consultationData.last_daily_round.created_at
props.consultationData.last_daily_round.taken_at
)}
</span>
</>
Expand Down Expand Up @@ -602,58 +602,59 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</div>
</div>
)}

<div className="mt-4 overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Body Details
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
Gender {" - "}
<span className="font-semibold">
{props.patientData.gender ?? "-"}
</span>
</div>
<div>
Age {" - "}
<span className="font-semibold">
{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
)
: "-"}
</span>
</div>
<div>
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
</span>
</div>
<div>
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600
).toFixed(2)}{" "}
m<sup>2</sup>
</span>
</div>
<div>
Blood Group {" - "}
<span className="font-semibold">
{props.patientData.blood_group ?? "-"}
</span>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div className="col-span-1 mt-4 overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Body Details
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
Gender {" - "}
<span className="font-semibold">
{props.patientData.gender ?? "-"}
</span>
</div>
<div>
Age {" - "}
<span className="font-semibold">
{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
)
: "-"}
</span>
</div>
<div>
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
</span>
</div>
<div>
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600
).toFixed(2)}{" "}
m<sup>2</sup>
</span>
</div>
<div>
Blood Group {" - "}
<span className="font-semibold">
{props.patientData.blood_group ?? "-"}
</span>
</div>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit b01cfbb

Please sign in to comment.