@ampath/esm-dispensing-app 1.10.0-next.1
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +80 -0
- package/.husky/pre-commit +7 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +12 -0
- package/.tx/config +11 -0
- package/.yarn/versions/1c40b9b6.yml +0 -0
- package/.yarn/versions/ff162597.yml +0 -0
- package/LICENSE +401 -0
- package/README.md +124 -0
- package/__mocks__/react-i18next.js +51 -0
- package/dist/1043.js +1 -0
- package/dist/1043.js.map +1 -0
- package/dist/1119.js +1 -0
- package/dist/1197.js +1 -0
- package/dist/2146.js +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2690.js +1 -0
- package/dist/2890.js +2 -0
- package/dist/2890.js.LICENSE.txt +14 -0
- package/dist/2890.js.map +1 -0
- package/dist/2898.js +1 -0
- package/dist/2898.js.map +1 -0
- package/dist/3041.js +1 -0
- package/dist/3041.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3184.js +2 -0
- package/dist/3184.js.LICENSE.txt +14 -0
- package/dist/3184.js.map +1 -0
- package/dist/3568.js +1 -0
- package/dist/3568.js.map +1 -0
- package/dist/3584.js +1 -0
- package/dist/4055.js +1 -0
- package/dist/4099.js +1 -0
- package/dist/4099.js.map +1 -0
- package/dist/4132.js +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/439.js +1 -0
- package/dist/4618.js +1 -0
- package/dist/4652.js +1 -0
- package/dist/4944.js +1 -0
- package/dist/5173.js +1 -0
- package/dist/5241.js +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5442.js +1 -0
- package/dist/5661.js +1 -0
- package/dist/5897.js +1 -0
- package/dist/5897.js.map +1 -0
- package/dist/6022.js +1 -0
- package/dist/609.js +1 -0
- package/dist/609.js.map +1 -0
- package/dist/6468.js +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.LICENSE.txt +9 -0
- package/dist/6540.js.map +1 -0
- package/dist/6589.js +1 -0
- package/dist/6606.js +1 -0
- package/dist/6606.js.map +1 -0
- package/dist/6679.js +1 -0
- package/dist/6825.js +1 -0
- package/dist/6825.js.map +1 -0
- package/dist/6840.js +1 -0
- package/dist/6841.js +1 -0
- package/dist/6841.js.map +1 -0
- package/dist/6859.js +1 -0
- package/dist/7097.js +1 -0
- package/dist/7159.js +1 -0
- package/dist/723.js +1 -0
- package/dist/7240.js +1 -0
- package/dist/7240.js.map +1 -0
- package/dist/7255.js +1 -0
- package/dist/7255.js.map +1 -0
- package/dist/7617.js +1 -0
- package/dist/795.js +1 -0
- package/dist/8163.js +1 -0
- package/dist/8349.js +1 -0
- package/dist/8371.js +1 -0
- package/dist/8569.js +2 -0
- package/dist/8569.js.LICENSE.txt +41 -0
- package/dist/8569.js.map +1 -0
- package/dist/8600.js +1 -0
- package/dist/8600.js.map +1 -0
- package/dist/8618.js +1 -0
- package/dist/8885.js +1 -0
- package/dist/8885.js.map +1 -0
- package/dist/890.js +1 -0
- package/dist/9214.js +1 -0
- package/dist/9538.js +1 -0
- package/dist/9569.js +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.js.map +1 -0
- package/dist/963.js +1 -0
- package/dist/963.js.map +1 -0
- package/dist/986.js +1 -0
- package/dist/9879.js +1 -0
- package/dist/9895.js +1 -0
- package/dist/9900.js +1 -0
- package/dist/9913.js +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +51 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-dispensing-app.js +1 -0
- package/dist/openmrs-esm-dispensing-app.js.buildmanifest.json +1645 -0
- package/dist/openmrs-esm-dispensing-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/README.md +119 -0
- package/e2e/commands/drug-order-operations.ts +43 -0
- package/e2e/commands/encounter-operations.ts +60 -0
- package/e2e/commands/index.ts +5 -0
- package/e2e/commands/patient-operations.ts +109 -0
- package/e2e/commands/provider-operations.ts +9 -0
- package/e2e/commands/types/index.ts +157 -0
- package/e2e/commands/visit-operations.ts +38 -0
- package/e2e/core/global-setup.ts +32 -0
- package/e2e/core/index.ts +1 -0
- package/e2e/core/test.ts +31 -0
- package/e2e/fixtures/api.ts +27 -0
- package/e2e/fixtures/index.ts +1 -0
- package/e2e/pages/dispensing-page.ts +9 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/specs/active-prescriptions.spec.ts +72 -0
- package/e2e/specs/close-prescription.spec.ts +71 -0
- package/e2e/specs/dispense-medication.spec.ts +71 -0
- package/e2e/specs/pause-prescription.spec.ts +72 -0
- package/e2e/support/github/Dockerfile +34 -0
- package/e2e/support/github/docker-compose.yml +24 -0
- package/e2e/support/github/run-e2e-docker-env.sh +42 -0
- package/e2e/types/index.ts +157 -0
- package/example.env +7 -0
- package/jest.config.js +24 -0
- package/package.json +110 -0
- package/playwright.config.ts +36 -0
- package/prettier.config.js +8 -0
- package/src/components/action-buttons.component.tsx +87 -0
- package/src/components/action-buttons.scss +16 -0
- package/src/components/action-buttons.test.tsx +217 -0
- package/src/components/medication-card.component.tsx +37 -0
- package/src/components/medication-card.scss +20 -0
- package/src/components/medication-card.test.tsx +36 -0
- package/src/components/medication-dispense-review.scss +108 -0
- package/src/components/medication-event.component.tsx +96 -0
- package/src/components/medication-event.scss +44 -0
- package/src/components/medication-event.test.tsx +212 -0
- package/src/components/prescription-actions/close-action-button.component.tsx +50 -0
- package/src/components/prescription-actions/dispense-action-button.component.tsx +57 -0
- package/src/components/prescription-actions/pause-action-button.component.tsx +49 -0
- package/src/conditions/conditions.component.tsx +118 -0
- package/src/conditions/conditions.resource.ts +100 -0
- package/src/conditions/conditions.scss +26 -0
- package/src/conditions/conditions.test.tsx +200 -0
- package/src/config-schema.ts +192 -0
- package/src/constants.ts +22 -0
- package/src/dashboard/dispensing-dashboard-link.component.tsx +36 -0
- package/src/dashboard/dispensing-dashboard.component.tsx +36 -0
- package/src/declarations.d.ts +2 -0
- package/src/diagnoses/diagnoses.component.tsx +111 -0
- package/src/diagnoses/diagnoses.resource.ts +30 -0
- package/src/diagnoses/diagnoses.scss +31 -0
- package/src/dispensing-link.component.tsx +9 -0
- package/src/dispensing-tiles/dispensing-tile.component.tsx +42 -0
- package/src/dispensing-tiles/dispensing-tile.scss +43 -0
- package/src/dispensing-tiles/dispensing-tiles.component.tsx +39 -0
- package/src/dispensing-tiles/dispensing-tiles.resource.tsx +30 -0
- package/src/dispensing-tiles/dispensing-tiles.scss +11 -0
- package/src/dispensing.component.tsx +31 -0
- package/src/dispensing.scss +5 -0
- package/src/dispensing.test.tsx +9 -0
- package/src/fill-prescription/fill-prescription-button.component.tsx +103 -0
- package/src/fill-prescription/fill-prescription-button.scss +8 -0
- package/src/fill-prescription/on-prescription-filled.modal.tsx +140 -0
- package/src/fill-prescription/on-prescription-filled.scss +7 -0
- package/src/forms/close-dispense-form.workspace.tsx +194 -0
- package/src/forms/dispense-form.workspace.test.tsx +334 -0
- package/src/forms/dispense-form.workspace.tsx +324 -0
- package/src/forms/forms.scss +152 -0
- package/src/forms/medication-dispense-review.component.tsx +649 -0
- package/src/forms/medication-dispense-review.test.tsx +158 -0
- package/src/forms/pause-dispense-form.workspace.tsx +196 -0
- package/src/forms/stock-dispense/stock-dispense.component.tsx +126 -0
- package/src/forms/stock-dispense/stock.resource.tsx +67 -0
- package/src/history/delete-confirm.modal.tsx +35 -0
- package/src/history/history-and-comments.component.tsx +338 -0
- package/src/history/history-and-comments.scss +54 -0
- package/src/index.ts +57 -0
- package/src/location/location.resource.test.tsx +108 -0
- package/src/location/location.resource.tsx +32 -0
- package/src/medication/medication.resource.test.tsx +156 -0
- package/src/medication/medication.resource.tsx +45 -0
- package/src/medication-dispense/medication-dispense.resource.test.tsx +243 -0
- package/src/medication-dispense/medication-dispense.resource.tsx +178 -0
- package/src/medication-request/medication-request.resource.test.tsx +1333 -0
- package/src/medication-request/medication-request.resource.tsx +257 -0
- package/src/patient/patient-info-cell.component.tsx +26 -0
- package/src/patient/patient.resources.ts +14 -0
- package/src/pharmacy-header/pharmacy-header.component.tsx +35 -0
- package/src/pharmacy-header/pharmacy-header.scss +55 -0
- package/src/pharmacy-header/pharmacy-illustration.component.tsx +30 -0
- package/src/prescriptions/patient-search-tab-panel.component.tsx +58 -0
- package/src/prescriptions/patient-search-tab-panel.scss +26 -0
- package/src/prescriptions/prescription-actions.component.tsx +24 -0
- package/src/prescriptions/prescription-actions.scss +14 -0
- package/src/prescriptions/prescription-details.component.tsx +152 -0
- package/src/prescriptions/prescription-details.scss +87 -0
- package/src/prescriptions/prescription-details.test.tsx +267 -0
- package/src/prescriptions/prescription-expanded.component.tsx +58 -0
- package/src/prescriptions/prescription-expanded.scss +56 -0
- package/src/prescriptions/prescription-tab-lists.component.tsx +70 -0
- package/src/prescriptions/prescription-tab-panel.component.tsx +83 -0
- package/src/prescriptions/prescriptions-table.component.tsx +189 -0
- package/src/prescriptions/prescriptions.scss +152 -0
- package/src/print-prescription/prescription-print-action.component.tsx +30 -0
- package/src/print-prescription/prescription-print-preview.modal.tsx +92 -0
- package/src/print-prescription/prescription-printout.component.tsx +154 -0
- package/src/print-prescription/print-prescription.scss +75 -0
- package/src/print-prescription/printable-prescriptions.component.tsx +57 -0
- package/src/routes.json +137 -0
- package/src/types.ts +530 -0
- package/src/utils.test.ts +2947 -0
- package/src/utils.ts +637 -0
- package/tools/i18next-parser.config.js +89 -0
- package/tools/setup-tests.ts +8 -0
- package/tools/update-openmrs-deps.mjs +42 -0
- package/translations/am.json +133 -0
- package/translations/ar.json +133 -0
- package/translations/ar_SY.json +133 -0
- package/translations/bn.json +133 -0
- package/translations/cs.json +133 -0
- package/translations/de.json +133 -0
- package/translations/en.json +133 -0
- package/translations/en_US.json +133 -0
- package/translations/es.json +133 -0
- package/translations/es_MX.json +133 -0
- package/translations/fr.json +133 -0
- package/translations/he.json +133 -0
- package/translations/hi.json +133 -0
- package/translations/hi_IN.json +133 -0
- package/translations/id.json +133 -0
- package/translations/it.json +133 -0
- package/translations/ka.json +133 -0
- package/translations/km.json +133 -0
- package/translations/ku.json +133 -0
- package/translations/ky.json +133 -0
- package/translations/lg.json +133 -0
- package/translations/ne.json +133 -0
- package/translations/pl.json +133 -0
- package/translations/pt.json +133 -0
- package/translations/pt_BR.json +133 -0
- package/translations/qu.json +133 -0
- package/translations/ro_RO.json +133 -0
- package/translations/ru_RU.json +133 -0
- package/translations/si.json +133 -0
- package/translations/sq.json +133 -0
- package/translations/sw.json +133 -0
- package/translations/sw_KE.json +133 -0
- package/translations/tr.json +133 -0
- package/translations/tr_TR.json +133 -0
- package/translations/uk.json +133 -0
- package/translations/uz.json +133 -0
- package/translations/uz@Latn.json +133 -0
- package/translations/uz_UZ.json +133 -0
- package/translations/vi.json +133 -0
- package/translations/zh.json +133 -0
- package/translations/zh_CN.json +133 -0
- package/translations/zh_TW.json +133 -0
- package/tsconfig.json +23 -0
- package/turbo.json +41 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Layer, StructuredListBody, StructuredListCell, StructuredListRow, StructuredListWrapper } from '@carbon/react';
|
|
5
|
+
import { formatDate, parseDate, useSession } from '@openmrs/esm-framework';
|
|
6
|
+
import { type DosageInstruction, type MedicationRequestBundle, type Quantity } from '../types';
|
|
7
|
+
import {
|
|
8
|
+
getDosageInstruction,
|
|
9
|
+
getMedicationDisplay,
|
|
10
|
+
getMedicationReferenceOrCodeableConcept,
|
|
11
|
+
getQuantity,
|
|
12
|
+
getRefillsAllowed,
|
|
13
|
+
} from '../utils';
|
|
14
|
+
import styles from './print-prescription.scss';
|
|
15
|
+
|
|
16
|
+
type PrescriptionsPrintoutProps = {
|
|
17
|
+
excludedPrescription: Array<string>;
|
|
18
|
+
medicationRequests: Array<MedicationRequestBundle>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const PrescriptionsPrintout: React.FC<PrescriptionsPrintoutProps> = ({ excludedPrescription, medicationRequests }) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const {
|
|
24
|
+
sessionLocation: { display: facilityName },
|
|
25
|
+
} = useSession();
|
|
26
|
+
const patient = medicationRequests[0]?.request?.subject;
|
|
27
|
+
|
|
28
|
+
const extractPatientName = (display: string) => (display.includes('(') ? display.split('(')[0] : display);
|
|
29
|
+
|
|
30
|
+
const requesters = useMemo(() => {
|
|
31
|
+
const uniqueRequesters = new Set<string>();
|
|
32
|
+
medicationRequests
|
|
33
|
+
?.filter((req) => !excludedPrescription.includes(req.request.id))
|
|
34
|
+
?.forEach((request) => {
|
|
35
|
+
const display = request.request?.requester?.display;
|
|
36
|
+
if (display) uniqueRequesters.add(display);
|
|
37
|
+
});
|
|
38
|
+
return uniqueRequesters;
|
|
39
|
+
}, [medicationRequests, excludedPrescription]);
|
|
40
|
+
|
|
41
|
+
const filteredRequests = useMemo(
|
|
42
|
+
() => medicationRequests?.filter((req) => !excludedPrescription.includes(req.request.id)) || [],
|
|
43
|
+
[medicationRequests, excludedPrescription],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Layer className={styles.printOutContainer}>
|
|
48
|
+
<StructuredListWrapper>
|
|
49
|
+
<StructuredListBody>
|
|
50
|
+
<StructuredListRow head>
|
|
51
|
+
<StructuredListCell head>
|
|
52
|
+
<br />
|
|
53
|
+
<br />
|
|
54
|
+
<p className={styles.printoutTitle}>{t('prescriptionInstructions', 'Prescription instructions')}</p>
|
|
55
|
+
{patient && (
|
|
56
|
+
<p className={classNames(styles.patientName, styles.faintText)}>
|
|
57
|
+
{extractPatientName(patient.display)}
|
|
58
|
+
</p>
|
|
59
|
+
)}
|
|
60
|
+
<br />
|
|
61
|
+
<br />
|
|
62
|
+
</StructuredListCell>
|
|
63
|
+
</StructuredListRow>
|
|
64
|
+
{filteredRequests.map((request) => {
|
|
65
|
+
const medicationEvent = request.request;
|
|
66
|
+
const dosageInstruction: DosageInstruction = getDosageInstruction(medicationEvent.dosageInstruction);
|
|
67
|
+
const quantity: Quantity = getQuantity(medicationEvent);
|
|
68
|
+
const numberOfRefillsAllowed: number = getRefillsAllowed(medicationEvent);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div key={request.request.id}>
|
|
72
|
+
{dosageInstruction && (
|
|
73
|
+
<StructuredListRow>
|
|
74
|
+
<StructuredListCell>
|
|
75
|
+
<p className={styles.medicationName}>
|
|
76
|
+
<strong>
|
|
77
|
+
{getMedicationDisplay(getMedicationReferenceOrCodeableConcept(medicationEvent))}
|
|
78
|
+
</strong>
|
|
79
|
+
</p>
|
|
80
|
+
<br />
|
|
81
|
+
<p>
|
|
82
|
+
<span className={styles.faintText}>{t('dose', 'Dose')}</span>
|
|
83
|
+
{': '}
|
|
84
|
+
<span className={styles.prescriptionInfo}>
|
|
85
|
+
{dosageInstruction?.doseAndRate?.map((doseAndRate, index) => {
|
|
86
|
+
return (
|
|
87
|
+
<span className={styles.prescriptionInfo} key={`dose-${request.request.id}-${index}`}>
|
|
88
|
+
{doseAndRate?.doseQuantity?.value} {doseAndRate?.doseQuantity?.unit}
|
|
89
|
+
</span>
|
|
90
|
+
);
|
|
91
|
+
})}
|
|
92
|
+
</span>{' '}
|
|
93
|
+
—{' '}
|
|
94
|
+
<span className={styles.prescriptionInfo}>
|
|
95
|
+
{dosageInstruction?.route?.text} — {dosageInstruction?.timing?.code?.text}
|
|
96
|
+
{dosageInstruction?.timing?.repeat?.duration
|
|
97
|
+
? ` ${t('for', 'for')} ${dosageInstruction?.timing?.repeat?.duration} ${dosageInstruction?.timing?.repeat?.durationUnit}`
|
|
98
|
+
: ''}
|
|
99
|
+
</span>
|
|
100
|
+
{quantity && (
|
|
101
|
+
<div>
|
|
102
|
+
<span className={styles.faintText}>{t('quantity', 'Quantity')}</span>
|
|
103
|
+
{': '}
|
|
104
|
+
<span className={styles.prescriptionInfo}>
|
|
105
|
+
{quantity.value} {quantity.unit}
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
109
|
+
</p>
|
|
110
|
+
<p>
|
|
111
|
+
<span className={styles.faintText}>{t('datePrescribed', 'Date prescribed')}</span>
|
|
112
|
+
{': '}{' '}
|
|
113
|
+
<span className={styles.prescriptionInfo}>
|
|
114
|
+
{formatDate(parseDate(request.request.authoredOn), { noToday: true })}
|
|
115
|
+
</span>
|
|
116
|
+
</p>
|
|
117
|
+
<p>
|
|
118
|
+
<span className={styles.faintText}>{t('refills', 'Refills')}</span>
|
|
119
|
+
{': '}{' '}
|
|
120
|
+
<span className={styles.prescriptionInfo}>
|
|
121
|
+
{numberOfRefillsAllowed || numberOfRefillsAllowed === 0
|
|
122
|
+
? numberOfRefillsAllowed
|
|
123
|
+
: t('noRefills', 'No refills')}
|
|
124
|
+
</span>
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
{dosageInstruction?.text && <p>{dosageInstruction.text}</p>}
|
|
128
|
+
{dosageInstruction?.additionalInstruction?.length > 0 && (
|
|
129
|
+
<p>
|
|
130
|
+
{dosageInstruction?.additionalInstruction.map((instruction) => instruction.text).join(', ')}
|
|
131
|
+
</p>
|
|
132
|
+
)}
|
|
133
|
+
</StructuredListCell>
|
|
134
|
+
</StructuredListRow>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
139
|
+
{requesters.size > 0 && (
|
|
140
|
+
<p className={styles.prescriber}>
|
|
141
|
+
{t('prescribedBy', 'Prescribed By')}:{' '}
|
|
142
|
+
{Array.from(requesters.values())
|
|
143
|
+
.map((name) => name?.split('(')?.at(0))
|
|
144
|
+
?.join(', ')}
|
|
145
|
+
</p>
|
|
146
|
+
)}
|
|
147
|
+
<p className={styles.facilityName}>{facilityName}</p>
|
|
148
|
+
</StructuredListBody>
|
|
149
|
+
</StructuredListWrapper>
|
|
150
|
+
</Layer>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export default PrescriptionsPrintout;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
|
|
5
|
+
.title {
|
|
6
|
+
@include type.type-style('heading-02');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.btnSet {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.faintText {
|
|
14
|
+
color: colors.$black;
|
|
15
|
+
@include type.type-style('heading-01');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.printOutContainer {
|
|
19
|
+
width: 20rem;
|
|
20
|
+
background-color: colors.$white;
|
|
21
|
+
padding: layout.$spacing-03;
|
|
22
|
+
|
|
23
|
+
@media print {
|
|
24
|
+
background-color: colors.$white;
|
|
25
|
+
height: 100vh;
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.printoutTitle {
|
|
31
|
+
@include type.type-style('heading-03');
|
|
32
|
+
text-align: center;
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.facilityName {
|
|
37
|
+
color: colors.$black;
|
|
38
|
+
text-align: end;
|
|
39
|
+
padding: layout.$spacing-05;
|
|
40
|
+
@include type.type-style('label-01');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.prescriber {
|
|
44
|
+
color: colors.$black;
|
|
45
|
+
padding: layout.$spacing-05;
|
|
46
|
+
@include type.type-style('label-01');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.printoutSelectorRow {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
gap: layout.$spacing-05;
|
|
53
|
+
padding: 0 layout.$spacing-05 0 layout.$spacing-05;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.patientName {
|
|
58
|
+
text-transform: capitalize;
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.printPreviewContainer {
|
|
63
|
+
background-color: colors.$white;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.prescriptionInfo {
|
|
67
|
+
color: colors.$black;
|
|
68
|
+
font-weight: bolder;
|
|
69
|
+
@include type.type-style('label-01');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.medicationName {
|
|
73
|
+
@include type.type-style('body-compact-02');
|
|
74
|
+
color: colors.$black;
|
|
75
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { Checkbox } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { type DosageInstruction, type MedicationRequestBundle } from '../types';
|
|
5
|
+
import { getDosageInstruction, getMedicationDisplay, getMedicationReferenceOrCodeableConcept } from '../utils';
|
|
6
|
+
|
|
7
|
+
type PrintablePrescriptionsSelectorProps = {
|
|
8
|
+
medicationRequests: Array<MedicationRequestBundle>;
|
|
9
|
+
excludedPrescription: Array<string>;
|
|
10
|
+
onExcludedPrescriptionChange: React.Dispatch<React.SetStateAction<string[]>>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const PrintablePrescriptionsSelector: React.FC<PrintablePrescriptionsSelectorProps> = ({
|
|
14
|
+
medicationRequests,
|
|
15
|
+
onExcludedPrescriptionChange,
|
|
16
|
+
excludedPrescription,
|
|
17
|
+
}) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
|
|
20
|
+
const handleChange = useCallback(
|
|
21
|
+
(checked: boolean, medicationEventId: string) => {
|
|
22
|
+
if (checked) {
|
|
23
|
+
onExcludedPrescriptionChange(excludedPrescription.filter((id) => id !== medicationEventId));
|
|
24
|
+
} else {
|
|
25
|
+
onExcludedPrescriptionChange([...excludedPrescription, medicationEventId]);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
[onExcludedPrescriptionChange, excludedPrescription],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<p>
|
|
34
|
+
<strong>{t('selectPrescriptions', 'Check prescriptions to print')}</strong>
|
|
35
|
+
</p>
|
|
36
|
+
{medicationRequests?.map((request) => {
|
|
37
|
+
const medicationEvent = request.request;
|
|
38
|
+
const dosageInstruction: DosageInstruction = getDosageInstruction(medicationEvent.dosageInstruction);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div key={medicationEvent.id}>
|
|
42
|
+
{dosageInstruction && (
|
|
43
|
+
<Checkbox
|
|
44
|
+
id={medicationEvent.id}
|
|
45
|
+
labelText={getMedicationDisplay(getMedicationReferenceOrCodeableConcept(medicationEvent))}
|
|
46
|
+
checked={!excludedPrescription.includes(medicationEvent.id)}
|
|
47
|
+
onChange={(_, { checked }) => handleChange(checked, medicationEvent.id)}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default PrintablePrescriptionsSelector;
|
package/src/routes.json
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"fhir2": ">=1.2",
|
|
5
|
+
"webservices.rest": ">=2.2.0"
|
|
6
|
+
},
|
|
7
|
+
"pages": [
|
|
8
|
+
{
|
|
9
|
+
"component": "dispensing",
|
|
10
|
+
"route": "dispensing",
|
|
11
|
+
"online": true,
|
|
12
|
+
"offline": true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"extensions": [
|
|
16
|
+
{
|
|
17
|
+
"name": "dispensing-link",
|
|
18
|
+
"slot": "app-menu-slot",
|
|
19
|
+
"component": "dispensingLink",
|
|
20
|
+
"online": true,
|
|
21
|
+
"offline": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "patient-diagnoses",
|
|
25
|
+
"component": "patientDiagnoses",
|
|
26
|
+
"slot": "dispensing-condition-and-diagnoses",
|
|
27
|
+
"online": true,
|
|
28
|
+
"offline": true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "patient-conditions",
|
|
32
|
+
"component": "patientConditions",
|
|
33
|
+
"slot": "dispensing-condition-and-diagnoses",
|
|
34
|
+
"online": true,
|
|
35
|
+
"offline": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "dispensing-dashboard",
|
|
39
|
+
"slot": "dispensing-dashboard-slot",
|
|
40
|
+
"component": "dispensingDashboard",
|
|
41
|
+
"online": true,
|
|
42
|
+
"offline": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "dispensing-dashboard-link",
|
|
46
|
+
"component": "dispensingDashboardLink",
|
|
47
|
+
"meta": {
|
|
48
|
+
"name": "dispensing",
|
|
49
|
+
"slot": "dispensing-dashboard-slot",
|
|
50
|
+
"title": "Dispensing"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "dispense-action-button",
|
|
55
|
+
"slot": "prescription-action-button-slot",
|
|
56
|
+
"component": "dispenseActionButton"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "pause-action-button",
|
|
60
|
+
"slot": "prescription-action-button-slot",
|
|
61
|
+
"component": "pauseActionButton"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "close-action-button",
|
|
65
|
+
"slot": "prescription-action-button-slot",
|
|
66
|
+
"component": "closeActionButton"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"workspaces2": [
|
|
70
|
+
{
|
|
71
|
+
"name": "close-dispense-workspace",
|
|
72
|
+
"component": "closeDispenseWorkspace",
|
|
73
|
+
"window": "dispensing-window"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "pause-dispense-workspace",
|
|
77
|
+
"component": "pauseDispenseWorkspace",
|
|
78
|
+
"window": "dispensing-window"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "dispense-workspace",
|
|
82
|
+
"component": "dispenseWorkspace",
|
|
83
|
+
"window": "dispensing-window"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "dispensing-patient-search-workspace",
|
|
87
|
+
"component": "@openmrs/esm-patient-search-app#patientSearchWorkspace2",
|
|
88
|
+
"window": "fill-prescription-window"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "dispensing-start-visit-workspace",
|
|
92
|
+
"component": "@openmrs/esm-patient-chart-app#exportedVisitForm",
|
|
93
|
+
"window": "fill-prescription-window"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "dispensing-order-basket-workspace",
|
|
97
|
+
"component": "@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace",
|
|
98
|
+
"window": "fill-prescription-window"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "dispensing-order-basket-add-drug-order-workspace",
|
|
102
|
+
"component": "@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace",
|
|
103
|
+
"window": "fill-prescription-window"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"workspaceWindows2": [
|
|
107
|
+
{
|
|
108
|
+
"name": "dispensing-window",
|
|
109
|
+
"group": "dispensing-group"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "fill-prescription-window",
|
|
113
|
+
"group": "dispensing-group"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"workspaceGroups2": [
|
|
117
|
+
{
|
|
118
|
+
"name": "dispensing-group",
|
|
119
|
+
"overlay": true
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"modals": [
|
|
123
|
+
{
|
|
124
|
+
"name": "prescription-print-preview-modal",
|
|
125
|
+
"component": "printPrescriptionPreviewModal"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "delete-confirm-modal",
|
|
129
|
+
"component": "deleteConfirmModal"
|
|
130
|
+
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "on-prescription-filled-modal",
|
|
134
|
+
"component": "onPrescriptionFilledModal"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|