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) => { )}