@openmrs/esm-service-queues-app 5.0.1-pre.2087

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 (254) hide show
  1. package/.turbo/turbo-build.log +40 -0
  2. package/LICENSE.md +401 -0
  3. package/README.md +23 -0
  4. package/__mocks__/active-visits.mock.ts +97 -0
  5. package/__mocks__/appointments-data.mock.ts +283 -0
  6. package/__mocks__/search.mock.ts +35 -0
  7. package/__mocks__/visits.mock.ts +42 -0
  8. package/dist/121.js +1 -0
  9. package/dist/121.js.map +1 -0
  10. package/dist/130.js +2 -0
  11. package/dist/130.js.LICENSE.txt +5 -0
  12. package/dist/130.js.map +1 -0
  13. package/dist/176.js +1 -0
  14. package/dist/176.js.map +1 -0
  15. package/dist/227.js +1 -0
  16. package/dist/227.js.map +1 -0
  17. package/dist/242.js +1 -0
  18. package/dist/242.js.map +1 -0
  19. package/dist/252.js +1 -0
  20. package/dist/252.js.map +1 -0
  21. package/dist/286.js +1 -0
  22. package/dist/286.js.map +1 -0
  23. package/dist/308.js +1 -0
  24. package/dist/308.js.map +1 -0
  25. package/dist/319.js +1 -0
  26. package/dist/328.js +1 -0
  27. package/dist/328.js.map +1 -0
  28. package/dist/330.js +1 -0
  29. package/dist/330.js.map +1 -0
  30. package/dist/364.js +1 -0
  31. package/dist/364.js.map +1 -0
  32. package/dist/425.js +1 -0
  33. package/dist/425.js.map +1 -0
  34. package/dist/457.js +1 -0
  35. package/dist/457.js.map +1 -0
  36. package/dist/469.js +1 -0
  37. package/dist/469.js.map +1 -0
  38. package/dist/521.js +1 -0
  39. package/dist/521.js.map +1 -0
  40. package/dist/53.js +1 -0
  41. package/dist/53.js.map +1 -0
  42. package/dist/574.js +1 -0
  43. package/dist/591.js +2 -0
  44. package/dist/591.js.LICENSE.txt +32 -0
  45. package/dist/591.js.map +1 -0
  46. package/dist/610.js +1 -0
  47. package/dist/610.js.map +1 -0
  48. package/dist/611.js +1 -0
  49. package/dist/611.js.map +1 -0
  50. package/dist/616.js +1 -0
  51. package/dist/616.js.map +1 -0
  52. package/dist/644.js +1 -0
  53. package/dist/644.js.map +1 -0
  54. package/dist/670.js +2 -0
  55. package/dist/670.js.LICENSE.txt +57 -0
  56. package/dist/670.js.map +1 -0
  57. package/dist/733.js +1 -0
  58. package/dist/733.js.map +1 -0
  59. package/dist/757.js +1 -0
  60. package/dist/764.js +1 -0
  61. package/dist/764.js.map +1 -0
  62. package/dist/766.js +1 -0
  63. package/dist/766.js.map +1 -0
  64. package/dist/784.js +2 -0
  65. package/dist/784.js.LICENSE.txt +9 -0
  66. package/dist/784.js.map +1 -0
  67. package/dist/788.js +1 -0
  68. package/dist/807.js +1 -0
  69. package/dist/833.js +1 -0
  70. package/dist/86.js +1 -0
  71. package/dist/86.js.map +1 -0
  72. package/dist/981.js +1 -0
  73. package/dist/981.js.map +1 -0
  74. package/dist/main.js +1 -0
  75. package/dist/main.js.map +1 -0
  76. package/dist/openmrs-esm-service-queues-app.js +1 -0
  77. package/dist/openmrs-esm-service-queues-app.js.buildmanifest.json +930 -0
  78. package/dist/openmrs-esm-service-queues-app.js.map +1 -0
  79. package/dist/routes.json +1 -0
  80. package/jest.config.js +3 -0
  81. package/package.json +53 -0
  82. package/src/active-visits/active-visits-tab.component.tsx +71 -0
  83. package/src/active-visits/active-visits-tab.test.tsx +19 -0
  84. package/src/active-visits/active-visits-table.component.tsx +543 -0
  85. package/src/active-visits/active-visits-table.resource.ts +443 -0
  86. package/src/active-visits/active-visits-table.scss +271 -0
  87. package/src/active-visits/active-visits-table.test.tsx +131 -0
  88. package/src/active-visits/change-status-dialog.component.tsx +233 -0
  89. package/src/active-visits/change-status-dialog.scss +32 -0
  90. package/src/active-visits/change-status-dialog.test.tsx +107 -0
  91. package/src/add-patient-toqueue/add-patient-toqueue-dialog.component.tsx +218 -0
  92. package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +32 -0
  93. package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +236 -0
  94. package/src/add-provider-queue-room/add-provider-queue-room.resource.tsx +76 -0
  95. package/src/add-provider-queue-room/add-provider-queue-room.scss +17 -0
  96. package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +98 -0
  97. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +74 -0
  98. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.resource.tsx +46 -0
  99. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +15 -0
  100. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +42 -0
  101. package/src/clear-queue-entries-dialog/clear-queue-entries.component.tsx +36 -0
  102. package/src/config-schema.ts +177 -0
  103. package/src/constants.ts +7 -0
  104. package/src/createDashboardLink.tsx +35 -0
  105. package/src/current-visit/current-visit-summary.component.tsx +38 -0
  106. package/src/current-visit/current-visit-summary.test.tsx +47 -0
  107. package/src/current-visit/current-visit.resource.ts +84 -0
  108. package/src/current-visit/current-visit.scss +34 -0
  109. package/src/current-visit/hooks/useVitalsConceptMetadata.tsx +101 -0
  110. package/src/current-visit/visit-details/biometrics-config-schema.ts +14 -0
  111. package/src/current-visit/visit-details/current-visit-details.component.tsx +96 -0
  112. package/src/current-visit/visit-details/triage-note.component.tsx +53 -0
  113. package/src/current-visit/visit-details/triage-note.scss +89 -0
  114. package/src/current-visit/visit-details/vitals-config-schema.ts +17 -0
  115. package/src/current-visit/visit-details/vitals.component.tsx +164 -0
  116. package/src/dashboard.meta.ts +5 -0
  117. package/src/declarations.d.ts +2 -0
  118. package/src/helpers/functions.ts +67 -0
  119. package/src/helpers/helpers.ts +170 -0
  120. package/src/helpers/time-helpers.ts +15 -0
  121. package/src/home.component.tsx +29 -0
  122. package/src/home.test.tsx +58 -0
  123. package/src/index.ts +100 -0
  124. package/src/overlay.component.tsx +46 -0
  125. package/src/overlay.scss +96 -0
  126. package/src/overlay.test.tsx +49 -0
  127. package/src/past-visit/past-visit-details/encounter-list.component.tsx +51 -0
  128. package/src/past-visit/past-visit-details/medications-list.component.tsx +95 -0
  129. package/src/past-visit/past-visit-details/notes-list.component.tsx +40 -0
  130. package/src/past-visit/past-visit-details/past-visit-summary.component.tsx +172 -0
  131. package/src/past-visit/past-visit-details/past-visit-summary.scss +58 -0
  132. package/src/past-visit/past-visit.component.tsx +37 -0
  133. package/src/past-visit/past-visit.resource.ts +83 -0
  134. package/src/past-visit/past-visit.scss +126 -0
  135. package/src/past-visit/past-visit.test.tsx +41 -0
  136. package/src/patient-info/appointment-details.component.tsx +98 -0
  137. package/src/patient-info/appointment-details.scss +34 -0
  138. package/src/patient-info/appointment-details.test.tsx +36 -0
  139. package/src/patient-info/appointments.resource.tsx +43 -0
  140. package/src/patient-info/contact-details.component.tsx +71 -0
  141. package/src/patient-info/contact-details.scss +31 -0
  142. package/src/patient-info/contact-details.test.tsx +94 -0
  143. package/src/patient-info/hooks/usePatientAttributes.tsx +42 -0
  144. package/src/patient-info/patient-info.component.tsx +78 -0
  145. package/src/patient-info/patient-info.scss +60 -0
  146. package/src/patient-info/patient-info.test.tsx +45 -0
  147. package/src/patient-queue-header/patient-queue-header.component.tsx +64 -0
  148. package/src/patient-queue-header/patient-queue-header.scss +88 -0
  149. package/src/patient-queue-header/patient-queue-illustration.component.tsx +22 -0
  150. package/src/patient-queue-metrics/clinic-metrics.component.tsx +93 -0
  151. package/src/patient-queue-metrics/clinic-metrics.resource.tsx +51 -0
  152. package/src/patient-queue-metrics/clinic-metrics.scss +11 -0
  153. package/src/patient-queue-metrics/clinic-metrics.test.tsx +87 -0
  154. package/src/patient-queue-metrics/metrics-card.component.tsx +64 -0
  155. package/src/patient-queue-metrics/metrics-card.scss +80 -0
  156. package/src/patient-queue-metrics/metrics-header.component.tsx +74 -0
  157. package/src/patient-queue-metrics/metrics-header.scss +22 -0
  158. package/src/patient-queue-metrics/queue-metrics.resource.ts +54 -0
  159. package/src/patient-search/advanced-search.component.tsx +190 -0
  160. package/src/patient-search/advanced-search.scss +154 -0
  161. package/src/patient-search/advanced-search.test.tsx +29 -0
  162. package/src/patient-search/basic-search.component.tsx +112 -0
  163. package/src/patient-search/basic-search.scss +139 -0
  164. package/src/patient-search/basic-search.test.tsx +23 -0
  165. package/src/patient-search/empty-data-illustration.component.tsx +41 -0
  166. package/src/patient-search/hooks/useActivePatientEnrollment.tsx +29 -0
  167. package/src/patient-search/hooks/useDefaultLocation.tsx +14 -0
  168. package/src/patient-search/hooks/usePatients.tsx +25 -0
  169. package/src/patient-search/hooks/useQueueLocations.tsx +20 -0
  170. package/src/patient-search/hooks/useRecommendedVisitTypes.tsx +36 -0
  171. package/src/patient-search/hooks/useScheduledVisits.tsx +50 -0
  172. package/src/patient-search/patient-scheduled-visits.component.tsx +350 -0
  173. package/src/patient-search/patient-scheduled-visits.scss +131 -0
  174. package/src/patient-search/patient-scheduled-visits.test.tsx +55 -0
  175. package/src/patient-search/patient-search.component.tsx +64 -0
  176. package/src/patient-search/search-illustration.component.tsx +27 -0
  177. package/src/patient-search/search-results.component.tsx +75 -0
  178. package/src/patient-search/search-results.scss +80 -0
  179. package/src/patient-search/search-results.test.tsx +77 -0
  180. package/src/patient-search/search.resource.ts +10 -0
  181. package/src/patient-search/visit-form/base-visit-type.component.tsx +82 -0
  182. package/src/patient-search/visit-form/base-visit-type.scss +100 -0
  183. package/src/patient-search/visit-form/base-visit-type.test.tsx +41 -0
  184. package/src/patient-search/visit-form/queue.resource.ts +73 -0
  185. package/src/patient-search/visit-form/recommended-visit-type.component.tsx +38 -0
  186. package/src/patient-search/visit-form/visit-form.component.tsx +366 -0
  187. package/src/patient-search/visit-form/visit-form.scss +96 -0
  188. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx +160 -0
  189. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.scss +21 -0
  190. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +67 -0
  191. package/src/queue-entry-table-components/actions-menu.component.tsx +51 -0
  192. package/src/queue-entry-table-components/actions-menu.scss +3 -0
  193. package/src/queue-entry-table-components/edit-entry.component.tsx +28 -0
  194. package/src/queue-entry-table-components/edit-entry.scss +14 -0
  195. package/src/queue-entry-table-components/open-chart.component.tsx +33 -0
  196. package/src/queue-entry-table-components/open-chart.resource.tsx +14 -0
  197. package/src/queue-entry-table-components/open-chart.scss +14 -0
  198. package/src/queue-entry-table-components/status-icon.component.tsx +17 -0
  199. package/src/queue-entry-table-components/transition-entry.component.tsx +53 -0
  200. package/src/queue-entry-table-components/transition-entry.scss +22 -0
  201. package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +230 -0
  202. package/src/queue-patient-linelists/queue-linelist-base-table.scss +110 -0
  203. package/src/queue-patient-linelists/queue-linelist-base-table.test.tsx +118 -0
  204. package/src/queue-patient-linelists/queue-linelist-filter.component.tsx +172 -0
  205. package/src/queue-patient-linelists/queue-linelist-filter.scss +63 -0
  206. package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +76 -0
  207. package/src/queue-patient-linelists/queue-linelist.component.tsx +29 -0
  208. package/src/queue-patient-linelists/queue-linelist.resource.tsx +84 -0
  209. package/src/queue-patient-linelists/queue-linelist.test.tsx +22 -0
  210. package/src/queue-patient-linelists/queue-services-table.component.tsx +63 -0
  211. package/src/queue-patient-linelists/scheduled-appointments-table.component.tsx +300 -0
  212. package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +42 -0
  213. package/src/queue-rooms/queue-room-form.component.tsx +168 -0
  214. package/src/queue-rooms/queue-room-form.test.tsx +65 -0
  215. package/src/queue-rooms/queue-room.resource.tsx +20 -0
  216. package/src/queue-rooms/queue-room.scss +58 -0
  217. package/src/queue-screen/queue-screen.component.tsx +47 -0
  218. package/src/queue-screen/queue-screen.scss +39 -0
  219. package/src/queue-screen/queue-screen.test.tsx +47 -0
  220. package/src/queue-screen/useActiveTickets.tsx +13 -0
  221. package/src/queue-services/queue-service-form.component.tsx +183 -0
  222. package/src/queue-services/queue-service-form.test.tsx +56 -0
  223. package/src/queue-services/queue-service.resource.tsx +38 -0
  224. package/src/queue-services/queue-service.scss +54 -0
  225. package/src/remove-queue-entry-dialog/remove-queue-entry.component.tsx +95 -0
  226. package/src/remove-queue-entry-dialog/remove-queue-entry.resource.tsx +93 -0
  227. package/src/remove-queue-entry-dialog/remove-queue-entry.scss +8 -0
  228. package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +44 -0
  229. package/src/root.component.tsx +28 -0
  230. package/src/root.scss +15 -0
  231. package/src/root.test.tsx +28 -0
  232. package/src/routes.json +91 -0
  233. package/src/side-menu/nav-group/createNavGroup.tsx +17 -0
  234. package/src/side-menu/nav-group/nav-group.component.tsx +24 -0
  235. package/src/side-menu/nav-group/nav-group.test.tsx +32 -0
  236. package/src/side-menu/nav-group/nav-group.ts +10 -0
  237. package/src/side-menu/side-menu.component.tsx +6 -0
  238. package/src/side-menu/side-menu.test.tsx +17 -0
  239. package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +174 -0
  240. package/src/transition-queue-entry/transition-queue-entry-dialog.scss +12 -0
  241. package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +95 -0
  242. package/src/transition-queue-entry/transition-queue-entry.resource.ts +16 -0
  243. package/src/types/index.ts +434 -0
  244. package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +298 -0
  245. package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +93 -0
  246. package/src/visits-missing-inqueue/visits-missing-inqueue.scss +108 -0
  247. package/translations/am.json +258 -0
  248. package/translations/en.json +258 -0
  249. package/translations/es.json +258 -0
  250. package/translations/fr.json +258 -0
  251. package/translations/he.json +262 -0
  252. package/translations/km.json +258 -0
  253. package/tsconfig.json +5 -0
  254. package/webpack.config.js +1 -0
@@ -0,0 +1,101 @@
1
+ import useSWRImmutable from 'swr/immutable';
2
+ import { openmrsFetch, useConfig, formatTime, parseDate } from '@openmrs/esm-framework';
3
+ import { Observation, PatientVitals, Encounter } from '../../types/index';
4
+ import { ConfigObject } from '../../config-schema';
5
+
6
+ export function useVitalsConceptMetadata() {
7
+ const customRepresentation =
8
+ 'custom:(setMembers:(uuid,display,hiNormal,hiAbsolute,hiCritical,lowNormal,lowAbsolute,lowCritical,units))';
9
+
10
+ const apiUrl = `/ws/rest/v1/concept/?q=VITALS SIGNS&v=${customRepresentation}`;
11
+
12
+ const { data, error, isLoading } = useSWRImmutable<{ data: VitalsConceptMetadataResponse }, Error>(
13
+ apiUrl,
14
+ openmrsFetch,
15
+ );
16
+
17
+ const conceptMetadata = data?.data?.results[0]?.setMembers;
18
+
19
+ const conceptUnits = conceptMetadata?.length
20
+ ? new Map<string, string>(conceptMetadata.map((concept) => [concept.uuid, concept.units]))
21
+ : new Map<string, string>([]);
22
+ return {
23
+ data: conceptUnits,
24
+ isError: error,
25
+ isLoading,
26
+ conceptMetadata,
27
+ };
28
+ }
29
+
30
+ export const withUnit = (label: string, unit: string | null | undefined) => {
31
+ return `${label} ${unit ? `(${unit})` : ''}`;
32
+ };
33
+
34
+ export interface ConceptMetadata {
35
+ uuid: string;
36
+ display: string;
37
+ hiNormal: number | string | null;
38
+ hiAbsolute: number | string | null;
39
+ hiCritical: number | string | null;
40
+ lowNormal: number | string | null;
41
+ lowAbsolute: number | string | null;
42
+ lowCritical: number | string | null;
43
+ units: string | null;
44
+ }
45
+
46
+ interface VitalsConceptMetadataResponse {
47
+ results: Array<{
48
+ setMembers: Array<ConceptMetadata>;
49
+ }>;
50
+ }
51
+
52
+ export const useVitalsFromObs = (encounter) => {
53
+ const config = useConfig() as ConfigObject;
54
+
55
+ const vitals: Array<PatientVitals> = [];
56
+
57
+ encounter.forEach((enc) => {
58
+ enc.obs?.forEach((obs: Observation) => {
59
+ if (obs.concept?.uuid === config.concepts.pulseUuid) {
60
+ vitals.push({
61
+ pulse: obs.value,
62
+ provider: {
63
+ name: encounter.encounterProviders?.length ? encounter.encounterProviders[0].provider.person.display : '',
64
+ role: encounter.encounterProviders?.length ? encounter.encounterProviders[0].encounterRole.display : '',
65
+ },
66
+ time: formatTime(parseDate(obs.obsDatetime)),
67
+ });
68
+ } else if (obs.concept?.uuid === config.concepts.oxygenSaturationUuid) {
69
+ vitals.push({
70
+ oxygenSaturation: obs.value,
71
+ });
72
+ } else if (obs.concept?.uuid === config.concepts.respiratoryRateUuid) {
73
+ vitals.push({
74
+ respiratoryRate: obs.value,
75
+ });
76
+ } else if (obs.concept?.uuid === config.concepts.temperatureUuid) {
77
+ vitals.push({
78
+ temperature: obs.value,
79
+ });
80
+ } else if (obs.concept?.uuid === config.concepts.systolicBloodPressureUuid) {
81
+ vitals.push({
82
+ systolic: obs.value,
83
+ });
84
+ } else if (obs.concept?.uuid === config.concepts.diastolicBloodPressureUuid) {
85
+ vitals.push({
86
+ diastolic: obs.value,
87
+ });
88
+ } else if (obs.concept?.uuid === config.concepts.weightUuid) {
89
+ vitals.push({
90
+ weight: obs.value,
91
+ });
92
+ } else if (obs.concept?.uuid === config.concepts.heightUuid) {
93
+ vitals.push({
94
+ height: obs.value,
95
+ });
96
+ }
97
+ });
98
+ });
99
+
100
+ return vitals;
101
+ };
@@ -0,0 +1,14 @@
1
+ import { Type } from '@openmrs/esm-framework';
2
+
3
+ export default {
4
+ bmiUnit: {
5
+ _type: Type.String,
6
+ _default: 'kg / m²',
7
+ },
8
+ };
9
+
10
+ export interface BiometricsConfigObject {
11
+ bmiUnit: string;
12
+ heightUnit: string;
13
+ weightUnit: string;
14
+ }
@@ -0,0 +1,96 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import {
4
+ StructuredListBody,
5
+ StructuredListCell,
6
+ StructuredListHead,
7
+ StructuredListRow,
8
+ StructuredListWrapper,
9
+ } from '@carbon/react';
10
+ import { OpenmrsResource, formatTime, parseDate } from '@openmrs/esm-framework';
11
+ import { Note, Encounter, Observation, DiagnosisItem } from '../../types/index';
12
+ import { useVitalsFromObs } from '../hooks/useVitalsConceptMetadata';
13
+ import TriageNote from './triage-note.component';
14
+ import Vitals from './vitals.component';
15
+ import styles from '../current-visit.scss';
16
+
17
+ interface CurrentVisitProps {
18
+ patientUuid: string;
19
+ encounters: Array<Encounter | OpenmrsResource>;
20
+ }
21
+
22
+ enum visitTypes {
23
+ CURRENT = 'currentVisit',
24
+ PAST = 'pastVisit',
25
+ }
26
+
27
+ const CurrentVisitDetails: React.FC<CurrentVisitProps> = ({ patientUuid, encounters }) => {
28
+ const { t } = useTranslation();
29
+
30
+ const [diagnoses, notes, vitalsToRetrieve]: [Array<DiagnosisItem>, Array<Note>, Array<Encounter>] = useMemo(() => {
31
+ const notes: Array<Note> = [];
32
+ const vitalsToRetrieve: Array<Encounter> = [];
33
+ const diagnoses: Array<DiagnosisItem> = [];
34
+
35
+ // Iterating through every Encounter
36
+ encounters?.forEach((enc: Encounter) => {
37
+ // Check for Visit Diagnoses and Notes
38
+ if (enc.encounterType?.display === 'Visit Note') {
39
+ enc.obs.forEach((obs: Observation) => {
40
+ if (obs.concept && obs.concept.display === 'Visit Diagnoses') {
41
+ // // Putting all the diagnoses in a single array.
42
+ diagnoses.push({
43
+ diagnosis: obs.groupMembers.find((mem) => mem.concept.display === 'PROBLEM LIST').value.display,
44
+ });
45
+ } else if (obs.concept && obs.concept.display === 'General patient note') {
46
+ // Putting all notes in a single array.
47
+ notes.push({
48
+ note: obs.value,
49
+ provider: {
50
+ name: enc.encounterProviders.length ? enc.encounterProviders[0].provider.person.display : '',
51
+ role: enc.encounterProviders.length ? enc.encounterProviders[0].encounterRole.display : '',
52
+ },
53
+ time: formatTime(parseDate(obs.obsDatetime)),
54
+ concept: obs.concept,
55
+ });
56
+ }
57
+ });
58
+ }
59
+
60
+ vitalsToRetrieve.push(enc);
61
+ });
62
+ return [diagnoses, notes, vitalsToRetrieve];
63
+ }, [encounters]);
64
+
65
+ return (
66
+ <div className={styles.wrapper}>
67
+ <div className={styles.visitContainer}>
68
+ <StructuredListWrapper className={styles.structuredList}>
69
+ <StructuredListHead></StructuredListHead>
70
+ <StructuredListBody>
71
+ <StructuredListRow className={styles.structuredListRow}>
72
+ <StructuredListCell>{t('triageNote', 'Triage note')}</StructuredListCell>
73
+ <StructuredListCell>
74
+ <TriageNote notes={notes} diagnoses={diagnoses} patientUuid={patientUuid} />
75
+ </StructuredListCell>
76
+ </StructuredListRow>
77
+
78
+ <StructuredListRow className={styles.structuredListRow}>
79
+ <StructuredListCell>{t('vitals', 'Vitals')}</StructuredListCell>
80
+ <StructuredListCell>
81
+ {' '}
82
+ <Vitals
83
+ vitals={useVitalsFromObs(vitalsToRetrieve)}
84
+ patientUuid={patientUuid}
85
+ visitType={visitTypes.CURRENT}
86
+ />
87
+ </StructuredListCell>
88
+ </StructuredListRow>
89
+ </StructuredListBody>
90
+ </StructuredListWrapper>
91
+ </div>
92
+ </div>
93
+ );
94
+ };
95
+
96
+ export default CurrentVisitDetails;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { Tag, Button } from '@carbon/react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { ArrowRight } from '@carbon/react/icons';
5
+ import { navigate } from '@openmrs/esm-framework';
6
+ import { DiagnosisItem, Note } from '../../types/index';
7
+ import styles from './triage-note.scss';
8
+
9
+ interface TriageNoteProps {
10
+ notes: Array<Note>;
11
+ diagnoses: Array<DiagnosisItem>;
12
+ patientUuid: string;
13
+ }
14
+
15
+ const TriageNote: React.FC<TriageNoteProps> = ({ notes, patientUuid, diagnoses }) => {
16
+ const { t } = useTranslation();
17
+
18
+ return (
19
+ <div>
20
+ {diagnoses.length > 0
21
+ ? diagnoses.map((d: DiagnosisItem, ind) => (
22
+ <Tag type="blue" size="md">
23
+ {d.diagnosis}
24
+ </Tag>
25
+ ))
26
+ : null}
27
+ {notes.length ? (
28
+ notes.map((note: Note, i) => (
29
+ <div>
30
+ <p>{note.note}</p>
31
+ <p className={styles.subHeading}>
32
+ {note.provider.name ? <span> {note.provider.name} </span> : null} · {note.time}
33
+ </p>
34
+ </div>
35
+ ))
36
+ ) : (
37
+ <div>
38
+ <p className={styles.emptyText}>{t('tirageNotYetCompleted', 'Triage has not yet been completed')}</p>
39
+ <Button
40
+ size="small"
41
+ kind="ghost"
42
+ renderIcon={(props) => <ArrowRight size={16} {...props} />}
43
+ onClick={() => navigate({ to: `\${openmrsSpaBase}/patient/${patientUuid}/chart` })}
44
+ iconDescription={t('triageForm', 'Triage form')}>
45
+ {t('triageForm', 'Triage form')}
46
+ </Button>
47
+ </div>
48
+ )}
49
+ </div>
50
+ );
51
+ };
52
+
53
+ export default TriageNote;
@@ -0,0 +1,89 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/styles/scss/type';
3
+ @import '~@openmrs/esm-styleguide/src/vars';
4
+
5
+ .subHeading {
6
+ @include type.type-style('label-01');
7
+ color: var(--text-02);
8
+ }
9
+
10
+ .emptyText {
11
+ padding: spacing.$spacing-05;
12
+ @include type.type-style('body-02');
13
+ }
14
+
15
+ .unit {
16
+ @include type.type-style('body-compact-01');
17
+ color: var(--text-02);
18
+ margin-left: spacing.$spacing-02;
19
+ }
20
+
21
+ .vitalValues {
22
+ @include type.type-style('body-compact-02');
23
+ color: $ui-05;
24
+ margin-left: spacing.$spacing-02;
25
+ }
26
+
27
+ .grid {
28
+ padding-left: 0;
29
+ }
30
+
31
+ .vitalValuesWrapper {
32
+ display: flex;
33
+ align-items: center;
34
+ }
35
+
36
+ .notification {
37
+ fill: $danger;
38
+ }
39
+
40
+ .danger-icon {
41
+ color: $danger;
42
+ height: spacing.$spacing-02;
43
+ width: spacing.$spacing-02;
44
+ margin-left: spacing.$spacing-02;
45
+ }
46
+
47
+ .iconWrapper {
48
+ margin-left: spacing.$spacing-02;
49
+ }
50
+
51
+ .critically-low,
52
+ .critically-high,
53
+ .low,
54
+ .high {
55
+ &::after {
56
+ @include type.type-style('heading-compact-01');
57
+ }
58
+ }
59
+
60
+ .low::after {
61
+ content: ' ↓';
62
+ }
63
+
64
+ .critically-low::after {
65
+ content: ' ↓↓';
66
+ }
67
+
68
+ .high::after {
69
+ content: ' ↑';
70
+ }
71
+
72
+ .critically-high::after {
73
+ content: ' ↑↑';
74
+ }
75
+
76
+ .bodyLong01 {
77
+ @include type.type-style('body-01');
78
+ }
79
+
80
+ .row {
81
+ display: flex;
82
+ justify-content: space-between;
83
+ align-items: center;
84
+ margin: 0.25rem 0.5rem;
85
+ }
86
+
87
+ .tile {
88
+ background-color: white;
89
+ }
@@ -0,0 +1,17 @@
1
+ import { Type } from '@openmrs/esm-framework';
2
+
3
+ export default {
4
+ formUuid: {
5
+ _type: Type.UUID,
6
+ _default: 'a000cb34-9ec1-4344-a1c8-f692232f6edd',
7
+ },
8
+ encounterTypeUuid: {
9
+ _type: Type.UUID,
10
+ _default: '67a71486-1a54-468f-ac3e-7091a9a79584',
11
+ },
12
+ };
13
+
14
+ export interface VitalsConfigObject {
15
+ formUuid: string;
16
+ encounterTypeUuid: string;
17
+ }
@@ -0,0 +1,164 @@
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Button, Grid, Layer, Row, Tile } from '@carbon/react';
4
+ import { ArrowRight, CircleFilled } from '@carbon/react/icons';
5
+ import { navigate, useConfig } from '@openmrs/esm-framework';
6
+ import { calculateBMI, assessValue, getReferenceRangesForConcept } from '../current-visit.resource';
7
+ import { useVitalsConceptMetadata } from '../hooks/useVitalsConceptMetadata';
8
+ import { ConfigObject } from '../../config-schema';
9
+ import { PatientVitals } from '../../types/index';
10
+ import styles from './triage-note.scss';
11
+
12
+ interface VitalsComponentProps {
13
+ vitals: Array<PatientVitals>;
14
+ patientUuid: string;
15
+ visitType: string;
16
+ }
17
+
18
+ const Vitals: React.FC<VitalsComponentProps> = ({ vitals, patientUuid, visitType }) => {
19
+ const { t } = useTranslation();
20
+ const config = useConfig() as ConfigObject;
21
+ const { data: conceptUnits, conceptMetadata } = useVitalsConceptMetadata();
22
+
23
+ const vitalsToDisplay = vitals.reduce(
24
+ (previousVital, currentVital) => Object.assign(previousVital, currentVital),
25
+ {},
26
+ );
27
+
28
+ return (
29
+ <div>
30
+ {Object.keys(vitalsToDisplay).length > 0 ? (
31
+ <div>
32
+ <div className={styles.row}>
33
+ <Tile className={styles.tile}>
34
+ <p>{t('temperature', 'Temperature')}</p>
35
+ <div className={styles.vitalValuesWrapper}>
36
+ <p className={styles.vitalValues}>{vitalsToDisplay.temperature ? vitalsToDisplay.temperature : '--'}</p>
37
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.temperatureUuid) ?? ''}</p>
38
+ <p>{}</p>
39
+ </div>
40
+ </Tile>
41
+ <Tile className={styles.tile}>
42
+ <p>{t('bp', 'Bp')}</p>
43
+ <div className={styles.vitalValuesWrapper}>
44
+ <p className={styles.vitalValues}>
45
+ {vitalsToDisplay.systolic ? vitalsToDisplay.systolic : '--'} /
46
+ {vitalsToDisplay.systolic ? vitalsToDisplay.diastolic : '--'}
47
+ </p>
48
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.systolicBloodPressureUuid) ?? ''}</p>
49
+ </div>
50
+ </Tile>
51
+ <Tile className={styles.tile}>
52
+ <p>
53
+ {t('heartRate', 'Heart rate')}
54
+ {assessValue(
55
+ vitalsToDisplay.pulse,
56
+ getReferenceRangesForConcept(config.concepts.pulseUuid, conceptMetadata),
57
+ ) !== 'normal' ? (
58
+ <CircleFilled className={styles['danger-icon']} size={16} />
59
+ ) : null}
60
+ </p>
61
+ <div className={styles.vitalValuesWrapper}>
62
+ <p className={styles.vitalValues}>{vitalsToDisplay.pulse ? vitalsToDisplay.pulse : '--'}</p>
63
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.pulseUuid) ?? ''}</p>
64
+ <p className={styles.iconWrapper}>
65
+ {assessValue(
66
+ vitalsToDisplay.pulse,
67
+ getReferenceRangesForConcept(config.concepts.pulseUuid, conceptMetadata),
68
+ ) === 'high' ? (
69
+ <span className={styles.high}></span>
70
+ ) : assessValue(
71
+ vitalsToDisplay.pulse,
72
+ getReferenceRangesForConcept(config.concepts.pulseUuid, conceptMetadata),
73
+ ) === 'critically_high' ? (
74
+ <span className={styles['critically-high']}></span>
75
+ ) : assessValue(
76
+ vitalsToDisplay.pulse,
77
+ getReferenceRangesForConcept(config.concepts.pulseUuid, conceptMetadata),
78
+ ) === 'low' ? (
79
+ <span className={styles.low}></span>
80
+ ) : assessValue(
81
+ vitalsToDisplay.pulse,
82
+ getReferenceRangesForConcept(config.concepts.pulseUuid, conceptMetadata),
83
+ ) === 'critically_low' ? (
84
+ <span className={styles['critically-low']}></span>
85
+ ) : null}
86
+ </p>
87
+ </div>
88
+ </Tile>
89
+ <Tile className={styles.tile}>
90
+ <p>{t('sp02', 'Sp02')}</p>
91
+ <div className={styles.vitalValuesWrapper}>
92
+ <p className={styles.vitalValues}>
93
+ {vitalsToDisplay.oxygenSaturation ? vitalsToDisplay.oxygenSaturation : '--'}
94
+ </p>
95
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.oxygenSaturationUuid) ?? ''}</p>
96
+ </div>
97
+ </Tile>
98
+ </div>
99
+ <div className={styles.row}>
100
+ <Tile className={styles.tile}>
101
+ <p>{t('rRate', 'R. Rate')}</p>
102
+ <div className={styles.vitalValuesWrapper}>
103
+ <p className={styles.vitalValues}>
104
+ {vitalsToDisplay.respiratoryRate ? vitalsToDisplay.respiratoryRate : '--'}
105
+ </p>
106
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.respiratoryRateUuid) ?? ''}</p>
107
+ </div>
108
+ </Tile>
109
+ <Tile className={styles.tile}>
110
+ <p>{t('height', 'Height')}</p>
111
+ <div className={styles.vitalValuesWrapper}>
112
+ <p className={styles.vitalValues}>{vitalsToDisplay.height ? vitalsToDisplay.height : '--'}</p>
113
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.heightUuid) ?? ''}</p>
114
+ </div>
115
+ </Tile>
116
+ <Tile className={styles.tile}>
117
+ <p>{t('weight', 'Weight')}</p>
118
+ <div className={styles.vitalValuesWrapper}>
119
+ <p className={styles.vitalValues}>{vitalsToDisplay.weight ? vitalsToDisplay.weight : '--'} </p>
120
+ <p className={styles.unit}>{conceptUnits.get(config.concepts.weightUuid) ?? ''}</p>
121
+ </div>
122
+ </Tile>
123
+ <Tile className={styles.tile}>
124
+ <p>{t('bmi', 'Bmi')}</p>
125
+ <div className={styles.vitalValuesWrapper}>
126
+ <p className={styles.vitalValues}>
127
+ {' '}
128
+ {calculateBMI(Number(vitalsToDisplay.weight), Number(vitalsToDisplay.height))}
129
+ </p>
130
+ <p className={styles.unit}>{config.biometrics['bmiUnit']}</p>
131
+ </div>
132
+ </Tile>
133
+ </div>
134
+ <p className={styles.subHeading}>
135
+ {vitalsToDisplay.provider?.name ? <span> {vitalsToDisplay.provider.name} </span> : null} ·{' '}
136
+ {vitalsToDisplay.time}
137
+ </p>
138
+ </div>
139
+ ) : (
140
+ <div>
141
+ {visitType === 'currentVisit' ? (
142
+ <div>
143
+ <p className={styles.emptyText}>
144
+ {t('vitalsNotRecordedForVisit', 'Vitals has not been recorded for this patient for this visit')}
145
+ </p>
146
+ <Button
147
+ size="small"
148
+ kind="ghost"
149
+ renderIcon={(props) => <ArrowRight size={16} {...props} />}
150
+ onClick={() => navigate({ to: `\${openmrsSpaBase}/patient/${patientUuid}/chart` })}
151
+ iconDescription={t('vitalsForm', 'Vitals form')}>
152
+ {t('vitalsForm', 'Vitals form')}
153
+ </Button>
154
+ </div>
155
+ ) : (
156
+ <p className={`${styles.bodyLong01} ${styles.text02}`}>{t('noVitalsFound', 'No vitals found')}</p>
157
+ )}
158
+ </div>
159
+ )}
160
+ </div>
161
+ );
162
+ };
163
+
164
+ export default Vitals;
@@ -0,0 +1,5 @@
1
+ export const dashboardMeta = {
2
+ name: 'service-queues',
3
+ slot: 'service-queues-dashboard-slot',
4
+ title: 'Service queues',
5
+ };
@@ -0,0 +1,2 @@
1
+ declare module '*.css';
2
+ declare module '*.scss';
@@ -0,0 +1,67 @@
1
+ import { OpenmrsResource } from '@openmrs/esm-framework';
2
+ import { MappedQueuePriority } from '../active-visits/active-visits-table.resource';
3
+
4
+ export const getTagType = (priority: string) => {
5
+ switch (priority as MappedQueuePriority) {
6
+ case 'Emergency':
7
+ return 'red';
8
+ case 'Not Urgent':
9
+ return 'green';
10
+ default:
11
+ return 'gray';
12
+ }
13
+ };
14
+
15
+ export const buildStatusString = (status: string, service: string) => {
16
+ if (!status || !service) {
17
+ return '';
18
+ }
19
+
20
+ if (status === 'waiting') {
21
+ return `${status} for ${service}`;
22
+ } else if (status === 'in service') {
23
+ return `Attending ${service}`;
24
+ } else if (status === 'finished service') {
25
+ return `Finished ${service}`;
26
+ }
27
+ };
28
+
29
+ export const formatWaitTime = (waitTime: string, t) => {
30
+ const num = parseInt(waitTime);
31
+ const hours = num / 60;
32
+ const rhours = Math.floor(hours);
33
+ const minutes = (hours - rhours) * 60;
34
+ const rminutes = Math.round(minutes);
35
+ if (rhours > 0) {
36
+ return rhours + ' ' + `${t('hoursAnd', 'hours and ')}` + rminutes + ' ' + `${t('minutes', 'minutes')}`;
37
+ } else {
38
+ return rminutes + ' ' + `${t('minutes', 'minutes')}`;
39
+ }
40
+ };
41
+
42
+ export const getGender = (gender, t) => {
43
+ switch (gender) {
44
+ case 'M':
45
+ return t('male', 'Male');
46
+ case 'F':
47
+ return t('female', 'Female');
48
+ case 'O':
49
+ return t('other', 'Other');
50
+ case 'U':
51
+ return t('unknown', 'Unknown');
52
+ default:
53
+ return gender;
54
+ }
55
+ };
56
+
57
+ export function findObsByConceptUUID(arr: Array<OpenmrsResource>, ids: Array<string>) {
58
+ for (const visit of arr) {
59
+ return visit.obs.filter((o) => {
60
+ return ids.includes(o.concept.uuid);
61
+ });
62
+ }
63
+ }
64
+
65
+ export function timeDiffInMinutes(date1: Date, date2: Date) {
66
+ return Math.round((date1.getTime() - date2.getTime()) / (1000 * 3600 * 24));
67
+ }