@kenyaemr/esm-patient-clinical-view-app 5.4.2-pre.2687 → 5.4.2-pre.2694
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/{195.js → 397.js} +1 -1
- package/dist/397.js.map +1 -0
- package/dist/kenyaemr-esm-patient-clinical-view-app.js +2 -2
- package/dist/kenyaemr-esm-patient-clinical-view-app.js.buildmanifest.json +27 -27
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/config-schema.ts +0 -45
- package/src/index.ts +0 -9
- package/src/routes.json +0 -20
- package/dist/195.js.map +0 -1
- package/src/in-patient/admission-request.component.tsx +0 -117
- package/src/in-patient/admission-request.test.tsx +0 -450
- package/src/in-patient/encounter-observations/encounter-observations.component.tsx +0 -71
- package/src/in-patient/encounter-observations/index.ts +0 -3
- package/src/in-patient/encounter-observations/styles.scss +0 -22
- package/src/in-patient/encounter-observations/visit.resource.tsx +0 -161
- package/src/in-patient/in-patient-table/in-patient-table.component.tsx +0 -155
- package/src/in-patient/in-patient-table/in-patient-table.scss +0 -37
- package/src/in-patient/in-patient.component.tsx +0 -13
- package/src/in-patient/in-patient.meta.tsx +0 -10
- package/src/in-patient/in-patient.resource.tsx +0 -56
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { OpenmrsResource, Privilege } from '@openmrs/esm-framework';
|
|
2
|
-
|
|
3
|
-
export interface MappedEncounter {
|
|
4
|
-
id: string;
|
|
5
|
-
datetime: string;
|
|
6
|
-
encounterType: string;
|
|
7
|
-
editPrivilege: string;
|
|
8
|
-
form: OpenmrsResource;
|
|
9
|
-
obs: Array<Observation>;
|
|
10
|
-
provider: string;
|
|
11
|
-
visitUuid: string;
|
|
12
|
-
visitType: string;
|
|
13
|
-
visitTypeUuid?: string;
|
|
14
|
-
visitStartDatetime?: string;
|
|
15
|
-
visitStopDatetime?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface Encounter {
|
|
19
|
-
uuid: string;
|
|
20
|
-
diagnoses: Array<Diagnosis>;
|
|
21
|
-
encounterDatetime: string;
|
|
22
|
-
encounterProviders: Array<EncounterProvider>;
|
|
23
|
-
encounterType: {
|
|
24
|
-
uuid: string;
|
|
25
|
-
display: string;
|
|
26
|
-
viewPrivilege: Privilege;
|
|
27
|
-
editPrivilege: Privilege;
|
|
28
|
-
};
|
|
29
|
-
obs: Array<Observation>;
|
|
30
|
-
orders: Array<Order>;
|
|
31
|
-
form: OpenmrsResource;
|
|
32
|
-
patient: OpenmrsResource;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface EncounterProvider {
|
|
36
|
-
uuid: string;
|
|
37
|
-
display: string;
|
|
38
|
-
encounterRole: {
|
|
39
|
-
uuid: string;
|
|
40
|
-
display: string;
|
|
41
|
-
};
|
|
42
|
-
provider: {
|
|
43
|
-
uuid: string;
|
|
44
|
-
person: {
|
|
45
|
-
uuid: string;
|
|
46
|
-
display: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface Observation {
|
|
52
|
-
uuid: string;
|
|
53
|
-
concept: {
|
|
54
|
-
uuid: string;
|
|
55
|
-
display: string;
|
|
56
|
-
conceptClass: {
|
|
57
|
-
uuid: string;
|
|
58
|
-
display: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
display: string;
|
|
62
|
-
groupMembers: null | Array<{
|
|
63
|
-
uuid: string;
|
|
64
|
-
concept: {
|
|
65
|
-
uuid: string;
|
|
66
|
-
display: string;
|
|
67
|
-
};
|
|
68
|
-
value: {
|
|
69
|
-
uuid: string;
|
|
70
|
-
display: string;
|
|
71
|
-
};
|
|
72
|
-
display: string;
|
|
73
|
-
}>;
|
|
74
|
-
value: any;
|
|
75
|
-
obsDatetime?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface Order {
|
|
79
|
-
uuid: string;
|
|
80
|
-
dateActivated: string;
|
|
81
|
-
dateStopped?: Date | null;
|
|
82
|
-
dose: number;
|
|
83
|
-
dosingInstructions: string | null;
|
|
84
|
-
dosingType?: 'org.openmrs.FreeTextDosingInstructions' | 'org.openmrs.SimpleDosingInstructions';
|
|
85
|
-
doseUnits: {
|
|
86
|
-
uuid: string;
|
|
87
|
-
display: string;
|
|
88
|
-
};
|
|
89
|
-
drug: {
|
|
90
|
-
uuid: string;
|
|
91
|
-
name: string;
|
|
92
|
-
strength: string;
|
|
93
|
-
display: string;
|
|
94
|
-
};
|
|
95
|
-
duration: number;
|
|
96
|
-
durationUnits: {
|
|
97
|
-
uuid: string;
|
|
98
|
-
display: string;
|
|
99
|
-
};
|
|
100
|
-
frequency: {
|
|
101
|
-
uuid: string;
|
|
102
|
-
display: string;
|
|
103
|
-
};
|
|
104
|
-
numRefills: number;
|
|
105
|
-
orderNumber: string;
|
|
106
|
-
orderReason: string | null;
|
|
107
|
-
orderReasonNonCoded: string | null;
|
|
108
|
-
orderer: {
|
|
109
|
-
uuid: string;
|
|
110
|
-
person: {
|
|
111
|
-
uuid: string;
|
|
112
|
-
display: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
orderType: {
|
|
116
|
-
uuid: string;
|
|
117
|
-
display: string;
|
|
118
|
-
};
|
|
119
|
-
route: {
|
|
120
|
-
uuid: string;
|
|
121
|
-
display: string;
|
|
122
|
-
};
|
|
123
|
-
quantity: number;
|
|
124
|
-
quantityUnits: OpenmrsResource;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export interface Note {
|
|
128
|
-
concept: OpenmrsResource;
|
|
129
|
-
note: string;
|
|
130
|
-
provider: {
|
|
131
|
-
name: string;
|
|
132
|
-
role: string;
|
|
133
|
-
};
|
|
134
|
-
time: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface OrderItem {
|
|
138
|
-
order: Order;
|
|
139
|
-
provider: {
|
|
140
|
-
name: string;
|
|
141
|
-
role: string;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface Diagnosis {
|
|
146
|
-
certainty: string;
|
|
147
|
-
display: string;
|
|
148
|
-
encounter: OpenmrsResource;
|
|
149
|
-
links: Array<any>;
|
|
150
|
-
patient: OpenmrsResource;
|
|
151
|
-
rank: number;
|
|
152
|
-
resourceVersion: string;
|
|
153
|
-
uuid: string;
|
|
154
|
-
voided: boolean;
|
|
155
|
-
diagnosis: {
|
|
156
|
-
coded: {
|
|
157
|
-
display: string;
|
|
158
|
-
links: Array<any>;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
DataTable,
|
|
4
|
-
TableContainer,
|
|
5
|
-
Table,
|
|
6
|
-
TableHead,
|
|
7
|
-
TableRow,
|
|
8
|
-
TableExpandHeader,
|
|
9
|
-
TableHeader,
|
|
10
|
-
TableBody,
|
|
11
|
-
TableExpandRow,
|
|
12
|
-
TableExpandedRow,
|
|
13
|
-
TableCell,
|
|
14
|
-
Button,
|
|
15
|
-
} from '@carbon/react';
|
|
16
|
-
import { Edit } from '@carbon/react/icons';
|
|
17
|
-
import { Encounter } from '../encounter-observations/visit.resource';
|
|
18
|
-
import { useTranslation } from 'react-i18next';
|
|
19
|
-
import { formatDatetime, launchWorkspace, usePagination, Visit } from '@openmrs/esm-framework';
|
|
20
|
-
import EncounterObservations from '../encounter-observations';
|
|
21
|
-
import { EmptyState, PatientChartPagination } from '@openmrs/esm-patient-common-lib';
|
|
22
|
-
import styles from './in-patient-table.scss';
|
|
23
|
-
import { mutate } from 'swr';
|
|
24
|
-
|
|
25
|
-
type InPatientTableProps = {
|
|
26
|
-
tableRows: Array<Encounter>;
|
|
27
|
-
currentVisit: Visit;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const InPatientTable: React.FC<InPatientTableProps> = ({ tableRows }) => {
|
|
31
|
-
const { t } = useTranslation();
|
|
32
|
-
const headers = [
|
|
33
|
-
{ key: 'dateTime', header: t('dateDate', 'Date & time') },
|
|
34
|
-
{ key: 'formName', header: t('formName', 'Form Name') },
|
|
35
|
-
{ key: 'provider', header: t('provider', 'Provider') },
|
|
36
|
-
{ key: 'encounterType', header: t('encounterType', 'Encounter Type') },
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
const { results, goTo, currentPage } = usePagination(tableRows, 10);
|
|
40
|
-
|
|
41
|
-
const paginatedRows = useMemo(() => {
|
|
42
|
-
return results.map((row) => ({
|
|
43
|
-
id: row.uuid,
|
|
44
|
-
dateTime: formatDatetime(new Date(row.encounterDatetime), {
|
|
45
|
-
mode: 'standard',
|
|
46
|
-
}),
|
|
47
|
-
formName: row.form.display,
|
|
48
|
-
provider: row.encounterProviders[0]?.provider?.person?.display,
|
|
49
|
-
encounterType: row.encounterType.display,
|
|
50
|
-
}));
|
|
51
|
-
}, [results]);
|
|
52
|
-
|
|
53
|
-
const onEncounterEdit = (encounter: Encounter) => {
|
|
54
|
-
launchWorkspace('patient-form-entry-workspace', {
|
|
55
|
-
workspaceTitle: encounter.form.display,
|
|
56
|
-
mutateForm: () => {
|
|
57
|
-
mutate((key) => typeof key === 'string' && key.startsWith(`/ws/rest/v1/encounter`), undefined, {
|
|
58
|
-
revalidate: true,
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
formInfo: {
|
|
62
|
-
encounterUuid: encounter.uuid,
|
|
63
|
-
formUuid: encounter?.form?.uuid,
|
|
64
|
-
additionalProps: {},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
if (results.length === 0) {
|
|
70
|
-
return (
|
|
71
|
-
<EmptyState displayText={t('noEncounters', 'No encounters found')} headerTitle={t('encounters', 'Encounters')} />
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<>
|
|
77
|
-
<DataTable size="sm" useZebraStyles rows={paginatedRows} headers={headers}>
|
|
78
|
-
{({
|
|
79
|
-
rows,
|
|
80
|
-
headers,
|
|
81
|
-
getHeaderProps,
|
|
82
|
-
getRowProps,
|
|
83
|
-
|
|
84
|
-
getTableProps,
|
|
85
|
-
getTableContainerProps,
|
|
86
|
-
}) => (
|
|
87
|
-
<TableContainer
|
|
88
|
-
title={t('encounters', 'Encounters')}
|
|
89
|
-
description={t('encountersDescription', 'List of encounters during the current visit')}
|
|
90
|
-
{...getTableContainerProps()}>
|
|
91
|
-
<Table {...getTableProps()} aria-label="sample table">
|
|
92
|
-
<TableHead>
|
|
93
|
-
<TableRow>
|
|
94
|
-
<TableExpandHeader aria-label="expand row" />
|
|
95
|
-
{headers.map((header, i) => (
|
|
96
|
-
<TableHeader
|
|
97
|
-
key={i}
|
|
98
|
-
{...getHeaderProps({
|
|
99
|
-
header,
|
|
100
|
-
})}>
|
|
101
|
-
{header.header}
|
|
102
|
-
</TableHeader>
|
|
103
|
-
))}
|
|
104
|
-
</TableRow>
|
|
105
|
-
</TableHead>
|
|
106
|
-
<TableBody>
|
|
107
|
-
{rows.map((row, index) => (
|
|
108
|
-
<React.Fragment key={row.id}>
|
|
109
|
-
<TableExpandRow
|
|
110
|
-
{...getRowProps({
|
|
111
|
-
row,
|
|
112
|
-
})}>
|
|
113
|
-
{row.cells.map((cell) => (
|
|
114
|
-
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
115
|
-
))}
|
|
116
|
-
</TableExpandRow>
|
|
117
|
-
{row.isExpanded ? (
|
|
118
|
-
<TableExpandedRow className={styles.expandedRow} colSpan={headers.length + 2}>
|
|
119
|
-
<>
|
|
120
|
-
<EncounterObservations observations={results[index].obs} />
|
|
121
|
-
|
|
122
|
-
<>
|
|
123
|
-
{results[index]?.form?.uuid && (
|
|
124
|
-
<Button
|
|
125
|
-
kind="ghost"
|
|
126
|
-
onClick={() => onEncounterEdit(results[index])}
|
|
127
|
-
renderIcon={(props) => <Edit size={16} {...props} />}>
|
|
128
|
-
{t('editThisEncounter', 'Edit this encounter')}
|
|
129
|
-
</Button>
|
|
130
|
-
)}
|
|
131
|
-
</>
|
|
132
|
-
</>
|
|
133
|
-
</TableExpandedRow>
|
|
134
|
-
) : (
|
|
135
|
-
<TableExpandedRow className={styles.hiddenRow} colSpan={headers.length + 2} />
|
|
136
|
-
)}
|
|
137
|
-
</React.Fragment>
|
|
138
|
-
))}
|
|
139
|
-
</TableBody>
|
|
140
|
-
</Table>
|
|
141
|
-
</TableContainer>
|
|
142
|
-
)}
|
|
143
|
-
</DataTable>
|
|
144
|
-
<PatientChartPagination
|
|
145
|
-
currentItems={results.length}
|
|
146
|
-
totalItems={tableRows?.length}
|
|
147
|
-
pageNumber={currentPage}
|
|
148
|
-
pageSize={10}
|
|
149
|
-
onPageNumberChange={(page) => goTo(page)}
|
|
150
|
-
/>
|
|
151
|
-
</>
|
|
152
|
-
);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export default InPatientTable;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
@use '@carbon/styles/scss/spacing';
|
|
2
|
-
@use '@carbon/styles/scss/type';
|
|
3
|
-
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
4
|
-
|
|
5
|
-
.tableContainer {
|
|
6
|
-
padding: 0;
|
|
7
|
-
|
|
8
|
-
:global(.cds--data-table-header) {
|
|
9
|
-
padding: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:global(.cds--table-toolbar) {
|
|
13
|
-
position: relative;
|
|
14
|
-
overflow: visible;
|
|
15
|
-
top: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&:global(.cds--data-table-container) {
|
|
19
|
-
background: none !important;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.expandedRow {
|
|
24
|
-
padding-inline-start: 3.5rem;
|
|
25
|
-
|
|
26
|
-
> td {
|
|
27
|
-
padding: inherit !important;
|
|
28
|
-
|
|
29
|
-
> div {
|
|
30
|
-
max-height: max-content !important;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
> div {
|
|
35
|
-
background-color: $ui-02;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import AdmissionRequest from './admission-request.component';
|
|
3
|
-
|
|
4
|
-
type InPatientProps = {
|
|
5
|
-
patientUuid: string;
|
|
6
|
-
patient: fhir.Patient;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const InPatient: React.FC<InPatientProps> = ({ patientUuid }) => {
|
|
10
|
-
return <AdmissionRequest patientUuid={patientUuid} />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default InPatient;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const inPatientMeta = {
|
|
2
|
-
slot: 'patient-chart-in-patient-dashboard-slot',
|
|
3
|
-
path: 'in-patient',
|
|
4
|
-
title: 'In Patient',
|
|
5
|
-
moduleName: '@kenyaemr/esm-bed-management-app',
|
|
6
|
-
name: 'In Patient',
|
|
7
|
-
columns: 1,
|
|
8
|
-
config: {},
|
|
9
|
-
icon: 'omrs-icon-hospital-bed',
|
|
10
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type Encounter, openmrsFetch, restBaseUrl, useConfig } from '@openmrs/esm-framework';
|
|
2
|
-
import useSWR from 'swr';
|
|
3
|
-
import { BedManagementConfig } from '../config-schema';
|
|
4
|
-
import { AdmissionRequest } from '../types';
|
|
5
|
-
|
|
6
|
-
export const usePatientEncounters = (patientUuid: string) => {
|
|
7
|
-
const { inPatientForms } = useConfig<BedManagementConfig>();
|
|
8
|
-
const { data, isLoading, error, mutate } = useSWR<{
|
|
9
|
-
data: { results: Array<Encounter> };
|
|
10
|
-
}>(
|
|
11
|
-
`/ws/rest/v1/encounter?patient=${patientUuid}&v=custom:(uuid,display,encounterDatetime,obs:full,form:(uuid,display),encounterType:(uuid,display),encounterProviders:(uuid,display,encounterRole:(uuid,display),provider:(uuid,person:(uuid,display))),orders:(uuid,display),diagnoses:(uuid,display)`,
|
|
12
|
-
openmrsFetch,
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const encounters =
|
|
16
|
-
data?.data?.['results']?.filter((encounter) =>
|
|
17
|
-
inPatientForms?.find((form) => form.uuid === encounter?.form?.uuid),
|
|
18
|
-
) ?? [];
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
encounters: encounters,
|
|
22
|
-
isLoading,
|
|
23
|
-
error,
|
|
24
|
-
mutate,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const defaultRep =
|
|
29
|
-
'custom:(' +
|
|
30
|
-
'dispositionLocation,' +
|
|
31
|
-
'dispositionType,' +
|
|
32
|
-
'disposition,' +
|
|
33
|
-
'dispositionEncounter:full,' +
|
|
34
|
-
'patient:(uuid,identifiers,voided,' +
|
|
35
|
-
'person:(uuid,display,gender,age,birthdate,birthtime,preferredName,preferredAddress,dead,deathDate)),' +
|
|
36
|
-
'dispositionObsGroup,' +
|
|
37
|
-
'visit)';
|
|
38
|
-
|
|
39
|
-
export const useAdmissionRequest = (patientUuid: string) => {
|
|
40
|
-
const patientUuids = [patientUuid];
|
|
41
|
-
const searchParams = new URLSearchParams();
|
|
42
|
-
searchParams.set('dispositionType', 'ADMIT');
|
|
43
|
-
searchParams.set('patients', patientUuids.join(','));
|
|
44
|
-
searchParams.set('v', defaultRep);
|
|
45
|
-
|
|
46
|
-
const url = `${restBaseUrl}/emrapi/inpatient/request?${searchParams.toString()}`;
|
|
47
|
-
|
|
48
|
-
const { data, isLoading, error, mutate } = useSWR<{ data: { results: Array<AdmissionRequest> } }>(url, openmrsFetch);
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
admissionRequest: data?.data?.results ?? [],
|
|
52
|
-
isLoading: isLoading,
|
|
53
|
-
error: error,
|
|
54
|
-
mutate: mutate,
|
|
55
|
-
};
|
|
56
|
-
};
|