@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.
Files changed (157) hide show
  1. package/.editorconfig +12 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc +32 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.husky/pre-push +6 -0
  6. package/.prettierignore +14 -0
  7. package/.turbo/turbo-build.log +30 -0
  8. package/.turbo/turbo-lint.log +12 -0
  9. package/.turbo/turbo-typescript.log +0 -0
  10. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
  11. package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
  12. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
  13. package/.yarn/versions/3d4697b8.yml +0 -0
  14. package/README.md +39 -0
  15. package/__mocks__/react-i18next.js +50 -0
  16. package/assets/logo/logo.png +0 -0
  17. package/assets/logo/moh_logo_without_word.png +0 -0
  18. package/assets/screenshots/labs_enter_results.png +0 -0
  19. package/assets/screenshots/labs_general_dashboard.png +0 -0
  20. package/dist/142.js +1 -0
  21. package/dist/142.js.map +1 -0
  22. package/dist/319.js +1 -0
  23. package/dist/36.js +1 -0
  24. package/dist/36.js.map +1 -0
  25. package/dist/395.js +1 -0
  26. package/dist/395.js.map +1 -0
  27. package/dist/453.js +1 -0
  28. package/dist/453.js.map +1 -0
  29. package/dist/533.js +1 -0
  30. package/dist/533.js.map +1 -0
  31. package/dist/56.js +2 -0
  32. package/dist/56.js.LICENSE.txt +32 -0
  33. package/dist/56.js.map +1 -0
  34. package/dist/572.js +1 -0
  35. package/dist/572.js.map +1 -0
  36. package/dist/574.js +1 -0
  37. package/dist/581.js +1 -0
  38. package/dist/581.js.map +1 -0
  39. package/dist/66.js +1 -0
  40. package/dist/66.js.map +1 -0
  41. package/dist/757.js +1 -0
  42. package/dist/769.js +1 -0
  43. package/dist/769.js.map +1 -0
  44. package/dist/770.js +1 -0
  45. package/dist/770.js.map +1 -0
  46. package/dist/800.js +2 -0
  47. package/dist/800.js.LICENSE.txt +3 -0
  48. package/dist/800.js.map +1 -0
  49. package/dist/809.js +1 -0
  50. package/dist/809.js.map +1 -0
  51. package/dist/889.js +1 -0
  52. package/dist/889.js.map +1 -0
  53. package/dist/894.js +2 -0
  54. package/dist/894.js.LICENSE.txt +48 -0
  55. package/dist/894.js.map +1 -0
  56. package/dist/924.js +1 -0
  57. package/dist/924.js.map +1 -0
  58. package/dist/928.js +1 -0
  59. package/dist/928.js.map +1 -0
  60. package/dist/967b98e46b0984c4.png +0 -0
  61. package/dist/97.js +1 -0
  62. package/dist/97.js.map +1 -0
  63. package/dist/983.js +1 -0
  64. package/dist/983.js.map +1 -0
  65. package/dist/main.js +2 -0
  66. package/dist/main.js.LICENSE.txt +48 -0
  67. package/dist/main.js.map +1 -0
  68. package/dist/openmrs-esm-laboratory-app.js +1 -0
  69. package/dist/openmrs-esm-laboratory-app.js.buildmanifest.json +628 -0
  70. package/dist/openmrs-esm-laboratory-app.js.map +1 -0
  71. package/dist/routes.json +1 -0
  72. package/i18next-parser.config.js +89 -0
  73. package/jest.config.js +16 -0
  74. package/package.json +121 -0
  75. package/src/completed-list/completed-list.component.tsx +242 -0
  76. package/src/completed-list/completed-list.resource.ts +0 -0
  77. package/src/completed-list/completed-list.scss +232 -0
  78. package/src/components/create-dashboard-link.component.tsx +44 -0
  79. package/src/components/overlay/hook.ts +47 -0
  80. package/src/components/overlay/overlay.component.tsx +52 -0
  81. package/src/components/overlay/overlay.scss +93 -0
  82. package/src/config-schema.ts +36 -0
  83. package/src/constants.ts +5 -0
  84. package/src/declarations.d.ts +6 -0
  85. package/src/header/laboratory-header.component.tsx +35 -0
  86. package/src/header/laboratory-header.scss +68 -0
  87. package/src/header/laboratory-illustration.component.tsx +13 -0
  88. package/src/index.ts +92 -0
  89. package/src/laboratory.component.tsx +18 -0
  90. package/src/patient-chart/laboratory-item/view-laboratory-item.component.tsx +39 -0
  91. package/src/patient-chart/laboratory-item/view-laboratory-item.resource.ts +290 -0
  92. package/src/patient-chart/laboratory-item/view-laboratory-item.scss +0 -0
  93. package/src/patient-chart/laboratory-order.component.tsx +453 -0
  94. package/src/patient-chart/laboratory-order.resource.ts +437 -0
  95. package/src/patient-chart/laboratory-order.scss +66 -0
  96. package/src/patient-chart/results-summary/print-results-summary.component.tsx +240 -0
  97. package/src/patient-chart/results-summary/print-results-summary.scss +105 -0
  98. package/src/patient-chart/results-summary/print-results-table.component.tsx +163 -0
  99. package/src/patient-chart/results-summary/results/results.component.tsx +25 -0
  100. package/src/patient-chart/results-summary/results/results.resource.ts +50 -0
  101. package/src/patient-chart/results-summary/results/results.scss +0 -0
  102. package/src/patient-chart/results-summary/results-dialog/edit-results-dialog.component.tsx +46 -0
  103. package/src/patient-chart/results-summary/results-summary.component.tsx +98 -0
  104. package/src/patient-chart/results-summary/results-summary.resource.tsx +185 -0
  105. package/src/patient-chart/results-summary/results-summary.scss +154 -0
  106. package/src/patient-chart/results-summary/send-email-dialog.component.tsx +111 -0
  107. package/src/patient-chart/results-summary/test-children-results.component.tsx +221 -0
  108. package/src/patient-chart/results-summary/test-print-results-table.component.tsx +148 -0
  109. package/src/patient-chart/results-summary/test-results-delete-action-menu.component.tsx +27 -0
  110. package/src/patient-chart/results-summary/test-results-rescend-action-menu.component.tsx +26 -0
  111. package/src/patient-chart/results-summary/test-results-table.component.tsx +153 -0
  112. package/src/patient-chart/results-summary/tests-children-detail.component.tsx +54 -0
  113. package/src/patient-chart/results-summary/views/email.handlebars +13 -0
  114. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +323 -0
  115. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +155 -0
  116. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.scss +20 -0
  117. package/src/queue-list/lab-tests/lab-tests.component.tsx +116 -0
  118. package/src/queue-list/lab-tests/lab-tests.resource.ts +17 -0
  119. package/src/queue-list/lab-tests/lab-tests.scss +12 -0
  120. package/src/queue-list/laboratory-patient-list.component.tsx +277 -0
  121. package/src/queue-list/laboratory-patient-list.resource.ts +86 -0
  122. package/src/queue-list/laboratory-queue.component.tsx +120 -0
  123. package/src/queue-list/laboratory-queue.scss +213 -0
  124. package/src/queue-list/laboratory-tabs.component.tsx +81 -0
  125. package/src/queue-list/pick-lab-request-menu.component.tsx +38 -0
  126. package/src/reject-order/reject-order-dialog.component.tsx +114 -0
  127. package/src/reject-order/reject-order-dialog.resource.ts +14 -0
  128. package/src/reject-order/reject-order-dialog.scss +14 -0
  129. package/src/results/result-form.component.tsx +223 -0
  130. package/src/results/result-form.resource.ts +328 -0
  131. package/src/results/result-form.scss +19 -0
  132. package/src/review-list/dialog/review-item.component.tsx +283 -0
  133. package/src/review-list/dialog/review-item.resource.ts +14 -0
  134. package/src/review-list/dialog/review-item.scss +0 -0
  135. package/src/review-list/review-list.component.tsx +277 -0
  136. package/src/review-list/review-list.resource.ts +0 -0
  137. package/src/review-list/review-list.scss +189 -0
  138. package/src/root.component.tsx +15 -0
  139. package/src/root.scss +50 -0
  140. package/src/routes.json +72 -0
  141. package/src/setup-tests.ts +1 -0
  142. package/src/summary-tiles/laboratory-summary-tiles.component.tsx +53 -0
  143. package/src/summary-tiles/laboratory-summary-tiles.scss +12 -0
  144. package/src/summary-tiles/laboratory-summary.resource.tsx +50 -0
  145. package/src/summary-tiles/summary-tile.component.tsx +48 -0
  146. package/src/summary-tiles/summary-tile.scss +43 -0
  147. package/src/types/index.ts +412 -0
  148. package/src/types/patient-queues.ts +189 -0
  149. package/src/utils/functions.ts +246 -0
  150. package/src/work-list/work-list.component.tsx +310 -0
  151. package/src/work-list/work-list.resource.ts +136 -0
  152. package/src/work-list/work-list.scss +215 -0
  153. package/translations/en.json +16 -0
  154. package/translations/es.json +3 -0
  155. package/translations/fr.json +3 -0
  156. package/tsconfig.json +23 -0
  157. package/webpack.config.js +29 -0
@@ -0,0 +1,240 @@
1
+ import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import styles from "./print-results-summary.scss";
3
+ import TestsPrintResults from "./test-print-results-table.component";
4
+ import { EncounterResponse } from "../laboratory-item/view-laboratory-item.resource";
5
+ import {
6
+ formatDate,
7
+ interpolateUrl,
8
+ parseDate,
9
+ useConfig,
10
+ } from "@openmrs/esm-framework";
11
+ import {
12
+ DataTable,
13
+ DataTableSkeleton,
14
+ Table,
15
+ TableBody,
16
+ TableCell,
17
+ TableContainer,
18
+ TableHead,
19
+ TableHeader,
20
+ TableRow,
21
+ Tile,
22
+ TableExpandHeader,
23
+ TableExpandRow,
24
+ TableExpandedRow,
25
+ } from "@carbon/react";
26
+ import logoImg from "../../../assets/logo/moh_logo_without_word.png";
27
+ import {
28
+ Identifier,
29
+ IdentifierType,
30
+ PatientResource,
31
+ useGetPatientByUuid,
32
+ } from "../../utils/functions";
33
+ import { useTranslation } from "react-i18next";
34
+ import TestResultsChildren from "./test-children-results.component";
35
+ import PrintResultsTable from "./print-results-table.component";
36
+ import { GetPatientByUuid } from "./results-summary.resource";
37
+
38
+ interface PrintResultsSummaryProps {
39
+ encounterResponse: EncounterResponse;
40
+ patient: PatientResource;
41
+ }
42
+
43
+ const PrintResultsSummary: React.FC<PrintResultsSummaryProps> = ({
44
+ encounterResponse,
45
+ patient,
46
+ }) => {
47
+ const { t } = useTranslation();
48
+
49
+ const filteredItems = encounterResponse.obs.filter(
50
+ (ob) => ob?.order?.type === "testorder"
51
+ );
52
+
53
+ const results = useMemo(() => {
54
+ let groupedResults = [];
55
+
56
+ filteredItems.forEach((element) => {
57
+ groupedResults[element.order.display] = element;
58
+ });
59
+ return groupedResults;
60
+ }, [filteredItems]);
61
+ return (
62
+ <div className={styles.printPage}>
63
+ <div
64
+ style={{
65
+ display: "flex",
66
+ justifyContent: "space-around",
67
+ flexDirection: "row",
68
+ alignItems: "center",
69
+ margin: " 10px",
70
+ }}
71
+ >
72
+ <div style={{ display: "flex", flexDirection: "column" }}>
73
+ <div
74
+ style={{
75
+ display: "flex",
76
+ flexDirection: "row",
77
+ justifyContent: "space-between",
78
+ }}
79
+ >
80
+ <div
81
+ style={{
82
+ display: "flex",
83
+ flexDirection: "column",
84
+ justifyContent: "center",
85
+ alignItems: "center",
86
+ }}
87
+ >
88
+ <img src={logoImg} alt={"logo"} width={50} height={50} />
89
+ <span
90
+ style={{ fontSize: "10px", fontWeight: "bold", margin: "5px" }}
91
+ >
92
+ {encounterResponse.visit.location.display}
93
+ </span>
94
+ </div>
95
+ <div
96
+ style={{
97
+ display: "flex",
98
+ flexDirection: "column",
99
+ justifyContent: "center",
100
+ alignItems: "center",
101
+ }}
102
+ >
103
+ <span
104
+ style={{ fontSize: "10px", fontWeight: "bold", margin: "2px" }}
105
+ >
106
+ Code :
107
+ </span>
108
+ <span
109
+ style={{ fontSize: "10px", fontWeight: "bold", margin: "2px" }}
110
+ >
111
+ District :
112
+ </span>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <div style={{ display: "flex", flexDirection: "column" }}>
118
+ <span style={{ margin: "5px", fontSize: "10px" }}>
119
+ <span style={{ fontSize: "10px", fontWeight: "bold" }}>
120
+ {patient?.person?.display}
121
+ </span>
122
+ ,
123
+ {patient?.person?.gender === "M"
124
+ ? " Male"
125
+ : patient?.person?.gender === "F"
126
+ ? " Female"
127
+ : " Unknown"}
128
+ ,
129
+ <span>
130
+ {" "}
131
+ {formatDate(parseDate(patient?.person?.birthdate), {
132
+ mode: "standard",
133
+ time: false,
134
+ })}{" "}
135
+ </span>
136
+ </span>
137
+ <span style={{ margin: "5px", fontSize: "10px" }}>
138
+ HIV Clinic No. :
139
+ {patient?.identifiers.length
140
+ ? patient?.identifiers.find((identifier: Identifier) => {
141
+ return (
142
+ identifier.identifierType.uuid ===
143
+ "e1731641-30ab-102d-86b0-7a5022ba4115"
144
+ );
145
+ })?.identifier
146
+ : "--"}
147
+ </span>
148
+ <span style={{ margin: "5px", fontSize: "10px" }}>
149
+ Patient Unique Code (UIC). :
150
+ {patient?.identifiers.length > 0
151
+ ? patient?.identifiers.find((identifier: Identifier) => {
152
+ return (
153
+ identifier.identifierType.uuid ===
154
+ "877169c4-92c6-4cc9-bf45-1ab95faea242"
155
+ );
156
+ })?.identifier
157
+ : "--"}
158
+ </span>
159
+ </div>
160
+
161
+ <div style={{ display: "flex", flexDirection: "column" }}>
162
+ <span style={{ margin: "5px", fontSize: "10px" }}>
163
+ Prepared By : {encounterResponse?.auditInfo?.creator?.display}
164
+ </span>
165
+ <span style={{ margin: "5px", fontSize: "10px" }}>
166
+ Date Requested :
167
+ {formatDate(parseDate(encounterResponse.encounterDatetime), {
168
+ time: false,
169
+ })}
170
+ </span>
171
+ </div>
172
+ </div>
173
+
174
+ <section className={styles.section}>
175
+ <div
176
+ style={{
177
+ display: "flex",
178
+ justifyContent: "space-between",
179
+ }}
180
+ ></div>
181
+ </section>
182
+ {/* <section className={styles.section}>
183
+ <div
184
+ style={{
185
+ display: "flex",
186
+ justifyContent: "center",
187
+ alignItems: "center",
188
+ margin: "10px",
189
+ }}
190
+ >
191
+ <div>
192
+ <span style={{ fontSize: "16px", fontWeight: "bold" }}>
193
+ Test Results
194
+ </span>
195
+ </div>
196
+ </div>
197
+ </section> */}
198
+ <section className={styles.section}>
199
+ {Object.keys(results).length > 0 && (
200
+ <PrintResultsTable groupedResults={results} />
201
+ )}
202
+ </section>
203
+
204
+ <section className={styles.section}>
205
+ <div
206
+ style={{
207
+ margin: "10px",
208
+ display: "flex",
209
+ width: "500px",
210
+ flexDirection: "row",
211
+ }}
212
+ >
213
+ <span style={{ fontSize: "14px", marginBottom: "10px" }}>
214
+ Results Reviewed / Authorized by :
215
+ <span style={{ marginLeft: "50px" }}>
216
+ {encounterResponse?.auditInfo?.creator?.display}
217
+ </span>
218
+ </span>
219
+ </div>
220
+ <div
221
+ style={{
222
+ margin: "10px",
223
+ display: "flex",
224
+ width: "500px",
225
+ flexDirection: "row",
226
+ }}
227
+ >
228
+ <span style={{ fontSize: "14px", marginTop: "10px" }}>
229
+ Sign : .............................................{" "}
230
+ <span style={{ fontSize: "14px", marginLeft: "50px" }}>
231
+ Date : ............................
232
+ </span>
233
+ </span>
234
+ </div>
235
+ </section>
236
+ </div>
237
+ );
238
+ };
239
+
240
+ export default PrintResultsSummary;
@@ -0,0 +1,105 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/styles/scss/type';
3
+ @import "~@openmrs/esm-styleguide/src/vars";
4
+ @import '../../root.scss';
5
+
6
+ @media screen {
7
+ .printPage {
8
+ background-color: white;
9
+ display: none;
10
+ }
11
+ }
12
+
13
+ @media print {
14
+ @page {
15
+ size: auto;
16
+ margin: 5px;
17
+ }
18
+
19
+ .section {
20
+ margin: 5px;
21
+ }
22
+
23
+ .headerBtnContainer {
24
+ background-color: $ui-background;
25
+ padding: spacing.$spacing-05;
26
+ text-align: right;
27
+ }
28
+
29
+ .tileContainer {
30
+ background-color: $ui-02;
31
+ border-top: 1px solid $ui-03;
32
+ padding: 5rem 0;
33
+ }
34
+
35
+ .tile {
36
+ margin: auto;
37
+ width: fit-content;
38
+ }
39
+
40
+ .tileContent {
41
+ display: flex;
42
+ flex-direction: column;
43
+ align-items: center;
44
+ }
45
+
46
+ .content {
47
+ @include type.type-style('heading-compact-02');
48
+ color: $text-02;
49
+ margin-bottom: 0.5rem;
50
+ }
51
+
52
+ .helper {
53
+ @include type.type-style('body-compact-01');
54
+ color: $text-02;
55
+ }
56
+
57
+ .separator {
58
+ @include type.type-style('body-compact-02');
59
+ color: $text-02;
60
+ width: 80%;
61
+ margin: 1.5rem auto;
62
+ overflow: hidden;
63
+ text-align: center;
64
+
65
+ &::before,
66
+ &::after {
67
+ background-color: $text-03;
68
+ content: '';
69
+ display: inline-block;
70
+ height: 1px;
71
+ position: relative;
72
+ vertical-align: middle;
73
+ width: 50%;
74
+ }
75
+
76
+ &::before {
77
+ right: 0.5rem;
78
+ margin-left: -50%;
79
+ }
80
+
81
+ &::after {
82
+ left: 0.5rem;
83
+ margin-right: -50%;
84
+ }
85
+ }
86
+
87
+ table {
88
+ font-family: Arial, sans-serif;
89
+ border-collapse: collapse;
90
+ width: 100%;
91
+ }
92
+
93
+ td, th {
94
+ border: 1px solid #000;
95
+ text-align: left;
96
+ font-size: 8px;
97
+ padding: 8px;
98
+ width: 80px;
99
+ }
100
+
101
+ th {
102
+ background-color: #f2f2f2;
103
+ }
104
+
105
+ }
@@ -0,0 +1,163 @@
1
+ import React from "react";
2
+ import styles from "./print-results-summary.scss";
3
+ import { GroupMember } from "../laboratory-order.resource";
4
+ import { useGetConceptById } from "./results-summary.resource";
5
+ import {
6
+ Button,
7
+ Form,
8
+ ModalBody,
9
+ ModalFooter,
10
+ ModalHeader,
11
+ InlineLoading,
12
+ Checkbox,
13
+ } from "@carbon/react";
14
+
15
+ interface PrintResultsTableProps {
16
+ groupedResults: any[];
17
+ }
18
+
19
+ interface ResultsRowProps {
20
+ groupMembers: GroupMember[];
21
+ }
22
+
23
+ interface ValueUnitsProps {
24
+ conceptUuid: string;
25
+ }
26
+
27
+ const PrintResultsTable: React.FC<PrintResultsTableProps> = ({
28
+ groupedResults,
29
+ }) => {
30
+ const RowTest: React.FC<ResultsRowProps> = ({ groupMembers }) => {
31
+ // get Units
32
+ const ValueUnits: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
33
+ const {
34
+ concept: concept,
35
+ isLoading,
36
+ isError,
37
+ } = useGetConceptById(conceptUuid);
38
+ if (isLoading) {
39
+ return <InlineLoading status="active" />;
40
+ }
41
+ if (isError) {
42
+ return <span>Error</span>;
43
+ }
44
+ return <span style={{ marginLeft: "10px" }}>{concept?.units}</span>;
45
+ };
46
+
47
+ // get Reference Range
48
+ const ReferenceRange: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
49
+ const {
50
+ concept: concept,
51
+ isLoading,
52
+ isError,
53
+ } = useGetConceptById(conceptUuid);
54
+ if (isLoading) {
55
+ return <InlineLoading status="active" />;
56
+ }
57
+ if (isError) {
58
+ return <span>Error</span>;
59
+ }
60
+ return (
61
+ <>
62
+ {concept?.hiNormal === undefined ||
63
+ concept?.lowNormal === undefined ? (
64
+ "N/A"
65
+ ) : (
66
+ <div>
67
+ <span>{concept?.lowNormal ? concept?.lowNormal : "--"}</span> :{" "}
68
+ <span>{concept?.hiNormal ? concept?.hiNormal : "--"}</span>
69
+ </div>
70
+ )}
71
+ </>
72
+ );
73
+ };
74
+ return (
75
+ <>
76
+ {groupMembers?.map((element, index) => {
77
+ return (
78
+ <tr key={index}>
79
+ {typeof element.value === "number" ? (
80
+ <>
81
+ <td>{element?.concept.display}</td>
82
+
83
+ <td>{element?.value}</td>
84
+
85
+ <td>
86
+ {
87
+ <ReferenceRange
88
+ conceptUuid={groupMembers[index].concept.uuid}
89
+ />
90
+ }
91
+ </td>
92
+
93
+ <td>
94
+ {
95
+ <ValueUnits
96
+ conceptUuid={groupMembers[index].concept.uuid}
97
+ />
98
+ }
99
+ </td>
100
+ </>
101
+ ) : typeof element.value === "object" ? (
102
+ <>
103
+ <td>{element?.concept.display}</td>
104
+
105
+ <td>{element?.value.display}</td>
106
+ <td>
107
+ {
108
+ <ReferenceRange
109
+ conceptUuid={groupMembers[index].concept.uuid}
110
+ />
111
+ }
112
+ </td>
113
+
114
+ <td>
115
+ {
116
+ <ValueUnits
117
+ conceptUuid={groupMembers[index].concept.uuid}
118
+ />
119
+ }
120
+ </td>
121
+ </>
122
+ ) : (
123
+ <td>{element?.display}</td>
124
+ )}
125
+ </tr>
126
+ );
127
+ })}
128
+ </>
129
+ );
130
+ };
131
+ return (
132
+ <section className={styles.section}>
133
+ <table>
134
+ <thead>
135
+ <tr>
136
+ <th>Tests</th>
137
+ <th>Result</th>
138
+ <th>Reference Range</th>
139
+ <th>Units</th>
140
+ </tr>
141
+ </thead>
142
+ </table>
143
+ <table>
144
+ <tbody>
145
+ {Object.keys(groupedResults).map((test) => (
146
+ <tr key={test} style={{ margin: "10px" }}>
147
+ <span
148
+ style={{ margin: "10px", fontSize: "8px", fontWeight: "bold" }}
149
+ >
150
+ {test}
151
+ </span>
152
+ <table style={{ margin: "10px" }}>
153
+ <RowTest groupMembers={groupedResults[test].groupMembers} />
154
+ </table>
155
+ </tr>
156
+ ))}
157
+ </tbody>
158
+ </table>
159
+ </section>
160
+ );
161
+ };
162
+
163
+ export default PrintResultsTable;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { useGetLabEncounterTests } from "./results.resource";
3
+ import { DataTableSkeleton } from "@carbon/react";
4
+ import { ErrorState } from "@openmrs/esm-framework";
5
+
6
+ interface ResultsProps {
7
+ encounterUuid: string;
8
+ }
9
+
10
+ const Results: React.FC<ResultsProps> = ({ encounterUuid }) => {
11
+ const { labResults, isLoading, isError } =
12
+ useGetLabEncounterTests(encounterUuid);
13
+
14
+ if (isLoading) {
15
+ return <DataTableSkeleton role="progressbar" />;
16
+ }
17
+
18
+ if (isError) {
19
+ return <ErrorState error={isError} headerTitle={"Results Error"} />;
20
+ }
21
+
22
+ return <span>{JSON.stringify(labResults)}</span>;
23
+ };
24
+
25
+ export default Results;
@@ -0,0 +1,50 @@
1
+ import { FetchResponse, openmrsFetch, useConfig } from "@openmrs/esm-framework";
2
+ import useSWR from "swr";
3
+
4
+ export interface LabTestResultResponse {
5
+ results: Result[];
6
+ }
7
+
8
+ export interface Result {
9
+ order: string;
10
+ result: Result2[];
11
+ links: Link[];
12
+ }
13
+
14
+ export interface Result2 {
15
+ investigation: string;
16
+ set: string;
17
+ test: string;
18
+ value: string;
19
+ hiNormal: any;
20
+ lowNormal: any;
21
+ lowAbsolute: any;
22
+ hiCritical: any;
23
+ lowCritical: any;
24
+ unit: any;
25
+ level: string;
26
+ concept: string;
27
+ encounterId: any;
28
+ testId: any;
29
+ hiAbsolute: any;
30
+ }
31
+
32
+ export interface Link {
33
+ rel: string;
34
+ uri: string;
35
+ resourceAlias: string;
36
+ }
37
+
38
+ export function useGetLabEncounterTests(encounterUuid: string) {
39
+ const apiUrl = `/ws/rest/v1/encountertestresults?encounterUuid=${encounterUuid}`;
40
+
41
+ const { data, error, isLoading } = useSWR<
42
+ { data: LabTestResultResponse },
43
+ Error
44
+ >(apiUrl, openmrsFetch, { refreshInterval: 3000 });
45
+ return {
46
+ labResults: data?.data ? data?.data.results : [],
47
+ isLoading,
48
+ isError: error,
49
+ };
50
+ }
@@ -0,0 +1,46 @@
1
+ import {
2
+ Button,
3
+ Form,
4
+ ModalBody,
5
+ ModalFooter,
6
+ ModalHeader,
7
+ } from "@carbon/react";
8
+ import React from "react";
9
+ import { useTranslation } from "react-i18next";
10
+ import { EncounterResponse } from "../../laboratory-item/view-laboratory-item.resource";
11
+
12
+ interface EditResultsDialogProps {
13
+ encounterResponse: EncounterResponse;
14
+ closeModal: () => void;
15
+ }
16
+
17
+ const EditResultsDialog: React.FC<EditResultsDialogProps> = ({
18
+ encounterResponse,
19
+ closeModal,
20
+ }) => {
21
+ const { t } = useTranslation();
22
+
23
+ return (
24
+ <>
25
+ <Form>
26
+ <ModalHeader
27
+ closeModal={closeModal}
28
+ title={t("editOrder", "Edit Order")}
29
+ />
30
+ <ModalBody>
31
+ <>
32
+ <span>{encounterResponse?.display}</span>
33
+ </>
34
+ </ModalBody>
35
+ <ModalFooter>
36
+ <Button kind="secondary" onClick={closeModal}>
37
+ {t("cancel", "Cancel")}
38
+ </Button>
39
+ <Button type="submit">{t("editOrder", "Submit")}</Button>
40
+ </ModalFooter>
41
+ </Form>
42
+ </>
43
+ );
44
+ };
45
+
46
+ export default EditResultsDialog;