From 041bd6c14d75de101906d4bb21e6bdd9291a16e6 Mon Sep 17 00:00:00 2001 From: Christopher Seven Phiri Date: Thu, 8 Aug 2024 13:24:06 +0200 Subject: [PATCH] update --- src/app/(dashboard)/patients/[id]/fetch.ts | 5 ++++- src/app/(dashboard)/patients/content.tsx | 4 ++-- src/components/careplan/careplanContainer.tsx | 13 ++++++++++++- src/lib/models/types.ts | 16 ++++++++++------ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/app/(dashboard)/patients/[id]/fetch.ts b/src/app/(dashboard)/patients/[id]/fetch.ts index eb1571e..3c8dee7 100644 --- a/src/app/(dashboard)/patients/[id]/fetch.ts +++ b/src/app/(dashboard)/patients/[id]/fetch.ts @@ -36,7 +36,6 @@ export const fetchCarePlan = async ( } }; - export const createDetails = async ( patienyId: string, carePlan: fhirR4.CarePlan @@ -51,6 +50,10 @@ export const createDetails = async ( patientId: patienyId, activities: tasks, requester: carePlan.author?.display, + period: { + start: carePlan.period?.start?.toString() ?? "NA", + end: carePlan.period?.end?.toString() ?? "NA", + }, visitNumber: carePlan.category?.find( (e) => diff --git a/src/app/(dashboard)/patients/content.tsx b/src/app/(dashboard)/patients/content.tsx index c7c6fd5..c221597 100644 --- a/src/app/(dashboard)/patients/content.tsx +++ b/src/app/(dashboard)/patients/content.tsx @@ -35,14 +35,14 @@ const Content = ({ locationMap }: Props) => { BirthDate: {patient.birthDate} {patient.phoneNumbers.map((value, index) => ( -
+
Phone {index + 1}: {value.number} -- Owner: {value.owner}
))} {patient.address.map((address, index) => ( -
+
Location: {address.facility} Physical: {address.physical}
diff --git a/src/components/careplan/careplanContainer.tsx b/src/components/careplan/careplanContainer.tsx index d2181eb..4fc7f03 100644 --- a/src/components/careplan/careplanContainer.tsx +++ b/src/components/careplan/careplanContainer.tsx @@ -3,6 +3,8 @@ import { CarePlanData, CarePlanDataActivity } from "@/lib/models/types"; import { useEffect, useState } from "react"; import { Button } from "../ui/button"; +import { format, formatISO } from "date-fns"; +import { AiOutlineDown as DownIcon } from "react-icons/ai"; type Props = { action: (data: FormData) => Promise; @@ -208,7 +210,15 @@ const CarePlanSummary = ({
- View Care Plan Details +
+ {careplan.period.start && ( + {format(careplan.period.start, "PPP")} + )} + - + {careplan.period.end && ( + {format(careplan.period.end, "PPP")} + )} +
{careplan.version != lastestVersion && ( )} +
diff --git a/src/lib/models/types.ts b/src/lib/models/types.ts index ea9d5b4..882211e 100644 --- a/src/lib/models/types.ts +++ b/src/lib/models/types.ts @@ -8,6 +8,10 @@ export type CarePlanData = { requester?: string; author?: string; visitNumber: string; + period: { + start?: string | Date | undefined; + end: string | Date | undefined; + }; tags: fhirR4.Coding[]; activities: CarePlanDataActivity[]; }; @@ -26,14 +30,14 @@ export type CarePlanDataActivity = { export type LocationData = { id: string; name: string; -} +}; export type SummaryResponse = { - summaries: SummaryItem[], - date: string | string[] | null -} + summaries: SummaryItem[]; + date: string | string[] | null; +}; export type SummaryItem = { name: string; - value: number -} + value: number; +};