Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the NIBP display from last 30 mins to current bed assignment date #6479

Merged
merged 19 commits into from
Nov 7, 2023
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update the CNS to pass the bedAssignmentStartDate prop to HL7PatientV…
…italsMonitor component
sriharsh05 committed Oct 27, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5371c69f92100adaee5e416250474724de13bf59
34 changes: 33 additions & 1 deletion src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ import { useTranslation } from "react-i18next";
import { SortOption } from "../Common/SortDropdown";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import useVitalsAspectRatioConfig from "../VitalsMonitor/useVitalsAspectRatioConfig";
import routes from "../../Redux/api";
import request from "../../Utils/request/request";

const PER_PAGE_LIMIT = 6;

@@ -51,6 +53,9 @@ export default function CentralNursingStation({ facilityId }: Props) {
const { qParams, updateQuery, removeFilter, updatePage } = useFilters({
limit: PER_PAGE_LIMIT,
});
const [bedAssignmentStartDate, setBedAssignmentStartDate] = useState<
string[]
>([]);

// To automatically collapse sidebar.
useEffect(() => {
@@ -118,6 +123,32 @@ export default function CentralNursingStation({ facilityId }: Props) {
qParams.bed_is_occupied,
]);

useEffect(() => {
const fetchDataAndBedAssignmentStartDate = async () => {
if (data && data.length > 0) {
const updatedBedAssignmentStartDate = await Promise.all(
data.map(async (item) => {
const { data: consultationData } = await request(
routes.getConsultationList,
{
query: { patient: item.patientAssetBed?.patient?.id },
}
);
const { data: bedData } = await request(
routes.listConsultationBeds,
{
query: { consultation: consultationData?.results[0].id },
}
);
return bedData?.results[0].created_date ?? "";
})
);
setBedAssignmentStartDate(updatedBedAssignmentStartDate);
}
};
fetchDataAndBedAssignmentStartDate();
}, [data]);

const { config, hash } = useVitalsAspectRatioConfig({
default: 6 / 11,
vs: 10 / 11,
@@ -270,9 +301,10 @@ export default function CentralNursingStation({ facilityId }: Props) {
</div>
) : (
<div className="mt-1 grid grid-cols-1 gap-1 lg:grid-cols-2 3xl:grid-cols-3">
{data.map((props) => (
{data.map((props, idx) => (
<div className="overflow-hidden text-clip">
<HL7PatientVitalsMonitor
patientCurrentBedAssignmentDate={bedAssignmentStartDate[idx]}
key={`${props.patientAssetBed?.bed.id}-${hash}`}
{...props}
config={config}
2 changes: 2 additions & 0 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ import {
AssetUpdate,
} from "../Components/Assets/AssetTypes";
import {
ConsultationModel,
CurrentBed,
FacilityModel,
LocationModel,
@@ -397,6 +398,7 @@ const routes = {
},
getConsultationList: {
path: "/api/v1/consultation/",
TRes: Type<PaginatedResponse<ConsultationModel>>(),
},
createConsultation: {
path: "/api/v1/consultation/",