@thrustdevs/esm-procedure-orders-app 1.0.2-pre.6

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.
Files changed (207) hide show
  1. package/.turbo/turbo-build.log +41 -0
  2. package/README.md +7 -0
  3. package/dist/122.js +1 -0
  4. package/dist/122.js.map +1 -0
  5. package/dist/144.js +2 -0
  6. package/dist/144.js.LICENSE.txt +19 -0
  7. package/dist/144.js.map +1 -0
  8. package/dist/182.js +1 -0
  9. package/dist/182.js.map +1 -0
  10. package/dist/205.js +1 -0
  11. package/dist/205.js.map +1 -0
  12. package/dist/216.js +2 -0
  13. package/dist/216.js.LICENSE.txt +9 -0
  14. package/dist/216.js.map +1 -0
  15. package/dist/290.js +2 -0
  16. package/dist/290.js.LICENSE.txt +5 -0
  17. package/dist/290.js.map +1 -0
  18. package/dist/300.js +1 -0
  19. package/dist/341.js +2 -0
  20. package/dist/341.js.LICENSE.txt +29 -0
  21. package/dist/341.js.map +1 -0
  22. package/dist/41.js +2 -0
  23. package/dist/41.js.LICENSE.txt +9 -0
  24. package/dist/41.js.map +1 -0
  25. package/dist/470.js +1 -0
  26. package/dist/470.js.map +1 -0
  27. package/dist/495.js +1 -0
  28. package/dist/495.js.map +1 -0
  29. package/dist/506.js +2 -0
  30. package/dist/506.js.LICENSE.txt +39 -0
  31. package/dist/506.js.map +1 -0
  32. package/dist/537.js +1 -0
  33. package/dist/537.js.map +1 -0
  34. package/dist/647.js +2 -0
  35. package/dist/647.js.LICENSE.txt +5 -0
  36. package/dist/647.js.map +1 -0
  37. package/dist/7.js +1 -0
  38. package/dist/7.js.map +1 -0
  39. package/dist/719.js +2 -0
  40. package/dist/719.js.LICENSE.txt +5 -0
  41. package/dist/719.js.map +1 -0
  42. package/dist/720.js +1 -0
  43. package/dist/720.js.map +1 -0
  44. package/dist/876.js +1 -0
  45. package/dist/876.js.map +1 -0
  46. package/dist/883.js +1 -0
  47. package/dist/883.js.map +1 -0
  48. package/dist/89.js +1 -0
  49. package/dist/89.js.map +1 -0
  50. package/dist/892.js +1 -0
  51. package/dist/892.js.map +1 -0
  52. package/dist/895.js +1 -0
  53. package/dist/895.js.map +1 -0
  54. package/dist/913.js +2 -0
  55. package/dist/913.js.LICENSE.txt +32 -0
  56. package/dist/913.js.map +1 -0
  57. package/dist/924.js +1 -0
  58. package/dist/924.js.map +1 -0
  59. package/dist/943.js +1 -0
  60. package/dist/943.js.map +1 -0
  61. package/dist/99.js +2 -0
  62. package/dist/99.js.LICENSE.txt +5 -0
  63. package/dist/99.js.map +1 -0
  64. package/dist/kenyaemr-esm-procedure-orders-app.js +1 -0
  65. package/dist/kenyaemr-esm-procedure-orders-app.js.buildmanifest.json +786 -0
  66. package/dist/kenyaemr-esm-procedure-orders-app.js.map +1 -0
  67. package/dist/main.js +2 -0
  68. package/dist/main.js.LICENSE.txt +35 -0
  69. package/dist/main.js.map +1 -0
  70. package/dist/routes.json +1 -0
  71. package/jest.config.js +8 -0
  72. package/package.json +55 -0
  73. package/src/completed-list/completed-list.component.tsx +40 -0
  74. package/src/completed-list/completed-list.resource.ts +0 -0
  75. package/src/completed-list/completed-list.scss +223 -0
  76. package/src/components/create-dashboard-link.component.tsx +35 -0
  77. package/src/components/overlay/hook.ts +47 -0
  78. package/src/components/overlay/overlay.component.tsx +42 -0
  79. package/src/components/overlay/overlay.scss +92 -0
  80. package/src/config-schema.ts +78 -0
  81. package/src/constants.ts +5 -0
  82. package/src/declarations.d.ts +6 -0
  83. package/src/empty-state/empty-state-component.tsx +21 -0
  84. package/src/empty-state/empty-state.scss +23 -0
  85. package/src/form/post-procedures/post-procedure-form.component.tsx +468 -0
  86. package/src/form/post-procedures/post-procedure-form.scss +189 -0
  87. package/src/form/post-procedures/post-procedure.resource.tsx +71 -0
  88. package/src/form/procedures-orders/add-procedures-order/add-procedures-order.scss +44 -0
  89. package/src/form/procedures-orders/add-procedures-order/add-procedures-order.workspace.tsx +93 -0
  90. package/src/form/procedures-orders/add-procedures-order/procedures-order-form.component.tsx +476 -0
  91. package/src/form/procedures-orders/add-procedures-order/procedures-order-form.scss +80 -0
  92. package/src/form/procedures-orders/add-procedures-order/procedures-order.ts +17 -0
  93. package/src/form/procedures-orders/add-procedures-order/procedures-type-search.scss +115 -0
  94. package/src/form/procedures-orders/add-procedures-order/procedures-type-search.tsx +236 -0
  95. package/src/form/procedures-orders/add-procedures-order/useProceduresTypes.ts +93 -0
  96. package/src/form/procedures-orders/api.ts +282 -0
  97. package/src/form/procedures-orders/order-config.ts +48 -0
  98. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-icon.component.tsx +39 -0
  99. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.component.tsx +100 -0
  100. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.scss +72 -0
  101. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.extension.tsx +190 -0
  102. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.scss +74 -0
  103. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket.scss +55 -0
  104. package/src/header/procedure-header.component.tsx +32 -0
  105. package/src/header/procedure-header.scss +70 -0
  106. package/src/header/procedure-illustration.component.tsx +52 -0
  107. package/src/hooks/useOrdersWorklist.ts +70 -0
  108. package/src/hooks/useSearchGroupedResults.ts +22 -0
  109. package/src/hooks/useSearchResults.ts +39 -0
  110. package/src/index.ts +59 -0
  111. package/src/left-panel-link.tsx +40 -0
  112. package/src/not-done-list/not-done-list.component.tsx +44 -0
  113. package/src/not-done-list/not-done.scss +207 -0
  114. package/src/patient-chart/patient-procedure-order-results-table.resource.ts +43 -0
  115. package/src/patient-chart/patient-procedure-order-results.component.tsx +12 -0
  116. package/src/patient-chart/patient-procedure-order-results.resource.ts +485 -0
  117. package/src/patient-chart/patient-procedure-results.component.tsx +30 -0
  118. package/src/patient-chart/procedure-active-order/procedure-active-order-results.component.tsx +390 -0
  119. package/src/patient-chart/procedure-active-order/procedure-active-order-results.scss +78 -0
  120. package/src/patient-chart/procedure-order-referals/procedure-order-referals.component.tsx +394 -0
  121. package/src/patient-chart/procedure-order-referals/procedure-order-referals.resource.tsx +0 -0
  122. package/src/patient-chart/procedure-order-referals/procedure-order-referals.scss +78 -0
  123. package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.component.tsx +366 -0
  124. package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.scss +74 -0
  125. package/src/patient-chart/procedure-tabs/laboratory-order-tabs.component.tsx +44 -0
  126. package/src/patient-chart/procedure-tabs/laboratory-order-tabs.scss +7 -0
  127. package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.component.tsx +11 -0
  128. package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.scss +0 -0
  129. package/src/patient-chart/results-summary/print-results-summary.component.tsx +152 -0
  130. package/src/patient-chart/results-summary/print-results-summary.scss +80 -0
  131. package/src/patient-chart/results-summary/print-results-table.component.tsx +134 -0
  132. package/src/patient-chart/results-summary/results-summary.resource.tsx +174 -0
  133. package/src/patient-chart/results-summary/results-summary.scss +158 -0
  134. package/src/patient-chart/results-summary/send-email-dialog.component.tsx +59 -0
  135. package/src/patient-chart/results-summary/test-children-results.component.tsx +177 -0
  136. package/src/patient-chart/results-summary/test-print-results-table.component.tsx +105 -0
  137. package/src/patient-chart/results-summary/test-results-table.component.tsx +103 -0
  138. package/src/print/print-procedure-results.component.tsx +49 -0
  139. package/src/print/print-procedure.component.tsx +105 -0
  140. package/src/print/print-procedure.scss +98 -0
  141. package/src/procedure-tabs/completed-tab.component.tsx +12 -0
  142. package/src/procedure-tabs/not-done-tab.component.tsx +12 -0
  143. package/src/procedure-tabs/referred-tab.component.tsx +12 -0
  144. package/src/procedure-tabs/work-list-tab.component.tsx +13 -0
  145. package/src/procedure.component.tsx +24 -0
  146. package/src/procedures-ordered/_pick-procedure-request-menu.component.tsx +33 -0
  147. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.component.tsx +105 -0
  148. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.resource.ts +106 -0
  149. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.scss +38 -0
  150. package/src/procedures-ordered/pick-procedure-request-menu.component.tsx +32 -0
  151. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.component.tsx +300 -0
  152. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.resource.ts +153 -0
  153. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.scss +38 -0
  154. package/src/procedures-ordered/procedure-instructions/instructions.scss +24 -0
  155. package/src/procedures-ordered/procedure-instructions/procedure-instructions-menu.component.tsx +32 -0
  156. package/src/procedures-ordered/procedure-instructions/procedure-instructions.component.tsx +78 -0
  157. package/src/procedures-ordered/procedure-instructions/procedure-instructions.scss +24 -0
  158. package/src/procedures-ordered/procedure-queue.scss +211 -0
  159. package/src/procedures-ordered/procedure-tabs.component.tsx +104 -0
  160. package/src/procedures-ordered/procedure-tests/procedure-tests.component.tsx +83 -0
  161. package/src/procedures-ordered/procedure-tests/procedure-tests.resource.ts +14 -0
  162. package/src/procedures-ordered/procedure-tests/procedure-tests.scss +12 -0
  163. package/src/procedures-ordered/procedures-ordered-list.component.tsx +38 -0
  164. package/src/procedures-ordered/reject-order-dialog/reject-order-dialog.scss +14 -0
  165. package/src/procedures-ordered/reject-order-dialog/reject-procedure-order-dialog.component.tsx +98 -0
  166. package/src/procedures-ordered/reject-reason/procedure-reject-reason-menu.component.tsx +32 -0
  167. package/src/procedures-ordered/reject-reason/procedure-reject-reason.component.tsx +40 -0
  168. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx +42 -0
  169. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss +14 -0
  170. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.test.tsx +67 -0
  171. package/src/referred-procedures/referred-procedures.component.tsx +37 -0
  172. package/src/results/result-form-field.component.tsx +141 -0
  173. package/src/results/result-form.component.tsx +120 -0
  174. package/src/results/result-form.resource.ts +361 -0
  175. package/src/results/result-form.scss +22 -0
  176. package/src/root.component.tsx +16 -0
  177. package/src/routes.json +152 -0
  178. package/src/setup-tests.ts +7 -0
  179. package/src/shared/ui/common/action-button/action-button.component.tsx +68 -0
  180. package/src/shared/ui/common/action-button/action-button.scss +12 -0
  181. package/src/shared/ui/common/action-button/order-action-extension.component.tsx +21 -0
  182. package/src/shared/ui/common/grouped-orders-table.component.tsx +176 -0
  183. package/src/shared/ui/common/grouped-orders-table.scss +30 -0
  184. package/src/shared/ui/common/grouped-procedure-types.ts +47 -0
  185. package/src/shared/ui/common/list-order-details.component.tsx +171 -0
  186. package/src/shared/ui/common/list-order-details.resource.ts +41 -0
  187. package/src/shared/ui/common/list-order-details.scss +118 -0
  188. package/src/shared/ui/common/orders-date-range-picker.scss +15 -0
  189. package/src/shared/ui/common/orders-date-range-picker.tsx +38 -0
  190. package/src/summary-tiles/procedure-summary-tiles.component.tsx +36 -0
  191. package/src/summary-tiles/procedure-summary-tiles.scss +11 -0
  192. package/src/summary-tiles/procedure-summary.resource.tsx +79 -0
  193. package/src/summary-tiles/summary-tile.component.tsx +41 -0
  194. package/src/summary-tiles/summary-tile.scss +53 -0
  195. package/src/types/index.ts +661 -0
  196. package/src/types/patient-queue.ts +77 -0
  197. package/src/ui-components/overflow-menu.component.tsx +74 -0
  198. package/src/ui-components/overflow-menu.scss +39 -0
  199. package/src/utils/functions.ts +236 -0
  200. package/src/utils/orders-table/orders-data-table.component.tsx +129 -0
  201. package/src/utils/orders-table/orders-data-table.scss +50 -0
  202. package/src/work-list/work-list.component.tsx +38 -0
  203. package/src/work-list/work-list.resource.ts +26 -0
  204. package/src/work-list/work-list.scss +207 -0
  205. package/translations/en.json +141 -0
  206. package/tsconfig.json +5 -0
  207. package/webpack.config.js +1 -0
@@ -0,0 +1,485 @@
1
+ import { formatDate, openmrsFetch, restBaseUrl, useConfig } from '@openmrs/esm-framework';
2
+ import useSWR from 'swr';
3
+
4
+ export interface LaboratoryResponse {
5
+ results: Result[];
6
+ }
7
+
8
+ export interface Result {
9
+ uuid: string;
10
+ display: string;
11
+ encounterDatetime: string;
12
+ patient: Patient;
13
+ location: Location;
14
+ form: Form;
15
+ encounterType: EncounterType;
16
+ obs: Ob[];
17
+ orders: Order[];
18
+ voided: boolean;
19
+ auditInfo: AuditInfo;
20
+ visit: Visit;
21
+ encounterProviders: EncounterProvider[];
22
+ diagnoses: any[];
23
+ links: Link[];
24
+ resourceVersion: string;
25
+ }
26
+
27
+ export interface Patient {
28
+ uuid: string;
29
+ display: string;
30
+ links: Link[];
31
+ }
32
+
33
+ export interface Link {
34
+ rel: string;
35
+ uri: string;
36
+ resourceAlias: string;
37
+ }
38
+
39
+ export interface Location {
40
+ uuid: string;
41
+ display: string;
42
+ name: string;
43
+ description: any;
44
+ address1: any;
45
+ address2: any;
46
+ cityVillage: any;
47
+ stateProvince: any;
48
+ country: string;
49
+ postalCode: any;
50
+ latitude: any;
51
+ longitude: any;
52
+ countyDistrict: any;
53
+ address3: any;
54
+ address4: any;
55
+ address5: any;
56
+ address6: any;
57
+ tags: Tag[];
58
+ parentLocation: ParentLocation;
59
+ childLocations: ChildLocation[];
60
+ retired: boolean;
61
+ attributes: any[];
62
+ address7: any;
63
+ address8: any;
64
+ address9: any;
65
+ address10: any;
66
+ address11: any;
67
+ address12: any;
68
+ address13: any;
69
+ address14: any;
70
+ address15: any;
71
+ links: Link[];
72
+ resourceVersion: string;
73
+ }
74
+
75
+ export interface Tag {
76
+ uuid: string;
77
+ display: string;
78
+ links: Link[];
79
+ }
80
+
81
+ export interface ParentLocation {
82
+ uuid: string;
83
+ display: string;
84
+ links: Link[];
85
+ }
86
+
87
+ export interface ChildLocation {
88
+ uuid: string;
89
+ display: string;
90
+ links: Link[];
91
+ }
92
+
93
+ export interface Form {
94
+ uuid: string;
95
+ display: string;
96
+ name: string;
97
+ description: string;
98
+ encounterType: EncounterType;
99
+ version: string;
100
+ build: any;
101
+ published: boolean;
102
+ formFields: any[];
103
+ retired: boolean;
104
+ resources: Resource[];
105
+ links: Link[];
106
+ resourceVersion: string;
107
+ }
108
+
109
+ export interface Resource {
110
+ uuid: string;
111
+ display: string;
112
+ links: Link[];
113
+ }
114
+
115
+ export interface EncounterType {
116
+ uuid: string;
117
+ display: string;
118
+ name: string;
119
+ description: string;
120
+ retired: boolean;
121
+ links: Link[];
122
+ resourceVersion: string;
123
+ }
124
+
125
+ export interface Ob {
126
+ uuid: string;
127
+ display: string;
128
+ concept: Concept;
129
+ person: Person;
130
+ obsDatetime: string;
131
+ accessionNumber: any;
132
+ obsGroup: any;
133
+ valueCodedName: any;
134
+ groupMembers: GroupMember[];
135
+ comment: any;
136
+ location: Location;
137
+ order: any;
138
+ encounter: Encounter;
139
+ voided: boolean;
140
+ value: any;
141
+ valueModifier: any;
142
+ formFieldPath: string;
143
+ formFieldNamespace: string;
144
+ links: Link[];
145
+ resourceVersion: string;
146
+ }
147
+
148
+ export interface GroupMember {
149
+ uuid: string;
150
+ display: string;
151
+ concept: Concept;
152
+ person: Person;
153
+ obsDatetime: string;
154
+ accessionNumber: any;
155
+ obsGroup: ObsGroup;
156
+ valueCodedName: any;
157
+ groupMembers: any;
158
+ comment: any;
159
+ location: Location;
160
+ order: Order;
161
+ encounter: Encounter;
162
+ voided: boolean;
163
+ value: number | Value;
164
+ valueModifier: any;
165
+ formFieldPath: any;
166
+ formFieldNamespace: any;
167
+ links: Link[];
168
+ resourceVersion: string;
169
+ }
170
+
171
+ export interface Value {
172
+ uuid: string;
173
+ display: string;
174
+ name: Name;
175
+ datatype: Datatype;
176
+ conceptClass: ConceptClass;
177
+ set: boolean;
178
+ version: any;
179
+ retired: boolean;
180
+ names: Name2[];
181
+ descriptions: Description[];
182
+ mappings: Mapping[];
183
+ answers: any[];
184
+ setMembers: any[];
185
+ attributes: any[];
186
+ links: Link[];
187
+ resourceVersion: string;
188
+ }
189
+
190
+ export interface Name {
191
+ display: string;
192
+ uuid: string;
193
+ name: string;
194
+ locale: string;
195
+ localePreferred: boolean;
196
+ conceptNameType: string;
197
+ links: Link[];
198
+ resourceVersion: string;
199
+ }
200
+
201
+ export interface Link {
202
+ rel: string;
203
+ uri: string;
204
+ resourceAlias: string;
205
+ }
206
+
207
+ export interface Datatype {
208
+ uuid: string;
209
+ display: string;
210
+ links: Link[];
211
+ }
212
+
213
+ export interface ConceptClass {
214
+ uuid: string;
215
+ display: string;
216
+ links: Link[];
217
+ }
218
+
219
+ export interface Name2 {
220
+ uuid: string;
221
+ display: string;
222
+ links: Link[];
223
+ }
224
+
225
+ export interface Description {
226
+ uuid: string;
227
+ display: string;
228
+ links: Link[];
229
+ }
230
+
231
+ export interface Mapping {
232
+ uuid: string;
233
+ display: string;
234
+ links: Link[];
235
+ }
236
+
237
+ export interface ObsGroup {
238
+ uuid: string;
239
+ display: string;
240
+ links: Link[];
241
+ }
242
+
243
+ export interface Concept {
244
+ uuid: string;
245
+ display: string;
246
+ links: Link[];
247
+ }
248
+
249
+ export interface Person {
250
+ uuid: string;
251
+ display: string;
252
+ links: Link[];
253
+ }
254
+
255
+ export interface Encounter {
256
+ uuid: string;
257
+ display: string;
258
+ links: Link[];
259
+ }
260
+
261
+ export interface AuditInfo {
262
+ creator: Creator;
263
+ dateCreated: string;
264
+ changedBy: any;
265
+ dateChanged: any;
266
+ }
267
+
268
+ export interface Creator {
269
+ uuid: string;
270
+ display: string;
271
+ links: Link[];
272
+ }
273
+
274
+ export interface Visit {
275
+ uuid: string;
276
+ display: string;
277
+ patient: Patient;
278
+ visitType: VisitType;
279
+ indication: any;
280
+ location: Location;
281
+ startDatetime: string;
282
+ stopDatetime: any;
283
+ encounters: Encounter[];
284
+ attributes: any[];
285
+ voided: boolean;
286
+ links: Link[];
287
+ resourceVersion: string;
288
+ }
289
+
290
+ export interface VisitType {
291
+ uuid: string;
292
+ display: string;
293
+ links: Link[];
294
+ }
295
+
296
+ export interface EncounterRole {
297
+ uuid: string;
298
+ display: string;
299
+ links: Link[];
300
+ }
301
+
302
+ export interface EncounterProvider {
303
+ uuid: string;
304
+ provider: Provider;
305
+ encounterRole: EncounterRole;
306
+ voided: boolean;
307
+ links: Link[];
308
+ resourceVersion: string;
309
+ }
310
+
311
+ export interface Provider {
312
+ uuid: string;
313
+ display: string;
314
+ links: Link[];
315
+ }
316
+
317
+ // order
318
+ export interface Order {
319
+ uuid: string;
320
+ orderNumber: string;
321
+ accessionNumber: any;
322
+ patient: Patient;
323
+ concept: Concept;
324
+ action: string;
325
+ careSetting: CareSetting;
326
+ previousOrder: any;
327
+ dateActivated: string;
328
+ scheduledDate: any;
329
+ dateStopped: string;
330
+ autoExpireDate: any;
331
+ encounter: Encounter;
332
+ orderer: Orderer;
333
+ orderReason: any;
334
+ orderReasonNonCoded: any;
335
+ orderType: OrderType;
336
+ urgency: string;
337
+ instructions: any;
338
+ commentToFulfiller: any;
339
+ display: string;
340
+ specimenSource: any;
341
+ laterality: any;
342
+ clinicalHistory: any;
343
+ frequency: any;
344
+ numberOfRepeats: any;
345
+ links: Link[];
346
+ type: string;
347
+ resourceVersion: string;
348
+ }
349
+
350
+ export interface Patient {
351
+ uuid: string;
352
+ display: string;
353
+ links: Link[];
354
+ }
355
+
356
+ export interface Link {
357
+ rel: string;
358
+ uri: string;
359
+ resourceAlias: string;
360
+ }
361
+
362
+ export interface Concept {
363
+ uuid: string;
364
+ display: string;
365
+ links: Link[];
366
+ }
367
+
368
+ export interface CareSetting {
369
+ uuid: string;
370
+ display: string;
371
+ links: Link[];
372
+ }
373
+
374
+ export interface Encounter {
375
+ uuid: string;
376
+ display: string;
377
+ links: Link[];
378
+ }
379
+
380
+ export interface Orderer {
381
+ uuid: string;
382
+ display: string;
383
+ links: Link[];
384
+ }
385
+
386
+ export interface OrderType {
387
+ uuid: string;
388
+ display: string;
389
+ name: string;
390
+ javaClassName: string;
391
+ retired: boolean;
392
+ description: string;
393
+ conceptClasses: any[];
394
+ parent: any;
395
+ links: Link[];
396
+ resourceVersion: string;
397
+ }
398
+
399
+ export const getOrderColor = (activated: string, stopped: string) => {
400
+ const numAct = formatWaitTime(activated);
401
+ let testStopped: number;
402
+ if (stopped === null) {
403
+ testStopped = 0;
404
+ }
405
+
406
+ if (numAct >= 0 && testStopped === 0) {
407
+ return '#6F6F6F'; // #6F6F6F
408
+ } else {
409
+ return 'green'; // green
410
+ }
411
+ };
412
+
413
+ export const formatWaitTime = (waitTime: string) => {
414
+ const num = parseInt(waitTime);
415
+ const hours = num / 60;
416
+ const rhours = Math.floor(hours);
417
+ const minutes = (hours - rhours) * 60;
418
+ const rminutes = Math.round(minutes);
419
+ return rminutes;
420
+ };
421
+
422
+ export enum ResourceRepresentation {
423
+ Default = 'default',
424
+ Full = 'full',
425
+ REF = 'ref',
426
+ }
427
+
428
+ export interface ResourceFilterCriteria {
429
+ v?: ResourceRepresentation | null;
430
+ q?: string | null;
431
+ totalCount?: boolean | null;
432
+ limit?: number | null;
433
+ }
434
+
435
+ export interface LaboratoryOrderFilter extends ResourceFilterCriteria {
436
+ patientUuid?: string | null | undefined;
437
+ laboratoryEncounterTypeUuid?: string | null;
438
+ }
439
+
440
+ export function toQueryParams<T extends ResourceFilterCriteria>(
441
+ filterCriteria?: T | null,
442
+ skipEmptyString = true,
443
+ ): string {
444
+ if (!filterCriteria) {
445
+ return '';
446
+ }
447
+ const queryParams: string = Object.keys(filterCriteria)
448
+ ?.map((key) => {
449
+ const value = filterCriteria[key];
450
+ return (skipEmptyString && (value === false || value === true ? true : value)) ||
451
+ (!skipEmptyString && (value === '' || (value === false || value === true ? true : value)))
452
+ ? `${encodeURIComponent(key)}=${encodeURIComponent(value.toString())}`
453
+ : null;
454
+ })
455
+ .filter((o) => o != null)
456
+ .join('&');
457
+ return queryParams.length > 0 ? '?' + queryParams : '';
458
+ }
459
+
460
+ export function usePatientLaboratoryOrders(filter: LaboratoryOrderFilter) {
461
+ const config = useConfig();
462
+ const { laboratoryEncounterTypeUuid } = config;
463
+
464
+ const apiUrl = `${restBaseUrl}/encounter?patient=${filter.patientUuid}&encounterType=${laboratoryEncounterTypeUuid}&v=${filter.v}&totalCount=true`;
465
+ const { data, error, isLoading } = useSWR<{ data: LaboratoryResponse }, Error>(apiUrl, openmrsFetch, {
466
+ refreshInterval: 3000,
467
+ });
468
+
469
+ return {
470
+ items: data?.data ? data?.data?.results : [],
471
+ isLoading,
472
+ isError: error,
473
+ };
474
+ }
475
+
476
+ export function useGetEncounterById(encounterUuid: string) {
477
+ const apiUrl = `${restBaseUrl}/encounter/${encounterUuid}?v=full`;
478
+ const { data, error, isLoading } = useSWR<{ data: Result }, Error>(apiUrl, openmrsFetch);
479
+
480
+ return {
481
+ encounter: data?.data,
482
+ isLoading,
483
+ isError: error,
484
+ };
485
+ }
@@ -0,0 +1,30 @@
1
+ import { EmptyState } from '@openmrs/esm-patient-common-lib';
2
+ import React, { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import LaboratoryActiveTestOrderResults from './procedure-active-order/procedure-active-order-results.component';
5
+ import LaboratoryPastTestOrderResults from './procedure-past-test/laboratory-past-test-order-results.component';
6
+
7
+ interface PatientLaboratoryResultsProps {
8
+ patientUuid: string;
9
+ }
10
+
11
+ const PatientLaboratoryResults: React.FC<PatientLaboratoryResultsProps> = ({ patientUuid }) => {
12
+ const { t } = useTranslation();
13
+
14
+ const [hasActiveOrderResults, setHasActiveOrderResults] = useState<boolean | null>(null);
15
+
16
+ return (
17
+ <>
18
+ <div style={{ margin: '10px' }}>
19
+ <div style={{ marginBottom: '1.5rem' }}>
20
+ <LaboratoryActiveTestOrderResults patientUuid={patientUuid} />
21
+ </div>
22
+ <div style={{ marginTop: '1.5rem' }}>
23
+ <LaboratoryPastTestOrderResults patientUuid={patientUuid} />
24
+ </div>
25
+ </div>
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default PatientLaboratoryResults;