@openmrs/esm-ward-app 9.2.1-pre.7380 → 9.2.1-pre.7385

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,9 +54,9 @@
54
54
  "entry": false,
55
55
  "recorded": false,
56
56
  "reason": "split chunk (cache group: default)",
57
- "size": 79640,
57
+ "size": 79800,
58
58
  "sizes": {
59
- "javascript": 79640
59
+ "javascript": 79800
60
60
  },
61
61
  "names": [],
62
62
  "idHints": [],
@@ -70,7 +70,7 @@
70
70
  "auxiliaryFiles": [
71
71
  "380.js.map"
72
72
  ],
73
- "hash": "d534c018b2e69fb3",
73
+ "hash": "79056e43226a2b27",
74
74
  "childrenByOrder": {}
75
75
  },
76
76
  {
@@ -427,9 +427,9 @@
427
427
  "initial": false,
428
428
  "entry": false,
429
429
  "recorded": false,
430
- "size": 92524,
430
+ "size": 93159,
431
431
  "sizes": {
432
- "javascript": 92524
432
+ "javascript": 93159
433
433
  },
434
434
  "names": [],
435
435
  "idHints": [],
@@ -443,7 +443,7 @@
443
443
  "auxiliaryFiles": [
444
444
  "1987.js.map"
445
445
  ],
446
- "hash": "1b74d8a7c44c8be5",
446
+ "hash": "2befe6e4e163dad5",
447
447
  "childrenByOrder": {}
448
448
  },
449
449
  {
@@ -974,9 +974,9 @@
974
974
  "initial": false,
975
975
  "entry": false,
976
976
  "recorded": false,
977
- "size": 6354,
977
+ "size": 6356,
978
978
  "sizes": {
979
- "javascript": 6354
979
+ "javascript": 6356
980
980
  },
981
981
  "names": [],
982
982
  "idHints": [],
@@ -988,7 +988,7 @@
988
988
  "4300.js"
989
989
  ],
990
990
  "auxiliaryFiles": [],
991
- "hash": "15bc9d4f77b3e1f3",
991
+ "hash": "6db67bdb6e02ce9b",
992
992
  "childrenByOrder": {}
993
993
  },
994
994
  {
@@ -1495,9 +1495,9 @@
1495
1495
  "initial": false,
1496
1496
  "entry": false,
1497
1497
  "recorded": false,
1498
- "size": 17354,
1498
+ "size": 17623,
1499
1499
  "sizes": {
1500
- "javascript": 17354
1500
+ "javascript": 17623
1501
1501
  },
1502
1502
  "names": [],
1503
1503
  "idHints": [],
@@ -1510,7 +1510,7 @@
1510
1510
  "auxiliaryFiles": [
1511
1511
  "7512.js.map"
1512
1512
  ],
1513
- "hash": "58a11293a52b3c71",
1513
+ "hash": "b4945fd0ebf15fd2",
1514
1514
  "childrenByOrder": {}
1515
1515
  },
1516
1516
  {
@@ -1518,9 +1518,9 @@
1518
1518
  "initial": false,
1519
1519
  "entry": false,
1520
1520
  "recorded": false,
1521
- "size": 23081,
1521
+ "size": 23241,
1522
1522
  "sizes": {
1523
- "javascript": 23081
1523
+ "javascript": 23241
1524
1524
  },
1525
1525
  "names": [],
1526
1526
  "idHints": [],
@@ -1534,7 +1534,7 @@
1534
1534
  "auxiliaryFiles": [
1535
1535
  "7524.js.map"
1536
1536
  ],
1537
- "hash": "ce621d64a54f7f84",
1537
+ "hash": "8061f1027d3884df",
1538
1538
  "childrenByOrder": {}
1539
1539
  },
1540
1540
  {
@@ -1773,9 +1773,9 @@
1773
1773
  "entry": false,
1774
1774
  "recorded": false,
1775
1775
  "reason": "split chunk (cache group: default)",
1776
- "size": 252402,
1776
+ "size": 252403,
1777
1777
  "sizes": {
1778
- "javascript": 252402
1778
+ "javascript": 252403
1779
1779
  },
1780
1780
  "names": [],
1781
1781
  "idHints": [],
@@ -1789,7 +1789,7 @@
1789
1789
  "auxiliaryFiles": [
1790
1790
  "8610.js.map"
1791
1791
  ],
1792
- "hash": "c2a11899f73673e8",
1792
+ "hash": "e1b21ada3f832b18",
1793
1793
  "childrenByOrder": {}
1794
1794
  },
1795
1795
  {
@@ -1846,10 +1846,10 @@
1846
1846
  "initial": true,
1847
1847
  "entry": true,
1848
1848
  "recorded": false,
1849
- "size": 39521,
1849
+ "size": 39790,
1850
1850
  "sizes": {
1851
1851
  "consume-shared": 126,
1852
- "javascript": 17354,
1852
+ "javascript": 17623,
1853
1853
  "share-init": 294,
1854
1854
  "runtime": 21747
1855
1855
  },
@@ -1866,7 +1866,7 @@
1866
1866
  "auxiliaryFiles": [
1867
1867
  "main.js.map"
1868
1868
  ],
1869
- "hash": "7000e8e8b56ff6ad",
1869
+ "hash": "03a62be626009fce",
1870
1870
  "childrenByOrder": {}
1871
1871
  },
1872
1872
  {
@@ -2015,9 +2015,9 @@
2015
2015
  "initial": false,
2016
2016
  "entry": false,
2017
2017
  "recorded": false,
2018
- "size": 23863,
2018
+ "size": 24023,
2019
2019
  "sizes": {
2020
- "javascript": 23863
2020
+ "javascript": 24023
2021
2021
  },
2022
2022
  "names": [],
2023
2023
  "idHints": [],
@@ -2031,7 +2031,7 @@
2031
2031
  "auxiliaryFiles": [
2032
2032
  "9775.js.map"
2033
2033
  ],
2034
- "hash": "73a23ac00dcfb7da",
2034
+ "hash": "2c15e69f68e3b3d2",
2035
2035
  "childrenByOrder": {}
2036
2036
  },
2037
2037
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","emrapi":">=2.0.0 <4.0.0"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"}],"workspaces2":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","window":"pending-admissions"},{"name":"transfer-elsewhere-workspace","component":"patientTransferRequestWorkspace","window":"pending-admissions"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","window":"pending-admissions"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","window":"pending-admissions"},{"name":"ward-app-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"add-patient-to-ward"},{"name":"ward-app-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"add-patient-to-ward"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","window":"add-patient-to-ward"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","window":"ward-patient"},{"name":"ward-patient-vitals-workspace","component":"@openmrs/esm-patient-vitals-app#exportedVitalsBiometricsFormWorkspace","window":"ward-patient"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","window":"ward-patient-notes"},{"name":"ward-patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","window":"ward-patient-transfer-swap"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","window":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"@openmrs/esm-patient-forms-app#exportedClinicalFormsWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-cancel-admission-request-workspace","component":"wardPatientCancelAdmissionRequestWorkspace","window":"ward-patient-cancel-admission-request"},{"name":"ward-patient-order-basket-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-drug-order-workspace","component":"@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-lab-order-workspace","component":"@openmrs/esm-patient-tests-app#exportedAddLabOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-general-order-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"}],"workspaceWindows2":[{"name":"pending-admissions","group":"ward-manage-admissions","icon":"admissionRequestsWorkspaceSideRailIcon","width":"wider"},{"name":"add-patient-to-ward","group":"ward-manage-admissions","icon":"createAdmissionEncounterWorkspaceSideRailIcon"},{"name":"ward-patient","group":"ward-patient","icon":"wardPatientActionButton","width":"wider"},{"name":"ward-patient-notes","group":"ward-patient","icon":"wardPatientNotesActionButton"},{"name":"ward-patient-transfer-swap","group":"ward-patient","icon":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"ward-patient-discharge","group":"ward-patient","icon":"patientDischargeWorkspaceSideRailIcon"},{"name":"ward-patient-clinical-forms","group":"ward-patient","icon":"clinicalFormWorkspaceSideRailIcon"},{"name":"ward-patient-order-basket","group":"ward-patient","icon":"orderBasketWorkspaceSideRailIcon"},{"name":"ward-patient-cancel-admission-request","group":"ward-patient"}],"workspaceGroups2":[{"name":"ward-manage-admissions","overlay":true,"persistence":"closable"},{"name":"ward-patient","overlay":true,"persistence":"closable"}],"version":"9.2.1-pre.7380"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","emrapi":">=2.0.0 <4.0.0"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"}],"workspaces2":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","window":"pending-admissions"},{"name":"transfer-elsewhere-workspace","component":"patientTransferRequestWorkspace","window":"pending-admissions"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","window":"pending-admissions"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","window":"pending-admissions"},{"name":"ward-app-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"add-patient-to-ward"},{"name":"ward-app-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"add-patient-to-ward"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","window":"add-patient-to-ward"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","window":"ward-patient"},{"name":"ward-patient-vitals-workspace","component":"@openmrs/esm-patient-vitals-app#exportedVitalsBiometricsFormWorkspace","window":"ward-patient"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","window":"ward-patient-notes"},{"name":"ward-patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","window":"ward-patient-transfer-swap"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","window":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"@openmrs/esm-patient-forms-app#exportedClinicalFormsWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-cancel-admission-request-workspace","component":"wardPatientCancelAdmissionRequestWorkspace","window":"ward-patient-cancel-admission-request"},{"name":"ward-patient-order-basket-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-drug-order-workspace","component":"@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-lab-order-workspace","component":"@openmrs/esm-patient-tests-app#exportedAddLabOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-general-order-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"}],"workspaceWindows2":[{"name":"pending-admissions","group":"ward-manage-admissions","icon":"admissionRequestsWorkspaceSideRailIcon","width":"wider"},{"name":"add-patient-to-ward","group":"ward-manage-admissions","icon":"createAdmissionEncounterWorkspaceSideRailIcon"},{"name":"ward-patient","group":"ward-patient","icon":"wardPatientActionButton","width":"wider"},{"name":"ward-patient-notes","group":"ward-patient","icon":"wardPatientNotesActionButton"},{"name":"ward-patient-transfer-swap","group":"ward-patient","icon":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"ward-patient-discharge","group":"ward-patient","icon":"patientDischargeWorkspaceSideRailIcon"},{"name":"ward-patient-clinical-forms","group":"ward-patient","icon":"clinicalFormWorkspaceSideRailIcon"},{"name":"ward-patient-order-basket","group":"ward-patient","icon":"orderBasketWorkspaceSideRailIcon"},{"name":"ward-patient-cancel-admission-request","group":"ward-patient"}],"workspaceGroups2":[{"name":"ward-manage-admissions","overlay":true,"persistence":"closable"},{"name":"ward-patient","overlay":true,"persistence":"closable"}],"version":"9.2.1-pre.7385"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-ward-app",
3
- "version": "9.2.1-pre.7380",
3
+ "version": "9.2.1-pre.7385",
4
4
  "description": "Ward and bed management module for O3",
5
5
  "browser": "dist/openmrs-esm-ward-app.js",
6
6
  "main": "src/index.ts",
@@ -257,6 +257,12 @@ export const configSchema = {
257
257
  _default: false,
258
258
  _description: 'Configure whether to hide vital history and record vital links in the ward patient workspace.',
259
259
  },
260
+ additionalInpatientNotesConceptUuids: {
261
+ _type: Type.Array,
262
+ _default: [],
263
+ _description:
264
+ 'List of uuids of concepts that represent notes to display in the notes view in addition to the consultFreeTextCommentsConcept defined by EMR-API',
265
+ },
260
266
  };
261
267
 
262
268
  export interface WardConfigObject {
@@ -270,6 +276,7 @@ export interface WardConfigObject {
270
276
  };
271
277
  wards: Array<WardDefinition>;
272
278
  hideWorkspaceVitalsLinks: boolean;
279
+ additionalInpatientNotesConceptUuids: Array<string>;
273
280
  }
274
281
 
275
282
  export interface PendingItemsElementConfig {
@@ -1,6 +1,5 @@
1
1
  import type {
2
2
  Concept,
3
- DefaultWorkspaceProps,
4
3
  Location,
5
4
  OpenmrsResource,
6
5
  OpenmrsResourceStrict,
@@ -230,7 +229,7 @@ export interface EncounterRole extends OpenmrsResourceStrict {
230
229
  export interface WardMetrics {
231
230
  patients: string;
232
231
  freeBeds: string;
233
- capacity: string;
232
+ totalBeds: string;
234
233
  }
235
234
 
236
235
  export interface EncounterPayload {
@@ -47,21 +47,13 @@ export function filterBeds(admissionLocation: AdmissionLocationFetchResponse): B
47
47
  }
48
48
 
49
49
  export function getWardMetrics(bedLayouts: BedLayout[], wardPatientGroup: WardPatientGroupDetails): WardMetrics {
50
- const bedMetrics = {
51
- patients: '--',
52
- freeBeds: '--',
53
- capacity: '--',
54
- };
55
- if (bedLayouts == null || bedLayouts.length == 0) return bedMetrics;
56
- const total = bedLayouts.length;
57
- const occupiedBeds = bedLayouts.filter((bed) => bed.patients.length > 0);
58
- const patients = occupiedBeds.length;
59
- const freeBeds = total - patients;
60
- const capacity = total != 0 ? Math.trunc((wardPatientGroup.totalPatientsCount / total) * 100) : 0;
50
+ const patients = wardPatientGroup?.totalPatientsCount ?? 0;
51
+ const totalBeds = bedLayouts?.length ?? 0;
52
+ const occupiedBeds = bedLayouts?.filter((bed) => bed.patients?.length > 0).length ?? 0;
61
53
  return {
62
- patients: wardPatientGroup?.totalPatientsCount.toString() ?? '--',
63
- freeBeds: freeBeds.toString(),
64
- capacity: capacity.toString(),
54
+ patients: patients.toString(),
55
+ freeBeds: (totalBeds - occupiedBeds).toString(),
56
+ totalBeds: totalBeds.toString(),
65
57
  };
66
58
  }
67
59
 
@@ -146,8 +138,8 @@ export function getWardMetricNameTranslation(name: string, t: TFunction) {
146
138
  return t('patients', 'Patients');
147
139
  case 'freeBeds':
148
140
  return t('freeBeds', 'Free beds');
149
- case 'capacity':
150
- return t('capacity', 'Capacity');
141
+ case 'totalBeds':
142
+ return t('totalBeds', 'Total beds');
151
143
  case 'pendingOut':
152
144
  return t('pendingOut', 'Pending out');
153
145
  }
@@ -159,8 +151,8 @@ export function getWardMetricValueTranslation(name: string, t: TFunction, value:
159
151
  return t('patientsMetricValue', '{{ metricValue }}', { metricValue: value });
160
152
  case 'freeBeds':
161
153
  return t('freeBedsMetricValue', '{{ metricValue }}', { metricValue: value });
162
- case 'capacity':
163
- return t('capacityMetricValue', '{{ metricValue }} %', { metricValue: value });
154
+ case 'totalBeds':
155
+ return t('totalBedsMetricValue', '{{ metricValue }}', { metricValue: value });
164
156
  case 'pendingOut':
165
157
  return t('pendingOutMetricValue', '{{ metricValue }}', { metricValue: value });
166
158
  }
@@ -10,7 +10,7 @@ import {
10
10
  import WardMetric from './ward-metric.component';
11
11
  import styles from './ward-metrics.scss';
12
12
 
13
- const wardMetrics = [{ name: 'patients' }, { name: 'freeBeds' }, { name: 'capacity' }];
13
+ const wardMetrics = [{ name: 'patients' }, { name: 'freeBeds' }, { name: 'totalBeds' }];
14
14
 
15
15
  const WardMetrics = () => {
16
16
  const { t } = useTranslation();
@@ -10,7 +10,7 @@ import WardMetrics from './ward-metrics.component';
10
10
  const wardMetrics = [
11
11
  { name: 'patients', key: 'patients', defaultTranslation: 'Patients' },
12
12
  { name: 'freeBeds', key: 'freeBeds', defaultTranslation: 'Free beds' },
13
- { name: 'capacity', key: 'capacity', defaultTranslation: 'Capacity' },
13
+ { name: 'totalBeds', key: 'totalBeds', defaultTranslation: 'Total beds' },
14
14
  ];
15
15
 
16
16
  jest.mocked(useAppContext<WardViewContext>).mockReturnValue(mockWardViewContext);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import dayjs from 'dayjs';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { SkeletonText, Tag, Tile } from '@carbon/react';
4
+ import { SkeletonText, Tile } from '@carbon/react';
5
5
  import { type PatientNote } from '../types';
6
6
  import styles from './styles.scss';
7
7
 
@@ -38,12 +38,6 @@ const InPatientNote: React.FC<InPatientNoteProps> = ({ note }) => {
38
38
  {formattedDate}, {formattedTime}
39
39
  </span>
40
40
  </div>
41
- {note.diagnoses &&
42
- note.diagnoses.split(',').map((diagnosis, index) => (
43
- <Tag key={index} type="red">
44
- {diagnosis.trim()}
45
- </Tag>
46
- ))}
47
41
  <div className={styles.noteBody}>{note.encounterNote}</div>
48
42
  <div className={styles.noteProviderName}>{note.encounterProvider}</div>
49
43
  </Tile>
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { type PatientUuid } from '@openmrs/esm-framework';
3
+ import { type PatientUuid, useConfig } from '@openmrs/esm-framework';
4
4
  import { usePatientNotes } from '../notes.resource';
5
5
  import InPatientNote, { InPatientNoteSkeleton } from './note.component';
6
6
  import styles from './styles.scss';
7
7
  import { InlineNotification } from '@carbon/react';
8
8
  import useEmrConfiguration from '../../../hooks/useEmrConfiguration';
9
+ import { type WardConfigObject } from '../../../config-schema';
9
10
 
10
11
  interface PatientNotesHistoryProps {
11
12
  patientUuid: PatientUuid;
@@ -15,13 +16,12 @@ interface PatientNotesHistoryProps {
15
16
  const PatientNotesHistory: React.FC<PatientNotesHistoryProps> = ({ patientUuid, visitUuid }) => {
16
17
  const { t } = useTranslation();
17
18
  const { emrConfiguration, isLoadingEmrConfiguration } = useEmrConfiguration();
19
+ const config = useConfig<WardConfigObject>();
18
20
 
19
- const { patientNotes, isLoadingPatientNotes, errorFetchingPatientNotes } = usePatientNotes(
20
- patientUuid,
21
- visitUuid,
22
- emrConfiguration?.inpatientNoteEncounterType?.uuid,
21
+ const { patientNotes, isLoadingPatientNotes, errorFetchingPatientNotes } = usePatientNotes(patientUuid, visitUuid, [
23
22
  emrConfiguration?.consultFreeTextCommentsConcept.uuid,
24
- );
23
+ ...config.additionalInpatientNotesConceptUuids,
24
+ ]);
25
25
 
26
26
  const isLoading = isLoadingPatientNotes || isLoadingEmrConfiguration;
27
27
 
@@ -4,6 +4,10 @@ import PatientNotesHistory from './notes-container.component';
4
4
  import { usePatientNotes } from '../notes.resource';
5
5
  import useEmrConfiguration from '../../../hooks/useEmrConfiguration';
6
6
  import { emrConfigurationMock } from '__mocks__';
7
+ import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
8
+ import { configSchema, type WardConfigObject } from '../../../config-schema';
9
+
10
+ const mockUseConfig = jest.mocked(useConfig<WardConfigObject>);
7
11
 
8
12
  const mockedUseEmrConfiguration = jest.mocked(useEmrConfiguration);
9
13
 
@@ -19,26 +23,23 @@ const mockPatientNotes = [
19
23
  {
20
24
  id: 'note-1',
21
25
  diagnoses: '',
22
- encounterDate: '2024-08-01',
23
26
  encounterNote: 'Patient shows improvement with current medication.',
24
27
  encounterNoteRecordedAt: '2024-08-01T12:34:56Z',
25
28
  encounterProvider: 'Dr. John Doe',
26
- encounterProviderRole: 'Endocrinologist',
27
29
  },
28
30
  {
29
31
  id: 'note-2',
30
32
  diagnoses: '',
31
- encounterDate: '2024-08-02',
32
33
  encounterNote: 'Blood pressure is slightly elevated. Consider adjusting medication.',
33
34
  encounterNoteRecordedAt: '2024-08-02T14:22:00Z',
34
35
  encounterProvider: 'Dr. Jane Smith',
35
- encounterProviderRole: 'Cardiologist',
36
36
  },
37
37
  ];
38
38
 
39
39
  describe('PatientNotesHistory', () => {
40
40
  beforeEach(() => {
41
41
  jest.resetAllMocks();
42
+ mockUseConfig.mockReturnValue(getDefaultsFromConfigSchema<WardConfigObject>(configSchema));
42
43
  });
43
44
 
44
45
  test('displays loading skeletons when loading', () => {
@@ -14,46 +14,38 @@ export function savePatientNote(payload: EncounterPayload, abortController: Abor
14
14
  });
15
15
  }
16
16
 
17
- export function usePatientNotes(
18
- patientUuid: string,
19
- visitUuid: string,
20
- encounterType: string,
21
- conceptUuid: string,
22
- ): UsePatientNotes {
17
+ export function usePatientNotes(patientUuid: string, visitUuid: string, conceptUuids: Array<string>): UsePatientNotes {
23
18
  const customRepresentation =
24
- 'custom:(uuid,display,encounterDatetime,patient,obs,' +
25
- 'encounterProviders:(uuid,display,' +
26
- 'encounterRole:(uuid,display),' +
27
- 'provider:(uuid,person:(uuid,display))),' +
28
- 'diagnoses';
29
- const encountersApiUrl = `${restBaseUrl}/encounter?patient=${patientUuid}&encounterType=${encounterType}&visit=${visitUuid}&v=${customRepresentation}`;
19
+ 'custom:(uuid,patient:(uuid),obs:(uuid,concept:(uuid),obsDatetime,value:(uuid)),' +
20
+ 'encounterProviders:(uuid,provider:(uuid,person:(uuid,display)))';
21
+ const encountersApiUrl = `${restBaseUrl}/encounter?patient=${patientUuid}&visit=${visitUuid}&v=${customRepresentation}`;
30
22
 
31
23
  const { data, error, isLoading, isValidating, mutate } = useOpenmrsFetchAll<RESTPatientNote>(
32
- patientUuid && encounterType ? encountersApiUrl : null,
24
+ patientUuid ? encountersApiUrl : null,
33
25
  );
34
26
 
35
27
  const patientNotes: Array<PatientNote> | null = useMemo(
36
28
  () =>
37
29
  data
38
30
  ? data
39
- .map((encounter) => {
40
- const noteObs = encounter.obs.find((obs) => obs.concept.uuid === conceptUuid);
41
-
42
- return {
43
- id: encounter.uuid,
44
- diagnoses: encounter.diagnoses.map((d) => d.display).join(', '),
45
- encounterDate: encounter.encounterDatetime,
46
- encounterNote: noteObs ? noteObs.value : '',
47
- encounterNoteRecordedAt: noteObs ? noteObs.obsDatetime : '',
48
- encounterProvider: encounter.encounterProviders.map((ep) => ep.provider.person.display).join(', '),
49
- encounterProviderRole: encounter.encounterProviders.map((ep) => ep.encounterRole.display).join(', '),
50
- };
31
+ .flatMap((encounter) => {
32
+ return encounter.obs?.reduce((acc, obs) => {
33
+ if (conceptUuids.includes(obs.concept.uuid)) {
34
+ acc.push({
35
+ id: encounter.uuid,
36
+ encounterNote: obs ? obs.value : '',
37
+ encounterNoteRecordedAt: obs ? obs.obsDatetime : '',
38
+ encounterProvider: encounter.encounterProviders.map((ep) => ep.provider.person.display).join(', '),
39
+ });
40
+ }
41
+ return acc;
42
+ }, []);
51
43
  })
52
44
  .sort(
53
45
  (a, b) => new Date(b.encounterNoteRecordedAt).getTime() - new Date(a.encounterNoteRecordedAt).getTime(),
54
46
  )
55
47
  : [],
56
- [data, conceptUuid],
48
+ [data, conceptUuids],
57
49
  );
58
50
 
59
51
  return useMemo(
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { render, screen } from '@testing-library/react';
4
- import { createErrorHandler, ResponsiveWrapper, showSnackbar, translateFrom, useSession } from '@openmrs/esm-framework';
4
+ import { getDefaultsFromConfigSchema, showSnackbar, useConfig } from '@openmrs/esm-framework';
5
5
  import { savePatientNote, usePatientNotes } from './notes.resource';
6
6
  import WardPatientNotesWorkspace from './notes.workspace';
7
- import { emrConfigurationMock, mockInpatientRequestAlice, mockPatient, mockPatientAlice, mockSession } from '__mocks__';
7
+ import { emrConfigurationMock, mockInpatientRequestAlice, mockPatientAlice } from '__mocks__';
8
8
  import useEmrConfiguration from '../../hooks/useEmrConfiguration';
9
9
  import { type WardPatient, type WardPatientWorkspaceDefinition } from '../../types';
10
+ import { configSchema, type WardConfigObject } from '../../config-schema';
10
11
 
11
12
  const mockWardPatientAlice: WardPatient = {
12
13
  visit: mockInpatientRequestAlice.visit,
@@ -41,6 +42,7 @@ jest.mock('../../hooks/useEmrConfiguration', () => jest.fn());
41
42
 
42
43
  const mockedUseEmrConfiguration = jest.mocked(useEmrConfiguration);
43
44
  const mockedUsePatientNotes = jest.mocked(usePatientNotes);
45
+ const mockUseConfig = jest.mocked(useConfig<WardConfigObject>);
44
46
 
45
47
  mockedUseEmrConfiguration.mockReturnValue({
46
48
  emrConfiguration: emrConfigurationMock,
@@ -50,6 +52,7 @@ mockedUseEmrConfiguration.mockReturnValue({
50
52
  });
51
53
 
52
54
  describe('<WardPatientNotesWorkspace>', () => {
55
+ mockUseConfig.mockReturnValue(getDefaultsFromConfigSchema<WardConfigObject>(configSchema));
53
56
  mockedUsePatientNotes.mockReturnValue({
54
57
  patientNotes: [],
55
58
  errorFetchingPatientNotes: undefined,
@@ -13,12 +13,9 @@ export interface RESTPatientNote extends OpenmrsResource {
13
13
 
14
14
  export interface PatientNote {
15
15
  id: string;
16
- diagnoses: string;
17
- encounterDate: string;
18
16
  encounterNote: string;
19
17
  encounterNoteRecordedAt: string;
20
18
  encounterProvider: string;
21
- encounterProviderRole: string;
22
19
  }
23
20
 
24
21
  export interface UsePatientNotes {
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",