diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 655ec197002..46ef0b41379 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -62,19 +62,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification( "Telemedicine Log Updates details created successfully", ); - // verify the copied previous value - cy.closeNotification(); - patientLogupdate.clickLogupdate(); - patientLogupdate.clickCopyPreviousValue(); - patientLogupdate.selectPatientCategory(patientCategory); - cy.submitButton("Save"); - cy.closeNotification(); - cy.verifyContentPresence("#physical_examination_info", [ - physicalExamination, - ]); - cy.verifyContentPresence("#rhythm_detail", [patientRhythm]); - cy.submitButton("Continue"); - cy.verifyNotification("Normal Log Updates details updated successfully"); }); it("Create a new log normal update for a domicilary care patient and edit it", () => { diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 0baee6e9b3f..3511f0241bb 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -84,9 +84,5 @@ class PatientLogupdate { cy.get("#consultation_tab_nav").scrollIntoView(); cy.verifyAndClickElement("#consultation_tab_nav", "Vitals"); } - - clickCopyPreviousValue() { - cy.get("#clone_last").click(); - } } export default PatientLogupdate; diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 9e0c8a96a39..3d6352b3260 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -371,8 +371,7 @@ export const CONSCIOUSNESS_LEVEL = [ id: "ONSET_OF_AGITATION_AND_CONFUSION", text: "Onset of Agitation and Confusion", }, - { id: "UNKNOWN", text: "Unknown" }, -]; +] as const; export const LINES_CATHETER_CHOICES: Array = [ { id: 1, text: "CVP catheter " }, @@ -439,14 +438,6 @@ export const PATIENT_CATEGORIES: { export const PATIENT_FILTER_CATEGORIES = PATIENT_CATEGORIES; -export const CURRENT_HEALTH_CHANGE = [ - { id: 0, text: "NO DATA", desc: "" }, - { id: 3, text: "STATUS QUO", desc: "No Change" }, - { id: 4, text: "BETTER", desc: "Better" }, - { id: 2, text: "WORSE", desc: "Worse" }, - { id: 1, text: "REQUIRES VENTILATOR", desc: "Requires Ventilator" }, -]; - export const SAMPLE_TEST_STATUS = [ { id: 1, text: "REQUEST_SUBMITTED", desc: "Request Submitted" }, { id: 2, text: "APPROVED", desc: "Approved for Sample Collection" }, @@ -753,11 +744,10 @@ export const CONSULTATION_TABS = [ { text: "ABDM", desc: "ABDM Records" }, ]; -export const RHYTHM_CHOICES: Array = [ - { id: 0, text: "UNKNOWN", desc: "Unknown" }, +export const RHYTHM_CHOICES = [ { id: 5, text: "REGULAR", desc: "Regular" }, { id: 10, text: "IRREGULAR", desc: "Irregular" }, -]; +] as const; export const LOCATION_BED_TYPES: Array = [ { id: "ISOLATION", name: "Isolation" }, diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 1ec89152f16..0f7f4d9b14a 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -37,7 +37,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { const [ventilatorSocketUrl, setVentilatorSocketUrl] = useState(); const [monitorBedData, setMonitorBedData] = useState(); const [ventilatorBedData, setVentilatorBedData] = useState(); - const [showEvents, setShowEvents] = useState(false); + const [showEvents, setShowEvents] = useState(false); const vitals = useVitalsAspectRatioConfig({ default: undefined, diff --git a/src/Components/Form/FormFields/RadioFormField.tsx b/src/Components/Form/FormFields/RadioFormField.tsx index 905986d62af..e7f79e14849 100644 --- a/src/Components/Form/FormFields/RadioFormField.tsx +++ b/src/Components/Form/FormFields/RadioFormField.tsx @@ -1,11 +1,12 @@ import FormField from "./FormField"; import { FormFieldBaseProps, useFormFieldPropsResolver } from "./Utils"; -type Props = FormFieldBaseProps & { +type Props = FormFieldBaseProps & { options: T[]; optionDisplay: (option: T) => React.ReactNode; optionValue: (option: T) => string; containerClassName?: string; + unselectLabel?: string; }; const RadioFormField = (props: Props) => { @@ -13,6 +14,20 @@ const RadioFormField = (props: Props) => { return (
+ {props.unselectLabel && ( +
+ field.handleChange(null)} + /> + +
+ )} {props.options.map((option, idx) => { const value = props.optionValue(option); const optionId = `${props.name}-${idx}`; diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 61b7ecf7686..3c5e70044ed 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -1,9 +1,5 @@ import { lazy, useState } from "react"; -import { - CONSCIOUSNESS_LEVEL, - CURRENT_HEALTH_CHANGE, - SYMPTOM_CHOICES, -} from "../../Common/constants"; +import { CONSCIOUSNESS_LEVEL, SYMPTOM_CHOICES } from "../../Common/constants"; import { DailyRoundsModel } from "./models"; import Page from "../Common/components/Page"; import ButtonV2 from "../Common/components/ButtonV2"; @@ -12,7 +8,6 @@ import useQuery from "../../Utils/request/useQuery"; import routes from "../../Redux/api"; const Loading = lazy(() => import("../Common/Loading")); const symptomChoices = [...SYMPTOM_CHOICES]; -const currentHealthChoices = [...CURRENT_HEALTH_CHANGE]; export const DailyRoundListDetails = (props: any) => { const { facilityId, patientId, consultationId, id } = props; @@ -23,19 +18,11 @@ export const DailyRoundListDetails = (props: any) => { pathParams: { consultationId, id }, onResponse: ({ res, data }) => { if (res && data) { - const currentHealth = currentHealthChoices.find( - (i) => i.text === data.current_health, - ); - const tdata: DailyRoundsModel = { ...data, temperature: Number(data.temperature) ? data.temperature : "", additional_symptoms_text: "", medication_given: data.medication_given ?? [], - - current_health: currentHealth - ? currentHealth.desc - : data.current_health, }; if (data.additional_symptoms?.length) { const symptoms = data.additional_symptoms.map((symptom: number) => { @@ -172,11 +159,11 @@ export const DailyRoundListDetails = (props: any) => { Level Of Consciousness:{" "} - {dailyRoundListDetailsData.consciousness_level - ? CONSCIOUSNESS_LEVEL.find( - (i) => i.id === dailyRoundListDetailsData.consciousness_level, - )?.text - : "-"} + {(dailyRoundListDetailsData.consciousness_level && + CONSCIOUSNESS_LEVEL.find( + (i) => i.id === dailyRoundListDetailsData.consciousness_level, + )?.text) || + "-"}
diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 713dfe097b8..dd15d44facc 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -21,7 +21,6 @@ import { SymptomsSelect } from "../Common/SymptomsSelect"; import TemperatureFormField from "../Common/TemperatureFormField"; import { Cancel, Submit } from "../Common/components/ButtonV2"; import Page from "../Common/components/Page"; -import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField"; import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField"; import { SelectFormField } from "../Form/FormFields/SelectFormField"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; @@ -33,6 +32,7 @@ import request from "../../Utils/request/request"; import routes from "../../Redux/api"; import { Scribe } from "../Scribe/Scribe"; import { DAILY_ROUND_FORM_SCRIBE_DATA } from "../Scribe/formDetails"; +import { DailyRoundsModel } from "./models"; const Loading = lazy(() => import("../Common/Loading")); const initForm: any = { @@ -41,23 +41,21 @@ const initForm: any = { physical_examination_info: "", other_details: "", patient_category: "", - current_health: 0, actions: null, action: "", review_interval: 0, admitted_to: "", taken_at: null, rounds_type: "NORMAL", - clone_last: false, systolic: null, diastolic: null, pulse: null, resp: null, temperature: null, - rhythm: "0", + rhythm: undefined, rhythm_detail: "", ventilator_spo2: null, - consciousness_level: "UNKNOWN", + consciousness_level: undefined, bp: { systolic: undefined, diastolic: undefined, @@ -112,7 +110,6 @@ export const DailyRounds = (props: any) => { const [consultationSuggestion, setConsultationSuggestion] = useState(""); const [prevReviewInterval, setPreviousReviewInterval] = useState(-1); const [prevAction, setPreviousAction] = useState("NO_ACTION"); - const [hasPreviousLog, setHasPreviousLog] = useState(false); const [initialData, setInitialData] = useState({ ...initForm, action: "", @@ -154,7 +151,7 @@ export const DailyRounds = (props: any) => { rhythm: (data.rhythm && RHYTHM_CHOICES.find((i) => i.text === data.rhythm)?.id) || - "0", + null, admitted_to: data.admitted_to ? data.admitted_to : "Select", }; } @@ -185,13 +182,6 @@ export const DailyRounds = (props: any) => { setPatientName(""); setFacilityName(""); } - if (consultationId && !id) { - const { data } = await request(routes.getDailyReports, { - pathParams: { consultationId }, - query: { limit: 1, offset: 0 }, - }); - setHasPreviousLog(!!data?.count); - } dispatch({ type: "set_form", form: formData }); setInitialData(formData); }, [consultationId, id, patientId]); @@ -236,54 +226,45 @@ export const DailyRounds = (props: any) => { return !invalidForm; }; - const handleSubmit = async (e: any) => { + const handleSubmit = async (e: React.SyntheticEvent) => { e.preventDefault(); const validForm = validateForm(); if (validForm) { setIsLoading(true); - const baseData = { - clone_last: state.form.clone_last ?? false, + let data: DailyRoundsModel = { rounds_type: state.form.rounds_type, patient_category: state.form.patient_category, taken_at: state.form.taken_at ? state.form.taken_at : new Date().toISOString(), - }; - let data: any; + additional_symptoms: state.form.additional_symptoms, + other_symptoms: state.form.additional_symptoms?.includes(9) + ? state.form.other_symptoms + : undefined, + admitted_to: + (state.form.admitted === "Select" + ? undefined + : state.form.admitted_to) || undefined, + physical_examination_info: state.form.physical_examination_info, + other_details: state.form.other_details, + consultation: consultationId, + action: prevAction, + review_interval: Number(prevReviewInterval), + }; - if (state.form.clone_last !== true) { + if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { data = { - ...baseData, - additional_symptoms: state.form.additional_symptoms, - other_symptoms: state.form.additional_symptoms?.includes(9) - ? state.form.other_symptoms - : undefined, - admitted_to: - (state.form.admitted === "Select" - ? undefined - : state.form.admitted_to) || undefined, - physical_examination_info: state.form.physical_examination_info, - other_details: state.form.other_details, - consultation: consultationId, - action: prevAction, - review_interval: Number(prevReviewInterval), + ...data, + bp: state.form.bp ?? {}, + pulse: state.form.pulse ?? null, + resp: state.form.resp ?? null, + temperature: state.form.temperature ?? null, + rhythm: state.form.rhythm || undefined, + rhythm_detail: state.form.rhythm_detail, + ventilator_spo2: state.form.ventilator_spo2 ?? null, + consciousness_level: state.form.consciousness_level || undefined, }; - if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { - data = { - ...data, - bp: state.form.bp ?? {}, - pulse: state.form.pulse ?? null, - resp: state.form.resp ?? null, - temperature: state.form.temperature ?? null, - rhythm: state.form.rhythm || 0, - rhythm_detail: state.form.rhythm_detail, - ventilator_spo2: state.form.ventilator_spo2 ?? null, - consciousness_level: state.form.consciousness_level, - }; - } - } else { - data = baseData; } if (id) { @@ -321,25 +302,13 @@ export const DailyRounds = (props: any) => { msg: `${obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)} Log Updates details created successfully`, }); if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { - if (data.clone_last) { - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds/${obj.id}/update`, - ); - } else { - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, - ); - } + navigate( + `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, + ); } else { - if (data.clone_last) { - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds/${obj.id}/update`, - ); - } else { - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily_rounds/${obj.id}/update`, - ); - } + navigate( + `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily_rounds/${obj.id}/update`, + ); } } } @@ -456,199 +425,187 @@ export const DailyRounds = (props: any) => {
- {!id && hasPreviousLog && ( - + + + - )} - - {(!state.form.clone_last || id) && ( -
- - - - - {state.form.additional_symptoms?.includes(9) && ( -
- -
- )} - option.desc} - optionValue={(option) => option.text} - value={prevAction} - onChange={(event) => { - handleFormFieldChange(event); - setPreviousAction(event.value); - }} - /> + {state.form.additional_symptoms?.includes(9) && ( +
+ +
+ )} + + option.desc} + optionValue={(option) => option.text} + value={prevAction} + onChange={(event) => { + handleFormFieldChange(event); + setPreviousAction(event.value); + }} + /> - option.text} - optionValue={(option) => option.id} - value={prevReviewInterval} - onChange={(event) => { - handleFormFieldChange(event); - setPreviousReviewInterval(Number(event.value)); - }} - /> + option.text} + optionValue={(option) => option.id} + value={prevReviewInterval} + onChange={(event) => { + handleFormFieldChange(event); + setPreviousReviewInterval(Number(event.value)); + }} + /> - {["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type) && ( - <> -

Vitals

- - - - - - - - - - - - option.desc} - optionValue={(option) => option.id} - /> - - - - ({ - label: level.text, - value: level.id, - }))} - optionDisplay={(option) => option.label} - optionValue={(option) => option.value} - containerClassName="grid gap-1 grid-cols-1" - /> - - )} -
- )} + {["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type) && ( + <> +

Vitals

+ + + + + + + + + + + + option.desc} + optionValue={(option) => option.id} + /> + + + + ({ + label: level.text, + value: level.id, + }))} + optionDisplay={(option) => option.label} + optionValue={(option) => option.value} + unselectLabel="Unknown" + containerClassName="grid gap-1 grid-cols-1" + /> + + )} +
goBack()} /> state.form[field] == initialData[field], ) && diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 9a56962fa7d..56a3fc01f2a 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -1,6 +1,10 @@ import { ConsultationModel, PatientCategory } from "../Facility/models"; import { PerformedByModel } from "../HCX/misc"; -import { OCCUPATION_TYPES } from "../../Common/constants"; +import { + CONSCIOUSNESS_LEVEL, + OCCUPATION_TYPES, + RHYTHM_CHOICES, +} from "../../Common/constants"; export interface FlowModel { id?: number; @@ -299,7 +303,7 @@ export interface DailyRoundsModel { | "NON_INVASIVE" | "INVASIVE"; spo2?: string; - rhythm?: string; + rhythm?: (typeof RHYTHM_CHOICES)[number]["text"]; rhythm_detail?: string; bp?: BloodPressure; pulse?: number; @@ -312,7 +316,8 @@ export interface DailyRoundsModel { additional_symptoms?: Array; medication_given?: Array; additional_symptoms_text?: string; - current_health?: string; + action?: string; + review_interval?: number; id?: string; other_symptoms?: string; admitted_to?: string; @@ -322,14 +327,7 @@ export interface DailyRoundsModel { created_date?: string; modified_date?: string; taken_at?: string; - consciousness_level?: - | "UNRESPONSIVE" - | "RESPONDS_TO_PAIN" - | "RESPONDS_TO_VOICE" - | "ALERT" - | "AGITATED_OR_CONFUSED" - | "ONSET_OF_AGITATION_AND_CONFUSION" - | "UNKNOWN"; + consciousness_level?: (typeof CONSCIOUSNESS_LEVEL)[number]["id"]; rounds_type?: (typeof DailyRoundTypes)[number]; last_updated_by_telemedicine?: boolean; created_by_telemedicine?: boolean; diff --git a/src/Components/Resource/ResourceCreate.tsx b/src/Components/Resource/ResourceCreate.tsx index 7fafe9fd2fa..7fa0ca35f28 100644 --- a/src/Components/Resource/ResourceCreate.tsx +++ b/src/Components/Resource/ResourceCreate.tsx @@ -147,7 +147,7 @@ export default function ResourceCreate(props: resourceProps) { return !isInvalidForm; }; - const handleChange = (e: FieldChangeEvent) => { + const handleChange = (e: FieldChangeEvent) => { const form = { ...state.form }; const { name, value } = e; form[name] = value; diff --git a/src/Components/Scribe/Scribe.tsx b/src/Components/Scribe/Scribe.tsx index cf9595d733d..6e876a4762c 100644 --- a/src/Components/Scribe/Scribe.tsx +++ b/src/Components/Scribe/Scribe.tsx @@ -22,7 +22,7 @@ export interface Field { type: string; example: string; default: string; - options?: FieldOption[]; + options?: readonly FieldOption[]; } export type ScribeModel = { diff --git a/src/Components/Scribe/formDetails.ts b/src/Components/Scribe/formDetails.ts index 9b17be2830f..2b56ce90df5 100644 --- a/src/Components/Scribe/formDetails.ts +++ b/src/Components/Scribe/formDetails.ts @@ -59,15 +59,6 @@ export const DAILY_ROUND_FORM_SCRIBE_DATA: Field[] = [ text: category.text, })), }, - { - friendlyName: "Current Health", - id: "current_health", - type: "number", - example: "0", - default: "0", - description: - "An integer to represent the current health status of the patient. 0 represents no health issues.", - }, { friendlyName: "Actions", id: "actions",