Skip to content

Commit

Permalink
fix(consultation): added action and recommend discharge tags
Browse files Browse the repository at this point in the history
  • Loading branch information
aeswibon committed Apr 17, 2023
1 parent f5d8cf9 commit f2809bd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 24 deletions.
79 changes: 55 additions & 24 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DISCHARGE_REASONS,
PATIENT_CATEGORIES,
RESPIRATORY_SUPPORT,
TELEMEDICINE_ACTIONS,
} from "../../Common/constants";
import moment from "moment";
import ButtonV2 from "../Common/components/ButtonV2";
Expand Down Expand Up @@ -39,8 +40,8 @@ export default function PatientInfoCard(props: {
const bedDialogTitle = !patient.is_active
? "Bed History"
: !consultation?.current_bed
? "Assign Bed"
: "Switch Bed";
? "Assign Bed"
: "Switch Bed";

return (
<>
Expand Down Expand Up @@ -73,8 +74,8 @@ export default function PatientInfoCard(props: {
className={`w-24 h-24 min-w-[5rem] bg-gray-200 ${categoryClass}-profile`}
>
{consultation &&
consultation?.current_bed &&
consultation?.discharge_date === null ? (
consultation?.current_bed &&
consultation?.discharge_date === null ? (
<div
className="flex flex-col items-center justify-center h-full"
title={`
Expand Down Expand Up @@ -159,11 +160,32 @@ export default function PatientInfoCard(props: {
Discharged from CARE
</p>
)}
<p className="text-sm sm:text-sm text-gray-900">
<span>{patient.age} years</span>
<span className="mx-2"></span>
<span>{patient.gender}</span>
</p>
<div className="flex flex-col sm:flex-row items-center gap-2 text-sm sm:text-sm text-gray-900">
<div>
{patient.action && patient.action != 10 && (
<div className="inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-start border-gray-500 border bg-blue-700">
<span className="font-semibold text-white">
Action:{" "}
{
TELEMEDICINE_ACTIONS.find(
(i) => i.id === patient.action
)?.desc
}
</span>
</div>
)}
</div>
<div>
<div className="inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-start border-gray-500 border bg-gray-200">
<b>Age:</b> {patient.age} years
</div>
</div>
<div>
<div className="inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-start border-gray-500 border bg-gray-200">
<b>Gender</b>: {patient.gender}
</div>
</div>
</div>
<div className="text-sm flex flex-col sm:flex-row items-center gap-2 lg:mt-4">
{[
["Blood Group", patient.blood_group, patient.blood_group],
Expand Down Expand Up @@ -212,8 +234,8 @@ export default function PatientInfoCard(props: {
on{" "}
{consultation?.suggestion === "A"
? moment(consultation?.admission_date).format(
"DD/MM/YYYY"
)
"DD/MM/YYYY"
)
: moment(consultation?.created_date).format("DD/MM/YYYY")}
,
{consultation?.discharge_reason === "EXP" ? (
Expand All @@ -237,6 +259,15 @@ export default function PatientInfoCard(props: {
</div>
</div>
)}
{patient.is_active &&
patient?.last_consultation?.last_daily_round
?.recommend_discharge && (
<div className="flex gap-4 text-sm mt-3 px-3 py-1 font-medium bg-green-500">
<span className="font-semibold text-white">
Discharge Recommended
</span>
</div>
)}
</div>
</div>

Expand Down Expand Up @@ -273,10 +304,10 @@ export default function PatientInfoCard(props: {
patient.is_active && consultation?.id,
[
!(consultation?.facility !== patient.facility) &&
!(consultation?.discharge_date || !patient.is_active) &&
moment(consultation?.modified_date).isBefore(
new Date().getTime() - 24 * 60 * 60 * 1000
),
!(consultation?.discharge_date || !patient.is_active) &&
moment(consultation?.modified_date).isBefore(
new Date().getTime() - 24 * 60 * 60 * 1000
),
<div className="text-center">
<CareIcon className="care-l-exclamation-triangle" /> No update
filed in the last 24 hours
Expand All @@ -299,13 +330,13 @@ export default function PatientInfoCard(props: {
.concat(
enable_hcx
? [
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`,
"Claims",
"copy-landscape",
consultation?.id,
],
]
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`,
"Claims",
"copy-landscape",
consultation?.id,
],
]
: []
)
.map(
Expand All @@ -317,8 +348,8 @@ export default function PatientInfoCard(props: {
variant={action[4] && action[4][0] ? "danger" : "primary"}
href={
consultation?.admitted &&
!consultation?.current_bed &&
i === 1
!consultation?.current_bed &&
i === 1
? undefined
: `${action[0]}`
}
Expand Down
1 change: 1 addition & 0 deletions src/Components/Patient/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface AssignedToObjectModel {
export interface PatientModel {
test_id?: string;
id?: number;
action?: number;
name?: string;
age?: number;
allow_transfer?: boolean;
Expand Down

0 comments on commit f2809bd

Please sign in to comment.