Skip to content

Commit

Permalink
fix: added validation for review_time
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Oct 24, 2022
1 parent eb5fea2 commit 9c424b8
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 47 deletions.
1 change: 1 addition & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface ConsultationModel {
lines?: any;
last_daily_round?: any;
current_bed?: CurrentBed;
review_interval?: number;
}
export interface PatientStatsModel {
id?: number;
Expand Down
17 changes: 10 additions & 7 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,16 @@ export const PatientManager = (props: any) => {
)}
<div className="flex w-full">
<div className="flex flex-wrap gap-2 flex-row justify-start">
{moment().isAfter(patient.review_time) && (
<Badge
color="red"
startIcon="clock"
text="Review Missed"
/>
)}
{patient.review_time &&
!patient.last_consultation?.discharge_date &&
Number(patient.last_consultation?.review_interval) > 0 &&
moment().isAfter(patient.review_time) && (
<Badge
color="red"
startIcon="clock"
text="Review Missed"
/>
)}
{patient.allow_transfer ? (
<Badge
color="yellow"
Expand Down
35 changes: 19 additions & 16 deletions src/Components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -670,22 +670,25 @@ export const PatientHome = (props: any) => {
className="space-y-2 flex-col justify-between flex h-full"
>
<div>
{patientData.review_time && (
<div
className={
"mb-2 inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-center border-gray-500 border " +
(moment().isBefore(patientData.review_time)
? " bg-gray-100"
: " p-1 bg-red-400 text-white")
}
>
<i className="mr-2 text-md fas fa-clock"></i>
{(moment().isBefore(patientData.review_time)
? "Review before: "
: "Review Missed: ") +
formatDate(patientData.review_time)}
</div>
)}
{patientData.review_time &&
!patientData.last_consultation?.discharge_date &&
Number(patientData.last_consultation?.review_interval) >
0 && (
<div
className={
"mb-2 inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-center border-gray-500 border " +
(moment().isBefore(patientData.review_time)
? " bg-gray-100"
: " p-1 bg-red-400 text-white")
}
>
<i className="mr-2 text-md fas fa-clock"></i>
{(moment().isBefore(patientData.review_time)
? "Review before: "
: "Review Missed: ") +
formatDate(patientData.review_time)}
</div>
)}
<div className="p-2 bg-white rounded-lg shadow text-center">
<div className="flex justify-between">
<div className="w-1/2 border-r-2 truncate">
Expand Down
42 changes: 18 additions & 24 deletions src/Components/TeleIcu/Patient/InfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ const PatientCategoryDisplayText: Record<PatientCategory, string> = {
unknown: "UNKNOWN",
};

const PatientCategoryClasses: Record<PatientCategory, string> = {
"Comfort Care": "h-10",
Stable: "h-6",
"Slightly Abnormal": "h-10",
Critical: "h-6",
unknown: "h-6",
};

export default function TeleICUPatientInfoCard(props: {
patient: PatientModel;
ip_no?: string | undefined;
Expand Down Expand Up @@ -116,22 +108,24 @@ export default function TeleICUPatientInfoCard(props: {
{patient.name}
</div>
<div>
{patient.review_time && (
<div
className={
"mb-2 inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-center border-gray-500 border " +
(moment().isBefore(patient.review_time)
? " bg-gray-100"
: " p-1 bg-red-400 text-white")
}
>
<i className="mr-2 text-md fas fa-clock"></i>
{(moment().isBefore(patient.review_time)
? "Review before: "
: "Review Missed: ") +
moment(patient.review_time).format("lll")}
</div>
)}
{patient.review_time &&
!patient.last_consultation?.discharge_date &&
Number(patient.last_consultation?.review_interval) > 0 && (
<div
className={
"mb-2 inline-flex items-center px-3 py-1 rounded-lg text-xs leading-4 font-semibold p-1 w-full justify-center border-gray-500 border " +
(moment().isBefore(patient.review_time)
? " bg-gray-100"
: " p-1 bg-red-400 text-white")
}
>
<i className="mr-2 text-md fas fa-clock"></i>
{(moment().isBefore(patient.review_time)
? "Review before: "
: "Review Missed: ") +
moment(patient.review_time).format("lll")}
</div>
)}
</div>
<div className="flex flex-col sm:flex-row items-center gap-1 lg:mb-2">
<Link
Expand Down

0 comments on commit 9c424b8

Please sign in to comment.