@ampath/esm-reports-app 1.0.0-next.41 → 1.0.0-next.45

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.
Files changed (183) hide show
  1. package/dist/143.css +1 -0
  2. package/dist/143.css.map +1 -0
  3. package/dist/143.js +1 -0
  4. package/dist/143.js.map +1 -0
  5. package/dist/197.js +1 -1
  6. package/dist/282.js +1 -1
  7. package/dist/282.js.map +1 -1
  8. package/dist/295.css +1 -0
  9. package/dist/295.css.map +1 -0
  10. package/dist/295.js +1 -0
  11. package/dist/295.js.map +1 -0
  12. package/dist/300.js +1 -1
  13. package/dist/311.js +1 -1
  14. package/dist/311.js.map +1 -1
  15. package/dist/335.js +1 -1
  16. package/dist/353.js +1 -1
  17. package/dist/353.js.map +1 -1
  18. package/dist/410.js +1 -0
  19. package/dist/410.js.map +1 -0
  20. package/dist/427.js +2 -0
  21. package/dist/427.js.LICENSE.txt +35 -0
  22. package/dist/427.js.map +1 -0
  23. package/dist/441.js +1 -0
  24. package/dist/441.js.map +1 -0
  25. package/dist/478.js +1 -1
  26. package/dist/478.js.map +1 -1
  27. package/dist/540.js +1 -1
  28. package/dist/540.js.map +1 -1
  29. package/dist/55.js +1 -1
  30. package/dist/652.js +1 -1
  31. package/dist/961.js +1 -1
  32. package/dist/961.js.map +1 -1
  33. package/dist/99.js +1 -1
  34. package/dist/ampath-esm-reports-app.js +1 -1
  35. package/dist/ampath-esm-reports-app.js.map +1 -1
  36. package/dist/routes.json +1 -1
  37. package/package.json +2 -2
  38. package/src/common/report-error/index.ts +1 -0
  39. package/src/common/report-error/show-report-error.ts +25 -0
  40. package/src/common/report-filters/date-range.ts +137 -0
  41. package/src/common/report-filters/index.ts +4 -0
  42. package/src/common/report-filters/report-filters.component.tsx +281 -151
  43. package/src/common/report-filters/report-filters.scss +180 -55
  44. package/src/common/report-filters/types.ts +66 -0
  45. package/src/common/report-filters/use-restore-period.ts +43 -0
  46. package/src/common/report-page/index.ts +2 -0
  47. package/src/common/report-page/report-page.component.tsx +32 -0
  48. package/src/common/report-page/report-page.scss +45 -0
  49. package/src/common/report-page/use-page-scale.ts +50 -0
  50. package/src/common/report-placeholder/has-report-data.ts +15 -0
  51. package/src/common/report-placeholder/index.ts +2 -0
  52. package/src/common/report-placeholder/report-placeholder.component.tsx +56 -0
  53. package/src/common/report-placeholder/report-placeholder.scss +46 -0
  54. package/src/common/report-register/index.ts +5 -0
  55. package/src/common/report-register/register-columns.ts +34 -0
  56. package/src/common/report-register/register-layout.component.tsx +237 -0
  57. package/src/common/report-register/register-layout.scss +140 -0
  58. package/src/common/report-register/register-table.scss +62 -0
  59. package/src/common/report-register/report-parents.ts +27 -0
  60. package/src/common/report-register/rows-to-csv.ts +59 -0
  61. package/src/common/report-register/use-patient-list.ts +92 -0
  62. package/src/common/report-skeleton/index.ts +1 -0
  63. package/src/common/report-skeleton/report-skeleton.component.tsx +46 -0
  64. package/src/common/report-skeleton/report-skeleton.scss +29 -0
  65. package/src/config-schema.ts +9 -1
  66. package/src/dashboard/report-catalog.ts +173 -0
  67. package/src/dashboard/reports-dasboard.tsx +101 -35
  68. package/src/dashboard/reports-dashboard.module.scss +269 -11
  69. package/src/index.ts +13 -1
  70. package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +50 -48
  71. package/src/reports/moh-240/moh-240-header.component.tsx +54 -56
  72. package/src/reports/moh-240/moh-240.columns.ts +64 -0
  73. package/src/reports/moh-240/moh-240.component.tsx +65 -84
  74. package/src/reports/moh-240/moh-240.scss +36 -7
  75. package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +27 -65
  76. package/src/reports/moh-240/sub-reports/page-summary.component.tsx +2 -2
  77. package/src/reports/moh-505/moh-505-header.component.tsx +59 -57
  78. package/src/reports/moh-505/moh-505.component.tsx +51 -56
  79. package/src/reports/moh-505/moh-505.scss +116 -2
  80. package/src/reports/moh-705B/moh-204b-register.component.tsx +41 -42
  81. package/src/reports/moh-705B/moh-204b.columns.ts +39 -0
  82. package/src/reports/moh-705B/moh-705b.component.tsx +492 -473
  83. package/src/reports/moh-705B/moh-705b.scss +110 -24
  84. package/src/reports/moh-705a/moh-705a.component.tsx +496 -476
  85. package/src/reports/moh-705a/moh-705a.scss +109 -24
  86. package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +41 -42
  87. package/src/reports/moh-705a/registers/moh-204a.columns.ts +57 -0
  88. package/src/reports/moh-706/moh-706-header.component.tsx +58 -56
  89. package/src/reports/moh-706/moh-706.component.tsx +84 -55
  90. package/src/reports/moh-706/moh-706.scss +115 -19
  91. package/src/reports/moh-710/moh-710.component.tsx +743 -727
  92. package/src/reports/moh-710/moh-710.scss +140 -23
  93. package/src/reports/moh-710/registers/moh-511-710-register.component.tsx +48 -43
  94. package/src/reports/moh-710/registers/moh-511-710.columns.ts +52 -0
  95. package/src/reports/moh-711/moh-711.component.tsx +94 -106
  96. package/src/reports/moh-711/moh711.scss +95 -64
  97. package/src/reports/moh-711/registers/moh-333-register.component.tsx +92 -94
  98. package/src/reports/moh-711/registers/moh-333.columns.ts +119 -0
  99. package/src/reports/moh-711/registers/moh-405-register.component.tsx +88 -89
  100. package/src/reports/moh-711/registers/moh-405.columns.ts +120 -0
  101. package/src/reports/moh-711/registers/moh-406-register.component.tsx +85 -88
  102. package/src/reports/moh-711/registers/moh-406.columns.ts +133 -0
  103. package/src/reports/moh-711/registers/moh-510-register.component.tsx +38 -44
  104. package/src/reports/moh-711/registers/moh-511-register.component.tsx +42 -43
  105. package/src/reports/moh-711/registers/moh-511.columns.ts +59 -0
  106. package/src/reports/moh-711/sections/anc.component.tsx +3 -3
  107. package/src/reports/moh-711/sections/cervical-cancer.component.tsx +3 -3
  108. package/src/reports/moh-711/sections/chanis.component.tsx +2 -3
  109. package/src/reports/moh-711/sections/family-planning.component.tsx +2 -2
  110. package/src/reports/moh-711/sections/gbv.component.tsx +2 -2
  111. package/src/reports/moh-711/sections/maternity.component.tsx +3 -8
  112. package/src/reports/moh-711/sections/medical-social-work.component.tsx +2 -12
  113. package/src/reports/moh-711/sections/other.component.tsx +2 -2
  114. package/src/reports/moh-711/sections/physiotherapy.component.tsx +2 -2
  115. package/src/reports/moh-711/sections/pnc.component.tsx +7 -5
  116. package/src/reports/moh-711/sections/post-abortion.component.tsx +2 -2
  117. package/src/reports/moh-711/sections/rehabilitation.component.tsx +2 -2
  118. package/src/reports/moh-711/sections/report-compiled-by.component.tsx +12 -4
  119. package/src/reports/moh-711/sections/tb-screening.component.tsx +2 -2
  120. package/src/reports/moh-717/moh-717.component.tsx +100 -121
  121. package/src/reports/moh-717/moh717.scss +163 -102
  122. package/src/reports/moh-717/sections/maternity.component.tsx +1 -1
  123. package/src/reports/moh-717/sections/orthopaedic-trauma.component.tsx +1 -1
  124. package/src/reports/moh-717/sections/outpatient.component.tsx +23 -23
  125. package/src/reports/moh-717/sections/preparedby.component.tsx +7 -2
  126. package/src/reports/moh-717/sections/special-services.component.tsx +1 -1
  127. package/src/reports/moh-731/moh-731.component.tsx +127 -110
  128. package/src/reports/moh-731/moh-731.scss +396 -68
  129. package/src/reports/moh-731/registers/moh-366.columns.ts +38 -0
  130. package/src/reports/moh-731/registers/moh-366.component.tsx +76 -83
  131. package/src/reports/moh-731/registers/prep-register.component.tsx +70 -78
  132. package/src/reports/moh-731/registers/prep.columns.ts +34 -0
  133. package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +1031 -751
  134. package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +230 -86
  135. package/src/reports/moh-731/sections/pmtct.component.tsx +185 -64
  136. package/src/reports/moh-740/moh-740.component.scss +159 -79
  137. package/src/reports/moh-740/moh-740.component.tsx +261 -230
  138. package/src/reports/moh-740/moh-740.resource.ts +17 -10
  139. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +77 -96
  140. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +50 -70
  141. package/src/reports/moh-740/registers/moh-740-patient-list.tsx +61 -32
  142. package/src/reports/moh-740/registers/moh-740.columns.ts +52 -0
  143. package/src/reports/moh-740/shared/utils/indicator-register-map.ts +3 -3
  144. package/src/reports/moh-740/types/index.ts +3 -3
  145. package/src/reports/moh-745/moh-745.component.tsx +897 -877
  146. package/src/reports/moh-745/moh-745.scss +104 -46
  147. package/src/reports/moh-745/registers/moh-412-register.component.tsx +42 -43
  148. package/src/reports/moh-745/registers/moh-412.columns.ts +52 -0
  149. package/src/reports/table-wrapper/table-wrapper.component.tsx +23 -14
  150. package/src/reports/table-wrapper/table-wrapper.scss +1 -16
  151. package/src/resources/moh-505.resource.ts +18 -35
  152. package/src/resources/moh-705.resource.ts +28 -39
  153. package/src/resources/moh-706.resource.ts +17 -30
  154. package/src/resources/moh-710.resource.ts +7 -17
  155. package/src/resources/moh-711.resource.ts +46 -64
  156. package/src/resources/moh-717.resource.ts +7 -17
  157. package/src/resources/moh-731.resource.ts +26 -32
  158. package/src/resources/moh-745.resource.ts +18 -20
  159. package/src/resources/patient-list-page.ts +66 -0
  160. package/src/root.component.tsx +28 -26
  161. package/src/root.scss +36 -0
  162. package/src/utils/get-base-url.ts +39 -7
  163. package/tsconfig.json +1 -1
  164. package/dist/110.js +0 -1
  165. package/dist/110.js.map +0 -1
  166. package/dist/184.js +0 -2
  167. package/dist/184.js.LICENSE.txt +0 -14
  168. package/dist/184.js.map +0 -1
  169. package/dist/205.js +0 -1
  170. package/dist/205.js.map +0 -1
  171. package/dist/812.js +0 -1
  172. package/dist/812.js.map +0 -1
  173. package/dist/822.js +0 -2
  174. package/dist/822.js.LICENSE.txt +0 -20
  175. package/dist/822.js.map +0 -1
  176. package/dist/ampath-esm-reports-app.js.buildmanifest.json +0 -560
  177. package/dist/main.js +0 -1
  178. package/dist/main.js.map +0 -1
  179. package/src/reports/moh-731/registers/moh-366.scss +0 -45
  180. package/src/reports/moh-731/registers/prep-registers.scss +0 -45
  181. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.scss +0 -18
  182. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +0 -18
  183. /package/src/{reports/moh-740/shared/utils → utils}/format-indicator.ts +0 -0
@@ -0,0 +1,133 @@
1
+ import { type RegisterColumn } from '../../../common/report-register';
2
+
3
+ /**
4
+ * MOH 406 as the register prints it: one column per cell, in the order they appear.
5
+ *
6
+ * The last 6 columns are rendered by the table but have no headings above
7
+ * them -- the header row is 43 columns wide against 49 of data. They carry
8
+ * their field names rather than headings borrowed from neighbouring columns.
9
+ */
10
+ export const moh406ExportColumns: RegisterColumn[] = [
11
+ { header: 'Registration Information - Date of Visit (dd/mm/yyyy)', value: (row) => row.date_of_visit ?? '' },
12
+ { header: 'Registration Information - PNC Number (New Visit) - NUPI', value: (row) => row.pnc_number ?? '' },
13
+ { header: 'Registration Information - PNC Number/NUPI (Revisit)', value: (row) => row.pnc_number ?? '' },
14
+ { header: 'Registration Information - AMRSID', value: (row) => row.amrsID ?? '' },
15
+ {
16
+ header: 'Registration Information - Full Name(first name, middle and surname)',
17
+ value: (row) => row.full_names ?? '',
18
+ },
19
+ {
20
+ header: 'Registration Information - Date of Birth (dd/mm/yyyy) - Age in Years',
21
+ value: (row) => row.date_of_birth ?? '',
22
+ },
23
+ { header: 'Registration Information - County/ SubCounty', value: (row) => row.subcounty_county ?? '' },
24
+ {
25
+ header: 'Registration Information - Village/Estate/ Landmark - Telephone number',
26
+ value: (row) => row.village_estate_landmark ?? '',
27
+ },
28
+ { header: 'Maternity History - Date of Delivery (dd/mm/yyyy)', value: (row) => row.date_of_delivery ?? '' },
29
+ {
30
+ header: 'Maternity History - Place of Delivery 1)Facility 2) Home 3) BBA',
31
+ value: (row) => row.place_of_delivery ?? '',
32
+ },
33
+ {
34
+ header: 'Maternity History - Mode of Delivery 1) SVD 2) CS 3) Breech 4) AVD',
35
+ value: (row) => row.mode_of_delivery ?? '',
36
+ },
37
+ {
38
+ header: 'Postpartum Visit - Timing Mother - 1=no change, 2=10 days to 14 days; 3=4 to 6 weeks; 4=4 to 6 months',
39
+ value: (row) => row.timing_mother ?? '',
40
+ },
41
+ {
42
+ header: 'Postpartum Visit - Timing Baby - 1=no change, 2=10 days to 14 days; 3=4 to 6 weeks; 4=4 to 6 months',
43
+ value: (row) => row.timing_baby ?? '',
44
+ },
45
+ { header: 'Vital Signs - Temp', value: (row) => row.temperature ?? '' },
46
+ { header: 'Vital Signs - Pulse', value: (row) => row.pulse ?? '' },
47
+ { header: 'Vital Signs - Blood Pressure', value: (row) => row.blood_pressure ?? '' },
48
+ {
49
+ header: 'Postnatal Examinations - Pallor (Y/N) - 1= mild; 2= moderate; 3= severe',
50
+ value: (row) => row.pallor_present ?? '',
51
+ },
52
+ {
53
+ header: 'Postnatal Examinations - Breast 1=normal 2= cracked nipple 3=engorged 4=mastitis',
54
+ value: (row) => row.breast ?? '',
55
+ },
56
+ {
57
+ header: 'Postnatal Examinations - Uterus 1= contracte d 2= not contracte d 3= Others Specify',
58
+ value: (row) => row.uterus ?? '',
59
+ },
60
+ { header: 'Postnatal Examinations - PPH 1=present 2=Absent', value: (row) => row.pph ?? '' },
61
+ {
62
+ header: 'Postnatal Examinations - C-Section Site 1=Bleeding 2=Normal 3=Infected 4=Gapping 5=N/A',
63
+ value: (row) => row.c_section_site ?? '',
64
+ },
65
+ { header: 'Postnatal Examinations - Lochia 1=Normal 2=Foul smelling 3=Excessi ve', value: (row) => row.lochia ?? '' },
66
+ {
67
+ header: 'Postnatal Examinations - Episiotomy 1=Repaired 2=Gaping 3=Infected 4=Healed 5=N/',
68
+ value: (row) => row.episiotomy ?? '',
69
+ },
70
+ { header: 'Postnatal Examinations - Fistula 1=VVF 2=RVF 3=VVR 4=Non', value: (row) => row.fistula ?? '' },
71
+ {
72
+ header: 'TB screening - TB Screening 1: Presumed TB 2: No signs 3: On TB treatment 4: On TPT 5: Not done',
73
+ value: (row) => row.tb_screening ?? '',
74
+ },
75
+ { header: 'Tested PNC - (I/R/ND/KP)', value: (row) => row.tested_pnc ?? '' },
76
+ {
77
+ header: 'HIV Test 1 - Kit Name: - Lot No. - Expiry No. / / - (N,P,I,NA)',
78
+ value: (row) => row.hiv_test_1_kit_name ?? '',
79
+ },
80
+ {
81
+ header: 'HIV Test 2 - Kit Name: - Lot No. - Expiry No. / / - (N,P,I,NA)',
82
+ value: (row) => row.hiv_test_2_kit_name ?? '',
83
+ },
84
+ {
85
+ header: 'HIV Test 3 - Kit Name: - Lot No. - Expiry No. / / - (N,P,I,NA)',
86
+ value: (row) => row.hiv_test_3_kit_name ?? '',
87
+ },
88
+ { header: 'Results in PNC - <=6wks - (N/P/Ic/NA)', value: (row) => row.results_less_6_weeks ?? '' },
89
+ { header: 'Results in PNC - &gt;6wks - (N/P/Ic/NA)', value: (row) => row.results_greater_6_weeks ?? '' },
90
+ {
91
+ header: 'HAART & Infant Prophylaxis and Treatment - <=6wks - Infant - NVP +AZT +CTX or NVP +CTX - (Y/N/NA/R)',
92
+ value: (row) => row.infant_prophylaxis_less_6_weeks ?? '',
93
+ },
94
+ {
95
+ header: 'HAART & Infant Prophylaxis and Treatment - <=6wks - Mother - HAART - (Y/N/NA/R)',
96
+ value: (row) => row.maternal_haart_less_6_weeks ?? '',
97
+ },
98
+ {
99
+ header: 'HAART & Infant Prophylaxis and Treatment - &gt;6wks - Infant - NVP +AZT +CTX or NVP +CTX - (Y/N/NA/R)',
100
+ value: (row) => row.infant_prophylaxis_greater_6_weeks ?? '',
101
+ },
102
+ {
103
+ header: 'HAART & Infant Prophylaxis and Treatment - &gt;6wks - Mother - HAART - (Y/N/NA/R)',
104
+ value: (row) => row.maternal_haart_greater_6_weeks ?? '',
105
+ },
106
+ {
107
+ header:
108
+ 'Cervical Cancer Screening (VIA/VILLI/PAP Smear/ND) - Results 1=Normal, 2=Suspected, 3= Confirmed, 4= Not done',
109
+ value: (row) => row.cervical_cancer_method ?? '',
110
+ },
111
+ {
112
+ header: 'Modern Post Partum Family Planning (Y/N) - Counseled Method received',
113
+ value: (row) => row.counselled ?? '',
114
+ },
115
+ { header: 'Other Maternal Complications', value: (row) => row.other_maternal_complications ?? '' },
116
+ { header: 'Haematinics (Y/N)', value: (row) => row.haematinics ?? '' },
117
+ {
118
+ header: 'Refferals - From - 1 = Community Unit 2 = Another Health Facility 3 = Not Applicable',
119
+ value: (row) => row.referrals_from ?? '',
120
+ },
121
+ {
122
+ header: 'Refferals - To - 1 = Community Unit 2 = Another Health Facility 3 = Not Applicable',
123
+ value: (row) => row.referrals_to ?? '',
124
+ },
125
+ { header: 'Refferals - Reasons for referral (specify)', value: (row) => row.reason_for_referral ?? '' },
126
+ { header: 'Remarks', value: (row) => row.remarks ?? '' },
127
+ { header: 'Nupi', value: (row) => row.nupi ?? '' },
128
+ { header: 'Age', value: (row) => row.age ?? '' },
129
+ { header: 'Phone number', value: (row) => row.phone_number ?? '' },
130
+ { header: 'Pallor', value: (row) => row.pallor ?? '' },
131
+ { header: 'Cervical cancer results', value: (row) => row.cervical_cancer_results ?? '' },
132
+ { header: 'Family planning method', value: (row) => row.family_planning_method ?? '' },
133
+ ];
@@ -1,16 +1,11 @@
1
- import { Button, Loading } from '@carbon/react';
2
- import React, { useEffect, useState } from 'react';
3
- import { useNavigate, useSearchParams } from 'react-router-dom';
1
+ import React from 'react';
2
+ import { useSearchParams } from 'react-router-dom';
4
3
 
5
- import styles from '../moh711.scss';
4
+ import styles from '../../../common/report-register/register-table.scss';
6
5
  import { getMoh510PatientList } from '../../../resources/moh-711.resource';
6
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
7
7
 
8
8
  const Moh510Register: React.FC = () => {
9
- const navigate = useNavigate();
10
-
11
- const [patientlist, setPatientList] = useState<any[]>([]);
12
- const [isLoading, setIsLoading] = useState(false);
13
-
14
9
  const [searchParams] = useSearchParams();
15
10
 
16
11
  const startDate = searchParams.get('startDate');
@@ -18,43 +13,42 @@ const Moh510Register: React.FC = () => {
18
13
  const locationUuids = searchParams.get('locationUuids');
19
14
  const indicator = searchParams.get('indicator');
20
15
 
21
- useEffect(() => {
22
- const fetchData = async () => {
23
- if (!startDate || !endDate || !locationUuids || !indicator) return;
24
-
25
- setIsLoading(true);
26
-
27
- try {
28
- const params = {
29
- startDate,
30
- endDate,
31
- locationUuids,
32
- indicator,
33
- };
34
-
35
- const data = await getMoh510PatientList(params);
36
-
37
- setPatientList(data?.results.results || []);
38
- } catch (error) {
39
- console.error('Failed to fetch register data', error);
40
- } finally {
41
- setIsLoading(false);
42
- }
43
- };
44
-
45
- fetchData();
46
- }, [startDate, endDate, locationUuids, indicator]);
16
+ const {
17
+ rows: patientlist,
18
+ total,
19
+ isTotalExact,
20
+ isLoading,
21
+ page,
22
+ pageSize,
23
+ onPageChange,
24
+ fetchAll,
25
+ } = usePatientList(
26
+ ({ startIndex, limit }) =>
27
+ getMoh510PatientList({
28
+ startDate,
29
+ endDate,
30
+ locationUuids,
31
+ indicator,
32
+ startIndex,
33
+ limit,
34
+ }),
35
+ [startDate, endDate, locationUuids, indicator],
36
+ );
47
37
 
48
- function navigateBack() {
49
- navigate('/moh-711');
50
- }
51
38
  return (
52
- <>
53
- <div className={styles.buttonContainer}>
54
- <Button onClick={navigateBack}>Back</Button>
55
- </div>
56
- <div>{isLoading && <Loading />}</div>
57
- </>
39
+ <RegisterLayout
40
+ parentLabel="MOH-711 Report"
41
+ parentPath="/moh-711"
42
+ title="MOH 510 Register"
43
+ isLoading={isLoading}
44
+ isEmpty={patientlist.length === 0}
45
+ page={page}
46
+ pageSize={pageSize}
47
+ total={total}
48
+ isTotalExact={isTotalExact}
49
+ onPageChange={onPageChange}
50
+ fetchAll={fetchAll}
51
+ ></RegisterLayout>
58
52
  );
59
53
  };
60
54
 
@@ -1,17 +1,15 @@
1
- import { Button, Loading, Table, TableBody, TableHead, TableHeader, TableRow } from '@carbon/react';
2
- import React, { useEffect, useState } from 'react';
1
+ import { Table, TableBody, TableHead, TableHeader, TableRow } from '@carbon/react';
2
+ import React from 'react';
3
3
  import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
4
4
 
5
- import styles from '../moh711.scss';
5
+ import styles from '../../../common/report-register/register-table.scss';
6
6
  import { getMoh511PatientList } from '../../../resources/moh-711.resource';
7
7
  import { moh511Columns } from './type';
8
8
  import classNames from 'classnames';
9
+ import { moh511ExportColumns } from './moh-511.columns';
10
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
9
11
 
10
12
  const Moh511Register: React.FC = () => {
11
- const navigate = useNavigate();
12
- const [patientlist, setPatientList] = useState<any[]>([]);
13
- const [isLoading, setIsLoading] = useState(false);
14
-
15
13
  const [searchParams] = useSearchParams();
16
14
  const location = useLocation();
17
15
 
@@ -21,43 +19,44 @@ const Moh511Register: React.FC = () => {
21
19
  const indicator = searchParams.get('indicator');
22
20
  const reportName = location.state?.reportName || '';
23
21
 
24
- useEffect(() => {
25
- const fetchData = async () => {
26
- if (!startDate || !endDate || !locationUuids || !indicator || !reportName) return;
27
-
28
- setIsLoading(true);
29
-
30
- try {
31
- const params = {
32
- startDate,
33
- endDate,
34
- locationUuids,
35
- indicator,
36
- reportName,
37
- };
38
-
39
- const data = await getMoh511PatientList(params);
40
-
41
- setPatientList(data?.results.results || []);
42
- } catch (error) {
43
- console.error('Failed to fetch register data', error);
44
- } finally {
45
- setIsLoading(false);
46
- }
47
- };
48
-
49
- fetchData();
50
- }, [startDate, endDate, locationUuids, indicator, reportName]);
22
+ const {
23
+ rows: patientlist,
24
+ total,
25
+ isTotalExact,
26
+ isLoading,
27
+ page,
28
+ pageSize,
29
+ onPageChange,
30
+ fetchAll,
31
+ } = usePatientList(
32
+ ({ startIndex, limit }) =>
33
+ getMoh511PatientList({
34
+ startDate,
35
+ endDate,
36
+ locationUuids,
37
+ indicator,
38
+ reportName,
39
+ startIndex,
40
+ limit,
41
+ }),
42
+ [startDate, endDate, locationUuids, indicator, reportName],
43
+ );
51
44
 
52
- function navigateBack() {
53
- navigate(location.state?.from || '/moh-711');
54
- }
55
45
  return (
56
- <>
57
- <div className={styles.buttonContainer}>
58
- <Button onClick={navigateBack}>Back</Button>
59
- </div>
60
- <div>{isLoading && <Loading />}</div>
46
+ <RegisterLayout
47
+ parentLabel="MOH-711 Report"
48
+ parentPath="/moh-711"
49
+ title="MOH 511 Register"
50
+ isLoading={isLoading}
51
+ isEmpty={patientlist.length === 0}
52
+ page={page}
53
+ pageSize={pageSize}
54
+ total={total}
55
+ isTotalExact={isTotalExact}
56
+ onPageChange={onPageChange}
57
+ fetchAll={fetchAll}
58
+ columns={moh511ExportColumns}
59
+ >
61
60
  <Table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
62
61
  <TableHead>
63
62
  <TableRow>
@@ -264,7 +263,7 @@ const Moh511Register: React.FC = () => {
264
263
  )}
265
264
  </TableBody>
266
265
  </Table>
267
- </>
266
+ </RegisterLayout>
268
267
  );
269
268
  };
270
269
 
@@ -0,0 +1,59 @@
1
+ import { type RegisterColumn } from '../../../common/report-register';
2
+
3
+ /**
4
+ * MOH 511 as the register prints it: one column per cell, in the order they appear.
5
+ */
6
+ export const moh511ExportColumns: RegisterColumn[] = [
7
+ { header: 'Serial No. - A', value: (row) => row.serial_no ?? '' },
8
+ { header: 'Date. (DD:MM:YYYY) - B', value: (row) => row.visit_date ?? '' },
9
+ { header: 'CWC No. (New Visit) - C', value: (row) => row.cwc_number_new ?? '' },
10
+ { header: 'CWC No. (Revisit) - D', value: (row) => row.cwc_number_revisit ?? '' },
11
+ { header: 'BIRTH NOTIFICATION (NUMBER) - E', value: (row) => row.birth_notification_number ?? '' },
12
+ { header: 'Full Names (Three names) - F', value: (row) => row.full_name ?? '' },
13
+ { header: 'Age - G', value: (row) => row.age ?? '' },
14
+ { header: 'Sex - H', value: (row) => row.sex ?? '' },
15
+ { header: 'County/Sub- county - I', value: (row) => row.county_sub_county ?? '' },
16
+ { header: 'Village /Estate / Landmark - J', value: (row) => row.village_estate_landmark ?? '' },
17
+ { header: 'Telephone number - K', value: (row) => row.phone_number ?? '' },
18
+ { header: 'Weight in Kgs - L', value: (row) => row.weight_kg ?? '' },
19
+ { header: 'Weight categories: (1=Normal 2=UW 3=SUW 4=OW 5=Obese) - M', value: (row) => row.weight_category ?? '' },
20
+ { header: 'Height / Length in cm - N', value: (row) => row.height ?? '' },
21
+ {
22
+ header: 'Height/Length categories: (1=Normal 2=Stunted 3=Sev. Stunted) - O',
23
+ value: (row) => row.height_category ?? '',
24
+ },
25
+ { header: 'MUAC 1.Green 2.Yellow 3.Red - P', value: (row) => row.muac ?? '' },
26
+ {
27
+ header: 'Exclusive Breast feeding (less than 6 months)(Y/N) - Q',
28
+ value: (row) => row.exclusive_breastfeeding_less_6_months ?? '',
29
+ },
30
+ {
31
+ header: 'Vitamin A supplimentation: (6-59 months) (1=6- 11 months, 2=12-59 months, 3=Not supplimented) - R',
32
+ value: (row) => row.vitamin_A_supplementation ?? '',
33
+ },
34
+ { header: 'Dewormed (Y/N) - S', value: (row) => row.dewormed ?? '' },
35
+ { header: 'MNPs supplimentation:(6-23 children) - T', value: (row) => row.mnps_supplimentation ?? '' },
36
+ {
37
+ header: 'Childs assessed for Developmental milestones including 1st Haed control ,2= sitting, 3=talking - U',
38
+ value: (row) => row.developmental_milestones ?? '',
39
+ },
40
+ {
41
+ header:
42
+ 'Any Danger Signs 1.Unable to breastfeed 2.Unable to drink 3.Vomits everything 4.Bloody diarrhoea 5.Has oedema 6.Has convulsions - V',
43
+ value: (row) => row.danger_signs ?? '',
44
+ },
45
+ { header: 'Any Disability - W', value: (row) => row.disability ?? '' },
46
+ { header: 'Immunization status up to date(Y/N) - X', value: (row) => row.immunization_status_up_to_date ?? '' },
47
+ { header: 'LLIN gievn to under 1 years(Y/N) - Y', value: (row) => row.llin_supplimentation_given ?? '' },
48
+ { header: 'Follow up for: 1=Nutrition service 2=Rehabilitation service - Z', value: (row) => row.follow_up ?? '' },
49
+ {
50
+ header: '1=referred from CU; 2= referred from another H/F; 3=Not applicable - AA',
51
+ value: (row) => row.referred_from ?? '',
52
+ },
53
+ {
54
+ header: '1=referred to CU; 2= referred to another H/F; 3=Not applicable - AB',
55
+ value: (row) => row.referred_to ?? '',
56
+ },
57
+ { header: 'Reason for referral ....specify - AC', value: (row) => row.reason_for_referral ?? '' },
58
+ { header: 'REMARKS - AD', value: (row) => row.remarks ?? '' },
59
+ ];
@@ -16,7 +16,7 @@ const ANCComponent: React.FC<ANCComponentProps> = ({ moh711Data, startDate, endD
16
16
  const location = useLocation();
17
17
  const navigateToRegister = (indicator: string) => {
18
18
  navigate(
19
- `/moh-405-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
19
+ `/moh-405-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}&from=moh-711`,
20
20
  {
21
21
  state: {
22
22
  from: location.pathname,
@@ -26,7 +26,7 @@ const ANCComponent: React.FC<ANCComponentProps> = ({ moh711Data, startDate, endD
26
26
  );
27
27
  };
28
28
  return (
29
- <>
29
+ <div className={styles.section}>
30
30
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
31
31
  <thead>
32
32
  <tr>
@@ -152,7 +152,7 @@ const ANCComponent: React.FC<ANCComponentProps> = ({ moh711Data, startDate, endD
152
152
  </tr>
153
153
  </tbody>
154
154
  </table>
155
- </>
155
+ </div>
156
156
  );
157
157
  };
158
158
 
@@ -21,11 +21,11 @@ const CervicalCancerComponent: React.FC<CervicalCancerComponentProps> = ({
21
21
 
22
22
  const navigateToRegister = (indicator: string) => {
23
23
  navigate(
24
- `/moh-412-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
24
+ `/moh-412-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}&from=moh-711`,
25
25
  );
26
26
  };
27
27
  return (
28
- <>
28
+ <div className={styles.section}>
29
29
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
30
30
  <thead>
31
31
  <tr>
@@ -141,7 +141,7 @@ const CervicalCancerComponent: React.FC<CervicalCancerComponentProps> = ({
141
141
  </tr>
142
142
  </tbody>
143
143
  </table>
144
- </>
144
+ </div>
145
145
  );
146
146
  };
147
147
 
@@ -9,10 +9,9 @@ interface ChanisComponentProps {
9
9
 
10
10
  const ChanisComponent: React.FC<ChanisComponentProps> = ({ moh711Data }) => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
- <th colSpan={6}></th>
16
15
  <tr>
17
16
  <th colSpan={6}>F. Child Health and Nutrition Information System</th>
18
17
  </tr>
@@ -360,7 +359,7 @@ const ChanisComponent: React.FC<ChanisComponentProps> = ({ moh711Data }) => {
360
359
  </tr>
361
360
  </tbody>
362
361
  </table>
363
- </>
362
+ </div>
364
363
  );
365
364
  };
366
365
 
@@ -9,7 +9,7 @@ interface FamilyPlanningComponentProps {
9
9
 
10
10
  const FamilyPlanningComponent: React.FC<FamilyPlanningComponentProps> = ({ moh711Data }) => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
15
  <tr>
@@ -214,7 +214,7 @@ const FamilyPlanningComponent: React.FC<FamilyPlanningComponentProps> = ({ moh71
214
214
  </tr>
215
215
  </tbody>
216
216
  </table>
217
- </>
217
+ </div>
218
218
  );
219
219
  };
220
220
 
@@ -9,7 +9,7 @@ interface GBVComponentProps {
9
9
 
10
10
  const GBVComponent: React.FC<GBVComponentProps> = ({ moh711Data }) => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
15
  <tr>
@@ -108,7 +108,7 @@ const GBVComponent: React.FC<GBVComponentProps> = ({ moh711Data }) => {
108
108
  </tr>
109
109
  </tbody>
110
110
  </table>
111
- </>
111
+ </div>
112
112
  );
113
113
  };
114
114
 
@@ -16,7 +16,7 @@ const MaternityComponent: React.FC<MaternityComponentProps> = ({ moh711Data, sta
16
16
  const location = useLocation();
17
17
  const navigateToRegister = (indicator: string) => {
18
18
  navigate(
19
- `/moh-333-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
19
+ `/moh-333-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}&from=moh-711`,
20
20
  {
21
21
  state: {
22
22
  from: location.pathname,
@@ -27,7 +27,7 @@ const MaternityComponent: React.FC<MaternityComponentProps> = ({ moh711Data, sta
27
27
  };
28
28
 
29
29
  return (
30
- <>
30
+ <div className={styles.section}>
31
31
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
32
32
  <thead>
33
33
  <tr>
@@ -58,11 +58,6 @@ const MaternityComponent: React.FC<MaternityComponentProps> = ({ moh711Data, sta
58
58
  {moh711Data.assisted_vaginal_delivery}
59
59
  </td>
60
60
  </tr>
61
- <tr>
62
- <td></td>
63
- <td colSpan={2}></td>
64
- <td></td>
65
- </tr>
66
61
  <tr>
67
62
  <th colSpan={3}>Total Deliveries</th>
68
63
  <th>
@@ -319,7 +314,7 @@ const MaternityComponent: React.FC<MaternityComponentProps> = ({ moh711Data, sta
319
314
  </tr>
320
315
  </tbody>
321
316
  </table>
322
- </>
317
+ </div>
323
318
  );
324
319
  };
325
320
 
@@ -9,7 +9,7 @@ interface MedicalSocialWorkComponentProps {
9
9
 
10
10
  const MedicalSocialWorkComponent: React.FC<MedicalSocialWorkComponentProps> = ({ moh711Data }) => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
15
  <tr>
@@ -64,19 +64,9 @@ const MedicalSocialWorkComponent: React.FC<MedicalSocialWorkComponentProps> = ({
64
64
  <td>Referrals</td>
65
65
  <td>{moh711Data.mental_health_referral}</td>
66
66
  </tr>
67
- <tr>
68
- <td></td>
69
- <td></td>
70
- <td></td>
71
- </tr>
72
- <tr>
73
- <td></td>
74
- <td></td>
75
- <td></td>
76
- </tr>
77
67
  </tbody>
78
68
  </table>
79
- </>
69
+ </div>
80
70
  );
81
71
  };
82
72
 
@@ -9,7 +9,7 @@ interface OtherComponentProps {
9
9
 
10
10
  const OtherComponent: React.FC<OtherComponentProps> = ({ moh711Data }) => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
15
  <tr>
@@ -40,7 +40,7 @@ const OtherComponent: React.FC<OtherComponentProps> = ({ moh711Data }) => {
40
40
  </tr>
41
41
  </tbody>
42
42
  </table>
43
- </>
43
+ </div>
44
44
  );
45
45
  };
46
46
 
@@ -9,7 +9,7 @@ interface PhysiotherapyComponentProps {
9
9
 
10
10
  const PhysiotherapyComponent: React.FC<PhysiotherapyComponentProps> = () => {
11
11
  return (
12
- <>
12
+ <div className={styles.section}>
13
13
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
14
14
  <thead>
15
15
  <tr>
@@ -54,7 +54,7 @@ const PhysiotherapyComponent: React.FC<PhysiotherapyComponentProps> = () => {
54
54
  </tr>
55
55
  </tbody>
56
56
  </table>
57
- </>
57
+ </div>
58
58
  );
59
59
  };
60
60
 
@@ -16,7 +16,7 @@ const PNCComponent: React.FC<PNCComponentProps> = ({ moh711Data, startDate, endD
16
16
  const location = useLocation();
17
17
  const navigateToRegister = (indicator: string) => {
18
18
  navigate(
19
- `/moh-406-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
19
+ `/moh-406-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}&from=moh-711`,
20
20
  {
21
21
  state: {
22
22
  from: location.pathname,
@@ -26,7 +26,7 @@ const PNCComponent: React.FC<PNCComponentProps> = ({ moh711Data, startDate, endD
26
26
  );
27
27
  };
28
28
  return (
29
- <>
29
+ <div className={styles.section}>
30
30
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
31
31
  <thead>
32
32
  <tr>
@@ -109,16 +109,18 @@ const PNCComponent: React.FC<PNCComponentProps> = ({ moh711Data, startDate, endD
109
109
  <tr>
110
110
  <td>7</td>
111
111
  <td colSpan={2}>Number of Cases of Fistula</td>
112
- <td onClick={() => navigateToRegister('pnc_new_clients')}>{moh711Data.fistula_cases}</td>
112
+ <td onClick={() => navigateToRegister('fistula_cases')}>{moh711Data.fistula_cases}</td>
113
113
  </tr>
114
114
  <tr>
115
115
  <td>8</td>
116
116
  <td colSpan={2}>No referred from the Community unit to PNC</td>
117
- <td onClick={() => navigateToRegister('pnc_new_clients')}>{moh711Data.referrals_from_community}</td>
117
+ <td onClick={() => navigateToRegister('referrals_from_community')}>
118
+ {moh711Data.referrals_from_community}
119
+ </td>
118
120
  </tr>
119
121
  </tbody>
120
122
  </table>
121
- </>
123
+ </div>
122
124
  );
123
125
  };
124
126