@ampath/esm-dispensing-app 1.10.0-next.1
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.
- package/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +80 -0
- package/.husky/pre-commit +7 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +12 -0
- package/.tx/config +11 -0
- package/.yarn/versions/1c40b9b6.yml +0 -0
- package/.yarn/versions/ff162597.yml +0 -0
- package/LICENSE +401 -0
- package/README.md +124 -0
- package/__mocks__/react-i18next.js +51 -0
- package/dist/1043.js +1 -0
- package/dist/1043.js.map +1 -0
- package/dist/1119.js +1 -0
- package/dist/1197.js +1 -0
- package/dist/2146.js +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2690.js +1 -0
- package/dist/2890.js +2 -0
- package/dist/2890.js.LICENSE.txt +14 -0
- package/dist/2890.js.map +1 -0
- package/dist/2898.js +1 -0
- package/dist/2898.js.map +1 -0
- package/dist/3041.js +1 -0
- package/dist/3041.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3184.js +2 -0
- package/dist/3184.js.LICENSE.txt +14 -0
- package/dist/3184.js.map +1 -0
- package/dist/3568.js +1 -0
- package/dist/3568.js.map +1 -0
- package/dist/3584.js +1 -0
- package/dist/4055.js +1 -0
- package/dist/4099.js +1 -0
- package/dist/4099.js.map +1 -0
- package/dist/4132.js +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/439.js +1 -0
- package/dist/4618.js +1 -0
- package/dist/4652.js +1 -0
- package/dist/4944.js +1 -0
- package/dist/5173.js +1 -0
- package/dist/5241.js +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5442.js +1 -0
- package/dist/5661.js +1 -0
- package/dist/5897.js +1 -0
- package/dist/5897.js.map +1 -0
- package/dist/6022.js +1 -0
- package/dist/609.js +1 -0
- package/dist/609.js.map +1 -0
- package/dist/6468.js +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.LICENSE.txt +9 -0
- package/dist/6540.js.map +1 -0
- package/dist/6589.js +1 -0
- package/dist/6606.js +1 -0
- package/dist/6606.js.map +1 -0
- package/dist/6679.js +1 -0
- package/dist/6825.js +1 -0
- package/dist/6825.js.map +1 -0
- package/dist/6840.js +1 -0
- package/dist/6841.js +1 -0
- package/dist/6841.js.map +1 -0
- package/dist/6859.js +1 -0
- package/dist/7097.js +1 -0
- package/dist/7159.js +1 -0
- package/dist/723.js +1 -0
- package/dist/7240.js +1 -0
- package/dist/7240.js.map +1 -0
- package/dist/7255.js +1 -0
- package/dist/7255.js.map +1 -0
- package/dist/7617.js +1 -0
- package/dist/795.js +1 -0
- package/dist/8163.js +1 -0
- package/dist/8349.js +1 -0
- package/dist/8371.js +1 -0
- package/dist/8569.js +2 -0
- package/dist/8569.js.LICENSE.txt +41 -0
- package/dist/8569.js.map +1 -0
- package/dist/8600.js +1 -0
- package/dist/8600.js.map +1 -0
- package/dist/8618.js +1 -0
- package/dist/8885.js +1 -0
- package/dist/8885.js.map +1 -0
- package/dist/890.js +1 -0
- package/dist/9214.js +1 -0
- package/dist/9538.js +1 -0
- package/dist/9569.js +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.js.map +1 -0
- package/dist/963.js +1 -0
- package/dist/963.js.map +1 -0
- package/dist/986.js +1 -0
- package/dist/9879.js +1 -0
- package/dist/9895.js +1 -0
- package/dist/9900.js +1 -0
- package/dist/9913.js +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +51 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-dispensing-app.js +1 -0
- package/dist/openmrs-esm-dispensing-app.js.buildmanifest.json +1645 -0
- package/dist/openmrs-esm-dispensing-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/README.md +119 -0
- package/e2e/commands/drug-order-operations.ts +43 -0
- package/e2e/commands/encounter-operations.ts +60 -0
- package/e2e/commands/index.ts +5 -0
- package/e2e/commands/patient-operations.ts +109 -0
- package/e2e/commands/provider-operations.ts +9 -0
- package/e2e/commands/types/index.ts +157 -0
- package/e2e/commands/visit-operations.ts +38 -0
- package/e2e/core/global-setup.ts +32 -0
- package/e2e/core/index.ts +1 -0
- package/e2e/core/test.ts +31 -0
- package/e2e/fixtures/api.ts +27 -0
- package/e2e/fixtures/index.ts +1 -0
- package/e2e/pages/dispensing-page.ts +9 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/specs/active-prescriptions.spec.ts +72 -0
- package/e2e/specs/close-prescription.spec.ts +71 -0
- package/e2e/specs/dispense-medication.spec.ts +71 -0
- package/e2e/specs/pause-prescription.spec.ts +72 -0
- package/e2e/support/github/Dockerfile +34 -0
- package/e2e/support/github/docker-compose.yml +24 -0
- package/e2e/support/github/run-e2e-docker-env.sh +42 -0
- package/e2e/types/index.ts +157 -0
- package/example.env +7 -0
- package/jest.config.js +24 -0
- package/package.json +110 -0
- package/playwright.config.ts +36 -0
- package/prettier.config.js +8 -0
- package/src/components/action-buttons.component.tsx +87 -0
- package/src/components/action-buttons.scss +16 -0
- package/src/components/action-buttons.test.tsx +217 -0
- package/src/components/medication-card.component.tsx +37 -0
- package/src/components/medication-card.scss +20 -0
- package/src/components/medication-card.test.tsx +36 -0
- package/src/components/medication-dispense-review.scss +108 -0
- package/src/components/medication-event.component.tsx +96 -0
- package/src/components/medication-event.scss +44 -0
- package/src/components/medication-event.test.tsx +212 -0
- package/src/components/prescription-actions/close-action-button.component.tsx +50 -0
- package/src/components/prescription-actions/dispense-action-button.component.tsx +57 -0
- package/src/components/prescription-actions/pause-action-button.component.tsx +49 -0
- package/src/conditions/conditions.component.tsx +118 -0
- package/src/conditions/conditions.resource.ts +100 -0
- package/src/conditions/conditions.scss +26 -0
- package/src/conditions/conditions.test.tsx +200 -0
- package/src/config-schema.ts +192 -0
- package/src/constants.ts +22 -0
- package/src/dashboard/dispensing-dashboard-link.component.tsx +36 -0
- package/src/dashboard/dispensing-dashboard.component.tsx +36 -0
- package/src/declarations.d.ts +2 -0
- package/src/diagnoses/diagnoses.component.tsx +111 -0
- package/src/diagnoses/diagnoses.resource.ts +30 -0
- package/src/diagnoses/diagnoses.scss +31 -0
- package/src/dispensing-link.component.tsx +9 -0
- package/src/dispensing-tiles/dispensing-tile.component.tsx +42 -0
- package/src/dispensing-tiles/dispensing-tile.scss +43 -0
- package/src/dispensing-tiles/dispensing-tiles.component.tsx +39 -0
- package/src/dispensing-tiles/dispensing-tiles.resource.tsx +30 -0
- package/src/dispensing-tiles/dispensing-tiles.scss +11 -0
- package/src/dispensing.component.tsx +31 -0
- package/src/dispensing.scss +5 -0
- package/src/dispensing.test.tsx +9 -0
- package/src/fill-prescription/fill-prescription-button.component.tsx +103 -0
- package/src/fill-prescription/fill-prescription-button.scss +8 -0
- package/src/fill-prescription/on-prescription-filled.modal.tsx +140 -0
- package/src/fill-prescription/on-prescription-filled.scss +7 -0
- package/src/forms/close-dispense-form.workspace.tsx +194 -0
- package/src/forms/dispense-form.workspace.test.tsx +334 -0
- package/src/forms/dispense-form.workspace.tsx +324 -0
- package/src/forms/forms.scss +152 -0
- package/src/forms/medication-dispense-review.component.tsx +649 -0
- package/src/forms/medication-dispense-review.test.tsx +158 -0
- package/src/forms/pause-dispense-form.workspace.tsx +196 -0
- package/src/forms/stock-dispense/stock-dispense.component.tsx +126 -0
- package/src/forms/stock-dispense/stock.resource.tsx +67 -0
- package/src/history/delete-confirm.modal.tsx +35 -0
- package/src/history/history-and-comments.component.tsx +338 -0
- package/src/history/history-and-comments.scss +54 -0
- package/src/index.ts +57 -0
- package/src/location/location.resource.test.tsx +108 -0
- package/src/location/location.resource.tsx +32 -0
- package/src/medication/medication.resource.test.tsx +156 -0
- package/src/medication/medication.resource.tsx +45 -0
- package/src/medication-dispense/medication-dispense.resource.test.tsx +243 -0
- package/src/medication-dispense/medication-dispense.resource.tsx +178 -0
- package/src/medication-request/medication-request.resource.test.tsx +1333 -0
- package/src/medication-request/medication-request.resource.tsx +257 -0
- package/src/patient/patient-info-cell.component.tsx +26 -0
- package/src/patient/patient.resources.ts +14 -0
- package/src/pharmacy-header/pharmacy-header.component.tsx +35 -0
- package/src/pharmacy-header/pharmacy-header.scss +55 -0
- package/src/pharmacy-header/pharmacy-illustration.component.tsx +30 -0
- package/src/prescriptions/patient-search-tab-panel.component.tsx +58 -0
- package/src/prescriptions/patient-search-tab-panel.scss +26 -0
- package/src/prescriptions/prescription-actions.component.tsx +24 -0
- package/src/prescriptions/prescription-actions.scss +14 -0
- package/src/prescriptions/prescription-details.component.tsx +152 -0
- package/src/prescriptions/prescription-details.scss +87 -0
- package/src/prescriptions/prescription-details.test.tsx +267 -0
- package/src/prescriptions/prescription-expanded.component.tsx +58 -0
- package/src/prescriptions/prescription-expanded.scss +56 -0
- package/src/prescriptions/prescription-tab-lists.component.tsx +70 -0
- package/src/prescriptions/prescription-tab-panel.component.tsx +83 -0
- package/src/prescriptions/prescriptions-table.component.tsx +189 -0
- package/src/prescriptions/prescriptions.scss +152 -0
- package/src/print-prescription/prescription-print-action.component.tsx +30 -0
- package/src/print-prescription/prescription-print-preview.modal.tsx +92 -0
- package/src/print-prescription/prescription-printout.component.tsx +154 -0
- package/src/print-prescription/print-prescription.scss +75 -0
- package/src/print-prescription/printable-prescriptions.component.tsx +57 -0
- package/src/routes.json +137 -0
- package/src/types.ts +530 -0
- package/src/utils.test.ts +2947 -0
- package/src/utils.ts +637 -0
- package/tools/i18next-parser.config.js +89 -0
- package/tools/setup-tests.ts +8 -0
- package/tools/update-openmrs-deps.mjs +42 -0
- package/translations/am.json +133 -0
- package/translations/ar.json +133 -0
- package/translations/ar_SY.json +133 -0
- package/translations/bn.json +133 -0
- package/translations/cs.json +133 -0
- package/translations/de.json +133 -0
- package/translations/en.json +133 -0
- package/translations/en_US.json +133 -0
- package/translations/es.json +133 -0
- package/translations/es_MX.json +133 -0
- package/translations/fr.json +133 -0
- package/translations/he.json +133 -0
- package/translations/hi.json +133 -0
- package/translations/hi_IN.json +133 -0
- package/translations/id.json +133 -0
- package/translations/it.json +133 -0
- package/translations/ka.json +133 -0
- package/translations/km.json +133 -0
- package/translations/ku.json +133 -0
- package/translations/ky.json +133 -0
- package/translations/lg.json +133 -0
- package/translations/ne.json +133 -0
- package/translations/pl.json +133 -0
- package/translations/pt.json +133 -0
- package/translations/pt_BR.json +133 -0
- package/translations/qu.json +133 -0
- package/translations/ro_RO.json +133 -0
- package/translations/ru_RU.json +133 -0
- package/translations/si.json +133 -0
- package/translations/sq.json +133 -0
- package/translations/sw.json +133 -0
- package/translations/sw_KE.json +133 -0
- package/translations/tr.json +133 -0
- package/translations/tr_TR.json +133 -0
- package/translations/uk.json +133 -0
- package/translations/uz.json +133 -0
- package/translations/uz@Latn.json +133 -0
- package/translations/uz_UZ.json +133 -0
- package/translations/vi.json +133 -0
- package/translations/zh.json +133 -0
- package/translations/zh_CN.json +133 -0
- package/translations/zh_TW.json +133 -0
- package/tsconfig.json +23 -0
- package/turbo.json +41 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import {
|
|
4
|
+
updateMedicationRequestFulfillerStatus,
|
|
5
|
+
useMedicationRequest,
|
|
6
|
+
usePatientAllergies,
|
|
7
|
+
usePrescriptionDetails,
|
|
8
|
+
usePrescriptionsTable,
|
|
9
|
+
} from './medication-request.resource';
|
|
10
|
+
import { openmrsFetch, parseDate } from '@openmrs/esm-framework';
|
|
11
|
+
import { MedicationRequestFulfillerStatus } from '../types';
|
|
12
|
+
import { JSON_MERGE_PATH_MIME_TYPE, OPENMRS_FHIR_EXT_REQUEST_FULFILLER_STATUS } from '../constants';
|
|
13
|
+
|
|
14
|
+
jest.mocked(openmrsFetch);
|
|
15
|
+
jest.mock('swr');
|
|
16
|
+
jest.mock('react', () => ({
|
|
17
|
+
...jest.requireActual('react'),
|
|
18
|
+
useMemo: jest.fn((fn) => fn()),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
describe('Medication Request Resource Test', () => {
|
|
22
|
+
test('usePrescriptionsTable should call active endpoint and proper date based on expiration period if status parameter is active', () => {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
useSWR.mockImplementation(() => ({ data: { data: 'mockedReturnData' } }));
|
|
25
|
+
usePrescriptionsTable(true, '', 'ACTIVE', 5, 5, 'bob', null, 10, 10000);
|
|
26
|
+
expect(useSWR).toHaveBeenCalledWith(
|
|
27
|
+
`/ws/fhir2/R4/Encounter?_query=encountersWithMedicationRequests&_getpagesoffset=5&_count=5&date=ge${dayjs()
|
|
28
|
+
.startOf('day')
|
|
29
|
+
.subtract(10, 'day')
|
|
30
|
+
.toISOString()}&status=ACTIVE&patientSearchTerm=bob`,
|
|
31
|
+
openmrsFetch,
|
|
32
|
+
{ refreshInterval: 10000 },
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('usePrescriptionsTable should call all endpoint if status parameter is not active', () => {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
useSWR.mockImplementation(() => ({ data: { data: 'mockedReturnData' } }));
|
|
39
|
+
usePrescriptionsTable(true, '', '', 5, 5, 'bob', null, 10, 10000);
|
|
40
|
+
expect(useSWR).toHaveBeenCalledWith(
|
|
41
|
+
`/ws/fhir2/R4/Encounter?_query=encountersWithMedicationRequests&_getpagesoffset=5&_count=5&status=&patientSearchTerm=bob`,
|
|
42
|
+
openmrsFetch,
|
|
43
|
+
{ refreshInterval: 10000 },
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('usePrescriptionsTable should include location uuids', () => {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
useSWR.mockImplementation(() => ({ data: { data: 'mockedReturnData' } }));
|
|
50
|
+
usePrescriptionsTable(
|
|
51
|
+
true,
|
|
52
|
+
'',
|
|
53
|
+
'',
|
|
54
|
+
5,
|
|
55
|
+
5,
|
|
56
|
+
'bob',
|
|
57
|
+
[
|
|
58
|
+
{ id: '123', name: 'Some Location' },
|
|
59
|
+
{ id: '456', name: 'Other Location' },
|
|
60
|
+
],
|
|
61
|
+
10,
|
|
62
|
+
10000,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(useSWR).toHaveBeenCalledWith(
|
|
66
|
+
`/ws/fhir2/R4/Encounter?_query=encountersWithMedicationRequests&_getpagesoffset=5&_count=5&status=&patientSearchTerm=bob&location=123,456`,
|
|
67
|
+
openmrsFetch,
|
|
68
|
+
{ refreshInterval: 10000 },
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('usePrescriptionTable and buildPrescriptionsTableRow should properly parse search results into prescription table', () => {
|
|
73
|
+
const queryResultsBundle = {
|
|
74
|
+
resourceType: 'Bundle',
|
|
75
|
+
id: '098e279f-bab5-4e38-82d5-83e25ec92dfc',
|
|
76
|
+
meta: {
|
|
77
|
+
lastUpdated: '2023-02-28T16:01:42.841-05:00',
|
|
78
|
+
},
|
|
79
|
+
type: 'searchset',
|
|
80
|
+
total: 26,
|
|
81
|
+
link: [
|
|
82
|
+
{
|
|
83
|
+
relation: 'self',
|
|
84
|
+
url: 'http://localhost:8080/openmrs/ws/fhir2/R4/Encounter?_count=2&_getpagesoffset=0&_query=encountersWithMedicationRequests&_tag=http%3A%2F%2Ffhir.openmrs.org%2Fext%2Fencounter-tag%7Cencounter',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
relation: 'next',
|
|
88
|
+
url: 'http://localhost:8080/openmrs/ws/fhir2/R4?_getpages=05518e5c-1b97-4197-8b79-9c254a097d3a&_getpagesoffset=2&_count=2&_bundletype=searchset',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
entry: [
|
|
92
|
+
{
|
|
93
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/7aee7123-9e50-4f72-a636-895d77a63e98',
|
|
94
|
+
resource: {
|
|
95
|
+
resourceType: 'Encounter',
|
|
96
|
+
id: '7aee7123-9e50-4f72-a636-895d77a63e98',
|
|
97
|
+
meta: {
|
|
98
|
+
lastUpdated: '2023-01-24T19:02:04.000-05:00',
|
|
99
|
+
tag: [
|
|
100
|
+
{
|
|
101
|
+
system: 'http://fhir.openmrs.org/ext/encounter-tag',
|
|
102
|
+
code: 'encounter',
|
|
103
|
+
display: 'Encounter',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
text: {
|
|
108
|
+
status: 'generated',
|
|
109
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>7aee7123-9e50-4f72-a636-895d77a63e98</td></tr><tr><td>Status:</td><td>UNKNOWN</td></tr><tr><td>Class:</td><td> (Details: http://terminology.hl7.org/CodeSystem/v3-ActCode ) </td></tr><tr><td>Type:</td><td> Drug Order Documentation </td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Period:</td><td>2023-01-24 19:02:04.0 - ?</td></tr></tbody></table></div>',
|
|
110
|
+
},
|
|
111
|
+
status: 'unknown',
|
|
112
|
+
class: {
|
|
113
|
+
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
|
|
114
|
+
code: 'AMB',
|
|
115
|
+
},
|
|
116
|
+
type: [
|
|
117
|
+
{
|
|
118
|
+
coding: [
|
|
119
|
+
{
|
|
120
|
+
system: 'http://fhir.openmrs.org/code-system/encounter-type',
|
|
121
|
+
code: '0b242b71-5b60-11eb-8f5a-0242ac110002',
|
|
122
|
+
display: 'Drug Order Documentation',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
subject: {
|
|
128
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
129
|
+
type: 'Patient',
|
|
130
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
131
|
+
},
|
|
132
|
+
period: {
|
|
133
|
+
start: '2023-01-24T19:02:04-05:00',
|
|
134
|
+
},
|
|
135
|
+
location: [
|
|
136
|
+
{
|
|
137
|
+
location: {
|
|
138
|
+
reference: 'Location/083e75b0-5959-11e4-8ed6-0800200c9a66',
|
|
139
|
+
type: 'Location',
|
|
140
|
+
display: 'CDI Klinik Ekstèn Jeneral',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
148
|
+
resource: {
|
|
149
|
+
resourceType: 'Encounter',
|
|
150
|
+
id: '8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
151
|
+
meta: {
|
|
152
|
+
lastUpdated: '2023-01-24T18:42:09.000-05:00',
|
|
153
|
+
tag: [
|
|
154
|
+
{
|
|
155
|
+
system: 'http://fhir.openmrs.org/ext/encounter-tag',
|
|
156
|
+
code: 'encounter',
|
|
157
|
+
display: 'Encounter',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
text: {
|
|
162
|
+
status: 'generated',
|
|
163
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>8be2352d-c10d-4111-ac01-0ccada4c54d2</td></tr><tr><td>Status:</td><td>UNKNOWN</td></tr><tr><td>Class:</td><td> (Details: http://terminology.hl7.org/CodeSystem/v3-ActCode ) </td></tr><tr><td>Type:</td><td> Drug Order Documentation </td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Period:</td><td>2023-01-24 18:42:09.0 - ?</td></tr></tbody></table></div>',
|
|
164
|
+
},
|
|
165
|
+
status: 'unknown',
|
|
166
|
+
class: {
|
|
167
|
+
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
|
|
168
|
+
code: 'AMB',
|
|
169
|
+
},
|
|
170
|
+
type: [
|
|
171
|
+
{
|
|
172
|
+
coding: [
|
|
173
|
+
{
|
|
174
|
+
system: 'http://fhir.openmrs.org/code-system/encounter-type',
|
|
175
|
+
code: '0b242b71-5b60-11eb-8f5a-0242ac110002',
|
|
176
|
+
display: 'Drug Order Documentation',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
subject: {
|
|
182
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
183
|
+
type: 'Patient',
|
|
184
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
185
|
+
},
|
|
186
|
+
period: {
|
|
187
|
+
start: '2023-01-24T18:42:09-05:00',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationRequest/d4f69a68-1171-4e47-8693-478df18daf40',
|
|
193
|
+
resource: {
|
|
194
|
+
resourceType: 'MedicationRequest',
|
|
195
|
+
id: 'd4f69a68-1171-4e47-8693-478df18daf40',
|
|
196
|
+
meta: {
|
|
197
|
+
lastUpdated: '2023-01-24T19:02:04.000-05:00',
|
|
198
|
+
},
|
|
199
|
+
text: {
|
|
200
|
+
status: 'generated',
|
|
201
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>d4f69a68-1171-4e47-8693-478df18daf40</td></tr><tr><td>Status:</td><td>COMPLETED</td></tr><tr><td>Intent:</td><td>ORDER</td></tr><tr><td>Priority:</td><td>ROUTINE</td></tr><tr><td>Medication:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Medication/c8d3444c-41a4-48d3-9ec1-811fe7b27d99">Ascorbic acid (Vitamin C), 250mg tablet</a></td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Encounter:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/7aee7123-9e50-4f72-a636-895d77a63e98">Encounter/7aee7123-9e50-4f72-a636-895d77a63e98</a></td></tr><tr><td>Authored On:</td><td>24/01/2023</td></tr><tr><td>Requester:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487">Goodrich, Mark (Identifier: MAADH)</a></td></tr><tr><td>Note:</td><td><div/></td></tr><tr><td>Dosage Instruction:</td><td><div>test</div></td></tr><tr><td>Dispense Requests:</td><td><table class="subPropertyTable"><tbody><tr><th>-</th><th>Initial Fill</th><th>Dispense Interval</th><th>Validity Period</th><th>Number of Repeats Allowed</th><th>Quantity</th><th>Expected Supply Duration</th><th>Performer</th></tr><tr><td>*</td><td><div> Quantity: </div><div> Duration: </div></td><td/><td> 2023-01-24 19:02:04.0 - ? </td><td> 8 </td><td> 7.0 Application </td><td/><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/null"/></td></tr></tbody></table></td></tr></tbody></table></div>',
|
|
202
|
+
},
|
|
203
|
+
status: 'completed',
|
|
204
|
+
intent: 'order',
|
|
205
|
+
priority: 'routine',
|
|
206
|
+
medicationReference: {
|
|
207
|
+
reference: 'Medication/c8d3444c-41a4-48d3-9ec1-811fe7b27d99',
|
|
208
|
+
type: 'Medication',
|
|
209
|
+
display: 'Ascorbic acid (Vitamin C), 250mg tablet',
|
|
210
|
+
},
|
|
211
|
+
subject: {
|
|
212
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
213
|
+
type: 'Patient',
|
|
214
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
215
|
+
},
|
|
216
|
+
encounter: {
|
|
217
|
+
reference: 'Encounter/7aee7123-9e50-4f72-a636-895d77a63e98',
|
|
218
|
+
type: 'Encounter',
|
|
219
|
+
},
|
|
220
|
+
authoredOn: '2023-01-24T19:02:04-05:00',
|
|
221
|
+
requester: {
|
|
222
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
223
|
+
type: 'Practitioner',
|
|
224
|
+
identifier: {
|
|
225
|
+
value: 'MAADH',
|
|
226
|
+
},
|
|
227
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
228
|
+
},
|
|
229
|
+
dosageInstruction: [
|
|
230
|
+
{
|
|
231
|
+
text: 'test',
|
|
232
|
+
timing: {
|
|
233
|
+
repeat: {
|
|
234
|
+
duration: 6,
|
|
235
|
+
durationUnit: 'd',
|
|
236
|
+
},
|
|
237
|
+
code: {
|
|
238
|
+
coding: [
|
|
239
|
+
{
|
|
240
|
+
code: '37328251-6759-4270-8a2e-8cab2c0b315b',
|
|
241
|
+
display: 'OD (once daily)',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
system: 'http://snomed.info/sct',
|
|
245
|
+
code: '229797004',
|
|
246
|
+
display: 'OD (once daily)',
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
text: 'OD (once daily)',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
asNeededBoolean: false,
|
|
253
|
+
route: {
|
|
254
|
+
coding: [
|
|
255
|
+
{
|
|
256
|
+
code: '46aaaca8-1f21-410a-aac9-67bfcc1fd577',
|
|
257
|
+
display: 'Oral',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
system: 'http://snomed.info/sct',
|
|
261
|
+
code: '26643006',
|
|
262
|
+
display: 'Oral',
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
text: 'Oral',
|
|
266
|
+
},
|
|
267
|
+
doseAndRate: [
|
|
268
|
+
{
|
|
269
|
+
doseQuantity: {
|
|
270
|
+
value: 5.0,
|
|
271
|
+
unit: 'Ampule(s)',
|
|
272
|
+
system: 'http://snomed.info/sct',
|
|
273
|
+
code: '413516001',
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
dispenseRequest: {
|
|
280
|
+
validityPeriod: {
|
|
281
|
+
start: '2023-01-24T19:02:04-05:00',
|
|
282
|
+
},
|
|
283
|
+
numberOfRepeatsAllowed: 8,
|
|
284
|
+
quantity: {
|
|
285
|
+
value: 7.0,
|
|
286
|
+
unit: 'Application',
|
|
287
|
+
system: 'http://snomed.info/sct',
|
|
288
|
+
code: '413568008',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationDispense/d5eb4c01-01a8-44e5-8852-720c499d6260',
|
|
295
|
+
resource: {
|
|
296
|
+
resourceType: 'MedicationDispense',
|
|
297
|
+
id: 'd5eb4c01-01a8-44e5-8852-720c499d6260',
|
|
298
|
+
meta: {
|
|
299
|
+
lastUpdated: '2023-02-02T14:19:57.000-05:00',
|
|
300
|
+
},
|
|
301
|
+
status: 'completed',
|
|
302
|
+
medicationReference: {
|
|
303
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
304
|
+
type: 'Medication',
|
|
305
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
306
|
+
},
|
|
307
|
+
subject: {
|
|
308
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
309
|
+
type: 'Patient',
|
|
310
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
311
|
+
},
|
|
312
|
+
performer: [
|
|
313
|
+
{
|
|
314
|
+
actor: {
|
|
315
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
316
|
+
type: 'Practitioner',
|
|
317
|
+
identifier: {
|
|
318
|
+
value: 'MAADH',
|
|
319
|
+
},
|
|
320
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
authorizingPrescription: [
|
|
325
|
+
{
|
|
326
|
+
reference: 'MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
327
|
+
type: 'MedicationRequest',
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
quantity: {
|
|
331
|
+
value: 5.0,
|
|
332
|
+
unit: 'Application',
|
|
333
|
+
system: 'http://snomed.info/sct',
|
|
334
|
+
code: '413568008',
|
|
335
|
+
},
|
|
336
|
+
whenPrepared: '2023-02-02T14:19:51-05:00',
|
|
337
|
+
whenHandedOver: '2023-02-02T14:19:51-05:00',
|
|
338
|
+
dosageInstruction: [
|
|
339
|
+
{
|
|
340
|
+
timing: {
|
|
341
|
+
code: {
|
|
342
|
+
coding: [
|
|
343
|
+
{
|
|
344
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
345
|
+
display: 'ON (night)',
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
text: 'ON (night)',
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
asNeededBoolean: false,
|
|
352
|
+
route: {
|
|
353
|
+
coding: [
|
|
354
|
+
{
|
|
355
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
356
|
+
display: 'Intravenous',
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
system: 'http://snomed.info/sct',
|
|
360
|
+
code: '47625008',
|
|
361
|
+
display: 'Intravenous',
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
text: 'Intravenous',
|
|
365
|
+
},
|
|
366
|
+
doseAndRate: [
|
|
367
|
+
{
|
|
368
|
+
doseQuantity: {
|
|
369
|
+
value: 5.0,
|
|
370
|
+
unit: 'Application',
|
|
371
|
+
system: 'http://snomed.info/sct',
|
|
372
|
+
code: '413568008',
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
substitution: {
|
|
379
|
+
wasSubstituted: false,
|
|
380
|
+
type: {
|
|
381
|
+
coding: [
|
|
382
|
+
{
|
|
383
|
+
code: '99836b5f-12a6-48c0-8bed-8bbc0346c42d',
|
|
384
|
+
display: 'Generic composition substitution',
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
text: 'Generic composition substitution',
|
|
388
|
+
},
|
|
389
|
+
reason: [
|
|
390
|
+
{
|
|
391
|
+
coding: [
|
|
392
|
+
{
|
|
393
|
+
code: '9fb2111c-031e-47de-afaf-160c15b19f7c',
|
|
394
|
+
display: 'Formulary policy',
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
text: 'Formulary policy',
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
405
|
+
resource: {
|
|
406
|
+
resourceType: 'MedicationRequest',
|
|
407
|
+
id: '1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
408
|
+
meta: {
|
|
409
|
+
lastUpdated: '2023-01-24T18:42:09.000-05:00',
|
|
410
|
+
},
|
|
411
|
+
text: {
|
|
412
|
+
status: 'generated',
|
|
413
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>1c1ad91e-8653-453a-9f59-8d5c36249aff</td></tr><tr><td>Status:</td><td>ACTIVE</td></tr><tr><td>Intent:</td><td>ORDER</td></tr><tr><td>Priority:</td><td>ROUTINE</td></tr><tr><td>Medication:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Medication/60520315-2c98-425a-b404-d282f8c841ec">Paracetamol, 100mg rectal suppository</a></td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Encounter:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2">Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2</a></td></tr><tr><td>Authored On:</td><td>24/01/2023</td></tr><tr><td>Requester:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487">Goodrich, Mark (Identifier: MAADH)</a></td></tr><tr><td>Note:</td><td><div/></td></tr><tr><td>Dosage Instruction:</td><td><div/></td></tr><tr><td>Dispense Requests:</td><td><table class="subPropertyTable"><tbody><tr><th>-</th><th>Initial Fill</th><th>Dispense Interval</th><th>Validity Period</th><th>Number of Repeats Allowed</th><th>Quantity</th><th>Expected Supply Duration</th><th>Performer</th></tr><tr><td>*</td><td><div> Quantity: </div><div> Duration: </div></td><td/><td> 2023-01-24 18:42:09.0 - ? </td><td> 5 </td><td> 5.0 Application </td><td/><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/null"/></td></tr></tbody></table></td></tr></tbody></table></div>',
|
|
414
|
+
},
|
|
415
|
+
status: 'active',
|
|
416
|
+
intent: 'order',
|
|
417
|
+
priority: 'routine',
|
|
418
|
+
medicationReference: {
|
|
419
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
420
|
+
type: 'Medication',
|
|
421
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
422
|
+
},
|
|
423
|
+
subject: {
|
|
424
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
425
|
+
type: 'Patient',
|
|
426
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
427
|
+
},
|
|
428
|
+
encounter: {
|
|
429
|
+
reference: 'Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
430
|
+
type: 'Encounter',
|
|
431
|
+
},
|
|
432
|
+
authoredOn: '2023-01-24T18:42:09-05:00',
|
|
433
|
+
requester: {
|
|
434
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
435
|
+
type: 'Practitioner',
|
|
436
|
+
identifier: {
|
|
437
|
+
value: 'MAADH',
|
|
438
|
+
},
|
|
439
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
440
|
+
},
|
|
441
|
+
dosageInstruction: [
|
|
442
|
+
{
|
|
443
|
+
timing: {
|
|
444
|
+
repeat: {
|
|
445
|
+
duration: 5,
|
|
446
|
+
durationUnit: 'wk',
|
|
447
|
+
},
|
|
448
|
+
code: {
|
|
449
|
+
coding: [
|
|
450
|
+
{
|
|
451
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
452
|
+
display: 'ON (night)',
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
text: 'ON (night)',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
asNeededBoolean: false,
|
|
459
|
+
route: {
|
|
460
|
+
coding: [
|
|
461
|
+
{
|
|
462
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
463
|
+
display: 'Intravenous',
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
system: 'http://snomed.info/sct',
|
|
467
|
+
code: '47625008',
|
|
468
|
+
display: 'Intravenous',
|
|
469
|
+
},
|
|
470
|
+
],
|
|
471
|
+
text: 'Intravenous',
|
|
472
|
+
},
|
|
473
|
+
doseAndRate: [
|
|
474
|
+
{
|
|
475
|
+
doseQuantity: {
|
|
476
|
+
value: 5.0,
|
|
477
|
+
unit: 'Application',
|
|
478
|
+
system: 'http://snomed.info/sct',
|
|
479
|
+
code: '413568008',
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
dispenseRequest: {
|
|
486
|
+
validityPeriod: {
|
|
487
|
+
start: '2023-01-24T18:42:09-05:00',
|
|
488
|
+
},
|
|
489
|
+
numberOfRepeatsAllowed: 5,
|
|
490
|
+
quantity: {
|
|
491
|
+
value: 5.0,
|
|
492
|
+
unit: 'Application',
|
|
493
|
+
system: 'http://snomed.info/sct',
|
|
494
|
+
code: '413568008',
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationDispense/8841f349-0a86-43d2-80f5-020b70553a99',
|
|
501
|
+
resource: {
|
|
502
|
+
resourceType: 'MedicationDispense',
|
|
503
|
+
id: '8841f349-0a86-43d2-80f5-020b70553a99',
|
|
504
|
+
meta: {
|
|
505
|
+
lastUpdated: '2023-02-02T14:09:35.000-05:00',
|
|
506
|
+
},
|
|
507
|
+
status: 'completed',
|
|
508
|
+
medicationReference: {
|
|
509
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
510
|
+
type: 'Medication',
|
|
511
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
512
|
+
},
|
|
513
|
+
subject: {
|
|
514
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
515
|
+
type: 'Patient',
|
|
516
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
517
|
+
},
|
|
518
|
+
performer: [
|
|
519
|
+
{
|
|
520
|
+
actor: {
|
|
521
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
522
|
+
type: 'Practitioner',
|
|
523
|
+
identifier: {
|
|
524
|
+
value: 'MAADH',
|
|
525
|
+
},
|
|
526
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
],
|
|
530
|
+
authorizingPrescription: [
|
|
531
|
+
{
|
|
532
|
+
reference: 'MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
533
|
+
type: 'MedicationRequest',
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
quantity: {
|
|
537
|
+
value: 5.0,
|
|
538
|
+
unit: 'Application',
|
|
539
|
+
system: 'http://snomed.info/sct',
|
|
540
|
+
code: '413568008',
|
|
541
|
+
},
|
|
542
|
+
whenPrepared: '2023-02-02T14:04:11-05:00',
|
|
543
|
+
whenHandedOver: '2023-02-02T14:04:11-05:00',
|
|
544
|
+
dosageInstruction: [
|
|
545
|
+
{
|
|
546
|
+
timing: {
|
|
547
|
+
code: {
|
|
548
|
+
coding: [
|
|
549
|
+
{
|
|
550
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
551
|
+
display: 'ON (night)',
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
text: 'ON (night)',
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
asNeededBoolean: false,
|
|
558
|
+
route: {
|
|
559
|
+
coding: [
|
|
560
|
+
{
|
|
561
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
562
|
+
display: 'Intravenous',
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
system: 'http://snomed.info/sct',
|
|
566
|
+
code: '47625008',
|
|
567
|
+
display: 'Intravenous',
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
text: 'Intravenous',
|
|
571
|
+
},
|
|
572
|
+
doseAndRate: [
|
|
573
|
+
{
|
|
574
|
+
doseQuantity: {
|
|
575
|
+
value: 5.0,
|
|
576
|
+
unit: 'Application',
|
|
577
|
+
system: 'http://snomed.info/sct',
|
|
578
|
+
code: '413568008',
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
},
|
|
583
|
+
],
|
|
584
|
+
substitution: {
|
|
585
|
+
wasSubstituted: false,
|
|
586
|
+
type: {
|
|
587
|
+
coding: [
|
|
588
|
+
{
|
|
589
|
+
code: '03795bf1-44be-4589-9873-0ea312a082fb',
|
|
590
|
+
display: 'Formulary substitution',
|
|
591
|
+
},
|
|
592
|
+
],
|
|
593
|
+
text: 'Formulary substitution',
|
|
594
|
+
},
|
|
595
|
+
reason: [
|
|
596
|
+
{
|
|
597
|
+
coding: [
|
|
598
|
+
{
|
|
599
|
+
code: '163057AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
600
|
+
display: 'Continue treatment',
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
system: 'http://snomed.info/sct',
|
|
604
|
+
code: '266714009',
|
|
605
|
+
display: 'Continue treatment',
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
text: 'Continue treatment',
|
|
609
|
+
},
|
|
610
|
+
],
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
],
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// @ts-ignore
|
|
618
|
+
useSWR.mockImplementation(() => ({ data: { data: queryResultsBundle } }));
|
|
619
|
+
const { prescriptionsTableRows, totalOrders } = usePrescriptionsTable(
|
|
620
|
+
true,
|
|
621
|
+
'',
|
|
622
|
+
'ACTIVE',
|
|
623
|
+
2,
|
|
624
|
+
0,
|
|
625
|
+
'bob',
|
|
626
|
+
[],
|
|
627
|
+
90,
|
|
628
|
+
10000,
|
|
629
|
+
);
|
|
630
|
+
expect(totalOrders).toBe(26);
|
|
631
|
+
expect(prescriptionsTableRows.length).toBe(2);
|
|
632
|
+
expect(prescriptionsTableRows[0].id).toBe('7aee7123-9e50-4f72-a636-895d77a63e98');
|
|
633
|
+
expect(prescriptionsTableRows[0].created).toBe('2023-01-24T19:02:04-05:00');
|
|
634
|
+
expect(prescriptionsTableRows[0].drugs).toBe('Ascorbic acid (Vitamin C), 250mg tablet');
|
|
635
|
+
expect(prescriptionsTableRows[0].lastDispenser).toBeUndefined();
|
|
636
|
+
expect(prescriptionsTableRows[0].patient.name).toBe('Dylan, Bob (ZL EMR ID: Y2CK2G)');
|
|
637
|
+
expect(prescriptionsTableRows[0].patient.uuid).toBe('558494fe-5850-4b34-a3bf-06550334ba4a');
|
|
638
|
+
expect(prescriptionsTableRows[0].prescriber).toBe('Goodrich, Mark (Identifier: MAADH)');
|
|
639
|
+
expect(prescriptionsTableRows[0].status).toBe('completed');
|
|
640
|
+
expect(prescriptionsTableRows[0].location).toBe('CDI Klinik Ekstèn Jeneral');
|
|
641
|
+
expect(prescriptionsTableRows[1].id).toBe('8be2352d-c10d-4111-ac01-0ccada4c54d2');
|
|
642
|
+
expect(prescriptionsTableRows[1].created).toBe('2023-01-24T18:42:09-05:00');
|
|
643
|
+
expect(prescriptionsTableRows[1].drugs).toBe('Paracetamol, 100mg rectal suppository');
|
|
644
|
+
expect(prescriptionsTableRows[1].lastDispenser).toBe('Goodrich, Mark (Identifier: MAADH)');
|
|
645
|
+
expect(prescriptionsTableRows[1].patient.name).toBe('Dylan, Bob (ZL EMR ID: Y2CK2G)');
|
|
646
|
+
expect(prescriptionsTableRows[1].patient.uuid).toBe('558494fe-5850-4b34-a3bf-06550334ba4a');
|
|
647
|
+
expect(prescriptionsTableRows[1].prescriber).toBe('Goodrich, Mark (Identifier: MAADH)');
|
|
648
|
+
expect(prescriptionsTableRows[1].status).toBe('expired');
|
|
649
|
+
expect(prescriptionsTableRows[1].location).toBeNull();
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
test('usePrescriptionsDetails should call endpoint with encounter uuid', () => {
|
|
653
|
+
// @ts-ignore
|
|
654
|
+
useSWR.mockImplementation(() => ({ data: { data: [] } }));
|
|
655
|
+
usePrescriptionDetails('123abc', 10000);
|
|
656
|
+
expect(useSWR).toHaveBeenCalledWith(
|
|
657
|
+
'/ws/fhir2/R4/MedicationRequest?encounter=123abc&_revinclude=MedicationDispense:prescription&_include=MedicationRequest:encounter',
|
|
658
|
+
openmrsFetch,
|
|
659
|
+
{ refreshInterval: 10000 },
|
|
660
|
+
);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
test('usePrescriptionDetails should properly parse medication request response', () => {
|
|
664
|
+
const queryRequestBundle = {
|
|
665
|
+
resourceType: 'Bundle',
|
|
666
|
+
id: '1aafa3c6-83c2-4485-baaa-f700056e43c9',
|
|
667
|
+
meta: {
|
|
668
|
+
lastUpdated: '2023-03-01T09:47:17.436-05:00',
|
|
669
|
+
},
|
|
670
|
+
type: 'searchset',
|
|
671
|
+
total: 1,
|
|
672
|
+
link: [
|
|
673
|
+
{
|
|
674
|
+
relation: 'self',
|
|
675
|
+
url: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationRequest?_include=MedicationRequest%3Aencounter&_revinclude=MedicationDispense%3Aprescription&encounter=8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
676
|
+
},
|
|
677
|
+
],
|
|
678
|
+
entry: [
|
|
679
|
+
{
|
|
680
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
681
|
+
resource: {
|
|
682
|
+
resourceType: 'MedicationRequest',
|
|
683
|
+
id: '1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
684
|
+
meta: {
|
|
685
|
+
lastUpdated: '2023-01-24T18:42:09.000-05:00',
|
|
686
|
+
},
|
|
687
|
+
text: {
|
|
688
|
+
status: 'generated',
|
|
689
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>1c1ad91e-8653-453a-9f59-8d5c36249aff</td></tr><tr><td>Status:</td><td>STOPPED</td></tr><tr><td>Intent:</td><td>ORDER</td></tr><tr><td>Priority:</td><td>ROUTINE</td></tr><tr><td>Medication:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Medication/60520315-2c98-425a-b404-d282f8c841ec">Paracetamol, 100mg rectal suppository</a></td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Encounter:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2">Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2</a></td></tr><tr><td>Authored On:</td><td>24/01/2023</td></tr><tr><td>Requester:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487">Goodrich, Mark (Identifier: MAADH)</a></td></tr><tr><td>Note:</td><td><div/></td></tr><tr><td>Dosage Instruction:</td><td><div/></td></tr><tr><td>Dispense Requests:</td><td><table class="subPropertyTable"><tbody><tr><th>-</th><th>Initial Fill</th><th>Dispense Interval</th><th>Validity Period</th><th>Number of Repeats Allowed</th><th>Quantity</th><th>Expected Supply Duration</th><th>Performer</th></tr><tr><td>*</td><td><div> Quantity: </div><div> Duration: </div></td><td/><td> 2023-01-24 18:42:09.0 - ? </td><td> 5 </td><td> 5.0 Application </td><td/><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/null"/></td></tr></tbody></table></td></tr></tbody></table></div>',
|
|
690
|
+
},
|
|
691
|
+
status: 'stopped',
|
|
692
|
+
intent: 'order',
|
|
693
|
+
priority: 'routine',
|
|
694
|
+
medicationReference: {
|
|
695
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
696
|
+
type: 'Medication',
|
|
697
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
698
|
+
},
|
|
699
|
+
subject: {
|
|
700
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
701
|
+
type: 'Patient',
|
|
702
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
703
|
+
},
|
|
704
|
+
encounter: {
|
|
705
|
+
reference: 'Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
706
|
+
type: 'Encounter',
|
|
707
|
+
},
|
|
708
|
+
authoredOn: '2023-01-24T18:42:09-05:00',
|
|
709
|
+
requester: {
|
|
710
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
711
|
+
type: 'Practitioner',
|
|
712
|
+
identifier: {
|
|
713
|
+
value: 'MAADH',
|
|
714
|
+
},
|
|
715
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
716
|
+
},
|
|
717
|
+
dosageInstruction: [
|
|
718
|
+
{
|
|
719
|
+
timing: {
|
|
720
|
+
repeat: {
|
|
721
|
+
duration: 5,
|
|
722
|
+
durationUnit: 'wk',
|
|
723
|
+
},
|
|
724
|
+
code: {
|
|
725
|
+
coding: [
|
|
726
|
+
{
|
|
727
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
728
|
+
display: 'ON (night)',
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
text: 'ON (night)',
|
|
732
|
+
},
|
|
733
|
+
},
|
|
734
|
+
asNeededBoolean: false,
|
|
735
|
+
route: {
|
|
736
|
+
coding: [
|
|
737
|
+
{
|
|
738
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
739
|
+
display: 'Intravenous',
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
system: 'http://snomed.info/sct',
|
|
743
|
+
code: '47625008',
|
|
744
|
+
display: 'Intravenous',
|
|
745
|
+
},
|
|
746
|
+
],
|
|
747
|
+
text: 'Intravenous',
|
|
748
|
+
},
|
|
749
|
+
doseAndRate: [
|
|
750
|
+
{
|
|
751
|
+
doseQuantity: {
|
|
752
|
+
value: 5.0,
|
|
753
|
+
unit: 'Application',
|
|
754
|
+
system: 'http://snomed.info/sct',
|
|
755
|
+
code: '413568008',
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
],
|
|
759
|
+
},
|
|
760
|
+
],
|
|
761
|
+
dispenseRequest: {
|
|
762
|
+
validityPeriod: {
|
|
763
|
+
start: '2023-01-24T18:42:09-05:00',
|
|
764
|
+
},
|
|
765
|
+
numberOfRepeatsAllowed: 5,
|
|
766
|
+
quantity: {
|
|
767
|
+
value: 5.0,
|
|
768
|
+
unit: 'Application',
|
|
769
|
+
system: 'http://snomed.info/sct',
|
|
770
|
+
code: '413568008',
|
|
771
|
+
},
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationDispense/d5eb4c01-01a8-44e5-8852-720c499d6260',
|
|
777
|
+
resource: {
|
|
778
|
+
resourceType: 'MedicationDispense',
|
|
779
|
+
id: 'd5eb4c01-01a8-44e5-8852-720c499d6260',
|
|
780
|
+
meta: {
|
|
781
|
+
lastUpdated: '2023-02-02T14:19:57.000-05:00',
|
|
782
|
+
},
|
|
783
|
+
status: 'completed',
|
|
784
|
+
medicationReference: {
|
|
785
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
786
|
+
type: 'Medication',
|
|
787
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
788
|
+
},
|
|
789
|
+
subject: {
|
|
790
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
791
|
+
type: 'Patient',
|
|
792
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
793
|
+
},
|
|
794
|
+
performer: [
|
|
795
|
+
{
|
|
796
|
+
actor: {
|
|
797
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
798
|
+
type: 'Practitioner',
|
|
799
|
+
identifier: {
|
|
800
|
+
value: 'MAADH',
|
|
801
|
+
},
|
|
802
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
803
|
+
},
|
|
804
|
+
},
|
|
805
|
+
],
|
|
806
|
+
authorizingPrescription: [
|
|
807
|
+
{
|
|
808
|
+
reference: 'MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
809
|
+
type: 'MedicationRequest',
|
|
810
|
+
},
|
|
811
|
+
],
|
|
812
|
+
quantity: {
|
|
813
|
+
value: 5.0,
|
|
814
|
+
unit: 'Application',
|
|
815
|
+
system: 'http://snomed.info/sct',
|
|
816
|
+
code: '413568008',
|
|
817
|
+
},
|
|
818
|
+
whenPrepared: '2023-02-02T14:19:51-05:00',
|
|
819
|
+
whenHandedOver: '2023-02-01T14:19:51-05:00',
|
|
820
|
+
dosageInstruction: [
|
|
821
|
+
{
|
|
822
|
+
timing: {
|
|
823
|
+
code: {
|
|
824
|
+
coding: [
|
|
825
|
+
{
|
|
826
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
827
|
+
display: 'ON (night)',
|
|
828
|
+
},
|
|
829
|
+
],
|
|
830
|
+
text: 'ON (night)',
|
|
831
|
+
},
|
|
832
|
+
},
|
|
833
|
+
asNeededBoolean: false,
|
|
834
|
+
route: {
|
|
835
|
+
coding: [
|
|
836
|
+
{
|
|
837
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
838
|
+
display: 'Intravenous',
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
system: 'http://snomed.info/sct',
|
|
842
|
+
code: '47625008',
|
|
843
|
+
display: 'Intravenous',
|
|
844
|
+
},
|
|
845
|
+
],
|
|
846
|
+
text: 'Intravenous',
|
|
847
|
+
},
|
|
848
|
+
doseAndRate: [
|
|
849
|
+
{
|
|
850
|
+
doseQuantity: {
|
|
851
|
+
value: 5.0,
|
|
852
|
+
unit: 'Application',
|
|
853
|
+
system: 'http://snomed.info/sct',
|
|
854
|
+
code: '413568008',
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
],
|
|
858
|
+
},
|
|
859
|
+
],
|
|
860
|
+
substitution: {
|
|
861
|
+
wasSubstituted: false,
|
|
862
|
+
type: {
|
|
863
|
+
coding: [
|
|
864
|
+
{
|
|
865
|
+
code: '99836b5f-12a6-48c0-8bed-8bbc0346c42d',
|
|
866
|
+
display: 'Generic composition substitution',
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
text: 'Generic composition substitution',
|
|
870
|
+
},
|
|
871
|
+
reason: [
|
|
872
|
+
{
|
|
873
|
+
coding: [
|
|
874
|
+
{
|
|
875
|
+
code: '9fb2111c-031e-47de-afaf-160c15b19f7c',
|
|
876
|
+
display: 'Formulary policy',
|
|
877
|
+
},
|
|
878
|
+
],
|
|
879
|
+
text: 'Formulary policy',
|
|
880
|
+
},
|
|
881
|
+
],
|
|
882
|
+
},
|
|
883
|
+
},
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/Encounter/8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
887
|
+
resource: {
|
|
888
|
+
resourceType: 'Encounter',
|
|
889
|
+
id: '8be2352d-c10d-4111-ac01-0ccada4c54d2',
|
|
890
|
+
meta: {
|
|
891
|
+
lastUpdated: '2023-01-24T18:42:09.000-05:00',
|
|
892
|
+
tag: [
|
|
893
|
+
{
|
|
894
|
+
system: 'http://fhir.openmrs.org/ext/encounter-tag',
|
|
895
|
+
code: 'encounter',
|
|
896
|
+
display: 'Encounter',
|
|
897
|
+
},
|
|
898
|
+
],
|
|
899
|
+
},
|
|
900
|
+
text: {
|
|
901
|
+
status: 'generated',
|
|
902
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>8be2352d-c10d-4111-ac01-0ccada4c54d2</td></tr><tr><td>Status:</td><td>UNKNOWN</td></tr><tr><td>Class:</td><td> (Details: http://terminology.hl7.org/CodeSystem/v3-ActCode ) </td></tr><tr><td>Type:</td><td> Drug Order Documentation </td></tr><tr><td>Subject:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Period:</td><td>2023-01-24 18:42:09.0 - ?</td></tr></tbody></table></div>',
|
|
903
|
+
},
|
|
904
|
+
status: 'unknown',
|
|
905
|
+
class: {
|
|
906
|
+
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
|
|
907
|
+
code: 'AMB',
|
|
908
|
+
},
|
|
909
|
+
type: [
|
|
910
|
+
{
|
|
911
|
+
coding: [
|
|
912
|
+
{
|
|
913
|
+
system: 'http://fhir.openmrs.org/code-system/encounter-type',
|
|
914
|
+
code: '0b242b71-5b60-11eb-8f5a-0242ac110002',
|
|
915
|
+
display: 'Drug Order Documentation',
|
|
916
|
+
},
|
|
917
|
+
],
|
|
918
|
+
},
|
|
919
|
+
],
|
|
920
|
+
subject: {
|
|
921
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
922
|
+
type: 'Patient',
|
|
923
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
924
|
+
},
|
|
925
|
+
period: {
|
|
926
|
+
start: '2023-01-24T18:42:09-05:00',
|
|
927
|
+
},
|
|
928
|
+
},
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/MedicationDispense/8841f349-0a86-43d2-80f5-020b70553a99',
|
|
932
|
+
resource: {
|
|
933
|
+
resourceType: 'MedicationDispense',
|
|
934
|
+
id: '8841f349-0a86-43d2-80f5-020b70553a99',
|
|
935
|
+
meta: {
|
|
936
|
+
lastUpdated: '2023-02-02T14:09:35.000-05:00',
|
|
937
|
+
},
|
|
938
|
+
status: 'completed',
|
|
939
|
+
medicationReference: {
|
|
940
|
+
reference: 'Medication/60520315-2c98-425a-b404-d282f8c841ec',
|
|
941
|
+
type: 'Medication',
|
|
942
|
+
display: 'Paracetamol, 100mg rectal suppository',
|
|
943
|
+
},
|
|
944
|
+
subject: {
|
|
945
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
946
|
+
type: 'Patient',
|
|
947
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
948
|
+
},
|
|
949
|
+
performer: [
|
|
950
|
+
{
|
|
951
|
+
actor: {
|
|
952
|
+
reference: 'Practitioner/19e06fb0-22ea-4dd4-aafd-da14c14a1487',
|
|
953
|
+
type: 'Practitioner',
|
|
954
|
+
identifier: {
|
|
955
|
+
value: 'MAADH',
|
|
956
|
+
},
|
|
957
|
+
display: 'Goodrich, Mark (Identifier: MAADH)',
|
|
958
|
+
},
|
|
959
|
+
},
|
|
960
|
+
],
|
|
961
|
+
authorizingPrescription: [
|
|
962
|
+
{
|
|
963
|
+
reference: 'MedicationRequest/1c1ad91e-8653-453a-9f59-8d5c36249aff',
|
|
964
|
+
type: 'MedicationRequest',
|
|
965
|
+
},
|
|
966
|
+
],
|
|
967
|
+
quantity: {
|
|
968
|
+
value: 5.0,
|
|
969
|
+
unit: 'Application',
|
|
970
|
+
system: 'http://snomed.info/sct',
|
|
971
|
+
code: '413568008',
|
|
972
|
+
},
|
|
973
|
+
whenPrepared: '2023-02-02T14:04:11-05:00',
|
|
974
|
+
whenHandedOver: '2023-02-02T14:04:11-05:00',
|
|
975
|
+
dosageInstruction: [
|
|
976
|
+
{
|
|
977
|
+
timing: {
|
|
978
|
+
code: {
|
|
979
|
+
coding: [
|
|
980
|
+
{
|
|
981
|
+
code: '023bee9c-2dbb-483c-8401-46f0ccf6b333',
|
|
982
|
+
display: 'ON (night)',
|
|
983
|
+
},
|
|
984
|
+
],
|
|
985
|
+
text: 'ON (night)',
|
|
986
|
+
},
|
|
987
|
+
},
|
|
988
|
+
asNeededBoolean: false,
|
|
989
|
+
route: {
|
|
990
|
+
coding: [
|
|
991
|
+
{
|
|
992
|
+
code: '304da4df-f376-4a3f-ba70-c9fbc8fe8fa6',
|
|
993
|
+
display: 'Intravenous',
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
system: 'http://snomed.info/sct',
|
|
997
|
+
code: '47625008',
|
|
998
|
+
display: 'Intravenous',
|
|
999
|
+
},
|
|
1000
|
+
],
|
|
1001
|
+
text: 'Intravenous',
|
|
1002
|
+
},
|
|
1003
|
+
doseAndRate: [
|
|
1004
|
+
{
|
|
1005
|
+
doseQuantity: {
|
|
1006
|
+
value: 5.0,
|
|
1007
|
+
unit: 'Application',
|
|
1008
|
+
system: 'http://snomed.info/sct',
|
|
1009
|
+
code: '413568008',
|
|
1010
|
+
},
|
|
1011
|
+
},
|
|
1012
|
+
],
|
|
1013
|
+
},
|
|
1014
|
+
],
|
|
1015
|
+
substitution: {
|
|
1016
|
+
wasSubstituted: false,
|
|
1017
|
+
type: {
|
|
1018
|
+
coding: [
|
|
1019
|
+
{
|
|
1020
|
+
code: '03795bf1-44be-4589-9873-0ea312a082fb',
|
|
1021
|
+
display: 'Formulary substitution',
|
|
1022
|
+
},
|
|
1023
|
+
],
|
|
1024
|
+
text: 'Formulary substitution',
|
|
1025
|
+
},
|
|
1026
|
+
reason: [
|
|
1027
|
+
{
|
|
1028
|
+
coding: [
|
|
1029
|
+
{
|
|
1030
|
+
code: '163057AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
1031
|
+
display: 'Continue treatment',
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
system: 'http://snomed.info/sct',
|
|
1035
|
+
code: '266714009',
|
|
1036
|
+
display: 'Continue treatment',
|
|
1037
|
+
},
|
|
1038
|
+
],
|
|
1039
|
+
text: 'Continue treatment',
|
|
1040
|
+
},
|
|
1041
|
+
],
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
},
|
|
1045
|
+
],
|
|
1046
|
+
};
|
|
1047
|
+
// @ts-ignore
|
|
1048
|
+
useSWR.mockImplementation(() => ({ data: { data: queryRequestBundle } }));
|
|
1049
|
+
const { medicationRequestBundles, prescriptionDate } = usePrescriptionDetails(
|
|
1050
|
+
'1aafa3c6-83c2-4485-baaa-f700056e43c9',
|
|
1051
|
+
10000,
|
|
1052
|
+
);
|
|
1053
|
+
expect(medicationRequestBundles.length).toBe(1);
|
|
1054
|
+
expect(medicationRequestBundles[0].request.id).toBe('1c1ad91e-8653-453a-9f59-8d5c36249aff');
|
|
1055
|
+
expect(medicationRequestBundles[0].dispenses.length).toBe(2);
|
|
1056
|
+
expect(medicationRequestBundles[0].dispenses[0].id).toBe('8841f349-0a86-43d2-80f5-020b70553a99');
|
|
1057
|
+
expect(medicationRequestBundles[0].dispenses[1].id).toBe('d5eb4c01-01a8-44e5-8852-720c499d6260');
|
|
1058
|
+
expect(prescriptionDate.toISOString()).toBe(parseDate('2023-01-24T18:42:09-05:00').toISOString());
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
test('usePatientAllergies should call endpoint with patient uuid', () => {
|
|
1062
|
+
// @ts-ignore
|
|
1063
|
+
useSWR.mockImplementation(() => ({ data: { data: [] } }));
|
|
1064
|
+
usePatientAllergies('123abc', 10000);
|
|
1065
|
+
expect(useSWR).toHaveBeenCalledWith('/ws/fhir2/R4/AllergyIntolerance?patient=123abc', openmrsFetch, {
|
|
1066
|
+
refreshInterval: 10000,
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
test('usePatientAllergies should parse allergy response', () => {
|
|
1071
|
+
const queryRequestBundle = {
|
|
1072
|
+
resourceType: 'Bundle',
|
|
1073
|
+
id: '9fef5048-2d50-4c0c-8e61-4c705b7260b5',
|
|
1074
|
+
meta: {
|
|
1075
|
+
lastUpdated: '2023-03-01T10:02:05.265-05:00',
|
|
1076
|
+
},
|
|
1077
|
+
type: 'searchset',
|
|
1078
|
+
total: 2,
|
|
1079
|
+
link: [
|
|
1080
|
+
{
|
|
1081
|
+
relation: 'self',
|
|
1082
|
+
url: 'http://localhost:8080/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
1083
|
+
},
|
|
1084
|
+
],
|
|
1085
|
+
entry: [
|
|
1086
|
+
{
|
|
1087
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/AllergyIntolerance/c8baf2e4-05d1-4797-a0c0-3c55cf32eda7',
|
|
1088
|
+
resource: {
|
|
1089
|
+
resourceType: 'AllergyIntolerance',
|
|
1090
|
+
id: 'c8baf2e4-05d1-4797-a0c0-3c55cf32eda7',
|
|
1091
|
+
meta: {
|
|
1092
|
+
lastUpdated: '2023-03-01T10:01:52.000-05:00',
|
|
1093
|
+
},
|
|
1094
|
+
text: {
|
|
1095
|
+
status: 'generated',
|
|
1096
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>c8baf2e4-05d1-4797-a0c0-3c55cf32eda7</td></tr><tr><td>Clinical Status:</td><td>Active</td></tr><tr><td>Verification Status:</td><td>Confirmed</td></tr><tr><td>Type:</td><td>ALLERGY</td></tr><tr><td>Category:</td><td> Enumeration[medication] </td></tr><tr><td>Criticality:</td><td>UNABLETOASSESS</td></tr><tr><td>Code:</td><td> Cephalosporins </td></tr><tr><td>Patient:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Recorded Date:</td><td>01/03/2023</td></tr><tr><td>Recorder:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Practitioner/92d873a8-c787-4465-aa4b-5b6197902587">Goodrich, Mark</a></td></tr><tr><td>Note:</td><td><div>tets</div></td></tr><tr><td>Reaction:</td><td/></tr><tr><td>Substance:</td><td> Cephalosporins </td></tr><tr><td>Manifestation:</td><td><div> Anemia </div></td></tr><tr><td>Severity:</td><td>MODERATE</td></tr></tbody></table></div>',
|
|
1097
|
+
},
|
|
1098
|
+
clinicalStatus: {
|
|
1099
|
+
coding: [
|
|
1100
|
+
{
|
|
1101
|
+
system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',
|
|
1102
|
+
code: 'active',
|
|
1103
|
+
display: 'Active',
|
|
1104
|
+
},
|
|
1105
|
+
],
|
|
1106
|
+
text: 'Active',
|
|
1107
|
+
},
|
|
1108
|
+
verificationStatus: {
|
|
1109
|
+
coding: [
|
|
1110
|
+
{
|
|
1111
|
+
system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',
|
|
1112
|
+
code: 'confirmed',
|
|
1113
|
+
display: 'Confirmed',
|
|
1114
|
+
},
|
|
1115
|
+
],
|
|
1116
|
+
text: 'Confirmed',
|
|
1117
|
+
},
|
|
1118
|
+
type: 'allergy',
|
|
1119
|
+
category: ['medication'],
|
|
1120
|
+
criticality: 'unable-to-assess',
|
|
1121
|
+
code: {
|
|
1122
|
+
coding: [
|
|
1123
|
+
{
|
|
1124
|
+
code: '162301AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
1125
|
+
display: 'Cephalosporins',
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
system: 'http://snomed.info/sct',
|
|
1129
|
+
code: '51779009',
|
|
1130
|
+
display: 'Cephalosporins',
|
|
1131
|
+
},
|
|
1132
|
+
],
|
|
1133
|
+
},
|
|
1134
|
+
patient: {
|
|
1135
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
1136
|
+
type: 'Patient',
|
|
1137
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
1138
|
+
},
|
|
1139
|
+
recordedDate: '2023-03-01T10:01:52-05:00',
|
|
1140
|
+
recorder: {
|
|
1141
|
+
reference: 'Practitioner/92d873a8-c787-4465-aa4b-5b6197902587',
|
|
1142
|
+
type: 'Practitioner',
|
|
1143
|
+
display: 'Goodrich, Mark',
|
|
1144
|
+
},
|
|
1145
|
+
note: [
|
|
1146
|
+
{
|
|
1147
|
+
text: 'tets',
|
|
1148
|
+
},
|
|
1149
|
+
],
|
|
1150
|
+
reaction: [
|
|
1151
|
+
{
|
|
1152
|
+
substance: {
|
|
1153
|
+
coding: [
|
|
1154
|
+
{
|
|
1155
|
+
code: '162301AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
1156
|
+
display: 'Cephalosporins',
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
system: 'http://snomed.info/sct',
|
|
1160
|
+
code: '51779009',
|
|
1161
|
+
display: 'Cephalosporins',
|
|
1162
|
+
},
|
|
1163
|
+
],
|
|
1164
|
+
},
|
|
1165
|
+
manifestation: [
|
|
1166
|
+
{
|
|
1167
|
+
coding: [
|
|
1168
|
+
{
|
|
1169
|
+
code: '3ccc4764-26fe-102b-80cb-0017a47871b2',
|
|
1170
|
+
display: 'Anemia',
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
system: 'http://snomed.info/sct',
|
|
1174
|
+
code: '271737000',
|
|
1175
|
+
display: 'Anemia',
|
|
1176
|
+
},
|
|
1177
|
+
],
|
|
1178
|
+
},
|
|
1179
|
+
],
|
|
1180
|
+
severity: 'moderate',
|
|
1181
|
+
},
|
|
1182
|
+
],
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
fullUrl: 'http://localhost:8080/openmrs/ws/fhir2/R4/AllergyIntolerance/b65c893f-4cd3-481e-aebf-4e2d03cff28b',
|
|
1187
|
+
resource: {
|
|
1188
|
+
resourceType: 'AllergyIntolerance',
|
|
1189
|
+
id: 'b65c893f-4cd3-481e-aebf-4e2d03cff28b',
|
|
1190
|
+
meta: {
|
|
1191
|
+
lastUpdated: '2023-03-01T10:01:59.000-05:00',
|
|
1192
|
+
},
|
|
1193
|
+
text: {
|
|
1194
|
+
status: 'generated',
|
|
1195
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><table class="hapiPropertyTable"><tbody><tr><td>Id:</td><td>b65c893f-4cd3-481e-aebf-4e2d03cff28b</td></tr><tr><td>Clinical Status:</td><td>Active</td></tr><tr><td>Verification Status:</td><td>Confirmed</td></tr><tr><td>Type:</td><td>ALLERGY</td></tr><tr><td>Category:</td><td> Enumeration[food] </td></tr><tr><td>Code:</td><td> Dairy food </td></tr><tr><td>Patient:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Patient/558494fe-5850-4b34-a3bf-06550334ba4a">Dylan, Bob (ZL EMR ID: Y2CK2G)</a></td></tr><tr><td>Recorded Date:</td><td>01/03/2023</td></tr><tr><td>Recorder:</td><td><a href="http://localhost:8080/openmrs/ws/fhir2/R4/Practitioner/92d873a8-c787-4465-aa4b-5b6197902587">Goodrich, Mark</a></td></tr><tr><td>Note:</td><td><div/></td></tr><tr><td>Reaction:</td><td/></tr><tr><td>Substance:</td><td> Dairy food </td></tr><tr><td>Manifestation:</td><td><div> Anaphylaxis </div></td></tr></tbody></table></div>',
|
|
1196
|
+
},
|
|
1197
|
+
clinicalStatus: {
|
|
1198
|
+
coding: [
|
|
1199
|
+
{
|
|
1200
|
+
system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',
|
|
1201
|
+
code: 'active',
|
|
1202
|
+
display: 'Active',
|
|
1203
|
+
},
|
|
1204
|
+
],
|
|
1205
|
+
text: 'Active',
|
|
1206
|
+
},
|
|
1207
|
+
verificationStatus: {
|
|
1208
|
+
coding: [
|
|
1209
|
+
{
|
|
1210
|
+
system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',
|
|
1211
|
+
code: 'confirmed',
|
|
1212
|
+
display: 'Confirmed',
|
|
1213
|
+
},
|
|
1214
|
+
],
|
|
1215
|
+
text: 'Confirmed',
|
|
1216
|
+
},
|
|
1217
|
+
type: 'allergy',
|
|
1218
|
+
category: ['food'],
|
|
1219
|
+
code: {
|
|
1220
|
+
coding: [
|
|
1221
|
+
{
|
|
1222
|
+
code: '162545AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
1223
|
+
display: 'Dairy food',
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
system: 'http://snomed.info/sct',
|
|
1227
|
+
code: '226760005',
|
|
1228
|
+
display: 'Dairy food',
|
|
1229
|
+
},
|
|
1230
|
+
],
|
|
1231
|
+
},
|
|
1232
|
+
patient: {
|
|
1233
|
+
reference: 'Patient/558494fe-5850-4b34-a3bf-06550334ba4a',
|
|
1234
|
+
type: 'Patient',
|
|
1235
|
+
display: 'Dylan, Bob (ZL EMR ID: Y2CK2G)',
|
|
1236
|
+
},
|
|
1237
|
+
recordedDate: '2023-03-01T10:01:59-05:00',
|
|
1238
|
+
recorder: {
|
|
1239
|
+
reference: 'Practitioner/92d873a8-c787-4465-aa4b-5b6197902587',
|
|
1240
|
+
type: 'Practitioner',
|
|
1241
|
+
display: 'Goodrich, Mark',
|
|
1242
|
+
},
|
|
1243
|
+
reaction: [
|
|
1244
|
+
{
|
|
1245
|
+
substance: {
|
|
1246
|
+
coding: [
|
|
1247
|
+
{
|
|
1248
|
+
code: '162545AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
1249
|
+
display: 'Dairy food',
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
system: 'http://snomed.info/sct',
|
|
1253
|
+
code: '226760005',
|
|
1254
|
+
display: 'Dairy food',
|
|
1255
|
+
},
|
|
1256
|
+
],
|
|
1257
|
+
},
|
|
1258
|
+
manifestation: [
|
|
1259
|
+
{
|
|
1260
|
+
coding: [
|
|
1261
|
+
{
|
|
1262
|
+
code: '3cd68008-26fe-102b-80cb-0017a47871b2',
|
|
1263
|
+
display: 'Anaphylaxis',
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
system: 'http://snomed.info/sct',
|
|
1267
|
+
code: '39579001',
|
|
1268
|
+
display: 'Anaphylaxis',
|
|
1269
|
+
},
|
|
1270
|
+
],
|
|
1271
|
+
},
|
|
1272
|
+
],
|
|
1273
|
+
},
|
|
1274
|
+
],
|
|
1275
|
+
},
|
|
1276
|
+
},
|
|
1277
|
+
],
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
// @ts-ignore
|
|
1281
|
+
useSWR.mockImplementation(() => ({ data: { data: queryRequestBundle } }));
|
|
1282
|
+
const { totalAllergies } = usePatientAllergies('558494fe-5850-4b34-a3bf-06550334ba4a', 10000);
|
|
1283
|
+
expect(totalAllergies).toBe(2);
|
|
1284
|
+
// TODO allergy parsing doesn't seem to be working?
|
|
1285
|
+
});
|
|
1286
|
+
|
|
1287
|
+
test('useMedicationRequest should prepend MedicationRequest and call endpoint if uuid passed in', () => {
|
|
1288
|
+
// @ts-ignore
|
|
1289
|
+
useSWR.mockImplementation(() => ({ data: { data: [] } }));
|
|
1290
|
+
useMedicationRequest('123abc', 10000);
|
|
1291
|
+
expect(useSWR).toHaveBeenCalledWith('/ws/fhir2/R4/MedicationRequest/123abc', openmrsFetch, {
|
|
1292
|
+
refreshInterval: 10000,
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
test('useMedicationRequest should prepend MedicationRequest and call endpoint if uuid passed in', () => {
|
|
1297
|
+
// @ts-ignore
|
|
1298
|
+
useSWR.mockImplementation(() => ({ data: { data: [] } }));
|
|
1299
|
+
useMedicationRequest('123abc', 10000);
|
|
1300
|
+
expect(useSWR).toHaveBeenCalledWith('/ws/fhir2/R4/MedicationRequest/123abc', openmrsFetch, {
|
|
1301
|
+
refreshInterval: 10000,
|
|
1302
|
+
});
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
test('useMedicationRequest should not prepend MedicationRequest and call endpoint if full reference passed in', () => {
|
|
1306
|
+
// @ts-ignore
|
|
1307
|
+
useSWR.mockImplementation(() => ({ data: { data: [] } }));
|
|
1308
|
+
useMedicationRequest('MedicationRequest/123abc', 10000);
|
|
1309
|
+
expect(useSWR).toHaveBeenCalledWith('/ws/fhir2/R4/MedicationRequest/123abc', openmrsFetch, {
|
|
1310
|
+
refreshInterval: 10000,
|
|
1311
|
+
});
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
test('updateMedicationRequestFulfillerStatus should call medication request FHIR endpoint with appropriate data ', () => {
|
|
1315
|
+
const medicationRequestUuid = '123abc';
|
|
1316
|
+
|
|
1317
|
+
updateMedicationRequestFulfillerStatus(medicationRequestUuid, MedicationRequestFulfillerStatus.completed);
|
|
1318
|
+
expect(openmrsFetch).toHaveBeenCalledWith(`/ws/fhir2/R4/MedicationRequest/${medicationRequestUuid}`, {
|
|
1319
|
+
method: 'PATCH',
|
|
1320
|
+
headers: {
|
|
1321
|
+
'Content-Type': JSON_MERGE_PATH_MIME_TYPE,
|
|
1322
|
+
},
|
|
1323
|
+
body: {
|
|
1324
|
+
extension: [
|
|
1325
|
+
{
|
|
1326
|
+
url: OPENMRS_FHIR_EXT_REQUEST_FULFILLER_STATUS,
|
|
1327
|
+
valueCode: MedicationRequestFulfillerStatus.completed,
|
|
1328
|
+
},
|
|
1329
|
+
],
|
|
1330
|
+
},
|
|
1331
|
+
});
|
|
1332
|
+
});
|
|
1333
|
+
});
|