Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added patient category descriptions for ICU bed patients #7970

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,33 @@ export type PatientCategoryID = "Comfort" | "Stable" | "Moderate" | "Critical";
export const PATIENT_CATEGORIES: {
id: PatientCategoryID;
text: PatientCategory;
description: string;
twClass: string;
}[] = [
{ id: "Comfort", text: "Comfort Care", twClass: "patient-comfort" },
{ id: "Stable", text: "Mild", twClass: "patient-stable" },
{ id: "Moderate", text: "Moderate", twClass: "patient-abnormal" },
{ id: "Critical", text: "Critical", twClass: "patient-critical" },
{
id: "Comfort",
text: "Comfort Care",
twClass: "patient-comfort",
description: "End of life care",
},
{
id: "Stable",
text: "Mild",
twClass: "patient-stable",
description: "Urgent: not life-threatening",
},
{
id: "Moderate",
text: "Moderate",
twClass: "patient-abnormal",
description: "Emergency: could be life-threatening",
},
{
id: "Critical",
text: "Critical",
twClass: "patient-critical",
description: "Immediate: life-threatening",
},
];

export const PATIENT_FILTER_CATEGORIES = PATIENT_CATEGORIES;
Expand Down
37 changes: 20 additions & 17 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1122,22 +1122,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
/>
</div>
</div>

<div className="col-span-6" ref={fieldRef["category"]}>
<PatientCategorySelect
labelSuffix={
disabledFields.includes("category") && (
<p className="text-xs font-medium text-warning-500">
A daily round already exists.
</p>
)
}
required
label="Category"
{...field("category")}
/>
</div>

<div className="col-span-6" ref={fieldRef["suggestion"]}>
<SelectFormField
required
Expand Down Expand Up @@ -1291,7 +1275,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
</div>
)}

<div className="col-span-6 mb-6" ref={fieldRef["patient_no"]}>
<div className="col-span-6" ref={fieldRef["patient_no"]}>
<TextFormField
{...field("patient_no")}
label={
Expand All @@ -1302,6 +1286,25 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
required={state.form.suggestion === "A"}
/>
</div>
<div className="col-span-6 mb-6" ref={fieldRef["category"]}>
<PatientCategorySelect
labelSuffix={
disabledFields.includes("category") && (
<p className="text-xs font-medium text-warning-500">
A daily round already exists.
</p>
)
}
hideDescription={
(Array.isArray(bed)
? bed[0].bed_type
: bed?.bed_type) !== "ICU"
}
required
label="Category"
{...field("category")}
/>
</div>
</div>

<div className="flex flex-col gap-4 pb-4">
Expand Down
6 changes: 6 additions & 0 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const DailyRounds = (props: any) => {
const [isLoading, setIsLoading] = useState(false);
const [facilityName, setFacilityName] = useState("");
const [patientName, setPatientName] = useState("");
const [bedType, setBedType] = useState<string>("");
const [consultationSuggestion, setConsultationSuggestion] = useState<any>("");
const [prevReviewInterval, setPreviousReviewInterval] = useState(-1);
const [prevAction, setPreviousAction] = useState("NO_ACTION");
Expand Down Expand Up @@ -180,6 +181,9 @@ export const DailyRounds = (props: any) => {
if (data) {
setPatientName(data.name!);
setFacilityName(data.facility_object!.name);
setBedType(
data.last_consultation?.current_bed?.bed_object?.bed_type || "",
);
setConsultationSuggestion(data.last_consultation?.suggestion);
setDiagnoses(
data.last_consultation?.diagnoses?.sort(
Expand All @@ -206,6 +210,7 @@ export const DailyRounds = (props: any) => {
};
}
} else {
setBedType("");
setPatientName("");
setFacilityName("");
}
Expand Down Expand Up @@ -517,6 +522,7 @@ export const DailyRounds = (props: any) => {
<div className="w-full md:w-1/3">
<PatientCategorySelect
{...field("patient_category")}
hideDescription={bedType !== "ICU"}
required
label="Category"
/>
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Patient/PatientCategorySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FormFieldBaseProps } from "../Form/FormFields/Utils";
* field.
*/
export default function PatientCategorySelect(
props: FormFieldBaseProps<PatientCategoryID>,
props: FormFieldBaseProps<PatientCategoryID> & { hideDescription?: boolean },
) {
return (
<SelectFormField
Expand All @@ -17,6 +17,9 @@ export default function PatientCategorySelect(
options={PATIENT_CATEGORIES}
optionValue={(option) => option.id}
optionLabel={(option) => option.text}
optionDescription={
props.hideDescription ? undefined : (option) => option.description
}
optionSelectedLabel={(option) => (
<span className="flex items-center gap-3">
<div
Expand Down
5 changes: 5 additions & 0 deletions src/Components/Patient/ShiftCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
const { facilityId, patientId } = props;
const [isLoading, setIsLoading] = useState(false);
const [patientCategory, setPatientCategory] = useState<any>();
const [bedType, setBedType] = useState("");
const { t } = useTranslation();
const { wartime_shifting } = useConfig();

Expand Down Expand Up @@ -120,6 +121,9 @@ export const ShiftCreate = (props: patientShiftProps) => {
setPatientCategory(
PATIENT_CATEGORIES.find((c) => c.text === patient_category)?.id,
);
setBedType(
data.last_consultation?.current_bed?.bed_object.bed_type || "",
);
}
},
});
Expand Down Expand Up @@ -331,6 +335,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
<PatientCategorySelect
required={true}
{...field("patient_category")}
hideDescription={bedType !== "ICU"}
value={patientCategory}
onChange={(e) => setPatientCategory(e.value)}
label="Patient Category"
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Shifting/ShiftDetailsUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
required={true}
name="patient_category"
value={state.form.patient_category}
hideDescription={
consultationData.current_bed?.bed_object.bed_type !== "ICU"
}
onChange={handleFormFieldChange}
label="Patient Category"
className="md:col-span-2"
Expand Down
Loading