diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 331c8b41ef9..a227d173889 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -150,7 +150,7 @@ const initForm: FormDetails = { assigned_to: "", assigned_to_object: null, special_instruction: "", - review_interval: 0, + review_interval: -1, weight: "", height: "", bed: null, @@ -265,7 +265,8 @@ export const ConsultationForm = (props: any) => { admitted: res.data.admitted ? String(res.data.admitted) : "false", admitted_to: res.data.admitted_to ? res.data.admitted_to : "", category: res.data.category - ? PATIENT_CATEGORIES.find((i) => i.text === res.data.category)?.id || "Comfort" + ? PATIENT_CATEGORIES.find((i) => i.text === res.data.category) + ?.id || "Comfort" : "Comfort", ip_no: res.data.ip_no ? res.data.ip_no : "", verified_by: res.data.verified_by ? res.data.verified_by : "", @@ -1050,7 +1051,7 @@ export const ConsultationForm = (props: any) => { variant="standard" value={state.form.review_interval} options={[ - { id: "", text: "select" }, + { id: -1, text: "select" }, ...REVIEW_AT_CHOICES, ]} onChange={handleChange} diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index 079241056cc..bd2598a41dc 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -126,6 +126,7 @@ export interface ConsultationModel { lines?: any; last_daily_round?: any; current_bed?: CurrentBed; + review_interval?: number; } export interface PatientStatsModel { id?: number; diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 14a918d4890..74e8c0945a4 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -52,7 +52,7 @@ const initForm: any = { current_health: 0, recommend_discharge: false, actions: null, - review_interval: null, + review_interval: 0, admitted_to: "", taken_at: null, rounds_type: "NORMAL", @@ -107,7 +107,7 @@ export const DailyRounds = (props: any) => { const [isLoading, setIsLoading] = useState(false); const [facilityName, setFacilityName] = useState(""); const [patientName, setPatientName] = useState(""); - const [prevReviewInterval, setPreviousReviewInterval] = useState(""); + const [prevReviewInterval, setPreviousReviewInterval] = useState(-1); const [hasPreviousLog, setHasPreviousLog] = useState(false); const headerText = !id ? "Add Consultation Update" : "Info"; const buttonText = !id ? "Save" : "Continue"; @@ -156,7 +156,9 @@ export const DailyRounds = (props: any) => { if (res.data) { setPatientName(res.data.name); setFacilityName(res.data.facility_object.name); - setPreviousReviewInterval(res.data.last_consultation.review_interval); + setPreviousReviewInterval( + Number(res.data.last_consultation.review_interval) + ); } } else { setPatientName(""); @@ -243,6 +245,8 @@ export const DailyRounds = (props: any) => { return map.toFixed(2); }; + console.log(state.form.review_interval); + const handleSubmit = async (e: any) => { e.preventDefault(); const validForm = validateForm(); @@ -275,8 +279,9 @@ export const DailyRounds = (props: any) => { consultation: consultationId, recommend_discharge: JSON.parse(state.form.recommend_discharge), action: state.form.action, - review_interval: state.form.review_interval, - // bed: isTeleicu === "true" ? state.form.bed : undefined, + review_interval: Number( + state.form.review_interval || prevReviewInterval + ), }; if (state.form.rounds_type === "NORMAL") { data = { @@ -460,8 +465,10 @@ export const DailyRounds = (props: any) => { }; const getExpectedReviewTime = () => { - const nextReviewTime = state.form.review_interval || prevReviewInterval; - if (Number(nextReviewTime)) + const nextReviewTime = Number( + state.form.review_interval || prevReviewInterval + ); + if (nextReviewTime > 0) return `Review before ${formatDate( moment().add(nextReviewTime, "minutes").toDate() )}`; @@ -674,7 +681,7 @@ export const DailyRounds = (props: any) => { variant="standard" value={state.form.review_interval || prevReviewInterval} options={[ - { id: 0, text: "select" }, + { id: -1, text: "select" }, ...REVIEW_AT_CHOICES, ]} onChange={handleChange} diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 647f9cc708d..1b324a3dd8a 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -566,13 +566,16 @@ export const PatientManager = (props: any) => { )}
- {moment().isAfter(patient.review_time) && ( - - )} + {patient.review_time && + !patient.last_consultation?.discharge_date && + Number(patient.last_consultation?.review_interval) > 0 && + moment().isAfter(patient.review_time) && ( + + )} {patient.allow_transfer ? ( { className="space-y-2 flex-col justify-between flex h-full" >
- {patientData.review_time && ( -
- - {(moment().isBefore(patientData.review_time) - ? "Review before: " - : "Review Missed: ") + - formatDate(patientData.review_time)} -
- )} + {patientData.review_time && + !patientData.last_consultation?.discharge_date && + Number(patientData.last_consultation?.review_interval) > + 0 && ( +
+ + {(moment().isBefore(patientData.review_time) + ? "Review before: " + : "Review Missed: ") + + formatDate(patientData.review_time)} +
+ )}
diff --git a/src/Components/TeleIcu/Patient/InfoCard.tsx b/src/Components/TeleIcu/Patient/InfoCard.tsx index a5e4187a0c6..e131866fcfc 100644 --- a/src/Components/TeleIcu/Patient/InfoCard.tsx +++ b/src/Components/TeleIcu/Patient/InfoCard.tsx @@ -16,14 +16,6 @@ const PatientCategoryDisplayText: Record = { unknown: "UNKNOWN", }; -const PatientCategoryClasses: Record = { - "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; @@ -116,22 +108,24 @@ export default function TeleICUPatientInfoCard(props: { {patient.name}
- {patient.review_time && ( -
- - {(moment().isBefore(patient.review_time) - ? "Review before: " - : "Review Missed: ") + - moment(patient.review_time).format("lll")} -
- )} + {patient.review_time && + !patient.last_consultation?.discharge_date && + Number(patient.last_consultation?.review_interval) > 0 && ( +
+ + {(moment().isBefore(patient.review_time) + ? "Review before: " + : "Review Missed: ") + + moment(patient.review_time).format("lll")} +
+ )}
([]); + const [queueData, setQueueData] = useState(Array(200).fill(0)); const [xData, setXData] = useState([]); const [lastStream, setLastStream] = useState(0); @@ -44,7 +44,7 @@ export default function Waveform(props: { seconds++; }, 1000); return () => clearInterval(timer); - }, [props]); + }, [props.wave.data]); useEffect(() => { const timeout = setTimeout(() => {