Skip to content

Commit

Permalink
Add consciousness level options for normal daily round type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Dec 28, 2023
1 parent 36fa6e3 commit 26511be
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,19 @@ export const DISCHARGE_REASONS = [
{ id: "LAMA", text: "LAMA" },
];

export const CONSCIOUSNESS_LEVEL = [
{ id: "UNRESPONSIVE", text: "Unresponsive" },
{ id: "RESPONDS_TO_PAIN", text: "Responds to Pain" },
{ id: "RESPONDS_TO_VOICE", text: "Responds to Voice" },
{ id: "ALERT", text: "Alert" },
{ id: "AGITATED_OR_CONFUSED", text: "Agitated or Confused" },
{
id: "Onset of Agitation and Confusion",
text: "Onset of Agitation and Confusion",
},
{ id: "UNKNOWN", text: "Unknown" },
];

export const LINES_CATHETER_CHOICES: Array<OptionsType> = [
{ id: 1, text: "CVP catheter " },
{ id: 2, text: "Arterial Line" },
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Form/FormFields/RadioFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ type Props<T> = FormFieldBaseProps<string> & {
options: T[];
optionDisplay: (option: T) => React.ReactNode;
optionValue: (option: T) => string;
containerClassName?: string;
};

const RadioFormField = <T,>(props: Props<T>) => {
const field = useFormFieldPropsResolver(props);
return (
<FormField field={field}>
<div className="flex gap-4 p-4">
<div className={props.containerClassName || "flex gap-4 p-4"}>
{props.options.map((option, idx) => {
const value = props.optionValue(option);
const optionId = `${props.name}-${idx}`;
Expand Down
16 changes: 15 additions & 1 deletion src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { lazy, useCallback, useState } from "react";
import { useDispatch } from "react-redux";
import { CURRENT_HEALTH_CHANGE, SYMPTOM_CHOICES } from "../../Common/constants";
import {
CONSCIOUSNESS_LEVEL,
CURRENT_HEALTH_CHANGE,
SYMPTOM_CHOICES,
} from "../../Common/constants";
import { statusType, useAbortableEffect } from "../../Common/utils";
import { getConsultationDailyRoundsDetails } from "../../Redux/actions";
import { DailyRoundsModel } from "./models";
Expand Down Expand Up @@ -183,6 +187,16 @@ export const DailyRoundListDetails = (props: any) => {
</span>
{dailyRoundListDetailsData.rhythm_detail ?? "-"}
</div>
<div className="md:col-span-2">
<span className="font-semibold leading-relaxed">
Level Of Consciousness:{" "}
</span>
{dailyRoundListDetailsData.consciousness_level
? CONSCIOUSNESS_LEVEL.find(
(i) => i.id === dailyRoundListDetailsData.consciousness_level
)?.text
: "-"}
</div>
<div>
<span className="font-semibold leading-relaxed">
Recommend Discharge:{" "}
Expand Down
21 changes: 19 additions & 2 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dayjs from "dayjs";
import { lazy, useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import {
CONSCIOUSNESS_LEVEL,
PATIENT_CATEGORIES,
REVIEW_AT_CHOICES,
RHYTHM_CHOICES,
Expand Down Expand Up @@ -35,6 +36,7 @@ import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import TextFormField from "../Form/FormFields/TextFormField";
import { FieldChangeEvent } from "../Form/FormFields/Utils";
import PatientCategorySelect from "./PatientCategorySelect";
import RadioFormField from "../Form/FormFields/RadioFormField";
const Loading = lazy(() => import("../Common/Loading"));

const initForm: any = {
Expand All @@ -59,6 +61,7 @@ const initForm: any = {
rhythm: "0",
rhythm_detail: "",
ventilator_spo2: null,
consciousness_level: "Unknown",
// bed: null,
};

Expand Down Expand Up @@ -129,6 +132,7 @@ export const DailyRounds = (props: any) => {
"ventilator_spo2",
"rhythm",
"rhythm_detail",
"consciousness_level",
];

useEffect(() => {
Expand Down Expand Up @@ -312,6 +316,7 @@ export const DailyRounds = (props: any) => {
rhythm: Number(state.form.rhythm) || 0,
rhythm_detail: state.form.rhythm_detail,
ventilator_spo2: state.form.ventilator_spo2,
consciousness_level: state.form.consciousness_level,
};
}
} else {
Expand Down Expand Up @@ -637,9 +642,21 @@ export const DailyRounds = (props: any) => {

<TextAreaFormField
{...field("rhythm_detail")}
className="md:col-span-2"
className="md:col-span-1"
label="Rhythm Description"
rows={5}
rows={7}
/>

<RadioFormField
label="Level Of Consciousness"
{...field("consciousness_level")}
options={CONSCIOUSNESS_LEVEL.map((level) => ({
label: level.text,
value: level.id,
}))}
optionDisplay={(option) => option.label}
optionValue={(option) => option.value}
containerClassName="grid gap-1 grid-cols-1"
/>
</>
)}
Expand Down

0 comments on commit 26511be

Please sign in to comment.