@ampath/esm-reports-app 1.0.0-next.80 → 1.0.0-next.82
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/README.md +2 -0
- package/dist/410.js +1 -1
- package/dist/410.js.map +1 -1
- package/dist/544.css +1 -0
- package/dist/544.css.map +1 -0
- package/dist/544.js +1 -0
- package/dist/544.js.map +1 -0
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/ampath-esm-reports-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/local-config.json +5 -0
- package/package.json +3 -2
- package/src/common/report-register/report-parents.ts +2 -0
- package/src/dashboard/report-catalog.ts +16 -0
- package/src/reports/moh-643/moh-643.component.tsx +222 -0
- package/src/reports/moh-643/moh-643.rows.ts +77 -0
- package/src/reports/moh-643/moh-643.scss +164 -0
- package/src/reports/moh-643/registers/moh-643-register.component.tsx +112 -0
- package/src/reports/moh-643/registers/moh-643.columns.ts +32 -0
- package/src/reports/moh-645/moh-645.component.tsx +331 -0
- package/src/reports/moh-645/moh-645.scss +147 -0
- package/src/reports/moh-645/registers/moh-645-register.component.tsx +125 -0
- package/src/reports/moh-645/registers/moh-645.columns.ts +40 -0
- package/src/reports/moh-740/moh-740.component.tsx +10 -3
- package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.scss +20 -0
- package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +45 -11
- package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +6 -0
- package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +29 -1
- package/src/reports/moh-745/moh-745.component.tsx +1 -1
- package/src/reports/moh-745/registers/moh-412-register.component.scss +6 -0
- package/src/reports/moh-745/registers/moh-412-register.component.tsx +29 -3
- package/src/resources/moh-643.resource.ts +61 -0
- package/src/resources/moh-645.resource.ts +61 -0
- package/src/root.component.tsx +8 -0
- package/dist/0.css +0 -1
- package/dist/0.css.map +0 -1
- package/dist/0.js +0 -1
- package/dist/0.js.map +0 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { formatDate, useSession } from '@openmrs/esm-framework';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
|
|
6
|
+
import { ReportFiltersComponent, type ReportPeriod, useRestorePeriod } from '../../common/report-filters';
|
|
7
|
+
import { showReportError } from '../../common/report-error';
|
|
8
|
+
import { hasReportData, ReportPlaceholder } from '../../common/report-placeholder';
|
|
9
|
+
import { ReportSkeleton } from '../../common/report-skeleton';
|
|
10
|
+
import { ReportPage } from '../../common/report-page';
|
|
11
|
+
import { getMoh645 } from '../../resources/moh-645.resource';
|
|
12
|
+
|
|
13
|
+
import styles from './moh-645.scss';
|
|
14
|
+
|
|
15
|
+
const STOCK_COLUMNS = [
|
|
16
|
+
{ letter: 'A', label: 'Beginning balance' },
|
|
17
|
+
{ letter: 'B', label: 'Quantity received' },
|
|
18
|
+
{ letter: 'C', label: 'Quantity dispensed' },
|
|
19
|
+
{ letter: 'D', label: 'Losses' },
|
|
20
|
+
{ letter: 'E', label: 'Positive adjustment' },
|
|
21
|
+
{ letter: 'F', label: 'Negative adjustment' },
|
|
22
|
+
{ letter: 'G', label: 'Physical count' },
|
|
23
|
+
{ letter: 'H', label: 'Expired' },
|
|
24
|
+
{ letter: 'I', label: 'Days stocked out' },
|
|
25
|
+
{ letter: 'J', label: 'Quantity to order' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const COMMODITY_ROWS: Array<{ label: string; indicator?: string }> = [
|
|
29
|
+
{ label: 'RDT kits' },
|
|
30
|
+
{ label: 'AL 6s (5–14 kg)', indicator: 'qty_dispensed_al_6s' },
|
|
31
|
+
{ label: 'AL 12s (15–24 kg)', indicator: 'qty_dispensed_al_12s' },
|
|
32
|
+
{ label: 'AL 18s (25–34 kg)', indicator: 'qty_dispensed_al_18s' },
|
|
33
|
+
{ label: 'AL 24s (≥35 kg)', indicator: 'qty_dispensed_al_24s' },
|
|
34
|
+
{ label: 'Inj. Artesunate 60 mg (vials)', indicator: 'qty_dispensed_artesunate_vials' },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const WEIGHT_BAND_ROWS: Array<{ label: string; indicator: string }> = [
|
|
38
|
+
{ label: '5–14 kg (AL 6s)', indicator: 'patients_al_5_14kg' },
|
|
39
|
+
{ label: '15–24 kg (AL 12s)', indicator: 'patients_al_15_24kg' },
|
|
40
|
+
{ label: '25–34 kg (AL 18s)', indicator: 'patients_al_25_34kg' },
|
|
41
|
+
{ label: '≥35 kg (AL 24s)', indicator: 'patients_al_35kg' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
interface ClickCellProps {
|
|
45
|
+
value?: number | string | null;
|
|
46
|
+
indicator?: string;
|
|
47
|
+
label: string;
|
|
48
|
+
onOpen: (indicator: string, label: string) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ClickCell: React.FC<ClickCellProps> = ({ value, indicator, label, onOpen }) => {
|
|
52
|
+
if (!indicator) {
|
|
53
|
+
return <td></td>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<td className={styles.clickable} onClick={() => onOpen(indicator, label)}>
|
|
58
|
+
{value ?? 0}
|
|
59
|
+
</td>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const Moh645Component: React.FC = () => {
|
|
64
|
+
const [moh645Data, setMoh645Data] = useState<Record<string, any>>({});
|
|
65
|
+
const isReportGenerated = hasReportData(moh645Data);
|
|
66
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
67
|
+
const [startDate, setStartDate] = useState('');
|
|
68
|
+
const [endDate, setEndDate] = useState('');
|
|
69
|
+
|
|
70
|
+
const session = useSession();
|
|
71
|
+
const locationUuids = session?.sessionLocation?.uuid;
|
|
72
|
+
const facility = session?.sessionLocation?.display ?? '';
|
|
73
|
+
const monthYear = startDate ? dayjs(startDate).format('MMMM YYYY') : '';
|
|
74
|
+
const compiledBy = session?.user?.person?.display ?? session?.user?.display ?? '';
|
|
75
|
+
const compiledOn = formatDate(new Date(), { mode: 'standard', time: false, noToday: true });
|
|
76
|
+
|
|
77
|
+
const navigate = useNavigate();
|
|
78
|
+
|
|
79
|
+
const fetchMoh645ReportData = async ({ startDate, endDate }: ReportPeriod) => {
|
|
80
|
+
setIsLoading(true);
|
|
81
|
+
setStartDate(startDate);
|
|
82
|
+
setEndDate(endDate);
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const data = await getMoh645({
|
|
86
|
+
locationUuids: locationUuids || '',
|
|
87
|
+
startDate,
|
|
88
|
+
endDate,
|
|
89
|
+
});
|
|
90
|
+
const rows = Array.isArray(data?.result) ? data.result : [];
|
|
91
|
+
setMoh645Data(Object.assign({}, ...rows));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
showReportError('the MOH-645 report', error);
|
|
94
|
+
} finally {
|
|
95
|
+
setIsLoading(false);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
useRestorePeriod(fetchMoh645ReportData);
|
|
100
|
+
|
|
101
|
+
const openRegister = (indicator: string, label: string) => {
|
|
102
|
+
const params = new URLSearchParams({
|
|
103
|
+
startDate,
|
|
104
|
+
endDate,
|
|
105
|
+
locationUuids: locationUuids || '',
|
|
106
|
+
indicators: indicator,
|
|
107
|
+
label,
|
|
108
|
+
from: 'moh-645',
|
|
109
|
+
});
|
|
110
|
+
navigate(`/moh-645-register?${params.toString()}`);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<ReportFiltersComponent
|
|
116
|
+
reportName="MOH-645 Report"
|
|
117
|
+
mode="monthly"
|
|
118
|
+
onGenerate={fetchMoh645ReportData}
|
|
119
|
+
isLoading={isLoading}
|
|
120
|
+
isReportGenerated={isReportGenerated}
|
|
121
|
+
generatedPeriod={{ startDate, endDate }}
|
|
122
|
+
/>
|
|
123
|
+
{isLoading && <ReportSkeleton />}
|
|
124
|
+
{!isLoading && !isReportGenerated && <ReportPlaceholder reportName="MOH-645" />}
|
|
125
|
+
{!isLoading && isReportGenerated && (
|
|
126
|
+
<ReportPage>
|
|
127
|
+
<div className={styles.headerContainer}>
|
|
128
|
+
<div className={styles.mainTitleBox}>
|
|
129
|
+
<h2 className={styles.mainTitle}>Ministry of Health</h2>
|
|
130
|
+
<h3 className={styles.subTitle}>Malaria Commodities: Monthly Summary Form (MOH 645)</h3>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<table className={styles.topMeta}>
|
|
135
|
+
<tbody>
|
|
136
|
+
<tr>
|
|
137
|
+
<td>
|
|
138
|
+
Name of the facility: <strong>{facility}</strong>
|
|
139
|
+
</td>
|
|
140
|
+
<td>
|
|
141
|
+
MFL code: <strong></strong>
|
|
142
|
+
</td>
|
|
143
|
+
<td>
|
|
144
|
+
County: <strong></strong>
|
|
145
|
+
</td>
|
|
146
|
+
<td>
|
|
147
|
+
Sub County: <strong></strong>
|
|
148
|
+
</td>
|
|
149
|
+
<td>
|
|
150
|
+
Month/Year: <strong>{monthYear}</strong>
|
|
151
|
+
</td>
|
|
152
|
+
</tr>
|
|
153
|
+
</tbody>
|
|
154
|
+
</table>
|
|
155
|
+
|
|
156
|
+
<table className={styles.table}>
|
|
157
|
+
<thead>
|
|
158
|
+
<tr>
|
|
159
|
+
<th className={styles.sectionHeader} colSpan={STOCK_COLUMNS.length + 1}>
|
|
160
|
+
Malaria commodities
|
|
161
|
+
</th>
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<th>Commodity</th>
|
|
165
|
+
{STOCK_COLUMNS.map((column) => (
|
|
166
|
+
<th key={column.letter} className={styles.rotateUp}>
|
|
167
|
+
{column.letter}. {column.label}
|
|
168
|
+
</th>
|
|
169
|
+
))}
|
|
170
|
+
</tr>
|
|
171
|
+
</thead>
|
|
172
|
+
<tbody>
|
|
173
|
+
{COMMODITY_ROWS.map((row) => (
|
|
174
|
+
<tr key={row.label}>
|
|
175
|
+
<td>{row.label}</td>
|
|
176
|
+
{STOCK_COLUMNS.map((column) =>
|
|
177
|
+
column.letter === 'C' ? (
|
|
178
|
+
<ClickCell
|
|
179
|
+
key={column.letter}
|
|
180
|
+
value={row.indicator ? moh645Data[row.indicator] : null}
|
|
181
|
+
indicator={row.indicator}
|
|
182
|
+
label={`${row.label} — quantity dispensed`}
|
|
183
|
+
onOpen={openRegister}
|
|
184
|
+
/>
|
|
185
|
+
) : (
|
|
186
|
+
<td key={column.letter}></td>
|
|
187
|
+
),
|
|
188
|
+
)}
|
|
189
|
+
</tr>
|
|
190
|
+
))}
|
|
191
|
+
</tbody>
|
|
192
|
+
</table>
|
|
193
|
+
|
|
194
|
+
<table className={styles.table}>
|
|
195
|
+
<thead>
|
|
196
|
+
<tr>
|
|
197
|
+
<th className={styles.sectionHeader} colSpan={2}>
|
|
198
|
+
Patients treated with AL by weight band
|
|
199
|
+
</th>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr>
|
|
202
|
+
<th>Weight band</th>
|
|
203
|
+
<th>Number of patients</th>
|
|
204
|
+
</tr>
|
|
205
|
+
</thead>
|
|
206
|
+
<tbody>
|
|
207
|
+
{WEIGHT_BAND_ROWS.map((row) => (
|
|
208
|
+
<tr key={row.indicator}>
|
|
209
|
+
<td>{row.label}</td>
|
|
210
|
+
<ClickCell
|
|
211
|
+
value={moh645Data[row.indicator]}
|
|
212
|
+
indicator={row.indicator}
|
|
213
|
+
label={row.label}
|
|
214
|
+
onOpen={openRegister}
|
|
215
|
+
/>
|
|
216
|
+
</tr>
|
|
217
|
+
))}
|
|
218
|
+
</tbody>
|
|
219
|
+
</table>
|
|
220
|
+
|
|
221
|
+
<table className={styles.table}>
|
|
222
|
+
<thead>
|
|
223
|
+
<tr>
|
|
224
|
+
<th className={styles.sectionHeader} colSpan={5}>
|
|
225
|
+
Malaria diagnostics
|
|
226
|
+
</th>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<th>Test</th>
|
|
230
|
+
<th>Positive</th>
|
|
231
|
+
<th>Negative</th>
|
|
232
|
+
<th>Invalid</th>
|
|
233
|
+
<th>Total tested</th>
|
|
234
|
+
</tr>
|
|
235
|
+
</thead>
|
|
236
|
+
<tbody>
|
|
237
|
+
<tr>
|
|
238
|
+
<td>Microscopy (blood smear)</td>
|
|
239
|
+
<ClickCell
|
|
240
|
+
value={moh645Data.microscopy_positive}
|
|
241
|
+
indicator="microscopy_positive"
|
|
242
|
+
label="Microscopy positive"
|
|
243
|
+
onOpen={openRegister}
|
|
244
|
+
/>
|
|
245
|
+
<ClickCell
|
|
246
|
+
value={moh645Data.microscopy_negative}
|
|
247
|
+
indicator="microscopy_negative"
|
|
248
|
+
label="Microscopy negative"
|
|
249
|
+
onOpen={openRegister}
|
|
250
|
+
/>
|
|
251
|
+
<td></td>
|
|
252
|
+
<ClickCell
|
|
253
|
+
value={moh645Data.microscopy_total_tested}
|
|
254
|
+
indicator="microscopy_total_tested"
|
|
255
|
+
label="Microscopy total tested"
|
|
256
|
+
onOpen={openRegister}
|
|
257
|
+
/>
|
|
258
|
+
</tr>
|
|
259
|
+
<tr>
|
|
260
|
+
<td>mRDT</td>
|
|
261
|
+
<ClickCell
|
|
262
|
+
value={moh645Data.rdt_positive}
|
|
263
|
+
indicator="rdt_positive"
|
|
264
|
+
label="mRDT positive"
|
|
265
|
+
onOpen={openRegister}
|
|
266
|
+
/>
|
|
267
|
+
<ClickCell
|
|
268
|
+
value={moh645Data.rdt_negative}
|
|
269
|
+
indicator="rdt_negative"
|
|
270
|
+
label="mRDT negative"
|
|
271
|
+
onOpen={openRegister}
|
|
272
|
+
/>
|
|
273
|
+
<ClickCell
|
|
274
|
+
value={moh645Data.rdt_invalid}
|
|
275
|
+
indicator="rdt_invalid"
|
|
276
|
+
label="mRDT invalid"
|
|
277
|
+
onOpen={openRegister}
|
|
278
|
+
/>
|
|
279
|
+
<ClickCell
|
|
280
|
+
value={moh645Data.rdt_total_tested}
|
|
281
|
+
indicator="rdt_total_tested"
|
|
282
|
+
label="mRDT total tested"
|
|
283
|
+
onOpen={openRegister}
|
|
284
|
+
/>
|
|
285
|
+
</tr>
|
|
286
|
+
<tr>
|
|
287
|
+
<td>Total</td>
|
|
288
|
+
<ClickCell
|
|
289
|
+
value={moh645Data.diagnostics_total_positive}
|
|
290
|
+
indicator="diagnostics_total_positive"
|
|
291
|
+
label="Diagnostics total positive"
|
|
292
|
+
onOpen={openRegister}
|
|
293
|
+
/>
|
|
294
|
+
<ClickCell
|
|
295
|
+
value={moh645Data.diagnostics_total_negative}
|
|
296
|
+
indicator="diagnostics_total_negative"
|
|
297
|
+
label="Diagnostics total negative"
|
|
298
|
+
onOpen={openRegister}
|
|
299
|
+
/>
|
|
300
|
+
<td></td>
|
|
301
|
+
<ClickCell
|
|
302
|
+
value={moh645Data.diagnostics_total_tested}
|
|
303
|
+
indicator="diagnostics_total_tested"
|
|
304
|
+
label="Diagnostics total tested"
|
|
305
|
+
onOpen={openRegister}
|
|
306
|
+
/>
|
|
307
|
+
</tr>
|
|
308
|
+
</tbody>
|
|
309
|
+
</table>
|
|
310
|
+
|
|
311
|
+
<div className={styles.signOff}>
|
|
312
|
+
<span>
|
|
313
|
+
Compiled by: Name <span className={styles.line}>{compiledBy}</span>
|
|
314
|
+
</span>
|
|
315
|
+
<span>
|
|
316
|
+
Signature <span className={styles.line}></span>
|
|
317
|
+
</span>
|
|
318
|
+
<span>
|
|
319
|
+
Phone no <span className={styles.shortLine}></span>
|
|
320
|
+
</span>
|
|
321
|
+
<span>
|
|
322
|
+
Date <span className={styles.shortLine}>{compiledOn}</span>
|
|
323
|
+
</span>
|
|
324
|
+
</div>
|
|
325
|
+
</ReportPage>
|
|
326
|
+
)}
|
|
327
|
+
</>
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export default Moh645Component;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* MOH-645 laid out for A4, matching MOH-745 and MOH-740: geometry in
|
|
2
|
+
millimetres, type in points, one rule weight. */
|
|
3
|
+
|
|
4
|
+
$ink: #000;
|
|
5
|
+
$bar: #d9d9d9;
|
|
6
|
+
$rule: 1px solid $ink;
|
|
7
|
+
|
|
8
|
+
$text: 7pt;
|
|
9
|
+
$title: 7.5pt;
|
|
10
|
+
$sub: 7.5pt;
|
|
11
|
+
$meta: 6.5pt;
|
|
12
|
+
|
|
13
|
+
.headerContainer {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.mainTitleBox {
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: 3mm;
|
|
22
|
+
text-align: center;
|
|
23
|
+
border: $rule;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.mainTitle {
|
|
27
|
+
margin: 0;
|
|
28
|
+
font-size: $title;
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.subTitle {
|
|
33
|
+
margin: 1mm 0 0;
|
|
34
|
+
font-size: $sub;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.topMeta {
|
|
39
|
+
width: 100%;
|
|
40
|
+
table-layout: fixed;
|
|
41
|
+
border-collapse: collapse;
|
|
42
|
+
border: $rule;
|
|
43
|
+
border-top: none;
|
|
44
|
+
|
|
45
|
+
td {
|
|
46
|
+
width: 17%;
|
|
47
|
+
padding: 1.5mm;
|
|
48
|
+
font-size: $meta;
|
|
49
|
+
vertical-align: top;
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
border: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
td:first-child {
|
|
55
|
+
width: 32%;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.table {
|
|
60
|
+
width: 100%;
|
|
61
|
+
border-collapse: collapse;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.table th,
|
|
65
|
+
.table td {
|
|
66
|
+
padding: 1mm 1.5mm;
|
|
67
|
+
font-size: $text;
|
|
68
|
+
text-align: center;
|
|
69
|
+
border: $rule;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.table th {
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
background-color: $bar;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.table td:first-child,
|
|
78
|
+
.table th:first-child {
|
|
79
|
+
text-align: left;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.sectionHeader {
|
|
83
|
+
font-weight: 700;
|
|
84
|
+
text-align: center;
|
|
85
|
+
text-transform: uppercase;
|
|
86
|
+
letter-spacing: 0.02em;
|
|
87
|
+
background-color: #ececec;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.table tbody tr:nth-of-type(odd) {
|
|
91
|
+
background-color: #fafafa;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.clickable {
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.clickable:hover {
|
|
100
|
+
background-color: #e8e8e8;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.rotateUp {
|
|
104
|
+
writing-mode: vertical-rl;
|
|
105
|
+
transform: rotate(180deg);
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.signOff {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-wrap: nowrap;
|
|
112
|
+
align-items: baseline;
|
|
113
|
+
justify-content: space-between;
|
|
114
|
+
gap: 2.5mm;
|
|
115
|
+
padding: 3mm;
|
|
116
|
+
font-size: $meta;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
border: $rule;
|
|
119
|
+
border-top: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.line,
|
|
123
|
+
.shortLine {
|
|
124
|
+
display: inline-block;
|
|
125
|
+
padding: 0 0.5mm;
|
|
126
|
+
margin-left: 1mm;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
text-align: center;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
vertical-align: bottom;
|
|
132
|
+
border-bottom: $rule;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.line {
|
|
136
|
+
width: 36mm;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.shortLine {
|
|
140
|
+
width: 22mm;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media print {
|
|
144
|
+
.table tbody tr:nth-of-type(odd) {
|
|
145
|
+
background-color: transparent;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Link, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@carbon/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useSearchParams } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
import styles from '../../../common/report-register/register-table.scss';
|
|
7
|
+
import { RegisterLayout, usePatientList } from '../../../common/report-register';
|
|
8
|
+
import { getMoh645PatientList } from '../../../resources/moh-645.resource';
|
|
9
|
+
import { moh645ExportColumns } from './moh-645.columns';
|
|
10
|
+
|
|
11
|
+
function formatDateValue(value: unknown): string {
|
|
12
|
+
if (!value) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
const text = String(value);
|
|
16
|
+
return text.includes('T') ? text.slice(0, 10) : text;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function countValue(...values: unknown[]): string {
|
|
20
|
+
for (const value of values) {
|
|
21
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
22
|
+
const n = Number(value);
|
|
23
|
+
if (!Number.isNaN(n) && n !== 0) {
|
|
24
|
+
return String(n);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const Moh645Register: React.FC = () => {
|
|
32
|
+
const [searchParams] = useSearchParams();
|
|
33
|
+
|
|
34
|
+
const startDate = searchParams.get('startDate');
|
|
35
|
+
const endDate = searchParams.get('endDate');
|
|
36
|
+
const locationUuids = searchParams.get('locationUuids');
|
|
37
|
+
const indicators = searchParams.get('indicators');
|
|
38
|
+
|
|
39
|
+
const { rows: patientlist, total, isTotalExact, isLoading, page, pageSize, onPageChange, fetchAll } = usePatientList(
|
|
40
|
+
({ startIndex, limit }) =>
|
|
41
|
+
getMoh645PatientList({
|
|
42
|
+
startDate: startDate || '',
|
|
43
|
+
endDate: endDate || '',
|
|
44
|
+
locationUuids: locationUuids || '',
|
|
45
|
+
indicators: indicators || '',
|
|
46
|
+
startIndex,
|
|
47
|
+
limit,
|
|
48
|
+
}),
|
|
49
|
+
[startDate, endDate, locationUuids, indicators],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<RegisterLayout
|
|
54
|
+
parentLabel="MOH-645 Report"
|
|
55
|
+
parentPath="/moh-645"
|
|
56
|
+
title="MOH 645 Malaria Commodities Register"
|
|
57
|
+
isLoading={isLoading}
|
|
58
|
+
isEmpty={patientlist.length === 0}
|
|
59
|
+
page={page}
|
|
60
|
+
pageSize={pageSize}
|
|
61
|
+
total={total}
|
|
62
|
+
isTotalExact={isTotalExact}
|
|
63
|
+
onPageChange={onPageChange}
|
|
64
|
+
fetchAll={fetchAll}
|
|
65
|
+
columns={moh645ExportColumns}
|
|
66
|
+
>
|
|
67
|
+
<div className={styles.tableContainer}>
|
|
68
|
+
<Table className={classNames(styles.table, styles.tableBordered, styles.tableStriped)}>
|
|
69
|
+
<TableHead>
|
|
70
|
+
<TableRow>
|
|
71
|
+
<TableHeader>No</TableHeader>
|
|
72
|
+
<TableHeader>Visit date</TableHeader>
|
|
73
|
+
<TableHeader>Facility</TableHeader>
|
|
74
|
+
<TableHeader>IP/OP</TableHeader>
|
|
75
|
+
<TableHeader>Patient name</TableHeader>
|
|
76
|
+
<TableHeader>Sex</TableHeader>
|
|
77
|
+
<TableHeader>Age</TableHeader>
|
|
78
|
+
<TableHeader>Identifier</TableHeader>
|
|
79
|
+
<TableHeader>Phone</TableHeader>
|
|
80
|
+
<TableHeader>Drug</TableHeader>
|
|
81
|
+
<TableHeader>Quantity</TableHeader>
|
|
82
|
+
<TableHeader>Microscopy POS</TableHeader>
|
|
83
|
+
<TableHeader>Microscopy NEG</TableHeader>
|
|
84
|
+
<TableHeader>mRDT POS</TableHeader>
|
|
85
|
+
<TableHeader>mRDT NEG</TableHeader>
|
|
86
|
+
<TableHeader>mRDT INV</TableHeader>
|
|
87
|
+
<TableHeader>No test</TableHeader>
|
|
88
|
+
</TableRow>
|
|
89
|
+
</TableHead>
|
|
90
|
+
<TableBody>
|
|
91
|
+
{patientlist.map((patient, index) => (
|
|
92
|
+
<TableRow key={patient.patient_uuid ?? patient.person_id ?? index}>
|
|
93
|
+
<TableCell>{(page - 1) * pageSize + index + 1}</TableCell>
|
|
94
|
+
<TableCell>{formatDateValue(patient.visit_date)}</TableCell>
|
|
95
|
+
<TableCell>{patient.facility ?? ''}</TableCell>
|
|
96
|
+
<TableCell>{patient.ip_op ?? ''}</TableCell>
|
|
97
|
+
<TableCell>
|
|
98
|
+
{patient.patient_uuid ? (
|
|
99
|
+
<Link href={`${window.spaBase}/patient/${patient.patient_uuid}/chart/`}>{patient.person_name}</Link>
|
|
100
|
+
) : (
|
|
101
|
+
patient.person_name
|
|
102
|
+
)}
|
|
103
|
+
</TableCell>
|
|
104
|
+
<TableCell>{patient.gender ?? ''}</TableCell>
|
|
105
|
+
<TableCell>{patient.age_years ?? ''}</TableCell>
|
|
106
|
+
<TableCell>{patient.amrs_universal_id ?? ''}</TableCell>
|
|
107
|
+
<TableCell>{patient.phone_number ?? ''}</TableCell>
|
|
108
|
+
<TableCell>{patient.drug_name ?? ''}</TableCell>
|
|
109
|
+
<TableCell>{patient.quantity ?? ''}</TableCell>
|
|
110
|
+
<TableCell>{countValue(patient.microscopy_pos, patient.microscopy_positive)}</TableCell>
|
|
111
|
+
<TableCell>{countValue(patient.microscopy_neg, patient.microscopy_negative)}</TableCell>
|
|
112
|
+
<TableCell>{countValue(patient.mrdt_pos, patient.rdt_positive)}</TableCell>
|
|
113
|
+
<TableCell>{countValue(patient.mrdt_neg, patient.rdt_negative)}</TableCell>
|
|
114
|
+
<TableCell>{countValue(patient.mrdt_inv, patient.rdt_invalid)}</TableCell>
|
|
115
|
+
<TableCell>{countValue(patient.no_test_done)}</TableCell>
|
|
116
|
+
</TableRow>
|
|
117
|
+
))}
|
|
118
|
+
</TableBody>
|
|
119
|
+
</Table>
|
|
120
|
+
</div>
|
|
121
|
+
</RegisterLayout>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default Moh645Register;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type RegisterColumn } from '../../../common/report-register';
|
|
2
|
+
|
|
3
|
+
function formatDateValue(value: unknown): string {
|
|
4
|
+
if (!value) {
|
|
5
|
+
return '';
|
|
6
|
+
}
|
|
7
|
+
const text = String(value);
|
|
8
|
+
return text.includes('T') ? text.slice(0, 10) : text;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function countValue(...values: unknown[]): string {
|
|
12
|
+
for (const value of values) {
|
|
13
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
14
|
+
const n = Number(value);
|
|
15
|
+
if (!Number.isNaN(n) && n !== 0) {
|
|
16
|
+
return String(n);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const moh645ExportColumns: RegisterColumn[] = [
|
|
24
|
+
{ header: 'Visit date', value: (row) => formatDateValue(row.visit_date) },
|
|
25
|
+
{ header: 'Facility', value: (row) => row.facility ?? '' },
|
|
26
|
+
{ header: 'IP/OP', value: (row) => row.ip_op ?? '' },
|
|
27
|
+
{ header: 'Patient name', value: (row) => row.person_name ?? '' },
|
|
28
|
+
{ header: 'Sex', value: (row) => row.gender ?? '' },
|
|
29
|
+
{ header: 'Age (years)', value: (row) => row.age_years ?? '' },
|
|
30
|
+
{ header: 'Identifier', value: (row) => row.amrs_universal_id ?? '', text: true },
|
|
31
|
+
{ header: 'Phone', value: (row) => row.phone_number ?? '', text: true },
|
|
32
|
+
{ header: 'Drug', value: (row) => row.drug_name ?? '' },
|
|
33
|
+
{ header: 'Quantity', value: (row) => row.quantity ?? '' },
|
|
34
|
+
{ header: 'Microscopy POS', value: (row) => countValue(row.microscopy_pos, row.microscopy_positive) },
|
|
35
|
+
{ header: 'Microscopy NEG', value: (row) => countValue(row.microscopy_neg, row.microscopy_negative) },
|
|
36
|
+
{ header: 'mRDT POS', value: (row) => countValue(row.mrdt_pos, row.rdt_positive) },
|
|
37
|
+
{ header: 'mRDT NEG', value: (row) => countValue(row.mrdt_neg, row.rdt_negative) },
|
|
38
|
+
{ header: 'mRDT INV', value: (row) => countValue(row.mrdt_inv, row.rdt_invalid) },
|
|
39
|
+
{ header: 'No test done', value: (row) => countValue(row.no_test_done) },
|
|
40
|
+
];
|
|
@@ -71,14 +71,21 @@ const Moh740Report: React.FC<Moh740ReportProps> = () => {
|
|
|
71
71
|
setSelectedIndicator(selectedIndicator);
|
|
72
72
|
const selectedRegister = getRegisterByIndicator(selectedIndicator as any);
|
|
73
73
|
setRegisterType(selectedRegister);
|
|
74
|
-
navigateToRegister(selectedIndicator);
|
|
74
|
+
navigateToRegister(selectedIndicator, selectedRegister);
|
|
75
75
|
// setView('register');
|
|
76
76
|
};
|
|
77
77
|
const handleBackToReport = () => {
|
|
78
78
|
setView('report');
|
|
79
79
|
};
|
|
80
|
-
const navigateToRegister = (indicator: string) => {
|
|
81
|
-
|
|
80
|
+
const navigateToRegister = (indicator: string, register: string) => {
|
|
81
|
+
let baseUrl = '';
|
|
82
|
+
if(register === Moh740Rgisters.DailyRegister){
|
|
83
|
+
baseUrl = 'moh-222'
|
|
84
|
+
}
|
|
85
|
+
if(register === Moh740Rgisters.PermanentRegister){
|
|
86
|
+
baseUrl = 'moh-270'
|
|
87
|
+
}
|
|
88
|
+
navigate({to:`${window.getOpenmrsSpaBase()}home/reports/${baseUrl}?startDate=${endDate}&endDate=${endDate}&locationUuids=${locationUuid}&indicator=${indicator}&from=moh-740`});
|
|
82
89
|
};
|
|
83
90
|
return (
|
|
84
91
|
<>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.registerHeader{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
column-gap: 5px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
.registerFilter{
|
|
7
|
+
display: flex;
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
.registerToolbar{
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
.exportRow{
|
|
16
|
+
padding: 5px;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
}
|