Skip to content

Commit

Permalink
Add discharge info card to consultation page (#5270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 authored Apr 7, 2023
1 parent 600455c commit 9b20573
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
156 changes: 156 additions & 0 deletions src/Components/Facility/ConsultationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,162 @@ export const ConsultationDetails = (props: any) => {
</section>
)}
<div className="grid lg:grid-cols-2 gap-4 mt-4">
{consultationData.discharge_date && (
<div
className={`bg-white overflow-hidden shadow rounded-lg gap-4 ${
consultationData.discharge_reason === "REC" &&
"lg:col-span-2"
}`}
>
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Discharge Information
</h3>
<div className="grid gap-4 mt-2">
<div>
Reason {" - "}
<span className="font-semibold">
{DISCHARGE_REASONS.find(
(d) => d.id === consultationData.discharge_reason
)?.text || "--"}
</span>
</div>
{consultationData.discharge_reason === "REC" && (
<div className="grid gap-4">
<div>
Date {" - "}
<span className="font-semibold">
{consultationData.discharge_date
? formatDate(consultationData.discharge_date)
: "--:--"}
</span>
</div>
<div>
Advice {" - "}
<span className="font-semibold">
{consultationData.discharge_notes || "--"}
</span>
</div>
<div className="mt-2">
<div className="font-semibold uppercase text-sm">
Prescription
</div>
<div className="my-2">
<div className="overflow-scroll">
<ResponsiveMedicineTable
theads={[
"Medicine",
"Route",
"Frequency",
"Dosage",
"Days",
"Notes",
]}
list={
consultationData.discharge_prescription
}
objectKeys={[
"medicine",
"route",
"dosage",
"dosage_new",
"days",
"notes",
]}
fieldsToDisplay={[2, 3]}
/>
</div>
</div>{" "}
</div>
<hr className="border border-gray-300 my-2"></hr>
<div className="mt-2">
<div className="font-semibold uppercase text-sm">
PRN Prescription
</div>
<div className="overflow-scroll">
<ResponsiveMedicineTable
theads={[
"Medicine",
"Route",
"Dosage",
"Indicator Event",
"Max. Dosage in 24 hrs",
"Min. time between 2 doses",
]}
list={
consultationData.discharge_prn_prescription
}
objectKeys={[
"medicine",
"route",
"dosage",
"indicator",
"max_dosage",
"min_time",
]}
fieldsToDisplay={[2, 4]}
/>
</div>
</div>
</div>
)}
{consultationData.discharge_reason === "EXP" && (
<div className="grid gap-4">
<div>
Discharge Date {" - "}
<span className="font-semibold">
{consultationData.discharge_date
? formatDate(consultationData.discharge_date)
: "--:--"}
</span>
</div>
<div>
Date of Death {" - "}
<span className="font-semibold">
{consultationData.death_datetime
? formatDate(consultationData.death_datetime)
: "--:--"}
</span>
</div>
<div>
Cause of death {" - "}
<span className="font-semibold">
{consultationData.discharge_reason || "--"}
</span>
</div>
<div>
Confirmed By {" - "}
<span className="font-semibold">
{consultationData.death_confirmed_doctor ||
"--"}
</span>
</div>
</div>
)}
{["REF", "LAMA"].includes(
consultationData.discharge_reason || ""
) && (
<div className="grid gap-4">
<div>
Date {" - "}
<span className="font-semibold">
{consultationData.discharge_date
? formatDate(consultationData.discharge_date)
: "--:--"}
</span>
</div>
<div>
Notes {" - "}
<span className="font-semibold">
{consultationData.discharge_notes || "--"}
</span>
</div>
</div>
)}
</div>
</div>
</div>
)}
{consultationData.symptoms_text && (
<div className="bg-white overflow-hidden shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export interface ConsultationModel {
created_date?: string;
discharge_date?: string;
discharge_reason?: string;
discharge_prescription: any;
discharge_prn_prescription: any;
discharge_notes?: string;
examination_details?: string;
history_of_present_illness?: string;
facility?: number;
Expand Down

0 comments on commit 9b20573

Please sign in to comment.