-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d586d13
commit 0fd3547
Showing
8 changed files
with
363 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import dayjs from "dayjs"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Table, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from "@/components/ui/table"; | ||
|
||
import PageTitle from "@/components/Common/PageTitle"; | ||
|
||
import { DummyCarePlanRetrieve } from "@/types/emr/careplan/careplanApi"; | ||
|
||
export default function CarePlan(props: { | ||
facilityId: string; | ||
encounterId: string; | ||
careplanId: string; | ||
}) { | ||
const { t } = useTranslation(); | ||
|
||
const planQuery = useQuery({ | ||
queryKey: ["care-plan", props.careplanId], | ||
queryFn: () => DummyCarePlanRetrieve(props.careplanId), | ||
}); | ||
|
||
const careplan = planQuery.data; | ||
|
||
return ( | ||
<div className="flex flex-col-reverse md:flex-row gap-4 md:justify-between"> | ||
<div> | ||
<PageTitle | ||
title={planQuery.data?.title || t("care_plan")} | ||
breadcrumbs={true} | ||
backUrl={`/facility/${props.facilityId}/encounter/${props.encounterId}/care-plan`} | ||
/> | ||
<div className="text-lg text-gray-500"> | ||
{dayjs(careplan?.end_date).isBefore(dayjs()) ? ( | ||
"Completed" | ||
) : dayjs(careplan?.start_date).isAfter(dayjs()) ? ( | ||
<span className="text-blue-500">Upcoming</span> | ||
) : ( | ||
<div className="text-red-500 flex items-center gap-1"> | ||
<div className="bg-red-500 w-2 aspect-square rounded-full inline-block" /> | ||
Active | ||
</div> | ||
)} | ||
</div> | ||
<div className="text-sm text-gray-500 mt-4"> | ||
{dayjs(careplan?.start_date).isAfter(dayjs()) | ||
? "Starts on" | ||
: "Started On"}{" "} | ||
: {dayjs(careplan?.start_date).format("DD/MM/YYYY hh:mm a")} | ||
<br /> | ||
{dayjs(careplan?.end_date).isAfter(dayjs()) | ||
? "Ends on" | ||
: "Ended On"}{" "} | ||
: {dayjs(careplan?.end_date).format("DD/MM/YYYY hh:mm a")} | ||
</div> | ||
<div className="mt-4">{careplan?.description}</div> | ||
<div className="mt-8"> | ||
<b className="text-lg">Addresses</b> | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Code</TableHead> | ||
<TableHead>Detail</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
{careplan?.addresses.map((code, i) => ( | ||
<TableRow key={i}> | ||
<TableCell>{code.code}</TableCell> | ||
<TableCell>{code.display}</TableCell> | ||
</TableRow> | ||
))} | ||
</Table> | ||
</div> | ||
<div className="mt-8"> | ||
<b className="text-lg">Goals</b> | ||
</div> | ||
</div> | ||
<div className="md:w-[200px] w-full flex flex-col gap-2"> | ||
<Button className="w-full" variant={"primary"}> | ||
Update | ||
</Button> | ||
<Button className="w-full" variant={"primary"}> | ||
Prescribe Medication | ||
</Button> | ||
<Button className="w-full" variant={"primary"}> | ||
Order Lab Test | ||
</Button> | ||
<Button className="w-full" variant={"primary"}> | ||
Record Task | ||
</Button> | ||
<Button className="w-full" variant={"primary"}> | ||
Print Plan | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import dayjs from "dayjs"; | ||
import { Link } from "raviger"; | ||
|
||
import SubHeading from "@/CAREUI/display/SubHeading"; | ||
|
||
import { EncounterTabProps } from "@/pages/Encounters/EncounterShow"; | ||
import { DummyCarePlanGet } from "@/types/emr/careplan/careplanApi"; | ||
|
||
export const EncounterCarePlanTab = (props: EncounterTabProps) => { | ||
const { patient, encounter, facilityId } = props; | ||
const { data: carePlans } = useQuery({ | ||
queryKey: ["patient", patient.id, "care-plans"], | ||
queryFn: DummyCarePlanGet, | ||
}); | ||
return ( | ||
<div className="flex flex-col"> | ||
<SubHeading title="Care Plan" /> | ||
<div className="grid grid-cols-3 gap-4"> | ||
{carePlans?.results.map((careplan, i) => ( | ||
<Link | ||
href={`/facility/${facilityId}/encounter/${encounter.id}/care-plan/${careplan.id}`} | ||
key={i} | ||
className="bg-white border rounded-lg p-4 hover:text-inherit hover:border-primary-500" | ||
> | ||
<span className="font-bold">{careplan.title}</span> | ||
<div className="text-sm text-gray-500"> | ||
{dayjs(careplan.end_date).isBefore(dayjs()) ? ( | ||
"Completed" | ||
) : dayjs(careplan.start_date).isAfter(dayjs()) ? ( | ||
<span className="text-blue-500">Upcoming</span> | ||
) : ( | ||
<div className="text-red-500 flex items-center gap-1"> | ||
<div className="bg-red-500 w-2 aspect-square rounded-full inline-block" /> | ||
Active | ||
</div> | ||
)} | ||
</div> | ||
<div className="mt-4 text-sm">{careplan.description}</div> | ||
<div className="text-xs text-gray-500 mt-4"> | ||
{dayjs(careplan.start_date).isAfter(dayjs()) | ||
? "Starts on" | ||
: "Started On"}{" "} | ||
: {dayjs(careplan.start_date).format("DD/MM/YYYY hh:mm a")} | ||
<br /> | ||
{dayjs(careplan.end_date).isAfter(dayjs()) | ||
? "Ends on" | ||
: "Ended On"}{" "} | ||
: {dayjs(careplan.end_date).format("DD/MM/YYYY hh:mm a")} | ||
</div> | ||
<div className="mt-4"> | ||
<span className="text-sm font-semibold">3/4 Goals Complete</span> | ||
<div className="bg-gray-200 rounded-full h-1 overflow-hidden mt-2"> | ||
<div className="bg-primary-500 rounded-full w-3/4 h-full" /> | ||
</div> | ||
</div> | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { BaseModel } from "@/Utils/types"; | ||
|
||
export const CARE_PLAN_STATUS = [ | ||
"draft", | ||
"active", | ||
"completed", | ||
"on-hold", | ||
"cancelled", | ||
] as const; | ||
|
||
export const CARE_PLAN_INTENT = [ | ||
"proposal", | ||
"plan", | ||
"order", | ||
"option", | ||
"directive", | ||
] as const; | ||
|
||
interface Code { | ||
code: string; | ||
display: string; | ||
system: string; | ||
} | ||
|
||
export interface CarePlan extends BaseModel { | ||
status: (typeof CARE_PLAN_STATUS)[number]; | ||
intent: (typeof CARE_PLAN_INTENT)[number]; | ||
title: string; | ||
description: string; | ||
start_date: string; | ||
end_date: string; | ||
patient: string; | ||
encounter: string; | ||
custodian: string; | ||
addresses: Code[]; | ||
notes?: string; | ||
} |
Oops, something went wrong.