@palladium-ethiopia/esm-clinical-workflow-app 5.4.2-pre.4
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 +5 -0
- package/README.md +1 -0
- package/dist/127.js +1 -0
- package/dist/267.js +1 -0
- package/dist/267.js.map +1 -0
- package/dist/329.js +1 -0
- package/dist/329.js.map +1 -0
- package/dist/40.js +1 -0
- package/dist/449.js +1 -0
- package/dist/449.js.map +1 -0
- package/dist/466.js +1 -0
- package/dist/466.js.map +1 -0
- package/dist/472.js +1 -0
- package/dist/472.js.map +1 -0
- package/dist/532.js +43 -0
- package/dist/532.js.map +1 -0
- package/dist/542.js +1 -0
- package/dist/542.js.map +1 -0
- package/dist/571.js +1 -0
- package/dist/571.js.map +1 -0
- package/dist/593.js +6 -0
- package/dist/593.js.map +1 -0
- package/dist/689.js +1 -0
- package/dist/689.js.map +1 -0
- package/dist/697.js +1 -0
- package/dist/697.js.map +1 -0
- package/dist/77.js +1 -0
- package/dist/77.js.map +1 -0
- package/dist/847.js +1 -0
- package/dist/847.js.map +1 -0
- package/dist/85.js +1 -0
- package/dist/85.js.map +1 -0
- package/dist/91.js +1 -0
- package/dist/91.js.map +1 -0
- package/dist/916.js +1 -0
- package/dist/972.js +1 -0
- package/dist/972.js.map +1 -0
- package/dist/998.js +1 -0
- package/dist/998.js.map +1 -0
- package/dist/ethiopia-esm-clinical-workflow-app.js +5 -0
- package/dist/ethiopia-esm-clinical-workflow-app.js.buildmanifest.json +638 -0
- package/dist/ethiopia-esm-clinical-workflow-app.js.map +1 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +59 -0
- package/rspack.config.js +1 -0
- package/src/config-schema.ts +14 -0
- package/src/constants.ts +2 -0
- package/src/createDashboardLink.tsx +10 -0
- package/src/dashboard.meta.ts +6 -0
- package/src/declarations.d.ts +3 -0
- package/src/helper.ts +29 -0
- package/src/index.ts +26 -0
- package/src/patient-registration/patient-registration.resource.tsx +13 -0
- package/src/patient-registration/patient.registration.workspace.tsx +77 -0
- package/src/root.component.tsx +20 -0
- package/src/root.scss +10 -0
- package/src/routes.json +51 -0
- package/src/triage/triage-dashboard.component.tsx +99 -0
- package/src/triage/triage-dashboard.scss +24 -0
- package/src/triage/triage.resource.tsx +17 -0
- package/src/types/index.ts +0 -0
- package/translations/am.json +19 -0
- package/translations/en.json +19 -0
- package/translations/sw.json +19 -0
- package/tsconfig.json +4 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Button, ContentSwitcher, Switch } from '@carbon/react';
|
|
4
|
+
import { Add } from '@carbon/react/icons';
|
|
5
|
+
import {
|
|
6
|
+
ExtensionSlot,
|
|
7
|
+
fetchCurrentPatient,
|
|
8
|
+
launchWorkspace,
|
|
9
|
+
PageHeader,
|
|
10
|
+
showSnackbar,
|
|
11
|
+
TriagePictogram,
|
|
12
|
+
UserHasAccess,
|
|
13
|
+
} from '@openmrs/esm-framework';
|
|
14
|
+
|
|
15
|
+
import { createVisitForPatient } from './triage.resource';
|
|
16
|
+
|
|
17
|
+
import styles from './triage-dashboard.scss';
|
|
18
|
+
|
|
19
|
+
const TriageDashboard: React.FC = () => {
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const [selectedTriageType, setSelectedTriageType] = React.useState<string | null>(null);
|
|
22
|
+
|
|
23
|
+
const triageMap = {
|
|
24
|
+
centralTriage: '37f6bd8d-586a-4169-95fa-5781f987fe62',
|
|
25
|
+
emergencyTriage: '0038a296-62f8-4099-80e5-c9ea7590c157',
|
|
26
|
+
pediatricsTriage: 'a1a62d1e-2def-11e9-b210-d663bd873d93',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleStartVisitAndLaunchTriageForm = async (patientUuid: string) => {
|
|
30
|
+
const patient = await fetchCurrentPatient(patientUuid);
|
|
31
|
+
const visitResponse = await createVisitForPatient(patientUuid);
|
|
32
|
+
if (visitResponse.ok) {
|
|
33
|
+
// launch triage form based on switch button value
|
|
34
|
+
const { data: visit } = visitResponse;
|
|
35
|
+
launchWorkspace('patient-form-entry-workspace', {
|
|
36
|
+
patientUuid: patientUuid,
|
|
37
|
+
patient: patient,
|
|
38
|
+
visitContext: visit,
|
|
39
|
+
formInfo: {
|
|
40
|
+
encounterUuid: '',
|
|
41
|
+
visitUuid: visit.uuid,
|
|
42
|
+
formUuid: triageMap[selectedTriageType], // Triage form UUID
|
|
43
|
+
visitTypeUuid: visit.visitType.uuid,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
showSnackbar({
|
|
48
|
+
title: t('triageDashboardErrorStartingVisit', 'Error starting visit for patient'),
|
|
49
|
+
kind: 'error',
|
|
50
|
+
subtitle: t('triageDashboardPleaseTryAgain', 'Please try again.'),
|
|
51
|
+
isLowContrast: true,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<PageHeader
|
|
59
|
+
className={styles.pageHeader}
|
|
60
|
+
title={t('triageDashboard', 'Triage Dashboard')}
|
|
61
|
+
illustration={<TriagePictogram />}
|
|
62
|
+
/>
|
|
63
|
+
<div className={styles.headerActions}>
|
|
64
|
+
<ContentSwitcher
|
|
65
|
+
lowContrast
|
|
66
|
+
selectedIndex={-1}
|
|
67
|
+
size="md"
|
|
68
|
+
onChange={({ name }) => setSelectedTriageType(name as string)}>
|
|
69
|
+
<UserHasAccess privilege={'Central triage'}>
|
|
70
|
+
<Switch name="centralTriage" text={t('centralTriage', 'Central triage')} />
|
|
71
|
+
</UserHasAccess>
|
|
72
|
+
<UserHasAccess privilege="Emergency triage">
|
|
73
|
+
<Switch name="emergencyTriage" text={t('emergencyTriage', 'Emergency triage')} />
|
|
74
|
+
</UserHasAccess>
|
|
75
|
+
<UserHasAccess privilege="Pediatrics triage">
|
|
76
|
+
<Switch name="pediatricsTriage" text={t('pediatricsTriage', 'Pediatrics triage')} />
|
|
77
|
+
</UserHasAccess>
|
|
78
|
+
</ContentSwitcher>
|
|
79
|
+
</div>
|
|
80
|
+
<div className={styles.headerActions}>
|
|
81
|
+
<ExtensionSlot
|
|
82
|
+
className={styles.patientSearchBar}
|
|
83
|
+
name="patient-search-bar-slot"
|
|
84
|
+
state={{
|
|
85
|
+
selectPatientAction: (patientUuid) => handleStartVisitAndLaunchTriageForm(patientUuid),
|
|
86
|
+
buttonProps: {
|
|
87
|
+
kind: 'secondary',
|
|
88
|
+
},
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
<Button onClick={() => launchWorkspace('patient-registration-workspace')} kind="tertiary" renderIcon={Add}>
|
|
92
|
+
{t('registerNewPatient', 'Register New Patient')}
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default TriageDashboard;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@carbon/colors';
|
|
3
|
+
|
|
4
|
+
.contentSwitcher {
|
|
5
|
+
margin: layout.$spacing-05;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.headerActions {
|
|
9
|
+
display: flex;
|
|
10
|
+
column-gap: layout.$spacing-05;
|
|
11
|
+
margin: layout.$spacing-05;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.patientSearchBar {
|
|
15
|
+
width: 100%;
|
|
16
|
+
|
|
17
|
+
& form {
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pageHeader {
|
|
23
|
+
border-bottom: 1px solid colors.$gray-20;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl, Visit } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export const createVisitForPatient = async (patientUuid: string) => {
|
|
4
|
+
const url = `${restBaseUrl}/visit?v=full`;
|
|
5
|
+
const payload = {
|
|
6
|
+
patient: patientUuid,
|
|
7
|
+
visitType: '3371a4d4-f66f-4454-a86d-92c7b3da990c', // Outpatient visit type UUID
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return openmrsFetch<Visit>(url, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
},
|
|
15
|
+
body: JSON.stringify(payload),
|
|
16
|
+
});
|
|
17
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"centralTriage": "Central triage",
|
|
3
|
+
"emergencyTriage": "Emergency triage",
|
|
4
|
+
"enterFirstName": "Enter First Name",
|
|
5
|
+
"enterLastName": "Enter Last Name",
|
|
6
|
+
"enterMiddleName": "Enter Middle Name",
|
|
7
|
+
"firstName": "First Name",
|
|
8
|
+
"gender": "Gender",
|
|
9
|
+
"lastName": "Last Name",
|
|
10
|
+
"middleName": "Middle Name",
|
|
11
|
+
"pediatricsTriage": "Pediatrics triage",
|
|
12
|
+
"registerNewPatient": "Register New Patient",
|
|
13
|
+
"selectDOB": "Select Date of Birth",
|
|
14
|
+
"selectGender": "Select gender",
|
|
15
|
+
"submitRegistration": "Submit Registration",
|
|
16
|
+
"triageDashboard": "Triage Dashboard",
|
|
17
|
+
"triageDashboardErrorStartingVisit": "Error starting visit for patient",
|
|
18
|
+
"triageDashboardPleaseTryAgain": "Please try again."
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"centralTriage": "Central triage",
|
|
3
|
+
"emergencyTriage": "Emergency triage",
|
|
4
|
+
"enterFirstName": "Enter First Name",
|
|
5
|
+
"enterLastName": "Enter Last Name",
|
|
6
|
+
"enterMiddleName": "Enter Middle Name",
|
|
7
|
+
"firstName": "First Name",
|
|
8
|
+
"gender": "Gender",
|
|
9
|
+
"lastName": "Last Name",
|
|
10
|
+
"middleName": "Middle Name",
|
|
11
|
+
"pediatricsTriage": "Pediatrics triage",
|
|
12
|
+
"registerNewPatient": "Register New Patient",
|
|
13
|
+
"selectDOB": "Select Date of Birth",
|
|
14
|
+
"selectGender": "Select gender",
|
|
15
|
+
"submitRegistration": "Submit Registration",
|
|
16
|
+
"triageDashboard": "Triage Dashboard",
|
|
17
|
+
"triageDashboardErrorStartingVisit": "Error starting visit for patient",
|
|
18
|
+
"triageDashboardPleaseTryAgain": "Please try again."
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"centralTriage": "Central triage",
|
|
3
|
+
"emergencyTriage": "Emergency triage",
|
|
4
|
+
"enterFirstName": "Enter First Name",
|
|
5
|
+
"enterLastName": "Enter Last Name",
|
|
6
|
+
"enterMiddleName": "Enter Middle Name",
|
|
7
|
+
"firstName": "First Name",
|
|
8
|
+
"gender": "Gender",
|
|
9
|
+
"lastName": "Last Name",
|
|
10
|
+
"middleName": "Middle Name",
|
|
11
|
+
"pediatricsTriage": "Pediatrics triage",
|
|
12
|
+
"registerNewPatient": "Register New Patient",
|
|
13
|
+
"selectDOB": "Select Date of Birth",
|
|
14
|
+
"selectGender": "Select gender",
|
|
15
|
+
"submitRegistration": "Submit Registration",
|
|
16
|
+
"triageDashboard": "Triage Dashboard",
|
|
17
|
+
"triageDashboardErrorStartingVisit": "Error starting visit for patient",
|
|
18
|
+
"triageDashboardPleaseTryAgain": "Please try again."
|
|
19
|
+
}
|
package/tsconfig.json
ADDED