Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenreup committed Aug 8, 2024
1 parent 41385b5 commit 041bd6c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/app/(dashboard)/patients/[id]/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const fetchCarePlan = async (
}
};


export const createDetails = async (
patienyId: string,
carePlan: fhirR4.CarePlan
Expand All @@ -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) =>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(dashboard)/patients/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ const Content = ({ locationMap }: Props) => {
<span className="badge">BirthDate: {patient.birthDate}</span>
</div>
{patient.phoneNumbers.map((value, index) => (
<div key={value.number} className="flex flex-row gap-2">
<div key={value.number} className="flex flex-row flex-wrap gap-2">
<span className="badge">
Phone {index + 1}: {value.number} -- Owner: {value.owner}
</span>
</div>
))}
{patient.address.map((address, index) => (
<div key={address.facility} className="flex flex-row gap-2">
<div key={address.facility} className="flex flex-row flex-wrap gap-2">
<span className="badge">Location: {address.facility}</span>
<span className="badge">Physical: {address.physical}</span>
</div>
Expand Down
13 changes: 12 additions & 1 deletion src/components/careplan/careplanContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
Expand Down Expand Up @@ -208,7 +210,15 @@ const CarePlanSummary = ({
<details className="collapse bg-base-200">
<summary className="collapse-title text-xl font-medium">
<div className="flex flex-row justify-between w-full items-center">
<span>View Care Plan Details</span>
<div className="flex flex-row gap-4">
{careplan.period.start && (
<span>{format(careplan.period.start, "PPP")}</span>
)}
-
{careplan.period.end && (
<span>{format(careplan.period.end, "PPP")}</span>
)}
</div>
<div className="flex flex-row gap-2 items-center">
{careplan.version != lastestVersion && (
<Button onClick={() => setCurrentVersion(careplan.version)}>
Expand All @@ -229,6 +239,7 @@ const CarePlanSummary = ({
Next {" >"}
</Button>
)}
<DownIcon />
</div>
</div>
</summary>
Expand Down
16 changes: 10 additions & 6 deletions src/lib/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
};
Expand All @@ -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;
};

0 comments on commit 041bd6c

Please sign in to comment.