diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 46ef0b41379..8cf83b1c5a8 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -89,6 +89,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Normal Log Updates details created successfully"); cy.closeNotification(); // edit the card and verify the data. + cy.contains("Daily Rounds").click(); patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); cy.verifyContentPresence("#consultation-preview", [ patientCategory, @@ -109,6 +110,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeDiastolic(patientModifiedDiastolic); cy.submitButton("Continue"); cy.verifyNotification("Normal Log Updates details updated successfully"); + cy.contains("Daily Rounds").click(); patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); cy.verifyContentPresence("#consultation-preview", [ patientModifiedDiastolic, diff --git a/src/CAREUI/misc/PaginatedList.tsx b/src/CAREUI/misc/PaginatedList.tsx index ec270bf8134..db68c6f042c 100644 --- a/src/CAREUI/misc/PaginatedList.tsx +++ b/src/CAREUI/misc/PaginatedList.tsx @@ -1,4 +1,4 @@ -import { createContext, useContext, useEffect, useState } from "react"; +import { createContext, useContext, useState } from "react"; import { PaginatedResponse, QueryRoute } from "../../Utils/request/types"; import useQuery, { QueryOptions } from "../../Utils/request/useQuery"; import ButtonV2, { @@ -33,9 +33,6 @@ function useContextualized() { interface Props extends QueryOptions> { route: QueryRoute>; perPage?: number; - queryCB?: ( - query: ReturnType>>, - ) => void; children: ( ctx: PaginatedListContext, query: ReturnType>>, @@ -46,7 +43,6 @@ export default function PaginatedList({ children, route, perPage = DEFAULT_PER_PAGE_LIMIT, - queryCB, ...queryOptions }: Props) { const [currentPage, setPage] = useState(1); @@ -61,12 +57,6 @@ export default function PaginatedList({ const items = query.data?.results ?? []; - useEffect(() => { - if (queryCB) { - queryCB(query); - } - }, [query]); - return ( ; } + if (!data?.results.length) { + return ( +
+

No Records found

+

+ Raise a consent request to fetch patient records over ABDM +

+
+ ); + } + return (
{data?.results.map((record) => { diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 0f7f4d9b14a..e9e658cee4f 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(true); const vitals = useVitalsAspectRatioConfig({ default: undefined, diff --git a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx index 560bfd02f33..fd45e3695d0 100644 --- a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx @@ -47,11 +47,11 @@ export default function EventsList() { isLast={items.indexOf(item) == items.length - 1} > {(() => { - const values = Object.entries(item.value).filter( - ([_, value]) => value !== null && value !== undefined, + const entries = Object.entries(item.value).filter( + ([_, value]) => value != null && value !== "", ); - if (values.length === 0) { + if (entries.length === 0) { return (
@@ -61,6 +61,8 @@ export default function EventsList() { ); } + const values = Object.fromEntries(entries); + switch (item.event_type.name) { case "INTERNAL_TRANSFER": case "CLINICAL": diff --git a/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx b/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx index c454136c592..543336987b2 100644 --- a/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx @@ -1,14 +1,13 @@ import type { ReactNode } from "react"; interface IProps { - values: Record; + values: Record; } /** * object - array, date */ - const formatValue = (value: unknown, key?: string): ReactNode => { - if (value === undefined || value === null) { + if (value == null) { return "N/A"; } @@ -17,11 +16,11 @@ const formatValue = (value: unknown, key?: string): ReactNode => { } if (typeof value === "number") { - return value; + return value % 1 ? value.toFixed(2) : value; } if (typeof value === "string") { - const trimmed = value.trim(); + const trimmed = value.trim().replaceAll(/_/g, " "); if (trimmed === "") { return "Empty"; @@ -41,26 +40,36 @@ const formatValue = (value: unknown, key?: string): ReactNode => { if (typeof value === "object") { if (Array.isArray(value)) { if (value.length === 0) { - return `No ${key?.replace(/_/g, " ")}`; + return `No ${key?.replaceAll(/_/g, " ")}`; } - return value.map((v) => formatValue(v, key)).join(", "); + return ( +
    + {value.map((v) => ( +
  • {formatValue(v, key)}
  • + ))} +
+ ); } if (value instanceof Date) { return value.toLocaleString(); } - if (Object.entries(value).length === 0) { - return `No ${key?.replace(/_/g, " ")}`; + const entries = Object.entries(value).filter( + ([_, value]) => value != null && value !== "", + ); + + if (entries.length === 0) { + return `No ${key?.replaceAll(/_/g, " ")}`; } - return Object.entries(value).map(([key, value]) => ( + return entries.map(([key, value]) => (
- {key.replace(/_/g, " ")} + {key.replaceAll(/_/g, " ")} - + {formatValue(value, key)}
@@ -70,14 +79,13 @@ const formatValue = (value: unknown, key?: string): ReactNode => { return JSON.stringify(value); }; -export default function GenericEvent({ values }: IProps) { - console.log("value", values); +export default function GenericEvent(props: IProps) { return (
- {values.map(([key, value]: [string, any]) => ( -
+ {Object.entries(props.values).map(([key, value]) => ( +
- {key.replace(/_/g, " ")} + {key.replaceAll(/_/g, " ")} {formatValue(value, key)} diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index ffcd9166f23..4d393752888 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -431,6 +431,11 @@ export const ConsultationDetails = (props: any) => { ) return null; // Hide feed tab } + + if (p.text === "ABDM" && !patientData.abha_number) { + return null; + } + return ( { if (!round) return; - const { - temperature, - temperature_measured_at, - bp, - resp, - spo2, - ventilator_spo2, - pulse, - } = round; + const { temperature, bp, resp, spo2, ventilator_spo2, pulse } = round; return { temperature, - temperature_measured_at, bp, resp, spo2, diff --git a/src/Components/Facility/DischargedPatientsList.tsx b/src/Components/Facility/DischargedPatientsList.tsx index 5afc34394cf..b06e5cd1b4b 100644 --- a/src/Components/Facility/DischargedPatientsList.tsx +++ b/src/Components/Facility/DischargedPatientsList.tsx @@ -5,6 +5,7 @@ import PaginatedList from "../../CAREUI/misc/PaginatedList"; import Loading from "../Common/Loading"; import { PatientModel } from "../Patient/models"; import useQuery from "../../Utils/request/useQuery"; +import { debounce } from "lodash-es"; import SearchInput from "../Form/SearchInput"; import { DISCHARGED_PATIENT_SORT_OPTIONS, @@ -17,13 +18,6 @@ import { useTranslation } from "react-i18next"; import SwitchTabs from "../Common/components/SwitchTabs"; import SortDropdownMenu from "../Common/SortDropdown"; import useFilters from "../../Common/hooks/useFilters"; -import PatientFilter from "../Patient/PatientFilter"; -import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover"; -import CountBlock from "../../CAREUI/display/Count"; -import { FieldChangeEvent } from "../Form/FormFields/Utils"; -import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField"; -import { useState } from "react"; -import { parseOptionId } from "../../Common/utils"; const DischargedPatientsList = ({ facility_external_id, @@ -35,66 +29,7 @@ const DischargedPatientsList = ({ pathParams: { id: facility_external_id }, }); - const { qParams, updateQuery, advancedFilter, FilterBadges } = useFilters({ - limit: 12, - cacheBlacklist: [ - "name", - "patient_no", - "phone_number", - "emergency_phone_number", - ], - }); - - const queryField = (name: string, defaultValue?: T) => { - return { - name, - value: qParams[name] || defaultValue, - onChange: (e: FieldChangeEvent) => updateQuery({ [e.name]: e.value }), - className: "grow w-full mb-2", - }; - }; - - const [phone_number, setPhoneNumber] = useState(""); - const [phoneNumberError, setPhoneNumberError] = useState(""); - const [emergency_phone_number, setEmergencyPhoneNumber] = useState(""); - const [emergencyPhoneNumberError, setEmergencyPhoneNumberError] = - useState(""); - const [count, setCount] = useState(0); - - const setPhoneNum = (phone_number: string) => { - setPhoneNumber(phone_number); - if (phone_number.length >= 13) { - setPhoneNumberError(""); - updateQuery({ phone_number }); - return; - } - - if (phone_number === "+91" || phone_number === "") { - setPhoneNumberError(""); - qParams.phone_number && updateQuery({ phone_number: null }); - return; - } - - setPhoneNumberError("Enter a valid number"); - }; - - const setEmergencyPhoneNum = (emergency_phone_number: string) => { - setEmergencyPhoneNumber(emergency_phone_number); - if (emergency_phone_number.length >= 13) { - setEmergencyPhoneNumberError(""); - updateQuery({ emergency_phone_number }); - return; - } - - if (emergency_phone_number === "+91" || emergency_phone_number === "") { - setEmergencyPhoneNumberError(""); - qParams.emergency_phone_number && - updateQuery({ emergency_phone_number: null }); - return; - } - - setEmergencyPhoneNumberError("Enter a valid number"); - }; + const { qParams, updateQuery, FilterBadges } = useFilters({}); return ( -
+ updateQuery({ name: e.value }))} + /> +
navigate("/patients")} isTab2Active /> - advancedFilter.setShow(true)} - /> } > -
-
-
- -
-
-
-
-
- - -
-
- setPhoneNum(e.value)} - error={phoneNumberError} - types={["mobile", "landline"]} - /> - setEmergencyPhoneNum(e.value)} - error={emergencyPhoneNumberError} - types={["mobile", "landline"]} - /> -
-
-
-
- [ - phoneNumber("Primary number", "phone_number"), - phoneNumber("Emergency number", "emergency_phone_number"), - badge("Patient name", "name"), - badge("IP/OP number", "patient_no"), - ...dateRange("Modified", "modified_date"), - ...dateRange("Created", "created_date"), - badge("No. of vaccination doses", "number_of_doses"), - kasp(), - badge("COWIN ID", "covin_id"), - badge("Is Antenatal", "is_antenatal"), - badge("Review Missed", "review_missed"), - badge("Facility Type", "facility_type"), - ordering(), - badge("Disease Status", "disease_status"), - value( - "Respiratory Support", - "ventilator_interface", - qParams.ventilator_interface && - t(`RESPIRATORY_SUPPORT_${qParams.ventilator_interface}`), - ), - value( - "Gender", - "gender", - parseOptionId(GENDER_TYPES, qParams.gender) || "", - ), - ...range("Age", "age"), - badge("SRF ID", "srf_id"), - badge("Declared Status", "is_declared_positive"), - ...dateRange("Result", "date_of_result"), - ...dateRange("Declared positive", "date_declared_positive"), - ...dateRange("Last vaccinated", "last_vaccinated_date"), - ]} - /> + [ordering()]} />
{ - setCount(query.data?.count || 0); - }} > {() => ( -
+
{t("discharged_patients_empty")} @@ -254,11 +99,6 @@ const DischargedPatientsList = ({
)} - ); }; diff --git a/src/Components/Patient/PatientFilter.tsx b/src/Components/Patient/PatientFilter.tsx index 5ded9678f7d..7c68dce8fbc 100644 --- a/src/Components/Patient/PatientFilter.tsx +++ b/src/Components/Patient/PatientFilter.tsx @@ -379,10 +379,9 @@ export default function PatientFilter(props: any) { } />
- {(props.dischargePage || - ["StateAdmin", "StateReadOnlyAdmin"].includes( - authUser.user_type, - )) && ( + {["StateAdmin", "StateReadOnlyAdmin"].includes( + authUser.user_type, + ) && (
Discharge Reason
- {!props.dischargePage && ( -
- Facility - setFilterWithRef("facility", obj)} - /> -
- )} +
+ Facility + setFilterWithRef("facility", obj)} + /> +
{filterState.facility && (
Location @@ -616,24 +613,22 @@ export default function PatientFilter(props: any) { />
)} - {!props.dischargePage && ( -
- Facility type - o.text} - optionValue={(o) => o.text} - value={filterState.facility_type} - onChange={(v) => - setFilterState({ ...filterState, facility_type: v }) - } - optionIcon={() => ( - - )} - /> -
- )} +
+ Facility type + o.text} + optionValue={(o) => o.text} + value={filterState.facility_type} + onChange={(v) => + setFilterState({ ...filterState, facility_type: v }) + } + optionIcon={() => ( + + )} + /> +
LSG Body
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 56a3fc01f2a..81a06ff659d 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -309,7 +309,6 @@ export interface DailyRoundsModel { pulse?: number; resp?: number; temperature?: string; - temperature_measured_at?: string; physical_examination_info?: string; other_details?: string; consultation?: number;