@openmrs/esm-laboratory-app 1.0.1-pre.106
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 +32 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo/turbo-build.log +30 -0
- package/.turbo/turbo-lint.log +12 -0
- package/.turbo/turbo-typescript.log +0 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/3d4697b8.yml +0 -0
- package/README.md +39 -0
- package/__mocks__/react-i18next.js +50 -0
- package/assets/logo/logo.png +0 -0
- package/assets/logo/moh_logo_without_word.png +0 -0
- package/assets/screenshots/labs_enter_results.png +0 -0
- package/assets/screenshots/labs_general_dashboard.png +0 -0
- package/dist/142.js +1 -0
- package/dist/142.js.map +1 -0
- package/dist/319.js +1 -0
- package/dist/36.js +1 -0
- package/dist/36.js.map +1 -0
- package/dist/395.js +1 -0
- package/dist/395.js.map +1 -0
- package/dist/453.js +1 -0
- package/dist/453.js.map +1 -0
- package/dist/533.js +1 -0
- package/dist/533.js.map +1 -0
- package/dist/56.js +2 -0
- package/dist/56.js.LICENSE.txt +32 -0
- package/dist/56.js.map +1 -0
- package/dist/572.js +1 -0
- package/dist/572.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/581.js +1 -0
- package/dist/581.js.map +1 -0
- package/dist/66.js +1 -0
- package/dist/66.js.map +1 -0
- package/dist/757.js +1 -0
- package/dist/769.js +1 -0
- package/dist/769.js.map +1 -0
- package/dist/770.js +1 -0
- package/dist/770.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/809.js +1 -0
- package/dist/809.js.map +1 -0
- package/dist/889.js +1 -0
- package/dist/889.js.map +1 -0
- package/dist/894.js +2 -0
- package/dist/894.js.LICENSE.txt +48 -0
- package/dist/894.js.map +1 -0
- package/dist/924.js +1 -0
- package/dist/924.js.map +1 -0
- package/dist/928.js +1 -0
- package/dist/928.js.map +1 -0
- package/dist/967b98e46b0984c4.png +0 -0
- package/dist/97.js +1 -0
- package/dist/97.js.map +1 -0
- package/dist/983.js +1 -0
- package/dist/983.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +48 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-laboratory-app.js +1 -0
- package/dist/openmrs-esm-laboratory-app.js.buildmanifest.json +628 -0
- package/dist/openmrs-esm-laboratory-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +16 -0
- package/package.json +121 -0
- package/src/completed-list/completed-list.component.tsx +242 -0
- package/src/completed-list/completed-list.resource.ts +0 -0
- package/src/completed-list/completed-list.scss +232 -0
- package/src/components/create-dashboard-link.component.tsx +44 -0
- package/src/components/overlay/hook.ts +47 -0
- package/src/components/overlay/overlay.component.tsx +52 -0
- package/src/components/overlay/overlay.scss +93 -0
- package/src/config-schema.ts +36 -0
- package/src/constants.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/header/laboratory-header.component.tsx +35 -0
- package/src/header/laboratory-header.scss +68 -0
- package/src/header/laboratory-illustration.component.tsx +13 -0
- package/src/index.ts +92 -0
- package/src/laboratory.component.tsx +18 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.component.tsx +39 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.resource.ts +290 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.scss +0 -0
- package/src/patient-chart/laboratory-order.component.tsx +453 -0
- package/src/patient-chart/laboratory-order.resource.ts +437 -0
- package/src/patient-chart/laboratory-order.scss +66 -0
- package/src/patient-chart/results-summary/print-results-summary.component.tsx +240 -0
- package/src/patient-chart/results-summary/print-results-summary.scss +105 -0
- package/src/patient-chart/results-summary/print-results-table.component.tsx +163 -0
- package/src/patient-chart/results-summary/results/results.component.tsx +25 -0
- package/src/patient-chart/results-summary/results/results.resource.ts +50 -0
- package/src/patient-chart/results-summary/results/results.scss +0 -0
- package/src/patient-chart/results-summary/results-dialog/edit-results-dialog.component.tsx +46 -0
- package/src/patient-chart/results-summary/results-summary.component.tsx +98 -0
- package/src/patient-chart/results-summary/results-summary.resource.tsx +185 -0
- package/src/patient-chart/results-summary/results-summary.scss +154 -0
- package/src/patient-chart/results-summary/send-email-dialog.component.tsx +111 -0
- package/src/patient-chart/results-summary/test-children-results.component.tsx +221 -0
- package/src/patient-chart/results-summary/test-print-results-table.component.tsx +148 -0
- package/src/patient-chart/results-summary/test-results-delete-action-menu.component.tsx +27 -0
- package/src/patient-chart/results-summary/test-results-rescend-action-menu.component.tsx +26 -0
- package/src/patient-chart/results-summary/test-results-table.component.tsx +153 -0
- package/src/patient-chart/results-summary/tests-children-detail.component.tsx +54 -0
- package/src/patient-chart/results-summary/views/email.handlebars +13 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +323 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +155 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.scss +20 -0
- package/src/queue-list/lab-tests/lab-tests.component.tsx +116 -0
- package/src/queue-list/lab-tests/lab-tests.resource.ts +17 -0
- package/src/queue-list/lab-tests/lab-tests.scss +12 -0
- package/src/queue-list/laboratory-patient-list.component.tsx +277 -0
- package/src/queue-list/laboratory-patient-list.resource.ts +86 -0
- package/src/queue-list/laboratory-queue.component.tsx +120 -0
- package/src/queue-list/laboratory-queue.scss +213 -0
- package/src/queue-list/laboratory-tabs.component.tsx +81 -0
- package/src/queue-list/pick-lab-request-menu.component.tsx +38 -0
- package/src/reject-order/reject-order-dialog.component.tsx +114 -0
- package/src/reject-order/reject-order-dialog.resource.ts +14 -0
- package/src/reject-order/reject-order-dialog.scss +14 -0
- package/src/results/result-form.component.tsx +223 -0
- package/src/results/result-form.resource.ts +328 -0
- package/src/results/result-form.scss +19 -0
- package/src/review-list/dialog/review-item.component.tsx +283 -0
- package/src/review-list/dialog/review-item.resource.ts +14 -0
- package/src/review-list/dialog/review-item.scss +0 -0
- package/src/review-list/review-list.component.tsx +277 -0
- package/src/review-list/review-list.resource.ts +0 -0
- package/src/review-list/review-list.scss +189 -0
- package/src/root.component.tsx +15 -0
- package/src/root.scss +50 -0
- package/src/routes.json +72 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary-tiles/laboratory-summary-tiles.component.tsx +53 -0
- package/src/summary-tiles/laboratory-summary-tiles.scss +12 -0
- package/src/summary-tiles/laboratory-summary.resource.tsx +50 -0
- package/src/summary-tiles/summary-tile.component.tsx +48 -0
- package/src/summary-tiles/summary-tile.scss +43 -0
- package/src/types/index.ts +412 -0
- package/src/types/patient-queues.ts +189 -0
- package/src/utils/functions.ts +246 -0
- package/src/work-list/work-list.component.tsx +310 -0
- package/src/work-list/work-list.resource.ts +136 -0
- package/src/work-list/work-list.scss +215 -0
- package/translations/en.json +16 -0
- package/translations/es.json +3 -0
- package/translations/fr.json +3 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +29 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { openmrsFetch } from "@openmrs/esm-framework";
|
|
2
|
+
import useSWR from "swr";
|
|
3
|
+
|
|
4
|
+
export interface ConceptResponse {
|
|
5
|
+
uuid: string;
|
|
6
|
+
display: string;
|
|
7
|
+
name: Name;
|
|
8
|
+
datatype: Datatype;
|
|
9
|
+
conceptClass: ConceptClass;
|
|
10
|
+
set: boolean;
|
|
11
|
+
version: string;
|
|
12
|
+
retired: boolean;
|
|
13
|
+
names: Name2[];
|
|
14
|
+
descriptions: Description[];
|
|
15
|
+
mappings: Mapping[];
|
|
16
|
+
answers: any[];
|
|
17
|
+
setMembers: SetMember[];
|
|
18
|
+
auditInfo: AuditInfo;
|
|
19
|
+
attributes: any[];
|
|
20
|
+
links: Link18[];
|
|
21
|
+
resourceVersion: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Name {
|
|
25
|
+
display: string;
|
|
26
|
+
uuid: string;
|
|
27
|
+
name: string;
|
|
28
|
+
locale: string;
|
|
29
|
+
localePreferred: boolean;
|
|
30
|
+
conceptNameType: string;
|
|
31
|
+
links: Link[];
|
|
32
|
+
resourceVersion: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Link {
|
|
36
|
+
rel: string;
|
|
37
|
+
uri: string;
|
|
38
|
+
resourceAlias: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Datatype {
|
|
42
|
+
uuid: string;
|
|
43
|
+
display: string;
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
hl7Abbreviation: string;
|
|
47
|
+
retired: boolean;
|
|
48
|
+
links: Link2[];
|
|
49
|
+
resourceVersion: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Link2 {
|
|
53
|
+
rel: string;
|
|
54
|
+
uri: string;
|
|
55
|
+
resourceAlias: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ConceptClass {
|
|
59
|
+
uuid: string;
|
|
60
|
+
display: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
retired: boolean;
|
|
64
|
+
links: Link3[];
|
|
65
|
+
resourceVersion: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Link3 {
|
|
69
|
+
rel: string;
|
|
70
|
+
uri: string;
|
|
71
|
+
resourceAlias: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface Name2 {
|
|
75
|
+
display: string;
|
|
76
|
+
uuid: string;
|
|
77
|
+
name: string;
|
|
78
|
+
locale: string;
|
|
79
|
+
localePreferred: boolean;
|
|
80
|
+
conceptNameType?: string;
|
|
81
|
+
links: Link4[];
|
|
82
|
+
resourceVersion: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface Link4 {
|
|
86
|
+
rel: string;
|
|
87
|
+
uri: string;
|
|
88
|
+
resourceAlias: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Description {
|
|
92
|
+
display: string;
|
|
93
|
+
uuid: string;
|
|
94
|
+
description: string;
|
|
95
|
+
locale: string;
|
|
96
|
+
links: Link5[];
|
|
97
|
+
resourceVersion: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Link5 {
|
|
101
|
+
rel: string;
|
|
102
|
+
uri: string;
|
|
103
|
+
resourceAlias: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface Mapping {
|
|
107
|
+
display: string;
|
|
108
|
+
uuid: string;
|
|
109
|
+
conceptReferenceTerm: ConceptReferenceTerm;
|
|
110
|
+
conceptMapType: ConceptMapType;
|
|
111
|
+
links: Link8[];
|
|
112
|
+
resourceVersion: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ConceptReferenceTerm {
|
|
116
|
+
uuid: string;
|
|
117
|
+
display: string;
|
|
118
|
+
links: Link6[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface Link6 {
|
|
122
|
+
rel: string;
|
|
123
|
+
uri: string;
|
|
124
|
+
resourceAlias: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ConceptMapType {
|
|
128
|
+
uuid: string;
|
|
129
|
+
display: string;
|
|
130
|
+
links: Link7[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface Link7 {
|
|
134
|
+
rel: string;
|
|
135
|
+
uri: string;
|
|
136
|
+
resourceAlias: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface Link8 {
|
|
140
|
+
rel: string;
|
|
141
|
+
uri: string;
|
|
142
|
+
resourceAlias: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface SetMember {
|
|
146
|
+
uuid: string;
|
|
147
|
+
display: string;
|
|
148
|
+
name: Name3;
|
|
149
|
+
datatype: Datatype2;
|
|
150
|
+
conceptClass: ConceptClass2;
|
|
151
|
+
set: boolean;
|
|
152
|
+
version: string;
|
|
153
|
+
retired: boolean;
|
|
154
|
+
names: Name4[];
|
|
155
|
+
descriptions: any[];
|
|
156
|
+
mappings: Mapping2[];
|
|
157
|
+
answers: Answer[];
|
|
158
|
+
setMembers: any[];
|
|
159
|
+
attributes: any[];
|
|
160
|
+
links: Link15[];
|
|
161
|
+
resourceVersion: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface Name3 {
|
|
165
|
+
display: string;
|
|
166
|
+
uuid: string;
|
|
167
|
+
name: string;
|
|
168
|
+
locale: string;
|
|
169
|
+
localePreferred: boolean;
|
|
170
|
+
conceptNameType: string;
|
|
171
|
+
links: Link9[];
|
|
172
|
+
resourceVersion: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface Link9 {
|
|
176
|
+
rel: string;
|
|
177
|
+
uri: string;
|
|
178
|
+
resourceAlias: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface Datatype2 {
|
|
182
|
+
uuid: string;
|
|
183
|
+
display: string;
|
|
184
|
+
links: Link10[];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface Link10 {
|
|
188
|
+
rel: string;
|
|
189
|
+
uri: string;
|
|
190
|
+
resourceAlias: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ConceptClass2 {
|
|
194
|
+
uuid: string;
|
|
195
|
+
display: string;
|
|
196
|
+
links: Link11[];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface Link11 {
|
|
200
|
+
rel: string;
|
|
201
|
+
uri: string;
|
|
202
|
+
resourceAlias: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface Name4 {
|
|
206
|
+
uuid: string;
|
|
207
|
+
display: string;
|
|
208
|
+
links: Link12[];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface Link12 {
|
|
212
|
+
rel: string;
|
|
213
|
+
uri: string;
|
|
214
|
+
resourceAlias: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface Mapping2 {
|
|
218
|
+
uuid: string;
|
|
219
|
+
display: string;
|
|
220
|
+
links: Link13[];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface Link13 {
|
|
224
|
+
rel: string;
|
|
225
|
+
uri: string;
|
|
226
|
+
resourceAlias: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface Answer {
|
|
230
|
+
uuid: string;
|
|
231
|
+
display: string;
|
|
232
|
+
links: Link14[];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface Link14 {
|
|
236
|
+
rel: string;
|
|
237
|
+
uri: string;
|
|
238
|
+
resourceAlias: string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface Link15 {
|
|
242
|
+
rel: string;
|
|
243
|
+
uri: string;
|
|
244
|
+
resourceAlias: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface AuditInfo {
|
|
248
|
+
creator: Creator;
|
|
249
|
+
dateCreated: string;
|
|
250
|
+
changedBy: ChangedBy;
|
|
251
|
+
dateChanged: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface Creator {
|
|
255
|
+
uuid: string;
|
|
256
|
+
display: string;
|
|
257
|
+
links: Link16[];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface Link16 {
|
|
261
|
+
rel: string;
|
|
262
|
+
uri: string;
|
|
263
|
+
resourceAlias: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface ChangedBy {
|
|
267
|
+
uuid: string;
|
|
268
|
+
display: string;
|
|
269
|
+
links: Link17[];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface Link17 {
|
|
273
|
+
rel: string;
|
|
274
|
+
uri: string;
|
|
275
|
+
resourceAlias: string;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface Link18 {
|
|
279
|
+
rel: string;
|
|
280
|
+
uri: string;
|
|
281
|
+
resourceAlias: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface ObPayload {
|
|
285
|
+
concept: string;
|
|
286
|
+
order: string;
|
|
287
|
+
value: string | number;
|
|
288
|
+
status: string;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// get order concept
|
|
292
|
+
export async function GetOrderConceptByUuid(uuid: string) {
|
|
293
|
+
const abortController = new AbortController();
|
|
294
|
+
return openmrsFetch(`/ws/rest/v1/concept/${uuid}?v=full`, {
|
|
295
|
+
headers: {
|
|
296
|
+
"Content-Type": "application/json",
|
|
297
|
+
},
|
|
298
|
+
signal: abortController.signal,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function useGetOrderConceptByUuid(uuid: string) {
|
|
303
|
+
const apiUrl = `/ws/rest/v1/concept/${uuid}?v=full`;
|
|
304
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<
|
|
305
|
+
{ data: ConceptResponse },
|
|
306
|
+
Error
|
|
307
|
+
>(apiUrl, openmrsFetch);
|
|
308
|
+
return {
|
|
309
|
+
concept: data?.data ? data?.data.setMembers : [],
|
|
310
|
+
isLoading,
|
|
311
|
+
isError: error,
|
|
312
|
+
isValidating,
|
|
313
|
+
mutate,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// create observation
|
|
318
|
+
export async function UpdateEncounter(uuid: string, payload: any) {
|
|
319
|
+
const abortController = new AbortController();
|
|
320
|
+
return openmrsFetch(`/ws/rest/v1/encounter/${uuid}`, {
|
|
321
|
+
method: "POST",
|
|
322
|
+
headers: {
|
|
323
|
+
"Content-Type": "application/json",
|
|
324
|
+
},
|
|
325
|
+
signal: abortController.signal,
|
|
326
|
+
body: payload,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
section {
|
|
6
|
+
margin: spacing.$spacing-03;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sectionTitle {
|
|
10
|
+
margin-bottom: spacing.$spacing-04;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.modalBody {
|
|
14
|
+
padding-bottom: spacing.$spacing-05;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.textInput {
|
|
18
|
+
margin: 5px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Form,
|
|
5
|
+
ModalBody,
|
|
6
|
+
ModalFooter,
|
|
7
|
+
ModalHeader,
|
|
8
|
+
InlineLoading,
|
|
9
|
+
Checkbox,
|
|
10
|
+
} from "@carbon/react";
|
|
11
|
+
import { useTranslation } from "react-i18next";
|
|
12
|
+
import { useGetEncounterById } from "../../patient-chart/laboratory-item/view-laboratory-item.resource";
|
|
13
|
+
import styles from "../review-list.scss";
|
|
14
|
+
import { GroupMember } from "../../patient-chart/laboratory-order.resource";
|
|
15
|
+
import { useGetConceptById } from "../../patient-chart/results-summary/results-summary.resource";
|
|
16
|
+
import { ApproverOrder } from "./review-item.resource";
|
|
17
|
+
import { showNotification, showToast } from "@openmrs/esm-framework";
|
|
18
|
+
|
|
19
|
+
interface ReviewItemDialogProps {
|
|
20
|
+
encounterUuid: string;
|
|
21
|
+
closeModal: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ResultsRowProps {
|
|
25
|
+
groupMembers: GroupMember[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ValueUnitsProps {
|
|
29
|
+
conceptUuid: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ReviewItem: React.FC<ReviewItemDialogProps> = ({
|
|
33
|
+
encounterUuid,
|
|
34
|
+
closeModal,
|
|
35
|
+
}) => {
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
|
|
38
|
+
const { encounter, isLoading, isError } = useGetEncounterById(encounterUuid);
|
|
39
|
+
|
|
40
|
+
const testsOrder = useMemo(() => {
|
|
41
|
+
return encounter?.obs.filter((item) => item?.order?.type === "testorder");
|
|
42
|
+
}, [encounter?.obs]);
|
|
43
|
+
|
|
44
|
+
const filteredGroupedResults = useMemo(() => {
|
|
45
|
+
let groupedResults = [];
|
|
46
|
+
|
|
47
|
+
testsOrder?.forEach((element) => {
|
|
48
|
+
groupedResults[element.order.display] = element;
|
|
49
|
+
});
|
|
50
|
+
return groupedResults;
|
|
51
|
+
}, [testsOrder]);
|
|
52
|
+
|
|
53
|
+
const [checkedItems, setCheckedItems] = useState({});
|
|
54
|
+
|
|
55
|
+
const handleCheckboxChange = (test, groupMembers, uuid) => {
|
|
56
|
+
setCheckedItems((prevCheckedItems) => ({
|
|
57
|
+
...prevCheckedItems,
|
|
58
|
+
[test]: {
|
|
59
|
+
groupMembers,
|
|
60
|
+
uuid,
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
console.info(checkedItems);
|
|
66
|
+
|
|
67
|
+
// handle approve
|
|
68
|
+
const approveOrder = async (e) => {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
|
|
71
|
+
let uuids = [];
|
|
72
|
+
|
|
73
|
+
Object.keys(checkedItems).map((item, index) => {
|
|
74
|
+
uuids.push(filteredGroupedResults[item].uuid);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const payload = {
|
|
78
|
+
orders: uuids.join(","),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
ApproverOrder(payload).then(
|
|
82
|
+
() => {
|
|
83
|
+
showToast({
|
|
84
|
+
critical: true,
|
|
85
|
+
title: t("approveOrder", "Approve Order"),
|
|
86
|
+
kind: "success",
|
|
87
|
+
description: t(
|
|
88
|
+
"successfullyApproved",
|
|
89
|
+
`You have successfully approved Order `
|
|
90
|
+
),
|
|
91
|
+
});
|
|
92
|
+
closeModal();
|
|
93
|
+
},
|
|
94
|
+
(err) => {
|
|
95
|
+
showNotification({
|
|
96
|
+
title: t(`errorApproving order', 'Error Approving a order`),
|
|
97
|
+
kind: "error",
|
|
98
|
+
critical: true,
|
|
99
|
+
description: err?.message,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// get Units
|
|
106
|
+
const ValueUnits: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
|
|
107
|
+
const {
|
|
108
|
+
concept: concept,
|
|
109
|
+
isLoading,
|
|
110
|
+
isError,
|
|
111
|
+
} = useGetConceptById(conceptUuid);
|
|
112
|
+
if (isLoading) {
|
|
113
|
+
return <InlineLoading status="active" />;
|
|
114
|
+
}
|
|
115
|
+
if (isError) {
|
|
116
|
+
return <span>Error</span>;
|
|
117
|
+
}
|
|
118
|
+
return <span style={{ marginLeft: "10px" }}>{concept?.units}</span>;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// get Reference Range
|
|
122
|
+
const ReferenceRange: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
|
|
123
|
+
const {
|
|
124
|
+
concept: concept,
|
|
125
|
+
isLoading,
|
|
126
|
+
isError,
|
|
127
|
+
} = useGetConceptById(conceptUuid);
|
|
128
|
+
if (isLoading) {
|
|
129
|
+
return <InlineLoading status="active" />;
|
|
130
|
+
}
|
|
131
|
+
if (isError) {
|
|
132
|
+
return <span>Error</span>;
|
|
133
|
+
}
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
{concept?.hiNormal === undefined || concept?.lowNormal === undefined ? (
|
|
137
|
+
"N/A"
|
|
138
|
+
) : (
|
|
139
|
+
<div>
|
|
140
|
+
<span>{concept?.lowNormal ? concept?.lowNormal : "--"}</span> :{" "}
|
|
141
|
+
<span>{concept?.hiNormal ? concept?.hiNormal : "--"}</span>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const RowTest: React.FC<ResultsRowProps> = ({ groupMembers }) => {
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
{groupMembers?.map((element, index) => {
|
|
152
|
+
return (
|
|
153
|
+
<tr key={index}>
|
|
154
|
+
{typeof element.value === "number" ? (
|
|
155
|
+
<>
|
|
156
|
+
<td>{element?.concept.display}</td>
|
|
157
|
+
|
|
158
|
+
<td>{element?.value}</td>
|
|
159
|
+
|
|
160
|
+
<td>
|
|
161
|
+
{
|
|
162
|
+
<ReferenceRange
|
|
163
|
+
conceptUuid={groupMembers[index].concept.uuid}
|
|
164
|
+
/>
|
|
165
|
+
}
|
|
166
|
+
</td>
|
|
167
|
+
|
|
168
|
+
<td>
|
|
169
|
+
{
|
|
170
|
+
<ValueUnits
|
|
171
|
+
conceptUuid={groupMembers[index].concept.uuid}
|
|
172
|
+
/>
|
|
173
|
+
}
|
|
174
|
+
</td>
|
|
175
|
+
</>
|
|
176
|
+
) : typeof element.value === "object" ? (
|
|
177
|
+
<>
|
|
178
|
+
<td>{element?.concept.display}</td>
|
|
179
|
+
|
|
180
|
+
<td>{element?.value.display}</td>
|
|
181
|
+
|
|
182
|
+
<td>
|
|
183
|
+
{
|
|
184
|
+
<ReferenceRange
|
|
185
|
+
conceptUuid={groupMembers[index].concept.uuid}
|
|
186
|
+
/>
|
|
187
|
+
}
|
|
188
|
+
</td>
|
|
189
|
+
|
|
190
|
+
<td>
|
|
191
|
+
{
|
|
192
|
+
<ValueUnits
|
|
193
|
+
conceptUuid={groupMembers[index].concept.uuid}
|
|
194
|
+
/>
|
|
195
|
+
}
|
|
196
|
+
</td>
|
|
197
|
+
</>
|
|
198
|
+
) : (
|
|
199
|
+
<td>{element?.display}</td>
|
|
200
|
+
)}
|
|
201
|
+
</tr>
|
|
202
|
+
);
|
|
203
|
+
})}
|
|
204
|
+
</>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<div>
|
|
210
|
+
<Form>
|
|
211
|
+
<ModalHeader
|
|
212
|
+
closeModal={closeModal}
|
|
213
|
+
title={t("approveResult", "Approve Result")}
|
|
214
|
+
/>
|
|
215
|
+
<ModalBody>
|
|
216
|
+
{isLoading && (
|
|
217
|
+
<InlineLoading
|
|
218
|
+
className={styles.bannerLoading}
|
|
219
|
+
iconDescription="Loading"
|
|
220
|
+
description="Loading banner"
|
|
221
|
+
status="active"
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
224
|
+
<section className={styles.section}>
|
|
225
|
+
<table>
|
|
226
|
+
<tbody>
|
|
227
|
+
{Object.keys(filteredGroupedResults).map((test, index) => (
|
|
228
|
+
<tr key={test} style={{ margin: "10px" }}>
|
|
229
|
+
<Checkbox
|
|
230
|
+
key={index}
|
|
231
|
+
style={{
|
|
232
|
+
margin: "10px",
|
|
233
|
+
fontSize: "15px",
|
|
234
|
+
fontWeight: "bold",
|
|
235
|
+
}}
|
|
236
|
+
onChange={() =>
|
|
237
|
+
handleCheckboxChange(
|
|
238
|
+
test,
|
|
239
|
+
filteredGroupedResults[test].groupMembers,
|
|
240
|
+
filteredGroupedResults[test].uuid
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
labelText={test}
|
|
244
|
+
id={`test-${test}`}
|
|
245
|
+
checked={checkedItems[test] || false}
|
|
246
|
+
/>
|
|
247
|
+
|
|
248
|
+
<table style={{ margin: "10px" }}>
|
|
249
|
+
<thead>
|
|
250
|
+
<tr>
|
|
251
|
+
<th>Tests</th>
|
|
252
|
+
<th>Result</th>
|
|
253
|
+
<th>Reference Range</th>
|
|
254
|
+
<th>Units</th>
|
|
255
|
+
</tr>
|
|
256
|
+
</thead>
|
|
257
|
+
<tbody>
|
|
258
|
+
<RowTest
|
|
259
|
+
groupMembers={
|
|
260
|
+
filteredGroupedResults[test].groupMembers
|
|
261
|
+
}
|
|
262
|
+
/>
|
|
263
|
+
</tbody>
|
|
264
|
+
</table>
|
|
265
|
+
</tr>
|
|
266
|
+
))}
|
|
267
|
+
</tbody>
|
|
268
|
+
</table>
|
|
269
|
+
</section>
|
|
270
|
+
</ModalBody>
|
|
271
|
+
<ModalFooter>
|
|
272
|
+
<Button kind="secondary" onClick={closeModal}>
|
|
273
|
+
{t("cancel", "Cancel")}
|
|
274
|
+
</Button>
|
|
275
|
+
<Button type="submit" onClick={approveOrder}>
|
|
276
|
+
{t("approveResult", "Approve Result")}
|
|
277
|
+
</Button>
|
|
278
|
+
</ModalFooter>
|
|
279
|
+
</Form>
|
|
280
|
+
</div>
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
export default ReviewItem;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FetchResponse, openmrsFetch, useConfig } from "@openmrs/esm-framework";
|
|
2
|
+
|
|
3
|
+
export async function ApproverOrder(body: any) {
|
|
4
|
+
const abortController = new AbortController();
|
|
5
|
+
|
|
6
|
+
return openmrsFetch(`/ws/rest/v1/approveorder`, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
},
|
|
11
|
+
signal: abortController.signal,
|
|
12
|
+
body: body,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
File without changes
|