@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,80 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/styles/scss/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as 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
+ table {
24
+ font-family: Arial, sans-serif;
25
+ border-collapse: collapse;
26
+ width: 100%;
27
+ }
28
+
29
+ td,
30
+ th {
31
+ border: 1px solid #000;
32
+ text-align: left;
33
+ font-size: 8px;
34
+ padding: 8px;
35
+ width: 80px;
36
+ }
37
+
38
+ th {
39
+ background-color: #f2f2f2;
40
+ }
41
+
42
+ .headingText {
43
+ font-size: '10px';
44
+ font-weight: 'bold';
45
+ margin: '5px';
46
+ }
47
+
48
+ .header {
49
+ display: 'flex';
50
+ justify-content: 'space-around';
51
+ flex-direction: 'row';
52
+ align-items: 'center';
53
+ margin: ' 10px';
54
+ }
55
+
56
+ .facilityContainer {
57
+ display: 'flex';
58
+ flex-direction: 'row';
59
+ justify-content: 'space-between';
60
+ }
61
+
62
+ .patientContainer {
63
+ display: 'flex';
64
+ flex-direction: 'column';
65
+ }
66
+
67
+ .headerSection {
68
+ display: 'flex';
69
+ flex-direction: 'column';
70
+ justify-content: 'center';
71
+ align-items: 'center';
72
+ }
73
+
74
+ .footerSection {
75
+ margin: '10px';
76
+ display: 'flex';
77
+ width: '500px';
78
+ flex-direction: 'row';
79
+ }
80
+ }
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import styles from './print-results-summary.scss';
3
+ import { type GroupMember } from '../patient-procedure-order-results.resource';
4
+ import { useGetConceptById } from './results-summary.resource';
5
+ import { InlineLoading } from '@carbon/react';
6
+
7
+ interface PrintResultsTableProps {
8
+ groupedResults: any[];
9
+ }
10
+
11
+ interface ResultsRowProps {
12
+ groupMembers: GroupMember[];
13
+ }
14
+
15
+ interface ValueUnitsProps {
16
+ conceptUuid: string;
17
+ }
18
+
19
+ const PrintResultsTable: React.FC<PrintResultsTableProps> = ({ groupedResults }) => {
20
+ const RowTest: React.FC<ResultsRowProps> = ({ groupMembers }) => {
21
+ // get Units
22
+ const ValueUnits: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
23
+ const { concept, isLoading, isError } = useGetConceptById(conceptUuid);
24
+
25
+ if (isLoading) {
26
+ return <InlineLoading status="active" />;
27
+ }
28
+ if (isError) {
29
+ return <span>Error</span>;
30
+ }
31
+
32
+ return <span style={{ marginLeft: '10px' }}>{concept?.units ?? 'N/A'}</span>;
33
+ };
34
+
35
+ // get Reference Range
36
+ const ReferenceRange: React.FC<ValueUnitsProps> = ({ conceptUuid }) => {
37
+ const { concept, isLoading, isError } = useGetConceptById(conceptUuid);
38
+
39
+ if (isLoading) {
40
+ return <InlineLoading status="active" />;
41
+ }
42
+ if (isError) {
43
+ return <span>Error</span>;
44
+ }
45
+
46
+ const lowNormal = concept?.lowNormal !== undefined ? concept.lowNormal : '--';
47
+ const hiNormal = concept?.hiNormal !== undefined ? concept.hiNormal : '--';
48
+
49
+ return (
50
+ <>
51
+ {concept?.hiNormal === undefined || concept?.lowNormal === undefined ? (
52
+ 'N/A'
53
+ ) : (
54
+ <div>
55
+ <span>{lowNormal}</span> : <span>{hiNormal}</span>
56
+ </div>
57
+ )}
58
+ </>
59
+ );
60
+ };
61
+
62
+ return (
63
+ <>
64
+ {groupMembers?.map((element, index) => (
65
+ <tr key={index}>
66
+ <td>{element?.concept.display}</td>
67
+ <td>{typeof element.value === 'object' ? element.value.display : element.value}</td>
68
+ <td>
69
+ <ReferenceRange conceptUuid={element.concept.uuid} />
70
+ </td>
71
+ <td>
72
+ <ValueUnits conceptUuid={element.concept.uuid} />
73
+ </td>
74
+ </tr>
75
+ ))}
76
+ </>
77
+ );
78
+ };
79
+ return (
80
+ <section className={styles.section}>
81
+ <table>
82
+ <thead>
83
+ <tr>
84
+ <th>Tests</th>
85
+ <th>Result</th>
86
+ <th>Reference Range</th>
87
+ <th>Units</th>
88
+ </tr>
89
+ </thead>
90
+ </table>
91
+ <table>
92
+ <tbody>
93
+ {Object.keys(groupedResults).map((test) => {
94
+ const { uuid, groupMembers } = groupedResults[test];
95
+ const isGrouped = uuid && groupMembers?.length > 0;
96
+ return (
97
+ <tr key={test} style={{ margin: '10px' }}>
98
+ <span
99
+ style={{
100
+ margin: '10px',
101
+ fontSize: '8px',
102
+ fontWeight: 'bold',
103
+ }}>
104
+ {test}
105
+ </span>
106
+ <table style={{ margin: '10px' }}>
107
+ {isGrouped && <RowTest groupMembers={groupMembers} />}
108
+ {!isGrouped && (
109
+ <tr>
110
+ <td>
111
+ <span>{groupedResults[test]?.order?.display}</span>
112
+ </td>
113
+ <td>
114
+ <span>{groupedResults[test]?.value?.display}</span>
115
+ </td>
116
+ <td>
117
+ <span>{'N/A'}</span>
118
+ </td>
119
+ <td>
120
+ <span>{'N/A'}</span>
121
+ </td>
122
+ </tr>
123
+ )}{' '}
124
+ </table>
125
+ </tr>
126
+ );
127
+ })}
128
+ </tbody>
129
+ </table>
130
+ </section>
131
+ );
132
+ };
133
+
134
+ export default PrintResultsTable;
@@ -0,0 +1,174 @@
1
+ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
+ import { type ObsMetaInfo } from '@openmrs/esm-patient-common-lib';
3
+
4
+ import useSWR from 'swr';
5
+
6
+ export type ObservationInterpretation = 'critically_low' | 'critically_high' | 'high' | 'low' | 'normal';
7
+
8
+ export interface ConceptResponse {
9
+ uuid: string;
10
+ display: string;
11
+ name: Name;
12
+ datatype: Datatype;
13
+ conceptClass: ConceptClass;
14
+ set: boolean;
15
+ version: any;
16
+ retired: boolean;
17
+ names: Name2[];
18
+ descriptions: Description[];
19
+ mappings: Mapping[];
20
+ answers: any[];
21
+ setMembers: any[];
22
+ auditInfo: AuditInfo;
23
+ hiNormal: number;
24
+ hiAbsolute: number;
25
+ hiCritical: number;
26
+ lowNormal: number;
27
+ lowAbsolute: number;
28
+ lowCritical: number;
29
+ units: string;
30
+ allowDecimal: boolean;
31
+ displayPrecision: any;
32
+ attributes: any[];
33
+ links: Link[];
34
+ resourceVersion: string;
35
+ }
36
+
37
+ export interface Name {
38
+ display: string;
39
+ uuid: string;
40
+ name: string;
41
+ locale: string;
42
+ localePreferred: boolean;
43
+ conceptNameType: string;
44
+ links: Link[];
45
+ resourceVersion: string;
46
+ }
47
+
48
+ export interface Link {
49
+ rel: string;
50
+ uri: string;
51
+ resourceAlias: string;
52
+ }
53
+
54
+ export interface Datatype {
55
+ uuid: string;
56
+ display: string;
57
+ name: string;
58
+ description: string;
59
+ hl7Abbreviation: string;
60
+ retired: boolean;
61
+ links: Link[];
62
+ resourceVersion: string;
63
+ }
64
+
65
+ export interface ConceptClass {
66
+ uuid: string;
67
+ display: string;
68
+ name: string;
69
+ description: string;
70
+ retired: boolean;
71
+ links: Link[];
72
+ resourceVersion: string;
73
+ }
74
+
75
+ export interface Name2 {
76
+ display: string;
77
+ uuid: string;
78
+ name: string;
79
+ locale: string;
80
+ localePreferred: boolean;
81
+ conceptNameType?: string;
82
+ links: Link[];
83
+ resourceVersion: string;
84
+ }
85
+
86
+ export interface Description {
87
+ display: string;
88
+ uuid: string;
89
+ description: string;
90
+ locale: string;
91
+ links: Link[];
92
+ resourceVersion: string;
93
+ }
94
+
95
+ export interface Mapping {
96
+ display: string;
97
+ uuid: string;
98
+ conceptReferenceTerm: ConceptReferenceTerm;
99
+ conceptMapType: ConceptMapType;
100
+ links: Link[];
101
+ resourceVersion: string;
102
+ }
103
+
104
+ export interface ConceptReferenceTerm {
105
+ uuid: string;
106
+ display: string;
107
+ links: Link[];
108
+ }
109
+
110
+ export interface ConceptMapType {
111
+ uuid: string;
112
+ display: string;
113
+ links: Link[];
114
+ }
115
+
116
+ export interface AuditInfo {
117
+ creator: Creator;
118
+ dateCreated: string;
119
+ changedBy: ChangedBy;
120
+ dateChanged: string;
121
+ }
122
+
123
+ export interface Creator {
124
+ uuid: string;
125
+ display: string;
126
+ links: Link[];
127
+ }
128
+
129
+ export interface ChangedBy {
130
+ uuid: string;
131
+ display: string;
132
+ links: Link[];
133
+ }
134
+
135
+ export function assessValue(value: number, range: ObsMetaInfo): ObservationInterpretation {
136
+ if (range?.hiCritical && value >= range.hiCritical) {
137
+ return 'critically_high';
138
+ }
139
+
140
+ if (range?.hiNormal && value > range.hiNormal) {
141
+ return 'high';
142
+ }
143
+
144
+ if (range?.lowCritical && value <= range.lowCritical) {
145
+ return 'critically_low';
146
+ }
147
+
148
+ if (range?.lowNormal && value < range.lowNormal) {
149
+ return 'low';
150
+ }
151
+
152
+ return 'normal';
153
+ }
154
+
155
+ export function useGetConceptById(conceptUuid: string) {
156
+ const apiUrl = `${restBaseUrl}/concept/${conceptUuid}?v=full`;
157
+ const { data, error, isLoading } = useSWR<{ data: ConceptResponse }, Error>(apiUrl, openmrsFetch);
158
+ return {
159
+ concept: data?.data,
160
+ isLoading,
161
+ isError: error,
162
+ };
163
+ }
164
+
165
+ export async function GetPatientByUuid(uuid: string) {
166
+ const abortController = new AbortController();
167
+
168
+ return openmrsFetch(`${restBaseUrl}/patient/${uuid}`, {
169
+ headers: {
170
+ 'Content-Type': 'application/json',
171
+ },
172
+ signal: abortController.signal,
173
+ });
174
+ }
@@ -0,0 +1,158 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/styles/scss/type';
3
+ @use '@carbon/styles/scss/colors';
4
+ @use '@openmrs/esm-styleguide/src/vars' as vars;
5
+ @import '../../root.scss';
6
+
7
+ .section {
8
+ margin: 5px;
9
+ }
10
+
11
+ .tileContainer {
12
+ background-color: vars.$ui-02;
13
+ border-top: 1px solid vars.$ui-03;
14
+ padding: 5rem 0;
15
+ }
16
+
17
+ .tile {
18
+ margin: auto;
19
+ width: fit-content;
20
+ }
21
+
22
+ .tileContent {
23
+ display: flex;
24
+ flex-direction: column;
25
+ align-items: center;
26
+ }
27
+
28
+ .content {
29
+ @include type.type-style('heading-compact-02');
30
+ color: vars.$text-02;
31
+ margin-bottom: 0.5rem;
32
+ }
33
+
34
+ .helper {
35
+ @include type.type-style('body-compact-01');
36
+ color: vars.$text-02;
37
+ }
38
+
39
+ .separator {
40
+ @include type.type-style('body-compact-02');
41
+ color: vars.$text-02;
42
+ width: 80%;
43
+ margin: 1.5rem auto;
44
+ overflow: hidden;
45
+ text-align: center;
46
+
47
+ &::before,
48
+ &::after {
49
+ background-color: vars.$text-03;
50
+ content: '';
51
+ display: inline-block;
52
+ height: 1px;
53
+ position: relative;
54
+ vertical-align: middle;
55
+ width: 50%;
56
+ }
57
+
58
+ &::before {
59
+ right: 0.5rem;
60
+ margin-left: -50%;
61
+ }
62
+
63
+ &::after {
64
+ left: 0.5rem;
65
+ margin-right: -50%;
66
+ }
67
+ }
68
+
69
+ td {
70
+ white-space: nowrap;
71
+ }
72
+
73
+ .criticallyLow,
74
+ .criticallyHigh,
75
+ .low,
76
+ .high {
77
+ td:nth-child(2) {
78
+ @include type.type-style('heading-compact-01');
79
+ }
80
+ }
81
+
82
+ .criticallyLow,
83
+ .criticallyHigh {
84
+ border: 2px solid colors.$red-60 !important;
85
+ }
86
+
87
+ .low,
88
+ .high {
89
+ border: 1.5px solid colors.$black-100 !important;
90
+ }
91
+
92
+ .criticallyLow {
93
+ td:nth-child(2)::after {
94
+ content: ' ↓↓';
95
+ }
96
+ }
97
+
98
+ .criticallyHigh {
99
+ td:nth-child(2)::after {
100
+ content: ' ↑↑';
101
+ }
102
+ }
103
+
104
+ .low {
105
+ td:nth-child(2)::after {
106
+ content: ' ↓';
107
+ }
108
+ }
109
+
110
+ .high {
111
+ td:nth-child(2)::after {
112
+ content: ' ↑';
113
+ }
114
+ }
115
+
116
+ .off-scale-low {
117
+ td:nth-child(2)::after {
118
+ content: ' ↓↓↓';
119
+ }
120
+ }
121
+
122
+ .off-scale-high {
123
+ td:nth-child(2)::after {
124
+ content: ' ↑↑↑';
125
+ }
126
+ }
127
+
128
+ .offScaleHigh,
129
+ .offScaleLow,
130
+ .criticallyHigh,
131
+ .criticallyLow,
132
+ .high,
133
+ .low {
134
+ @include type.type-style('heading-compact-01');
135
+ }
136
+
137
+ .criticallyLow::after {
138
+ content: ' ↓↓';
139
+ }
140
+
141
+ .criticallyHigh::after {
142
+ content: ' ↑↑';
143
+ }
144
+
145
+ .low::after {
146
+ content: ' ↓';
147
+ }
148
+
149
+ .high::after {
150
+ content: ' ↑';
151
+ }
152
+
153
+ .cds--data-table--zebra tbody tr[data-parent-row]:nth-child(4n + 1) td {
154
+ background-color: #fff;
155
+ border-bottom: 1px solid #e0e0e0;
156
+ border-top: 1px solid #e0e0e0;
157
+ padding: 0 16px;
158
+ }
@@ -0,0 +1,59 @@
1
+ import { Button, Form, ModalBody, ModalFooter, ModalHeader, TextInput, InlineLoading } from '@carbon/react';
2
+ import React, { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { usePatient } from '@openmrs/esm-framework';
5
+ import styles from './results-summary.scss';
6
+
7
+ interface SendEmailDialogProps {
8
+ patientUuid: string;
9
+ closeModal: () => void;
10
+ sendEmail: () => Promise<void>;
11
+ }
12
+
13
+ const SendEmailDialog: React.FC<SendEmailDialogProps> = ({ patientUuid, closeModal, sendEmail }) => {
14
+ const { t } = useTranslation();
15
+
16
+ const [email, setEmail] = useState();
17
+
18
+ const { patient, isLoading } = usePatient(patientUuid);
19
+
20
+ return (
21
+ <>
22
+ <Form onSubmit={sendEmail}>
23
+ <ModalHeader closeModal={closeModal} title={t('sendResults', 'Send Results')} />
24
+ <ModalBody>
25
+ {isLoading && (
26
+ <InlineLoading
27
+ className={styles.bannerLoading}
28
+ iconDescription="Loading"
29
+ description="Loading banner"
30
+ status="active"
31
+ />
32
+ )}
33
+ {patient?.address ? (
34
+ <div>
35
+ <TextInput
36
+ id="text-input-email"
37
+ invalidText="Error message goes here"
38
+ labelText="Email"
39
+ onChange={(e) => setEmail(e.target.value)}
40
+ size="md"
41
+ type="email"
42
+ />
43
+ </div>
44
+ ) : (
45
+ "Patient doesn't have an email address"
46
+ )}
47
+ </ModalBody>
48
+ <ModalFooter>
49
+ <Button kind="secondary" onClick={closeModal}>
50
+ {t('cancel', 'Cancel')}
51
+ </Button>
52
+ <Button type="submit">{t('sendEmail', 'Send Email')}</Button>
53
+ </ModalFooter>
54
+ </Form>
55
+ </>
56
+ );
57
+ };
58
+
59
+ export default SendEmailDialog;