From e8091bf0640220596a837c21af671fe1f78b422d Mon Sep 17 00:00:00 2001 From: Gampa Sri Harsh <114745442+sriharsh05@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:54:28 +0530 Subject: [PATCH] change the NIBP display from last 30 mins to current bed assignment date (#6479) * change the NIBP display from last 30 mins to currect bed assignment date * change model name to PascalCase and used PaginatedResponse to wrap the model * use onResponse for useQuery * resolved merge conflict * move bed assignment date fetch logic to parent component * replaced console log with notification for error * change logic by passing date to VitalsMonitor and change models * remove unused models and useState variables * update the CNS to pass the bedAssignmentStartDate prop to HL7PatientVitalsMonitor component * Reverted last commit * update the CNS to pass the correct bedAssignmentStartDate to the VitalsMonitor component * remove usage of useQuery and replaced the prop with existing data * fix NIBP visibility bug in Vitals Monitor * delete unused function --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- src/Components/Facility/CentralNursingStation.tsx | 4 ++++ .../ConsultationDetails/ConsultationUpdatesTab.tsx | 8 ++++++++ src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx | 8 ++------ src/Components/VitalsMonitor/types.ts | 1 + src/Redux/api.tsx | 3 +++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Components/Facility/CentralNursingStation.tsx b/src/Components/Facility/CentralNursingStation.tsx index 0d510d8459e..26bed83635b 100644 --- a/src/Components/Facility/CentralNursingStation.tsx +++ b/src/Components/Facility/CentralNursingStation.tsx @@ -273,6 +273,10 @@ export default function CentralNursingStation({ facilityId }: Props) { {data.map((props) => (
{
{
{ return `${dayjs().diff(dayjs(timestamp), "minute")}m ago`; }; -const isWithinMinutes = (timestamp: string, minutes: number) => { - return dayjs().diff(dayjs(timestamp), "minute") < minutes; -}; - export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) { const { connect, waveformCanvas, data, isOnline } = useHL7VitalsMonitor( props.config @@ -39,8 +35,8 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) { connect(props.socketUrl); }, [props.socketUrl]); - const bpWithinMaxPersistence = !!( - (data.bp?.["date-time"] && isWithinMinutes(data.bp?.["date-time"], 30)) // Max blood pressure persistence is 30 minutes + const bpWithinMaxPersistence = dayjs(data.bp?.["date-time"]).isAfter( + props.patientCurrentBedAssignmentDate ); return ( diff --git a/src/Components/VitalsMonitor/types.ts b/src/Components/VitalsMonitor/types.ts index 60979a6f9b0..c73d7399b59 100644 --- a/src/Components/VitalsMonitor/types.ts +++ b/src/Components/VitalsMonitor/types.ts @@ -46,6 +46,7 @@ export interface ChannelOptions { } export interface IVitalsComponentProps { + patientCurrentBedAssignmentDate?: string; patientAssetBed?: PatientAssetBed; socketUrl: string; config?: ReturnType; diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 7194aba5278..0e3fabf0bff 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -1,4 +1,5 @@ import { IConfig } from "../Common/hooks/useConfig"; + import { IAadhaarOtp, IAadhaarOtpTBody, @@ -29,6 +30,7 @@ import { } from "../Components/Assets/AssetTypes"; import { ConsultationModel, + CurrentBed, FacilityModel, LocationModel, WardModel, @@ -355,6 +357,7 @@ const routes = { listConsultationBeds: { path: "/api/v1/consultationbed/", method: "GET", + TRes: Type>(), }, createConsultationBed: { path: "/api/v1/consultationbed/",