@kenyaemr/esm-ward-app 8.5.3-pre.87 → 8.5.3-pre.89
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 +4 -4
- package/dist/6009.js +1 -1
- package/dist/6009.js.map +1 -1
- package/dist/kenyaemr-esm-ward-app.js.buildmanifest.json +3 -3
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/ward-patients/admitted-patients.tsx +56 -47
- package/src/ward-patients/awaiting-admission-patients.tsx +60 -50
- package/src/ward-patients/discharge-in-patients.tsx +55 -47
- package/src/ward-patients/discharge-patients.tsx +105 -95
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
DataTableSkeleton,
|
|
4
4
|
OverflowMenu,
|
|
5
5
|
OverflowMenuItem,
|
|
6
|
+
Pagination,
|
|
7
|
+
Search,
|
|
6
8
|
Table,
|
|
7
9
|
TableBody,
|
|
8
10
|
TableCell,
|
|
@@ -10,25 +12,30 @@ import {
|
|
|
10
12
|
TableHead,
|
|
11
13
|
TableHeader,
|
|
12
14
|
TableRow,
|
|
13
|
-
Pagination,
|
|
14
15
|
} from '@carbon/react';
|
|
15
16
|
import { formatDatetime, launchWorkspace, parseDate, useAppContext, usePagination } from '@openmrs/esm-framework';
|
|
17
|
+
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
16
18
|
import dayjs from 'dayjs';
|
|
17
19
|
import React, { useMemo, useState } from 'react';
|
|
18
20
|
import { useTranslation } from 'react-i18next';
|
|
19
21
|
import { type WardPatient, type WardPatientWorkspaceProps, type WardViewContext } from '../types';
|
|
20
22
|
import { getOpenmrsId } from '../ward-view/ward-view.resource';
|
|
21
23
|
import AdmitPatientButton from '../ward-workspace/admit-patient-button.component';
|
|
22
|
-
import { EmptyState, ErrorState } from './table-state-components';
|
|
23
|
-
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
24
24
|
import { HyperLinkPatientCell } from './patient-cells';
|
|
25
|
+
import { EmptyState, ErrorState } from './table-state-components';
|
|
25
26
|
|
|
26
27
|
const AwaitingAdmissionPatients = () => {
|
|
27
28
|
const { t } = useTranslation();
|
|
29
|
+
const [search, setSearch] = useState('');
|
|
28
30
|
const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
|
|
29
31
|
const { inpatientRequests, isLoading, error } = wardPatientGroupDetails?.inpatientRequestResponse ?? {};
|
|
30
32
|
const [pageSize, setPageSize] = useState(5);
|
|
31
|
-
const
|
|
33
|
+
const searchResults = useMemo(() => {
|
|
34
|
+
return inpatientRequests?.filter((req) =>
|
|
35
|
+
req.patient?.person?.display.toLowerCase().includes(search.toLowerCase()),
|
|
36
|
+
);
|
|
37
|
+
}, [inpatientRequests, search]);
|
|
38
|
+
const { paginated, results, totalPages, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
32
39
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
33
40
|
|
|
34
41
|
const headers = [
|
|
@@ -109,52 +116,55 @@ const AwaitingAdmissionPatients = () => {
|
|
|
109
116
|
if (!inpatientRequests || !inpatientRequests.length)
|
|
110
117
|
return <EmptyState message={t('noPatientInAdmisionQueue', 'No patients in admission queue')} />;
|
|
111
118
|
return (
|
|
112
|
-
<
|
|
113
|
-
{(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
header
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
119
|
+
<div>
|
|
120
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
121
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
122
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
123
|
+
<TableContainer>
|
|
124
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
125
|
+
<TableHead>
|
|
126
|
+
<TableRow>
|
|
127
|
+
{headers.map((header) => (
|
|
128
|
+
<TableHeader
|
|
129
|
+
key={header.key}
|
|
130
|
+
{...getHeaderProps({
|
|
131
|
+
header,
|
|
132
|
+
})}>
|
|
133
|
+
{header.header}
|
|
134
|
+
</TableHeader>
|
|
135
|
+
))}
|
|
136
|
+
</TableRow>
|
|
137
|
+
</TableHead>
|
|
138
|
+
<TableBody>
|
|
139
|
+
{rows.map((row) => {
|
|
140
|
+
return (
|
|
141
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
142
|
+
{row.cells.map((cell) => (
|
|
143
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
144
|
+
{cell.value}
|
|
145
|
+
</TableCell>
|
|
146
|
+
))}
|
|
147
|
+
</TableRow>
|
|
148
|
+
);
|
|
149
|
+
})}
|
|
150
|
+
</TableBody>
|
|
151
|
+
</Table>
|
|
152
|
+
{paginated && !isLoading && (
|
|
153
|
+
<Pagination
|
|
154
|
+
page={currentPage}
|
|
155
|
+
pageSize={pageSize}
|
|
156
|
+
pageSizes={pageSizes}
|
|
157
|
+
totalItems={(inpatientRequests ?? []).length}
|
|
158
|
+
onChange={({ page, pageSize }) => {
|
|
159
|
+
goTo(page);
|
|
160
|
+
setPageSize(pageSize);
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</TableContainer>
|
|
165
|
+
)}
|
|
166
|
+
</DataTable>
|
|
167
|
+
</div>
|
|
158
168
|
);
|
|
159
169
|
};
|
|
160
170
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
OverflowMenu,
|
|
4
4
|
OverflowMenuItem,
|
|
5
5
|
Pagination,
|
|
6
|
+
Search,
|
|
6
7
|
Table,
|
|
7
8
|
TableBody,
|
|
8
9
|
TableCell,
|
|
@@ -33,6 +34,7 @@ import { EmptyState } from './table-state-components';
|
|
|
33
34
|
|
|
34
35
|
const DischargeInPatients = () => {
|
|
35
36
|
const { t } = useTranslation();
|
|
37
|
+
const [search, setSearch] = useState('');
|
|
36
38
|
const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
|
|
37
39
|
const { bedLayouts, wardAdmittedPatientsWithBed, isLoading } = wardPatientGroupDetails ?? {};
|
|
38
40
|
const { emrConfiguration, isLoadingEmrConfiguration, errorFetchingEmrConfiguration } = useEmrConfiguration();
|
|
@@ -86,7 +88,10 @@ const DischargeInPatients = () => {
|
|
|
86
88
|
}, [bedLayouts, wardAdmittedPatientsWithBed, config]);
|
|
87
89
|
|
|
88
90
|
const [pageSize, setPageSize] = useState(5);
|
|
89
|
-
const
|
|
91
|
+
const searchResults = useMemo(() => {
|
|
92
|
+
return patients?.filter((pat) => pat?.patient?.person?.display?.toLowerCase().includes(search.toLowerCase()));
|
|
93
|
+
}, [patients, search]);
|
|
94
|
+
const { paginated, results, totalPages, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
90
95
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
91
96
|
|
|
92
97
|
const tableRows = useMemo(() => {
|
|
@@ -147,52 +152,55 @@ const DischargeInPatients = () => {
|
|
|
147
152
|
if (!patients.length) return <EmptyState message={t('noDischargeInpatients', 'No Discharge in patients')} />;
|
|
148
153
|
|
|
149
154
|
return (
|
|
150
|
-
<
|
|
151
|
-
{(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
header
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
155
|
+
<div>
|
|
156
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
157
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
158
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
159
|
+
<TableContainer>
|
|
160
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
161
|
+
<TableHead>
|
|
162
|
+
<TableRow>
|
|
163
|
+
{headers.map((header) => (
|
|
164
|
+
<TableHeader
|
|
165
|
+
key={header.key}
|
|
166
|
+
{...getHeaderProps({
|
|
167
|
+
header,
|
|
168
|
+
})}>
|
|
169
|
+
{header.header}
|
|
170
|
+
</TableHeader>
|
|
171
|
+
))}
|
|
172
|
+
</TableRow>
|
|
173
|
+
</TableHead>
|
|
174
|
+
<TableBody>
|
|
175
|
+
{rows.map((row) => {
|
|
176
|
+
return (
|
|
177
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
178
|
+
{row.cells.map((cell) => (
|
|
179
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
180
|
+
{cell.value}
|
|
181
|
+
</TableCell>
|
|
182
|
+
))}
|
|
183
|
+
</TableRow>
|
|
184
|
+
);
|
|
185
|
+
})}
|
|
186
|
+
</TableBody>
|
|
187
|
+
</Table>
|
|
188
|
+
{paginated && !isLoading && (
|
|
189
|
+
<Pagination
|
|
190
|
+
page={currentPage}
|
|
191
|
+
pageSize={pageSize}
|
|
192
|
+
pageSizes={pageSizes}
|
|
193
|
+
totalItems={(patients ?? []).length}
|
|
194
|
+
onChange={({ page, pageSize }) => {
|
|
195
|
+
goTo(page);
|
|
196
|
+
setPageSize(pageSize);
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
)}
|
|
200
|
+
</TableContainer>
|
|
201
|
+
)}
|
|
202
|
+
</DataTable>
|
|
203
|
+
</div>
|
|
196
204
|
);
|
|
197
205
|
};
|
|
198
206
|
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
DataTableSkeleton,
|
|
4
4
|
OverflowMenu,
|
|
5
5
|
OverflowMenuItem,
|
|
6
|
+
Pagination,
|
|
7
|
+
Search,
|
|
6
8
|
Table,
|
|
7
9
|
TableBody,
|
|
8
10
|
TableCell,
|
|
@@ -10,13 +12,13 @@ import {
|
|
|
10
12
|
TableHead,
|
|
11
13
|
TableHeader,
|
|
12
14
|
TableRow,
|
|
13
|
-
Pagination,
|
|
14
15
|
} from '@carbon/react';
|
|
15
|
-
import
|
|
16
|
+
import { formatDatetime, parseDate, showModal } from '@openmrs/esm-framework';
|
|
17
|
+
import React, { useMemo, useState } from 'react';
|
|
16
18
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import
|
|
19
|
+
import DischargeSummary from '../discharge-printouts/discharge-summary';
|
|
20
|
+
import GatePassPrintout from '../discharge-printouts/gate-pass-printout';
|
|
18
21
|
import { useIpdDischargeEncounter } from '../hooks/useIpdDischargeEncounter';
|
|
19
|
-
import { formatDatetime, parseDate, showModal } from '@openmrs/esm-framework';
|
|
20
22
|
import {
|
|
21
23
|
HyperLinkPatientCell,
|
|
22
24
|
PatientAdmissionDateCell,
|
|
@@ -24,11 +26,12 @@ import {
|
|
|
24
26
|
PatientDayInWardCell,
|
|
25
27
|
PatientGenderCell,
|
|
26
28
|
} from './patient-cells';
|
|
27
|
-
import
|
|
28
|
-
import GatePassPrintout from '../discharge-printouts/gate-pass-printout';
|
|
29
|
+
import { EmptyState, ErrorState } from './table-state-components';
|
|
29
30
|
|
|
30
31
|
const DischargePatients = () => {
|
|
31
32
|
const { t } = useTranslation();
|
|
33
|
+
const [search, setSearch] = useState('');
|
|
34
|
+
|
|
32
35
|
const {
|
|
33
36
|
encounters,
|
|
34
37
|
error,
|
|
@@ -53,44 +56,48 @@ const DischargePatients = () => {
|
|
|
53
56
|
{ key: 'action', header: t('action', 'Action') },
|
|
54
57
|
];
|
|
55
58
|
const tableRows = useMemo(() => {
|
|
56
|
-
return encounters
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
59
|
+
return encounters
|
|
60
|
+
?.filter((encounter) => encounter.patient.name.toLowerCase().includes(search.toLowerCase()))
|
|
61
|
+
?.map((encounter, index) => {
|
|
62
|
+
return {
|
|
63
|
+
id: encounter.uuid,
|
|
64
|
+
dischargeDate: encounter.encounterDateTime ? formatDatetime(parseDate(encounter.encounterDateTime)) : '--',
|
|
65
|
+
admissionDate: (
|
|
66
|
+
<PatientAdmissionDateCell patientUuid={encounter.patient.uuid} encounterUuid={encounter.uuid} />
|
|
67
|
+
),
|
|
68
|
+
idNumber: encounter.patient.openmrsId,
|
|
69
|
+
name: <HyperLinkPatientCell patientName={encounter.patient.name} patientUuid={encounter.patient.uuid} />, //encounter.patient.name,
|
|
70
|
+
gender: <PatientGenderCell patientUuid={encounter.patient.uuid} />,
|
|
71
|
+
age: <PatientAgeCell patientUuid={encounter.patient.uuid} />,
|
|
72
|
+
bedNumber: '--',
|
|
73
|
+
daysAdmitted: <PatientDayInWardCell patientUuid={encounter.patient.uuid} encounterUuid={encounter.uuid} />,
|
|
74
|
+
action: (
|
|
75
|
+
<OverflowMenu size={'sm'} flipped>
|
|
76
|
+
<OverflowMenuItem
|
|
77
|
+
itemText={t('dischargeSummary', 'Discharge Summary')}
|
|
78
|
+
onClick={() => {
|
|
79
|
+
const dispose = showModal('patient-discharge-document-preview-modal', {
|
|
80
|
+
size: 'lg',
|
|
81
|
+
onClose: () => dispose(),
|
|
82
|
+
printout: <DischargeSummary dischargeEncounterUuid={encounter.uuid} patient={encounter.patient} />,
|
|
83
|
+
});
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
<OverflowMenuItem
|
|
87
|
+
itemText={t('gatePass', 'Gate Pass')}
|
|
88
|
+
onClick={() => {
|
|
89
|
+
const dispose = showModal('patient-discharge-document-preview-modal', {
|
|
90
|
+
size: 'lg',
|
|
91
|
+
onClose: () => dispose(),
|
|
92
|
+
printout: <GatePassPrintout dischargeEncounterUuid={encounter.uuid} patient={encounter.patient} />,
|
|
93
|
+
});
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
</OverflowMenu>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
}, [encounters, search, t]);
|
|
94
101
|
|
|
95
102
|
if (isLoading) return <DataTableSkeleton />;
|
|
96
103
|
if (error) return <ErrorState error={error} />;
|
|
@@ -98,57 +105,60 @@ const DischargePatients = () => {
|
|
|
98
105
|
if (!encounters?.length) return <EmptyState message={t('noDischargedPatients', 'No Discharged patients')} />;
|
|
99
106
|
|
|
100
107
|
return (
|
|
101
|
-
<
|
|
102
|
-
{(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
header
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
108
|
+
<div>
|
|
109
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
110
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
111
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
112
|
+
<TableContainer>
|
|
113
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
114
|
+
<TableHead>
|
|
115
|
+
<TableRow>
|
|
116
|
+
{headers.map((header) => (
|
|
117
|
+
<TableHeader
|
|
118
|
+
key={header.key}
|
|
119
|
+
{...getHeaderProps({
|
|
120
|
+
header,
|
|
121
|
+
})}>
|
|
122
|
+
{header.header}
|
|
123
|
+
</TableHeader>
|
|
124
|
+
))}
|
|
125
|
+
</TableRow>
|
|
126
|
+
</TableHead>
|
|
127
|
+
<TableBody>
|
|
128
|
+
{rows.map((row) => {
|
|
129
|
+
return (
|
|
130
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
131
|
+
{row.cells.map((cell) => (
|
|
132
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
133
|
+
{cell.value}
|
|
134
|
+
</TableCell>
|
|
135
|
+
))}
|
|
136
|
+
</TableRow>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
139
|
+
</TableBody>
|
|
140
|
+
</Table>
|
|
141
|
+
{paginated && !isLoading && (
|
|
142
|
+
<Pagination
|
|
143
|
+
forwardText=""
|
|
144
|
+
backwardText=""
|
|
145
|
+
page={currentPage}
|
|
146
|
+
pageSize={currPageSize}
|
|
147
|
+
pageSizes={pageSizes}
|
|
148
|
+
totalItems={totalCount}
|
|
149
|
+
size={'sm'}
|
|
150
|
+
onChange={({ page: newPage, pageSize }) => {
|
|
151
|
+
if (newPage !== currentPage) {
|
|
152
|
+
goTo(newPage);
|
|
153
|
+
}
|
|
154
|
+
setCurrPageSize(pageSize);
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
)}
|
|
158
|
+
</TableContainer>
|
|
159
|
+
)}
|
|
160
|
+
</DataTable>
|
|
161
|
+
</div>
|
|
152
162
|
);
|
|
153
163
|
};
|
|
154
164
|
|