@kenyaemr/esm-shr-app 5.1.1-pre.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +45 -0
- package/LICENSE.md +401 -0
- package/README.md +5 -0
- package/dist/130.js +2 -0
- package/dist/130.js.LICENSE.txt +5 -0
- package/dist/130.js.map +1 -0
- package/dist/336.js +1 -0
- package/dist/336.js.map +1 -0
- package/dist/44.js +1 -0
- package/dist/44.js.map +1 -0
- package/dist/47.js +1 -0
- package/dist/47.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/588.js +1 -0
- package/dist/588.js.map +1 -0
- package/dist/591.js +2 -0
- package/dist/591.js.LICENSE.txt +32 -0
- package/dist/591.js.map +1 -0
- package/dist/625.js +2 -0
- package/dist/625.js.LICENSE.txt +35 -0
- package/dist/625.js.map +1 -0
- package/dist/784.js +2 -0
- package/dist/784.js.LICENSE.txt +9 -0
- package/dist/784.js.map +1 -0
- package/dist/964.js +1 -0
- package/dist/964.js.map +1 -0
- package/dist/kenyaemr-esm-shr-app.js +1 -0
- package/dist/kenyaemr-esm-shr-app.js.buildmanifest.json +335 -0
- package/dist/kenyaemr-esm-shr-app.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +35 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/package.json +52 -0
- package/src/config-schema.ts +1 -0
- package/src/dashboard.meta.ts +6 -0
- package/src/declarations.d.tsx +2 -0
- package/src/hooks/useSHRSummary.ts +14 -0
- package/src/index.ts +24 -0
- package/src/print-layout/print.component.tsx +16 -0
- package/src/print-layout/print.scss +10 -0
- package/src/routes.json +30 -0
- package/src/shrpatient-summary/root.scss +81 -0
- package/src/shrpatient-summary/shr-summary.scss +168 -0
- package/src/shrpatient-summary/shrDataTable.component.tsx +63 -0
- package/src/shrpatient-summary/shrpatient-summary.component.tsx +176 -0
- package/src/shrpatient-summary/visit-detail-overview.scss +193 -0
- package/src/types/index.ts +173 -0
- package/translations/en.json +1 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +4 -0
package/dist/routes.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^18.6.2"},"pages":[],"extensions":[{"name":"shr-patient-summary","component":"shrPatientSummary","slot":"patient-chart-shr-dashboard-slot","meta":{"columnSpan":4}},{"name":"shr-summary-dashboard-link","component":"shrSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":21,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-shr-dashboard-slot","title":"SHARED HEALTH RECORDS","path":"SHR panel"}}],"version":"5.1.0"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kenyaemr/esm-shr-app",
|
|
3
|
+
"version": "5.1.1-pre.122",
|
|
4
|
+
"description": "Patient care panels microfrontend for the OpenMRS SPA",
|
|
5
|
+
"browser": "dist/kenyaemr-esm-shr-app.js",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"source": true,
|
|
8
|
+
"license": "MPL-2.0",
|
|
9
|
+
"homepage": "https://github.com/palladiumkenya/kenyaemr-esm-core#readme",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "openmrs develop",
|
|
12
|
+
"serve": "webpack serve --mode=development",
|
|
13
|
+
"debug": "npm run serve",
|
|
14
|
+
"build": "webpack --mode production",
|
|
15
|
+
"analyze": "webpack --mode=production --env.analyze=true",
|
|
16
|
+
"lint": "eslint src --ext ts,tsx",
|
|
17
|
+
"typescript": "tsc",
|
|
18
|
+
"extract-translations": "i18next 'src/**/*.component.tsx'"
|
|
19
|
+
},
|
|
20
|
+
"browserslist": [
|
|
21
|
+
"extends browserslist-config-openmrs"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"openmrs"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/palladiumkenya/kenyaemr-esm-core#readme"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/palladiumkenya/kenyaemr-esm-core/issues"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@carbon/react": "^1.12.0",
|
|
38
|
+
"lodash-es": "^4.17.15",
|
|
39
|
+
"react-to-print": "^2.14.13"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@openmrs/esm-framework": "5.x",
|
|
43
|
+
"react": "^18.1.0",
|
|
44
|
+
"react-i18next": "11.x",
|
|
45
|
+
"react-router-dom": "6.x"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@openmrs/esm-patient-common-lib": "next",
|
|
49
|
+
"webpack": "^5.74.0"
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "87e82c8006300c48a9e18f7e3fcd8753647793cb"
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const configSchema = {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { SHRSummary } from '../types/index';
|
|
4
|
+
|
|
5
|
+
export const useSHRSummary = (patientUuid: string) => {
|
|
6
|
+
const shrSummaryUrl = `/ws/rest/v1/kenyaemril/shrPatientSummary?patientUuid=${patientUuid}`;
|
|
7
|
+
const { data, mutate, error, isLoading } = useSWR<{ data: SHRSummary }>(shrSummaryUrl, openmrsFetch);
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
data: data?.data ? data?.data : null,
|
|
11
|
+
isError: error,
|
|
12
|
+
isLoading: isLoading,
|
|
13
|
+
};
|
|
14
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getAsyncLifecycle, defineConfigSchema, registerBreadcrumbs, getSyncLifecycle } from '@openmrs/esm-framework';
|
|
2
|
+
import { configSchema } from './config-schema';
|
|
3
|
+
import { dashboardMeta } from './dashboard.meta';
|
|
4
|
+
import { createDashboardLink } from '@openmrs/esm-patient-common-lib';
|
|
5
|
+
|
|
6
|
+
const moduleName = '@kenyaemr/esm-shr-app';
|
|
7
|
+
|
|
8
|
+
const options = {
|
|
9
|
+
featureName: 'patient-shr',
|
|
10
|
+
moduleName,
|
|
11
|
+
};
|
|
12
|
+
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
13
|
+
|
|
14
|
+
export const shrPatientSummary = getAsyncLifecycle(
|
|
15
|
+
() => import('./shrpatient-summary/shrpatient-summary.component'),
|
|
16
|
+
options,
|
|
17
|
+
);
|
|
18
|
+
// t('sharedhealthrecords', 'Shared Health Records')
|
|
19
|
+
export const shrSummaryDashboardLink = getSyncLifecycle(createDashboardLink({ ...dashboardMeta, moduleName }), options);
|
|
20
|
+
|
|
21
|
+
export function startupApp() {
|
|
22
|
+
registerBreadcrumbs([]);
|
|
23
|
+
defineConfigSchema(moduleName, configSchema);
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import styles from './print.scss';
|
|
3
|
+
import { useConfig } from '@openmrs/esm-framework';
|
|
4
|
+
|
|
5
|
+
export function PrintComponent() {
|
|
6
|
+
const componentRef = useRef(null);
|
|
7
|
+
const { logo } = useConfig();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.printPage}>
|
|
11
|
+
<div ref={componentRef}>{logo?.src ? <img src={logo.src} alt={logo?.alt} width={110} height={40} /> : null}</div>
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default PrintComponent;
|
package/src/routes.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"kenyaemr": "^18.6.2"
|
|
5
|
+
},
|
|
6
|
+
"pages": [],
|
|
7
|
+
"extensions": [
|
|
8
|
+
{
|
|
9
|
+
"name": "shr-patient-summary",
|
|
10
|
+
"component": "shrPatientSummary",
|
|
11
|
+
"slot": "patient-chart-shr-dashboard-slot",
|
|
12
|
+
"meta": {
|
|
13
|
+
"columnSpan": 4
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "shr-summary-dashboard-link",
|
|
18
|
+
"component": "shrSummaryDashboardLink",
|
|
19
|
+
"slot": "patient-chart-dashboard-slot",
|
|
20
|
+
"order": 21,
|
|
21
|
+
"meta": {
|
|
22
|
+
"columns": 1,
|
|
23
|
+
"columnSpan": 1,
|
|
24
|
+
"slot": "patient-chart-shr-dashboard-slot",
|
|
25
|
+
"title": "SHARED HEALTH RECORDS",
|
|
26
|
+
"path": "SHR panel"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.patientChartWrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.patientChartWrapper {
|
|
11
|
+
&>nav {
|
|
12
|
+
overflow-y: scroll;
|
|
13
|
+
padding-bottom: 3rem;
|
|
14
|
+
scrollbar-width: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
::-webkit-scrollbar {
|
|
18
|
+
width: 0px;
|
|
19
|
+
background-color: transparent
|
|
20
|
+
}
|
|
21
|
+
:global(.cds--side-nav__overlay-active) {
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.caption01 {
|
|
27
|
+
@include type.type-style("legal-01");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.productiveHeading01 {
|
|
31
|
+
@include type.type-style("heading-compact-01");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.productiveHeading02 {
|
|
35
|
+
@include type.type-style("heading-compact-02");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.productiveHeading03 {
|
|
39
|
+
@include type.type-style("heading-03");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.productiveHeading04 {
|
|
43
|
+
@include type.type-style("heading-04");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.bodyLong01 {
|
|
47
|
+
@include type.type-style("body-01");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.bodyShort02 {
|
|
51
|
+
@include type.type-style("body-compact-02");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.text01 {
|
|
55
|
+
color: $ui-05;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.text02 {
|
|
59
|
+
color: $text-02;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.label01 {
|
|
63
|
+
@include type.type-style("label-01")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Overriding styles for RTL support
|
|
67
|
+
html[dir='rtl'] {
|
|
68
|
+
:global(.cds--date-picker-input__wrapper) {
|
|
69
|
+
svg {
|
|
70
|
+
left: 1rem;
|
|
71
|
+
right: unset;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
:global(.cds--side-nav) {
|
|
75
|
+
right: 0;
|
|
76
|
+
:global(.active-left-nav-link) {
|
|
77
|
+
border-right: 0.25rem solid var(--brand-01);
|
|
78
|
+
border-left: unset;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/type';
|
|
2
|
+
@use '@carbon/styles/scss/spacing';
|
|
3
|
+
@use '@carbon/colors';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.bodyContainer {
|
|
7
|
+
margin: spacing.$spacing-03;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.desktopHeading {
|
|
11
|
+
h4 {
|
|
12
|
+
@include type.type-style('heading-compact-02');
|
|
13
|
+
color: $text-02;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tabletHeading {
|
|
18
|
+
h4 {
|
|
19
|
+
@include type.type-style('heading-03');
|
|
20
|
+
color: $text-02;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.desktopHeading,
|
|
25
|
+
.tabletHeading {
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
text-transform: capitalize;
|
|
29
|
+
margin-bottom: spacing.$spacing-02;
|
|
30
|
+
margin-top: spacing.$spacing-02;
|
|
31
|
+
|
|
32
|
+
h4:after {
|
|
33
|
+
content: '';
|
|
34
|
+
display: block;
|
|
35
|
+
width: 2rem;
|
|
36
|
+
padding-top: 0.188rem;
|
|
37
|
+
border-bottom: 0.375rem solid var(--brand-03);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.heading:after {
|
|
42
|
+
content: '';
|
|
43
|
+
display: block;
|
|
44
|
+
width: 2rem;
|
|
45
|
+
padding-top: 0.188rem;
|
|
46
|
+
border-bottom: 0.375rem solid var(--brand-03);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.card {
|
|
50
|
+
background-color: $ui-02;
|
|
51
|
+
padding: spacing.$spacing-04;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.value {
|
|
55
|
+
@include type.type-style('productive-heading-03');
|
|
56
|
+
color: colors.$gray-100;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.label {
|
|
60
|
+
@include type.type-style('label-01');
|
|
61
|
+
color: $text-02;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.container {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
padding-left: 1rem;
|
|
68
|
+
// flex-wrap: wrap;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.content {
|
|
72
|
+
margin-top: spacing.$spacing-05;
|
|
73
|
+
width: 30%;
|
|
74
|
+
margin-left: spacing.$spacing-03;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.btnHidden {
|
|
78
|
+
visibility: hidden;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.btnShow {
|
|
82
|
+
visibility: visible;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.verticalTabs {
|
|
86
|
+
margin: 1rem 0;
|
|
87
|
+
scroll-behavior: smooth;
|
|
88
|
+
|
|
89
|
+
> ul {
|
|
90
|
+
flex-direction: column !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item+.cds--tabs--scrollable__nav-item) {
|
|
94
|
+
margin-left: 0rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-link) {
|
|
98
|
+
border-bottom: 0 !important;
|
|
99
|
+
border-left: 2px solid $color-gray-30;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tab {
|
|
104
|
+
outline: 0;
|
|
105
|
+
outline-offset: 0;
|
|
106
|
+
|
|
107
|
+
&:active, &:focus {
|
|
108
|
+
outline: 2px solid var(--brand-03) !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&[aria-selected="true"] {
|
|
112
|
+
border-left: 3px solid var(--brand-03);
|
|
113
|
+
border-bottom: none;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
margin-left: 0rem !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[aria-selected="false"] {
|
|
119
|
+
border-bottom: none;
|
|
120
|
+
border-left: 2px solid $ui-03;
|
|
121
|
+
margin-left: 0rem !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.tablist {
|
|
126
|
+
:global(.cds--tab--list) {
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
max-height: fit-content;
|
|
129
|
+
overflow-x: visible;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
> button :global(.cds--tabs .cds--tabs__nav-link) {
|
|
133
|
+
border-bottom: none;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.flexSections {
|
|
138
|
+
display: flex;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.desktopTabs {
|
|
142
|
+
button {
|
|
143
|
+
height: 32px;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tabletTabs {
|
|
148
|
+
button {
|
|
149
|
+
height: 48px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tabContent {
|
|
154
|
+
border-top: 1px solid $ui-03;
|
|
155
|
+
padding: 1rem 0;
|
|
156
|
+
width: 70%;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.summaryContainer {
|
|
160
|
+
background-color: $ui-background;
|
|
161
|
+
display: grid;
|
|
162
|
+
grid-template-columns: max-content auto;
|
|
163
|
+
padding: 1rem 0rem;
|
|
164
|
+
|
|
165
|
+
:global(.cds--tabs) {
|
|
166
|
+
max-height: 30rem;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import styles from './shr-summary.scss';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell } from '@carbon/react';
|
|
5
|
+
import { itemDetails } from '../types';
|
|
6
|
+
import { usePagination } from '@openmrs/esm-framework';
|
|
7
|
+
import { PatientChartPagination } from '@openmrs/esm-patient-common-lib';
|
|
8
|
+
|
|
9
|
+
interface SHRDataTableProps {
|
|
10
|
+
data: itemDetails[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SHRDataTable: React.FC<SHRDataTableProps> = ({ data }) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const tableHeaders = ['Name', 'Value', 'Date Recorded'];
|
|
16
|
+
const urlLabel = t('seeAll', 'See all');
|
|
17
|
+
const pageUrl = `\${openmrsSpaBase}/patient/test/chart/SHR`;
|
|
18
|
+
|
|
19
|
+
const pagesize = 5;
|
|
20
|
+
const { results: paginatedData, goTo, currentPage } = usePagination(data ?? [], pagesize);
|
|
21
|
+
|
|
22
|
+
const tableRows = useMemo(() => {
|
|
23
|
+
return paginatedData?.map((payload) => ({
|
|
24
|
+
...[payload],
|
|
25
|
+
}));
|
|
26
|
+
}, [paginatedData]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={styles.widgetCard}>
|
|
30
|
+
<DataTable rows={tableRows} headers={tableHeaders}>
|
|
31
|
+
{({ rows, headers, getHeaderProps, getRowProps }) => (
|
|
32
|
+
<Table>
|
|
33
|
+
<TableHead>
|
|
34
|
+
<TableRow>
|
|
35
|
+
{headers.map((header) => (
|
|
36
|
+
<TableHeader {...getHeaderProps({ header })}>{header}</TableHeader>
|
|
37
|
+
))}
|
|
38
|
+
</TableRow>
|
|
39
|
+
</TableHead>
|
|
40
|
+
<TableBody>
|
|
41
|
+
{tableRows.map((row) => (
|
|
42
|
+
<TableRow {...getRowProps({ row })}>
|
|
43
|
+
<TableCell>{row[0].name}</TableCell>
|
|
44
|
+
<TableCell>{row[0].value}</TableCell>
|
|
45
|
+
<TableCell>{row[0].dateRecorded}</TableCell>
|
|
46
|
+
</TableRow>
|
|
47
|
+
))}
|
|
48
|
+
</TableBody>
|
|
49
|
+
</Table>
|
|
50
|
+
)}
|
|
51
|
+
</DataTable>
|
|
52
|
+
<PatientChartPagination
|
|
53
|
+
currentItems={paginatedData.length}
|
|
54
|
+
onPageNumberChange={({ page }) => goTo(page)}
|
|
55
|
+
pageNumber={currentPage}
|
|
56
|
+
pageSize={pagesize}
|
|
57
|
+
totalItems={data.length}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default SHRDataTable;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import styles from './shr-summary.scss';
|
|
3
|
+
import { Tab, Tabs, TabList, TabPanel, TabPanels, StructuredListSkeleton, Button } from '@carbon/react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { useLayoutType, useSession } from '@openmrs/esm-framework';
|
|
6
|
+
import { useSHRSummary } from '../hooks/useSHRSummary';
|
|
7
|
+
import { Printer } from '@carbon/react/icons';
|
|
8
|
+
import { useReactToPrint } from 'react-to-print';
|
|
9
|
+
import PrintComponent from '../print-layout/print.component';
|
|
10
|
+
import SHRDataTable from './shrDataTable.component';
|
|
11
|
+
|
|
12
|
+
interface SHRSummaryProps {
|
|
13
|
+
patientUuid: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SharedHealthRecordsSummary: React.FC<SHRSummaryProps> = ({ patientUuid }) => {
|
|
17
|
+
const { data, isError, isLoading } = useSHRSummary(patientUuid);
|
|
18
|
+
const currentUserSession = useSession();
|
|
19
|
+
const componentRef = useRef(null);
|
|
20
|
+
const [printMode, setPrintMode] = useState(false);
|
|
21
|
+
const layout = useLayoutType();
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const isTablet = useLayoutType() == 'tablet';
|
|
24
|
+
|
|
25
|
+
const printRef = useReactToPrint({
|
|
26
|
+
content: () => componentRef.current,
|
|
27
|
+
onBeforeGetContent: () => setPrintMode(true),
|
|
28
|
+
onAfterPrint: () => setPrintMode(false),
|
|
29
|
+
pageStyle: styles.pageStyle,
|
|
30
|
+
documentTitle: 'Shared Health Records',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
34
|
+
const handlePrint = async () => {
|
|
35
|
+
await delay(500);
|
|
36
|
+
printRef();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// If still loading
|
|
40
|
+
if (isLoading) {
|
|
41
|
+
return <StructuredListSkeleton role="progressbar" />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// If there is an error
|
|
45
|
+
if (isError) {
|
|
46
|
+
return <span>{t('errorSHRSummary', 'Error loading SHR summary')}</span>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If there is no data
|
|
50
|
+
if (Object.keys(data)?.length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const tableHeaders = [
|
|
55
|
+
{
|
|
56
|
+
key: 'name',
|
|
57
|
+
header: t('name', 'Name'),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: 'value',
|
|
61
|
+
header: t('value', 'Value'),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: 'dateRecorded',
|
|
65
|
+
header: t('daterecorded', 'Date Recorded'),
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const headers = ['Name', 'Value', 'Date Recorded'];
|
|
70
|
+
// const [selectedTab, setSelectedTab] = useState(0);
|
|
71
|
+
|
|
72
|
+
if (Object.keys(data).length > 0) {
|
|
73
|
+
return (
|
|
74
|
+
<div className={styles.bodyContainer} ref={componentRef}>
|
|
75
|
+
{printMode === true && <PrintComponent />}
|
|
76
|
+
|
|
77
|
+
<div className={styles.card}>
|
|
78
|
+
<div className={isTablet ? styles.tabletHeading : styles.desktopHeading}>
|
|
79
|
+
<h4 className={styles.title}> {t('shrPatientSHRSummary', 'Patient SHR Summary')}</h4>
|
|
80
|
+
{printMode === false && (
|
|
81
|
+
<Button
|
|
82
|
+
size="sm"
|
|
83
|
+
className={styles.btnShow}
|
|
84
|
+
onClick={() => {
|
|
85
|
+
handlePrint(), setPrintMode(true);
|
|
86
|
+
}}
|
|
87
|
+
kind="tertiary"
|
|
88
|
+
renderIcon={(props) => <Printer size={16} {...props} />}
|
|
89
|
+
iconDescription={t('print', 'Print')}>
|
|
90
|
+
{t('print', 'Print')}
|
|
91
|
+
</Button>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<hr />
|
|
96
|
+
|
|
97
|
+
<div className={styles.summaryContainer}>
|
|
98
|
+
<Tabs className={`${styles.verticalTabs} ${layout === 'tablet' ? styles.tabletTabs : styles.desktopTabs}`}>
|
|
99
|
+
<TabList aria-label="Shared Medical Record tabs" className={styles.tablist}>
|
|
100
|
+
<Tab
|
|
101
|
+
className={`${styles.tab} ${styles.bodyLong01}`}
|
|
102
|
+
id="vitals-tab"
|
|
103
|
+
disabled={data?.vitals.length <= 0}>
|
|
104
|
+
{t('vitals', 'Vitals')}
|
|
105
|
+
</Tab>
|
|
106
|
+
<Tab className={styles.tab} id="labresults-tab" disabled={data?.labResults.length <= 0}>
|
|
107
|
+
{t('labresults', 'labResults')}
|
|
108
|
+
</Tab>
|
|
109
|
+
<Tab className={styles.tab} id="complaints-tab" disabled={data?.complaints.length <= 0}>
|
|
110
|
+
{t('complaints', 'Complaints')}
|
|
111
|
+
</Tab>
|
|
112
|
+
<Tab className={styles.tab} id="diagnosis-tab" disabled={data?.diagnosis.length <= 0}>
|
|
113
|
+
{t('diagnosis', 'Diagnosis')}
|
|
114
|
+
</Tab>
|
|
115
|
+
<Tab className={styles.tab} id="allergies-tab" disabled={data?.allergies.length <= 0}>
|
|
116
|
+
{t('allergies', 'Allergies')}
|
|
117
|
+
</Tab>
|
|
118
|
+
<Tab className={styles.tab} id="conditions-tab" disabled={data?.conditions.length <= 0}>
|
|
119
|
+
{t('conditions', 'Conditions')}
|
|
120
|
+
</Tab>
|
|
121
|
+
<Tab className={styles.tab} id="medications-tab" disabled={data?.medications.length <= 0}>
|
|
122
|
+
{t('medications', 'Medications')}
|
|
123
|
+
</Tab>
|
|
124
|
+
</TabList>
|
|
125
|
+
<TabPanels>
|
|
126
|
+
<TabPanel>
|
|
127
|
+
<div>
|
|
128
|
+
<SHRDataTable data={data?.vitals} />
|
|
129
|
+
</div>
|
|
130
|
+
</TabPanel>
|
|
131
|
+
<TabPanel>
|
|
132
|
+
<div>
|
|
133
|
+
<SHRDataTable data={data?.labResults} />
|
|
134
|
+
</div>
|
|
135
|
+
</TabPanel>
|
|
136
|
+
<TabPanel>
|
|
137
|
+
<div>
|
|
138
|
+
<SHRDataTable data={data?.complaints} />
|
|
139
|
+
</div>
|
|
140
|
+
</TabPanel>
|
|
141
|
+
<TabPanel>
|
|
142
|
+
<div>
|
|
143
|
+
<SHRDataTable data={data?.diagnosis} />
|
|
144
|
+
</div>
|
|
145
|
+
</TabPanel>
|
|
146
|
+
<TabPanel>
|
|
147
|
+
<div>
|
|
148
|
+
<SHRDataTable data={data?.allergies} />
|
|
149
|
+
</div>
|
|
150
|
+
</TabPanel>
|
|
151
|
+
<TabPanel>
|
|
152
|
+
<div>
|
|
153
|
+
<SHRDataTable data={data?.conditions} />
|
|
154
|
+
</div>
|
|
155
|
+
</TabPanel>
|
|
156
|
+
<TabPanel>
|
|
157
|
+
<div>
|
|
158
|
+
<SHRDataTable data={data?.medications} />
|
|
159
|
+
</div>
|
|
160
|
+
</TabPanel>
|
|
161
|
+
</TabPanels>
|
|
162
|
+
</Tabs>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
} else {
|
|
168
|
+
return (
|
|
169
|
+
<div>
|
|
170
|
+
<h4 className={styles.title}> {t('noSharedHealthRecordsFound', 'No Shared Health Records Found')}</h4>
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default SharedHealthRecordsSummary;
|