@ampath/esm-reports-app 1.0.0-next.113 → 1.0.0-next.115
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/dist/410.js +1 -1
- package/dist/{248.css → 794.css} +1 -1
- package/dist/{248.css.map → 794.css.map} +1 -1
- package/dist/794.js +1 -0
- package/dist/794.js.map +1 -0
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/registers/moh-368/moh-368.columns.ts +43 -4
- package/src/registers/moh-368/moh-368.component.tsx +50 -1
- package/src/registers/moh-409/moh-409.columns.ts +32 -0
- package/src/registers/moh-409/moh-409.component.tsx +296 -0
- package/src/registers/moh-409/moh-409.scss +163 -0
- package/src/registers/register-catalog.ts +8 -0
- package/src/reports/moh-710/linelist/moh-710-line-list.component.tsx +83 -0
- package/src/reports/moh-710/moh-710.component.tsx +4 -4
- package/src/reports/moh-711/linelist/use-open-moh-711-chanis-linelist.ts +2 -2
- package/src/reports/moh-711/sections/chanis.component.tsx +407 -113
- package/src/reports/moh-713/moh-713.component.tsx +7 -7
- package/src/reports/moh-718/moh-718.component.tsx +1 -1
- package/src/reports/moh-740/line-list/moh-740-line-list.component.tsx +107 -0
- package/src/reports/moh-740/moh-740.component.tsx +1 -1
- package/src/reports/moh-740/registers/moh-740.columns.ts +1 -0
- package/src/resources/moh-713.resource.ts +26 -0
- package/src/root.component.tsx +4 -0
- package/dist/248.js +0 -1
- package/dist/248.js.map +0 -1
|
@@ -14,11 +14,11 @@ import { ReportPage } from '../../common/report-page';
|
|
|
14
14
|
|
|
15
15
|
const MOH713Component: React.FC = () => {
|
|
16
16
|
const [moh713Data, setMoh713Data] = useState<any>(() => {
|
|
17
|
-
const saved = sessionStorage.getItem('
|
|
17
|
+
const saved = sessionStorage.getItem('moh713Data');
|
|
18
18
|
return saved ? JSON.parse(saved) : [];
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('
|
|
21
|
+
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('moh713Location');
|
|
22
22
|
const isReportGenerated = hasReportData(moh713Data) && isForCurrentLocation;
|
|
23
23
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
24
24
|
const [startDate, setStartDate] = useState<string>(() => {
|
|
@@ -26,7 +26,7 @@ const MOH713Component: React.FC = () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const [endDate, setEndDate] = useState<string>(() => {
|
|
29
|
-
return sessionStorage.getItem('
|
|
29
|
+
return sessionStorage.getItem('moh713EndDate') || '';
|
|
30
30
|
});
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
sessionStorage.setItem('moh711Data', JSON.stringify(moh713Data));
|
|
@@ -49,7 +49,7 @@ const MOH713Component: React.FC = () => {
|
|
|
49
49
|
const reportMonth = startDate ? dayjs(startDate).format('MMMM') : '';
|
|
50
50
|
const reportYear = startDate ? dayjs(startDate).format('YYYY') : '';
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const fetchMoh713ReportData = async ({ startDate, endDate }: ReportPeriod) => {
|
|
53
53
|
setIsLoading(true);
|
|
54
54
|
setStartDate(startDate);
|
|
55
55
|
setEndDate(endDate);
|
|
@@ -68,15 +68,15 @@ const MOH713Component: React.FC = () => {
|
|
|
68
68
|
} catch (error) {
|
|
69
69
|
setIsLoading(false);
|
|
70
70
|
setIsLoading(false);
|
|
71
|
-
showReportError('the MOH-
|
|
71
|
+
showReportError('the MOH-713 report', error);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
return (
|
|
75
75
|
<>
|
|
76
76
|
<ReportFiltersComponent
|
|
77
|
-
reportName="MOH-
|
|
77
|
+
reportName="MOH-713 Report"
|
|
78
78
|
mode="both"
|
|
79
|
-
onGenerate={
|
|
79
|
+
onGenerate={fetchMoh713ReportData}
|
|
80
80
|
isLoading={isLoading}
|
|
81
81
|
isReportGenerated={isReportGenerated}
|
|
82
82
|
generatedPeriod={{ startDate, endDate }}
|
|
@@ -135,7 +135,7 @@ const Moh718Report: React.FC = () => {
|
|
|
135
135
|
</table>
|
|
136
136
|
</div>
|
|
137
137
|
<div className={styles.tableContainer}>
|
|
138
|
-
<div className={styles.tableTitle}>Certain
|
|
138
|
+
<div className={styles.tableTitle}>Certain infectious and parasitic diseases</div>
|
|
139
139
|
<table className={styles.reportTable}>
|
|
140
140
|
<thead>
|
|
141
141
|
<tr>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { type LinelistColumn, LinelistTable, useAllRows } from '../../../common/linelist-table';
|
|
5
|
+
import { RegisterLayout, useLocationName } from '../../../common/report-register';
|
|
6
|
+
import { fetchMoh740Register } from '../moh-740.resource';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import { showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
9
|
+
import { type Moh222Patient } from '../types';
|
|
10
|
+
|
|
11
|
+
const MOH_740_LINELIST_COLUMNS: LinelistColumn[] = [
|
|
12
|
+
{ header: 'Patient ID', field: 'person_id' },
|
|
13
|
+
{ header: 'AMRS Universal ID', field: 'amrs_universal_id' },
|
|
14
|
+
{ header: 'CCC NO', field: 'ccc_no' },
|
|
15
|
+
{ header: 'Patient Name', field: 'person_name' },
|
|
16
|
+
{ header: 'Age', field: 'age' },
|
|
17
|
+
{ header: 'Gender', field: 'gender' },
|
|
18
|
+
{ header: 'HIV Status', field: 'hiv_status' },
|
|
19
|
+
{ header: 'Location Name', field: 'location' },
|
|
20
|
+
{ header: 'Initiation Date', field: 'enrollment_date' },
|
|
21
|
+
{ header: 'Encounter Date', field: 'encounter_date' },
|
|
22
|
+
{ header: 'RTC Date', field: 'rtc_date' },
|
|
23
|
+
{ header: 'Disease Type', field: 'disease_type' },
|
|
24
|
+
{ header: 'Date of Diagnosis', field: 'diagnosis_date' },
|
|
25
|
+
{ header: 'Systolic', field: 'systolic' },
|
|
26
|
+
{ header: 'Diastolic', field: 'diastolic' },
|
|
27
|
+
{ header: 'RBS', field: 'rbs' },
|
|
28
|
+
{ header: 'FBS', field: 'fbs' },
|
|
29
|
+
{ header: 'HbA1C', field:'hba1c' },
|
|
30
|
+
{ header: 'HTN Meds', field:'htn_meds' },
|
|
31
|
+
{ header: 'Diabetes Meds', field:'diabetes_meds' }
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const Moh740Linelist: React.FC = () => {
|
|
35
|
+
const [rows, setRows] = useState<Moh222Patient[] | any>([]);
|
|
36
|
+
const [searchParams] = useSearchParams();
|
|
37
|
+
const session = useSession();
|
|
38
|
+
const startDate = searchParams.get('startDate') ?? '';
|
|
39
|
+
const endDate = searchParams.get('endDate') ?? '';
|
|
40
|
+
const locationUuids = searchParams.get('locationUuids') ?? '';
|
|
41
|
+
const indicator = searchParams.get('indicator') ?? '';
|
|
42
|
+
const from = searchParams.get('from') || undefined;
|
|
43
|
+
const locationName = useLocationName(locationUuids);
|
|
44
|
+
const [isLoading,setIsLoading] = useState<boolean>(false);
|
|
45
|
+
const [period, setPeriod] = useState<{ startDate: string; endDate: string }>({ startDate: '', endDate: '' });
|
|
46
|
+
useEffect(()=>{
|
|
47
|
+
if(startDate && endDate && locationUuids){
|
|
48
|
+
fetchPatientList();
|
|
49
|
+
}
|
|
50
|
+
},[startDate,endDate,locationUuids,indicator]);
|
|
51
|
+
|
|
52
|
+
async function fetchPatientList(){
|
|
53
|
+
setIsLoading(true);
|
|
54
|
+
setPeriod({ startDate, endDate });
|
|
55
|
+
let indicators = '';
|
|
56
|
+
let locationUuid = '';
|
|
57
|
+
const selectedDate = dayjs(startDate).endOf('month')
|
|
58
|
+
const registerStartDate = selectedDate.format('YYYY-MM-DD');
|
|
59
|
+
try {
|
|
60
|
+
if(!indicator){
|
|
61
|
+
indicators = 'cumulative_all';
|
|
62
|
+
}else{
|
|
63
|
+
indicators = indicator;
|
|
64
|
+
}
|
|
65
|
+
if(!locationUuids){
|
|
66
|
+
locationUuid = session.sessionLocation?.uuid ?? '';
|
|
67
|
+
}else{
|
|
68
|
+
locationUuid = locationUuids;
|
|
69
|
+
}
|
|
70
|
+
const resp = await fetchMoh740Register({ locationUuid: locationUuid, endDate: registerStartDate,indicators: indicators});
|
|
71
|
+
console.log({resp});
|
|
72
|
+
if(resp){
|
|
73
|
+
setRows(resp);
|
|
74
|
+
}
|
|
75
|
+
}catch(error){
|
|
76
|
+
showSnackbar({
|
|
77
|
+
kind: 'error',
|
|
78
|
+
title: 'Error generating line list',
|
|
79
|
+
subtitle: 'Error generating line list, kindly try again or contact support'
|
|
80
|
+
});
|
|
81
|
+
}finally{
|
|
82
|
+
setIsLoading(false);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<RegisterLayout
|
|
90
|
+
parentLabel="MOH-740 Report"
|
|
91
|
+
parentPath="/moh-740"
|
|
92
|
+
title="MOH-740 Linelist"
|
|
93
|
+
location={locationName}
|
|
94
|
+
isLoading={isLoading}
|
|
95
|
+
isEmpty={!isLoading && rows.length === 0}
|
|
96
|
+
>
|
|
97
|
+
<LinelistTable
|
|
98
|
+
rows={rows}
|
|
99
|
+
columns={MOH_740_LINELIST_COLUMNS}
|
|
100
|
+
layoutKey={`moh-740:${indicator}`}
|
|
101
|
+
exportName={`MOH-740 ${indicator || 'linelist'} ${startDate} ${endDate}`}
|
|
102
|
+
/>
|
|
103
|
+
</RegisterLayout>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Moh740Linelist;
|
|
@@ -80,7 +80,7 @@ const Moh740Report: React.FC<Moh740ReportProps> = () => {
|
|
|
80
80
|
const navigateToRegister = (indicator: string, register: string) => {
|
|
81
81
|
let baseUrl = '';
|
|
82
82
|
if(register === Moh740Rgisters.DailyRegister){
|
|
83
|
-
baseUrl = 'moh-
|
|
83
|
+
baseUrl = 'moh-740-line-list'
|
|
84
84
|
}
|
|
85
85
|
if(register === Moh740Rgisters.PermanentRegister){
|
|
86
86
|
baseUrl = 'moh-270'
|
|
@@ -30,6 +30,7 @@ export const MOH_222_COLUMNS: RegisterColumn[] = [
|
|
|
30
30
|
{ header: 'Screened for TB', value: (r) => r.screened_for_tb ?? '' },
|
|
31
31
|
{ header: 'TB Status after Screening', value: (r) => r.tbs_status ?? '' },
|
|
32
32
|
{ header: 'Active SHA(Y/N)', value: (r) => (r.covered_by_shif ? 'Y' : 'N') },
|
|
33
|
+
{ header: 'HIV Status', value: (r) => r.hiv_status ?? '' },
|
|
33
34
|
];
|
|
34
35
|
|
|
35
36
|
/** MOH 270, in the order the register prints its columns */
|
|
@@ -62,3 +62,29 @@ export async function getMoh368Register(params: PatientListParams): Promise<Pati
|
|
|
62
62
|
throw new Error(`An error occurred while fetching the MOH-368 Register: ${error.message}`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
export async function getMoh409Register(params: PatientListParams): Promise<PatientListPage> {
|
|
67
|
+
const url = await buildEtlUrl('moh-409-register', {
|
|
68
|
+
locationUuids: params.locationUuids || '',
|
|
69
|
+
startDate: params.startDate || '',
|
|
70
|
+
endDate: params.endDate || '',
|
|
71
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
72
|
+
reportName: params.reportName || '',
|
|
73
|
+
...pageParams(params),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const response = await openmrsFetch(url);
|
|
78
|
+
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
const errorText = await response.text();
|
|
81
|
+
|
|
82
|
+
throw new Error(`Failed to fetch moh-409: ${response.status} - ${errorText}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const data = await response.json();
|
|
86
|
+
return toPatientListPage(data?.data, params.startIndex ?? 0, params.limit ?? PAGE_SIZE);
|
|
87
|
+
} catch (error: any) {
|
|
88
|
+
throw new Error(`An error occurred while fetching the MOH-409 Register: ${error.message}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/root.component.tsx
CHANGED
|
@@ -72,6 +72,8 @@ import Moh718Report from './reports/moh-718/moh-718.component';
|
|
|
72
72
|
import MOH713Component from './reports/moh-713/moh-713.component';
|
|
73
73
|
import MOH368Component from './registers/moh-368/moh-368.component';
|
|
74
74
|
import Moh301Register from './reports/moh-718/registers/moh-301/moh-301.register';
|
|
75
|
+
import Moh740Linelist from './reports/moh-740/line-list/moh-740-line-list.component';
|
|
76
|
+
import Moh409Component from './registers/moh-409/moh-409.component';
|
|
75
77
|
|
|
76
78
|
const RootComponent: React.FC = () => {
|
|
77
79
|
const baseName = window.getOpenmrsSpaBase() + 'home/reports';
|
|
@@ -153,6 +155,7 @@ const RootComponent: React.FC = () => {
|
|
|
153
155
|
<Route path="/moh-510-register" element={<Moh510RegisterComponent />} />
|
|
154
156
|
<Route path="/moh-362" element={<Moh362Register />} />
|
|
155
157
|
<Route path="/moh-222" element={<Moh222DailyRegister />} />
|
|
158
|
+
<Route path="/moh-740-line-list" element={<Moh740Linelist />} />
|
|
156
159
|
<Route path="/moh-270" element={<Moh270DailyRegister />} />
|
|
157
160
|
<Route path="/moh-240-register" element={<Moh240LabRegister />} />
|
|
158
161
|
<Route path="/tb-lab-register" element={<TbLabRegister />} />
|
|
@@ -174,6 +177,7 @@ const RootComponent: React.FC = () => {
|
|
|
174
177
|
<Route path="/moh-713" element={<MOH713Component />} />
|
|
175
178
|
<Route path="/moh-368-register" element={<MOH368Component />} />
|
|
176
179
|
<Route path="/moh-301-register" element={<Moh301Register />} />
|
|
180
|
+
<Route path="/moh-409-register" element={<Moh409Component />} />
|
|
177
181
|
</Routes>
|
|
178
182
|
</div>
|
|
179
183
|
</BrowserRouter>
|