Skip to content

Commit

Permalink
O3-3475 - ward app - update to use latest backend bed-management modu…
Browse files Browse the repository at this point in the history
…le (#1207)
  • Loading branch information
chibongho authored Jun 26, 2024
1 parent 7d121c7 commit 881c31e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions __mocks__/wards.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const mockAdmissionLocation: AdmissionLocation = {
status: 'OCCUPIED',
bedType: mockBedType,
location: mockLocationInpatientWard.display,
patient: mockPatientAlice,
patients: [mockPatientAlice],
bedTagMaps: [],
},
{
Expand All @@ -36,7 +36,7 @@ export const mockAdmissionLocation: AdmissionLocation = {
status: 'AVAILABLE',
bedType: mockBedType,
location: mockLocationInpatientWard.display,
patient: null,
patients: [],
bedTagMaps: [],
},
{
Expand All @@ -48,7 +48,7 @@ export const mockAdmissionLocation: AdmissionLocation = {
status: 'AVAILABLE',
bedType: mockBedType,
location: mockLocationInpatientWard.display,
patient: null,
patients: [],
bedTagMaps: [],
},
{
Expand All @@ -60,7 +60,7 @@ export const mockAdmissionLocation: AdmissionLocation = {
status: 'AVAILABLE',
bedType: mockBedType,
location: mockLocationInpatientWard.display,
patient: null,
patients: [],
bedTagMaps: [],
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/esm-ward-app/src/beds/occupied-bed.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jest.mocked(useConfig).mockReturnValue(defaultConfig);
const mockBedLayouts = filterBeds(mockAdmissionLocation);

const mockBedToUse = mockBedLayouts[0];
jest.replaceProperty(mockBedToUse.patient.person, 'preferredName', {
jest.replaceProperty(mockBedToUse.patients[0].person, 'preferredName', {
uuid: '',
givenName: 'Alice',
familyName: 'Johnson',
});
const mockPatient = mockBedToUse.patient;
const mockPatient = mockBedToUse.patients[0];
const mockBed = bedLayoutToBed(mockBedToUse);

describe('Occupied bed: ', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-ward-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"optionalBackendDependencies":{
"bedmanagement":{
"version": "^5.14.0 || 5.14.0-SNAPSHOT",
"version": "^6.0.0 || 6.0.0-SNAPSHOT",
"feature": {
"flagName": "bedmanagement-module",
"label":"Ward App Patient Service",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-ward-app/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface BedLayout {
status: BedStatus;
bedType: BedType;
location: string;
patient: Patient;
patients: Patient[];
bedTagMaps: BedTagMap[];
}

Expand Down
5 changes: 3 additions & 2 deletions packages/esm-ward-app/src/ward-view/ward-view.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ const WardViewByLocation = ({ location }: { location: Location }) => {
return (
<>
{bedLayouts.map((bedLayout, i) => {
const { patient } = bedLayout;
const { patients } = bedLayout;
const bed = bedLayoutToBed(bedLayout);

// TODO: replace visit field with real value fetched from useAdmissionLocation (or replacement API)
return <WardBed key={bed.uuid} bed={bed} patientInfos={patient ? [{ patient, visit: null }] : null} />;
const patientInfos = patients.map((patient) => ({ patient, visit: null }));
return <WardBed key={bed.uuid} bed={bed} patientInfos={patientInfos} />;
})}
{bedLayouts.length == 0 && (
<InlineNotification
Expand Down

0 comments on commit 881c31e

Please sign in to comment.