@pih/esm-pathology-app 1.0.7 → 1.1.1-pre.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +31 -0
- package/__mocks__/react-i18next.js +17 -16
- package/dist/39.js +2 -0
- package/dist/39.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/784.js +3 -0
- package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
- package/dist/784.js.map +1 -0
- package/dist/858.js +3 -0
- package/dist/858.js.LICENSE.txt +1 -0
- package/dist/858.js.map +1 -0
- package/dist/862.js +2 -0
- package/dist/862.js.map +1 -0
- package/dist/pih-esm-pathology-app.js +1 -2
- package/dist/pih-esm-pathology-app.js.buildmanifest.json +38 -98
- package/dist/pih-esm-pathology-app.js.map +1 -1
- package/dist/pih-esm-pathology-app.old +2 -0
- package/jest.config.json +2 -3
- package/package.json +10 -58
- package/src/Pathology-getter/Pathology-encounter-getter-resource.ts +15 -0
- package/src/Pathology-getter/Pathology-patient-encounters-getter-resource.ts +15 -0
- package/src/Pathology-getter/Pathology-patients-getter-resource.ts +12 -0
- package/src/config-schema.ts +22 -163
- package/src/declarations.d.tsx +1 -3
- package/src/pathology-report/ReportComponent.css +17 -39
- package/src/pathology-report/ReportComponent.tsx +38 -475
- package/src/pathology-report/TableRow.tsx +24 -0
- package/src/pathology.test.tsx +32 -0
- package/tsconfig.json +1 -19
- package/webpack.config.js +1 -30
- package/.babelrc +0 -10
- package/.eslintignore +0 -1
- package/.eslintrc +0 -5
- package/.gitattributes +0 -1
- package/.husky/pre-commit +0 -7
- package/.prettierignore +0 -2
- package/README.md +0 -4
- package/babel.config.json +0 -8
- package/dist/00ebb57bb20c59433e84.gif +0 -0
- package/dist/16.js +0 -3
- package/dist/16.js.LICENSE.txt +0 -1
- package/dist/16.js.map +0 -1
- package/dist/24.js +0 -3
- package/dist/24.js.LICENSE.txt +0 -16
- package/dist/24.js.map +0 -1
- package/dist/248.js +0 -3
- package/dist/248.js.LICENSE.txt +0 -99
- package/dist/248.js.map +0 -1
- package/dist/294.js +0 -3
- package/dist/294.js.map +0 -1
- package/dist/5b8bb278fcab4da4972e.ttf +0 -0
- package/dist/861.js +0 -2
- package/dist/861.js.map +0 -1
- package/dist/867.js +0 -2
- package/dist/867.js.map +0 -1
- package/dist/976.js +0 -3
- package/dist/976.js.LICENSE.txt +0 -8
- package/dist/976.js.map +0 -1
- package/dist/a5fad24f075c978ac04b.ttf +0 -0
- package/src/Fonts/georgia/GEORGIA4.TTF +0 -0
- package/src/Fonts/georgia/Georgia Bold Italic font.ttf +0 -0
- package/src/Fonts/georgia/Georgia Regular font.ttf +0 -0
- package/src/Fonts/georgia/Georgia.ttf +0 -0
- package/src/Fonts/georgia/georgia bold italic.ttf +0 -0
- package/src/Fonts/georgia/georgia italic.ttf +0 -0
- package/src/Fonts/georgia/georgia-bold.ttf +0 -0
- package/src/Fonts/georgia/georgiab.ttf +0 -0
- package/src/Fonts/georgia/georgiai.ttf +0 -0
- package/src/Fonts/georgia/georgiaz.ttf +0 -0
- package/src/Fonts/georgia/seriffic.ttf +0 -0
- package/src/Fonts/georgia/sharefonts.net.txt +0 -1
- package/src/Print-to-PDF/Document-Component.tsx +0 -296
- package/src/images/ButaroHospitalLogo.gif +0 -0
- package/src/pathology-report/ReportComponent.resource.ts +0 -279
- package/src/pathology-report/ReportComponent.test.tsx +0 -251
- package/src/test.html +0 -0
|
@@ -1,490 +1,53 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useConfig } from "@openmrs/esm-framework";
|
|
3
|
-
import cloneDeep from "lodash-es/cloneDeep";
|
|
4
|
-
import DataTable, {
|
|
5
|
-
Table,
|
|
6
|
-
TableHead,
|
|
7
|
-
TableRow,
|
|
8
|
-
TableHeader,
|
|
9
|
-
TableBody,
|
|
10
|
-
TableCell,
|
|
11
|
-
} from "carbon-components-react/es/components/DataTable";
|
|
12
|
-
import { PDFDownloadLink, PDFViewer } from "@react-pdf/renderer";
|
|
13
|
-
|
|
14
2
|
import styles from "./ReportComponent.css";
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getLocations,
|
|
19
|
-
getEncounters,
|
|
20
|
-
postSampleDropoffObs,
|
|
21
|
-
voidSampleDropoff,
|
|
22
|
-
postSampleStatusChangeObs,
|
|
23
|
-
updateSampleStatusChangeObs,
|
|
24
|
-
postReferralStatusChangeObs,
|
|
25
|
-
updateReferralStatusChangeObs,
|
|
26
|
-
EncounterResult,
|
|
27
|
-
getUser,
|
|
28
|
-
Concept,
|
|
29
|
-
getEncounter,
|
|
30
|
-
} from "./ReportComponent.resource";
|
|
31
|
-
import MyDocument from "../Print-to-PDF/Document-Component";
|
|
32
|
-
import { Config } from "../config-schema";
|
|
3
|
+
import TableRow from "./TableRow";
|
|
4
|
+
import getPatientEncounters from "../Pathology-getter/Pathology-patient-encounters-getter-resource";
|
|
5
|
+
import getEncounters from "../Pathology-getter/Pathology-encounter-getter-resource";
|
|
33
6
|
|
|
34
7
|
const ReportComponent = () => {
|
|
35
|
-
const
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
Array<EncounterResult>
|
|
39
|
-
>([]);
|
|
40
|
-
const [sendingHospital, setSendingHospital] = React.useState("");
|
|
41
|
-
const [listOfHospitals, setListOfHospitals] = React.useState([]);
|
|
42
|
-
const [sampleStatusAnswers, setSampleStatusAnswers] = React.useState<
|
|
43
|
-
Array<Concept>
|
|
44
|
-
>([]);
|
|
45
|
-
const [referralStatusAnswers, setReferralStatusAnswers] = React.useState<
|
|
46
|
-
Array<Concept>
|
|
47
|
-
>([]);
|
|
48
|
-
const [sampleStatus, setSampleStatus] = React.useState("");
|
|
49
|
-
const [referralStatus, setReferralStatus] = React.useState("");
|
|
50
|
-
const [patientName, setPatientName] = React.useState("");
|
|
51
|
-
const headers = [
|
|
52
|
-
{
|
|
53
|
-
key: "patientNames",
|
|
54
|
-
header: "Patient name",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
key: "pathologyRequest",
|
|
58
|
-
header: "pathology request",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
key: "sendingHospital",
|
|
62
|
-
header: "Sending Hospital",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
key: "phoneNumber",
|
|
66
|
-
header: "Phone number",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: "sampleStatus",
|
|
70
|
-
header: "Sample status",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
key: "dateOfRequest",
|
|
74
|
-
header: "Date of Request",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
key: "referralStatus",
|
|
78
|
-
header: "Referral status",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: "sampleDropOff",
|
|
82
|
-
header: "Sample drop off?",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
key: "pathologicDiagnosisObs",
|
|
86
|
-
header: "Pathologic diagnosis",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
key: "resultsEncounter",
|
|
90
|
-
header: "Results",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
key: "PDFReport",
|
|
94
|
-
header: "Report",
|
|
95
|
-
},
|
|
96
|
-
];
|
|
8
|
+
const [encountersList, setEncountersList] = React.useState([]);
|
|
9
|
+
// const [selectedEncounter, setSelectedEncounter] = React.useState();
|
|
10
|
+
let selectedEncounter;
|
|
97
11
|
|
|
98
12
|
React.useEffect(() => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
setSampleStatusAnswers
|
|
103
|
-
);
|
|
104
|
-
getConceptAnswers(config.referralStatusConceptUUID).then(
|
|
105
|
-
setReferralStatusAnswers
|
|
106
|
-
);
|
|
107
|
-
getEncounters(
|
|
108
|
-
config.healthCenterAttrTypeUUID,
|
|
109
|
-
config.pathologyFullAllowedLocationUUID
|
|
110
|
-
).then(setEncountersList);
|
|
13
|
+
getPatientEncounters("").then((encs) => {
|
|
14
|
+
setEncountersList(encs.data.results);
|
|
15
|
+
});
|
|
111
16
|
}, []);
|
|
112
17
|
|
|
113
|
-
const
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
!sampleStatus ||
|
|
117
|
-
encList.sampleStatusObs?.toLowerCase() == sampleStatus.toLowerCase()
|
|
118
|
-
)
|
|
119
|
-
.filter(
|
|
120
|
-
(encList) =>
|
|
121
|
-
!referralStatus ||
|
|
122
|
-
encList.referralStatusObs?.toLowerCase() == referralStatus.toLowerCase()
|
|
123
|
-
)
|
|
124
|
-
.filter(
|
|
125
|
-
(encList) =>
|
|
126
|
-
!sendingHospital ||
|
|
127
|
-
encList.patientHealthCenter?.toLowerCase() ==
|
|
128
|
-
sendingHospital.toLowerCase()
|
|
129
|
-
)
|
|
130
|
-
.filter((encList) => {
|
|
131
|
-
if (!patientName) {
|
|
132
|
-
return true;
|
|
133
|
-
} else {
|
|
134
|
-
// Given a patient name filter input, break it up into tokens.
|
|
135
|
-
// Filter to patients for which each token matches.
|
|
136
|
-
// Matching is case-insensitive and matches the beginning of each name.
|
|
137
|
-
const nameTokens = patientName.split(/\s+/);
|
|
138
|
-
const name = `${encList.family_name} ${encList.middle_name} ${encList.given_name}`;
|
|
139
|
-
return nameTokens.every((token) =>
|
|
140
|
-
new RegExp("\\b" + token, "i").test(name)
|
|
141
|
-
);
|
|
142
|
-
}
|
|
18
|
+
const encounterInfo = (encUUID) => {
|
|
19
|
+
getEncounters(encUUID).then((enc) => {
|
|
20
|
+
return enc.data;
|
|
143
21
|
});
|
|
144
|
-
|
|
145
|
-
const rows = filteredEncList.map((encounterInfo) => {
|
|
146
|
-
return {
|
|
147
|
-
id: encounterInfo.encounterId,
|
|
148
|
-
patientNames: (
|
|
149
|
-
<a
|
|
150
|
-
data-testid="patientNames"
|
|
151
|
-
href={`/openmrs/patientDashboard.form?patientId=${encounterInfo.personId}`}
|
|
152
|
-
>
|
|
153
|
-
{encounterInfo.family_name}
|
|
154
|
-
{" "}
|
|
155
|
-
{encounterInfo.given_name}
|
|
156
|
-
{" "}
|
|
157
|
-
{encounterInfo.middle_name}
|
|
158
|
-
</a>
|
|
159
|
-
),
|
|
160
|
-
pathologyRequest: (
|
|
161
|
-
<a
|
|
162
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=${encounterInfo.encounterId}&mode=VIEW`}
|
|
163
|
-
>
|
|
164
|
-
{" "}
|
|
165
|
-
Link{" "}
|
|
166
|
-
</a>
|
|
167
|
-
),
|
|
168
|
-
sendingHospital: encounterInfo.patientHealthCenter,
|
|
169
|
-
phoneNumber: encounterInfo.patientPhoneNumber || "",
|
|
170
|
-
sampleStatus: (
|
|
171
|
-
<select
|
|
172
|
-
onChange={(e) =>
|
|
173
|
-
sampleStatusChange(
|
|
174
|
-
{
|
|
175
|
-
uuid: e.target.value,
|
|
176
|
-
display: e.target.options[e.target.selectedIndex].text,
|
|
177
|
-
},
|
|
178
|
-
encounterInfo
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
>
|
|
182
|
-
<option value=""></option>
|
|
183
|
-
{sampleStatusAnswers.map((ans) => (
|
|
184
|
-
<option
|
|
185
|
-
data-testid="sampleStatus-option"
|
|
186
|
-
value={ans.uuid}
|
|
187
|
-
key={ans.uuid}
|
|
188
|
-
selected={
|
|
189
|
-
encounterInfo.sampleStatusObs
|
|
190
|
-
? encounterInfo.sampleStatusObs === ans.display && true
|
|
191
|
-
: false
|
|
192
|
-
}
|
|
193
|
-
>
|
|
194
|
-
{ans.display}
|
|
195
|
-
</option>
|
|
196
|
-
))}
|
|
197
|
-
</select>
|
|
198
|
-
),
|
|
199
|
-
dateOfRequest: new Date(encounterInfo.encounterDatetime).toLocaleString(
|
|
200
|
-
["en-GB", "en-US", "en", "fr-RW"],
|
|
201
|
-
{ day: "numeric", month: "numeric", year: "numeric" }
|
|
202
|
-
),
|
|
203
|
-
referralStatus: (
|
|
204
|
-
<select
|
|
205
|
-
onChange={(e) =>
|
|
206
|
-
referralStatusChange(
|
|
207
|
-
{
|
|
208
|
-
uuid: e.target.value,
|
|
209
|
-
display: e.target.options[e.target.selectedIndex].text,
|
|
210
|
-
},
|
|
211
|
-
encounterInfo
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
>
|
|
215
|
-
<option data-testid="referralStatus-option" value=""></option>
|
|
216
|
-
{referralStatusAnswers.map((ans) => (
|
|
217
|
-
<option
|
|
218
|
-
value={ans.uuid}
|
|
219
|
-
key={ans.uuid}
|
|
220
|
-
selected={
|
|
221
|
-
encounterInfo.referralStatusObs &&
|
|
222
|
-
encounterInfo.referralStatusObs === ans.display
|
|
223
|
-
}
|
|
224
|
-
>
|
|
225
|
-
{ans.display}
|
|
226
|
-
</option>
|
|
227
|
-
))}
|
|
228
|
-
</select>
|
|
229
|
-
),
|
|
230
|
-
sampleDropOff: (
|
|
231
|
-
<input
|
|
232
|
-
data-testid="sampleDropOff"
|
|
233
|
-
type="checkbox"
|
|
234
|
-
checked={Boolean(encounterInfo.sampleDropoffObs)}
|
|
235
|
-
onChange={(e) => sampleDropOffChange(encounterInfo)}
|
|
236
|
-
/>
|
|
237
|
-
),
|
|
238
|
-
pathologicDiagnosisObs: encounterInfo.pathologicDiagnosisObs,
|
|
239
|
-
resultsEncounter: encounterInfo.resultsEncounterId ? (
|
|
240
|
-
<a
|
|
241
|
-
data-testid="resultsEncounter"
|
|
242
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=${encounterInfo.resultsEncounterId}&mode=VIEW`}
|
|
243
|
-
>
|
|
244
|
-
{" "}
|
|
245
|
-
Results{" "}
|
|
246
|
-
</a>
|
|
247
|
-
) : (
|
|
248
|
-
(!userLocation ||
|
|
249
|
-
userLocation === config.pathologyFullAllowedLocationUUID) && (
|
|
250
|
-
<a
|
|
251
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?personId=${encounterInfo.personId}&patientId=${encounterInfo.personId}&returnUrl=&formId=${config.pathologyResultsFromID}&uuid=${encounterInfo.encounterUuid}`}
|
|
252
|
-
>
|
|
253
|
-
{" "}
|
|
254
|
-
Fill in results{" "}
|
|
255
|
-
</a>
|
|
256
|
-
)
|
|
257
|
-
),
|
|
258
|
-
PDFReport: encounterInfo.resultsEncounterId &&
|
|
259
|
-
encounterInfo.approvedBy && (
|
|
260
|
-
<PDFDownloadLink
|
|
261
|
-
document={
|
|
262
|
-
<MyDocument encounterInfo={encounterInfo} config={config} />
|
|
263
|
-
}
|
|
264
|
-
fileName="Pathology Report"
|
|
265
|
-
>
|
|
266
|
-
{({ loading }) =>
|
|
267
|
-
loading ? "loading..." : <button>Download</button>
|
|
268
|
-
}
|
|
269
|
-
</PDFDownloadLink>
|
|
270
|
-
),
|
|
271
|
-
};
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
const sampleDropOffChange = (encounterInfo) => {
|
|
275
|
-
const tempEncList = cloneDeep(encountersList);
|
|
276
|
-
if (!encounterInfo.sampleDropoffObs) {
|
|
277
|
-
postSampleDropoffObs(
|
|
278
|
-
encounterInfo,
|
|
279
|
-
config.sampleDropOffconceptUUID,
|
|
280
|
-
config.healthCenterAttrTypeUUID,
|
|
281
|
-
config.yesConceptUUID
|
|
282
|
-
).then((response) => {
|
|
283
|
-
if (response.ok) {
|
|
284
|
-
const encIndex = tempEncList.findIndex(
|
|
285
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
286
|
-
);
|
|
287
|
-
tempEncList[encIndex].sampleDropoffObs = config.yesConceptName;
|
|
288
|
-
tempEncList[encIndex].sampleDropoffObsUuid = response.data.uuid;
|
|
289
|
-
setEncountersList(tempEncList);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
} else {
|
|
293
|
-
voidSampleDropoff(encounterInfo.sampleDropoffObsUuid).then((response) => {
|
|
294
|
-
if (response.ok) {
|
|
295
|
-
const encIndex = tempEncList.findIndex(
|
|
296
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
297
|
-
);
|
|
298
|
-
tempEncList[encIndex].sampleDropoffObs = "";
|
|
299
|
-
tempEncList[encIndex].sampleDropoffObsUuid = "";
|
|
300
|
-
setEncountersList(tempEncList);
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const sampleStatusChange = (
|
|
307
|
-
newStatus: { uuid: string; display: string },
|
|
308
|
-
encounterInfo
|
|
309
|
-
) => {
|
|
310
|
-
const tempEncList = cloneDeep(encountersList);
|
|
311
|
-
if (!encounterInfo.sampleStatusObs) {
|
|
312
|
-
postSampleStatusChangeObs(
|
|
313
|
-
newStatus.uuid,
|
|
314
|
-
encounterInfo,
|
|
315
|
-
config.sampleStatusConceptUUID,
|
|
316
|
-
config.healthCenterAttrTypeUUID
|
|
317
|
-
).then((response) => {
|
|
318
|
-
if (response.ok) {
|
|
319
|
-
const encIndex = tempEncList.findIndex(
|
|
320
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
321
|
-
);
|
|
322
|
-
tempEncList[encIndex].sampleStatusObs = newStatus.display;
|
|
323
|
-
tempEncList[encIndex].sampleStatusObsUuid = response.data.uuid;
|
|
324
|
-
|
|
325
|
-
setEncountersList(tempEncList);
|
|
326
|
-
} else {
|
|
327
|
-
setEncountersList(tempEncList);
|
|
328
|
-
//Need error message
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
} else {
|
|
332
|
-
updateSampleStatusChangeObs(
|
|
333
|
-
newStatus,
|
|
334
|
-
encounterInfo,
|
|
335
|
-
config.sampleStatusConceptUUID,
|
|
336
|
-
config.healthCenterAttrTypeUUID
|
|
337
|
-
).then((response) => {
|
|
338
|
-
if (response.ok) {
|
|
339
|
-
const encIndex = tempEncList.findIndex(
|
|
340
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
341
|
-
);
|
|
342
|
-
tempEncList[encIndex].sampleStatusObs = newStatus.display;
|
|
343
|
-
tempEncList[encIndex].sampleStatusObsUuid = response.data.uuid;
|
|
344
|
-
setEncountersList(tempEncList);
|
|
345
|
-
} else {
|
|
346
|
-
setEncountersList(tempEncList);
|
|
347
|
-
//Need error message
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
const referralStatusChange = (targetedElem, encounterInfo) => {
|
|
354
|
-
const tempEncList = cloneDeep(encountersList);
|
|
355
|
-
if (!encounterInfo.referralStatusObs) {
|
|
356
|
-
postReferralStatusChangeObs(
|
|
357
|
-
targetedElem.uuid,
|
|
358
|
-
encounterInfo,
|
|
359
|
-
config.referralStatusConceptUUID,
|
|
360
|
-
config.healthCenterAttrTypeUUID
|
|
361
|
-
).then((response) => {
|
|
362
|
-
if (response.ok) {
|
|
363
|
-
const encIndex = tempEncList.findIndex(
|
|
364
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
365
|
-
);
|
|
366
|
-
tempEncList[encIndex].referralStatusObs = targetedElem.display;
|
|
367
|
-
tempEncList[encIndex].referralStatusObsUuid = response.data.uuid;
|
|
368
|
-
setEncountersList(tempEncList);
|
|
369
|
-
} else {
|
|
370
|
-
setEncountersList(tempEncList);
|
|
371
|
-
//Need error message
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
} else {
|
|
375
|
-
updateReferralStatusChangeObs(
|
|
376
|
-
targetedElem,
|
|
377
|
-
encounterInfo,
|
|
378
|
-
config.referralStatusConceptUUID,
|
|
379
|
-
config.healthCenterAttrTypeUUID
|
|
380
|
-
).then((response) => {
|
|
381
|
-
if (response.ok) {
|
|
382
|
-
const encIndex = tempEncList.findIndex(
|
|
383
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
384
|
-
);
|
|
385
|
-
tempEncList[encIndex].referralStatusObs = targetedElem.display;
|
|
386
|
-
tempEncList[encIndex].referralStatusObsUuid = response.data.uuid;
|
|
387
|
-
setEncountersList(tempEncList);
|
|
388
|
-
} else {
|
|
389
|
-
setEncountersList(tempEncList);
|
|
390
|
-
//Need error message
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
22
|
};
|
|
395
23
|
|
|
396
24
|
return (
|
|
397
|
-
<
|
|
398
|
-
<
|
|
399
|
-
<
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
<
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
<select
|
|
424
|
-
id="sample-status"
|
|
425
|
-
className={styles.dropdown}
|
|
426
|
-
value={sampleStatus}
|
|
427
|
-
onChange={(e) => setSampleStatus(e.target.value)}
|
|
428
|
-
>
|
|
429
|
-
<option value=""></option>
|
|
430
|
-
{sampleStatusAnswers.map((ans) => (
|
|
431
|
-
<option value={ans.display} key={ans.uuid}>
|
|
432
|
-
{ans.display}
|
|
433
|
-
</option>
|
|
434
|
-
))}
|
|
435
|
-
</select>
|
|
436
|
-
<label htmlFor="referral-status">Referral Status </label>
|
|
437
|
-
<select
|
|
438
|
-
id="referral-status"
|
|
439
|
-
className={styles.dropdown}
|
|
440
|
-
value={referralStatus}
|
|
441
|
-
onChange={(e) => setReferralStatus(e.target.value)}
|
|
442
|
-
>
|
|
443
|
-
<option value=""></option>
|
|
444
|
-
{referralStatusAnswers.map((ans) => (
|
|
445
|
-
<option value={ans.display} key={ans.uuid}>
|
|
446
|
-
{ans.display}
|
|
447
|
-
</option>
|
|
448
|
-
))}
|
|
449
|
-
</select>
|
|
450
|
-
|
|
451
|
-
<label htmlFor="patient-name">Patient Name </label>
|
|
452
|
-
<input
|
|
453
|
-
id="patient-name"
|
|
454
|
-
className={styles.textBox}
|
|
455
|
-
type="text"
|
|
456
|
-
onChange={(e) => setPatientName(e.target.value)}
|
|
457
|
-
/>
|
|
458
|
-
</div>
|
|
459
|
-
{console.log(encountersList)}
|
|
460
|
-
<div className={styles.tableContainer}>
|
|
461
|
-
<DataTable rows={rows} headers={headers}>
|
|
462
|
-
{({ rows, headers, getTableProps, getHeaderProps, getRowProps }) => (
|
|
463
|
-
<Table {...getTableProps()}>
|
|
464
|
-
<TableHead>
|
|
465
|
-
<TableRow>
|
|
466
|
-
{headers.map((header) => (
|
|
467
|
-
<TableHeader {...getHeaderProps({ header })}>
|
|
468
|
-
{header.header}
|
|
469
|
-
</TableHeader>
|
|
470
|
-
))}
|
|
471
|
-
</TableRow>
|
|
472
|
-
</TableHead>
|
|
473
|
-
<TableBody>
|
|
474
|
-
{rows.map((row) => (
|
|
475
|
-
<TableRow {...getRowProps({ row })}>
|
|
476
|
-
{row.cells.map((cell) => (
|
|
477
|
-
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
478
|
-
))}
|
|
479
|
-
</TableRow>
|
|
480
|
-
))}
|
|
481
|
-
</TableBody>
|
|
482
|
-
</Table>
|
|
483
|
-
)}
|
|
484
|
-
</DataTable>
|
|
485
|
-
</div>
|
|
486
|
-
<div></div>
|
|
487
|
-
</div>
|
|
25
|
+
<table className={styles.table}>
|
|
26
|
+
<thead>
|
|
27
|
+
<tr className={`omrs-bold ${styles.tr}`}>
|
|
28
|
+
<td>Link to patient</td>
|
|
29
|
+
<td>Patient name</td>
|
|
30
|
+
<td>pathology request</td>
|
|
31
|
+
<td>Phone number</td>
|
|
32
|
+
<td>Sample status</td>
|
|
33
|
+
<td>Date of Request</td>
|
|
34
|
+
<td>Referral status</td>
|
|
35
|
+
<td>Sample drop off?</td>
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
<tbody>
|
|
39
|
+
{encountersList.map((request) => (
|
|
40
|
+
// foo.results.find(item => item.id === 2)
|
|
41
|
+
|
|
42
|
+
<tr className={styles.tr} key={request.uuid}>
|
|
43
|
+
<TableRow
|
|
44
|
+
request={request}
|
|
45
|
+
encounterInfo={encounterInfo(request.uuid)}
|
|
46
|
+
/>
|
|
47
|
+
</tr>
|
|
48
|
+
))}
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
488
51
|
);
|
|
489
52
|
};
|
|
490
53
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const TableRow = (prop) => {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<td>Link</td>
|
|
7
|
+
<td>
|
|
8
|
+
{/* {prop.patient.family_name} {' '}
|
|
9
|
+
{prop.patient.middle_name} {' '}
|
|
10
|
+
{prop.patient.first_name} {' '} */}
|
|
11
|
+
</td>
|
|
12
|
+
<td>Link</td>
|
|
13
|
+
<td>{/* {prop.patient.phone_number} */}</td>
|
|
14
|
+
<td>arrived at BDH</td>
|
|
15
|
+
<td>{prop.encounterInfo.encounterDatetime}</td>
|
|
16
|
+
<td>-</td>
|
|
17
|
+
<td>
|
|
18
|
+
<input type="checkbox" />
|
|
19
|
+
</td>
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default TableRow;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the root test for this page. It simply checks that the page
|
|
3
|
+
* renders. If the components of your page are highly interdependent,
|
|
4
|
+
* (e.g., if the `Hello` component had state that communicated
|
|
5
|
+
* information between `Greeter` and `PatientGetter`) then you might
|
|
6
|
+
* want to do most of your testing here. If those components are
|
|
7
|
+
* instead quite independent (as is the case in this example), then
|
|
8
|
+
* it would make more sense to test those components independently.
|
|
9
|
+
*
|
|
10
|
+
* The key thing to remember, always, is: write tests that behave like
|
|
11
|
+
* users. They should *look* for elements by their visual
|
|
12
|
+
* characteristics, *interact* with them, and (mostly) *assert* based
|
|
13
|
+
* on things that would be visually apparent to a user.
|
|
14
|
+
*
|
|
15
|
+
* To learn more about how we do testing, see the following resources:
|
|
16
|
+
* https://kentcdodds.com/blog/how-to-know-what-to-test
|
|
17
|
+
* https://kentcdodds.com/blog/testing-implementation-details
|
|
18
|
+
* https://kentcdodds.com/blog/common-mistakes-with-react-testing-library
|
|
19
|
+
*
|
|
20
|
+
* Kent C. Dodds is the inventor of `@testing-library`:
|
|
21
|
+
* https://testing-library.com/docs/guiding-principles
|
|
22
|
+
*/
|
|
23
|
+
import React from "react";
|
|
24
|
+
import { render, cleanup } from "@testing-library/react";
|
|
25
|
+
import PathologySystem from "./PathologySystem";
|
|
26
|
+
|
|
27
|
+
describe(`<PathologySystem />`, () => {
|
|
28
|
+
afterEach(cleanup);
|
|
29
|
+
it(`renders without dying`, () => {
|
|
30
|
+
render(<PathologySystem />);
|
|
31
|
+
});
|
|
32
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"esModuleInterop": true,
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"allowSyntheticDefaultImports": true,
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"lib": [
|
|
10
|
-
"dom",
|
|
11
|
-
"es5",
|
|
12
|
-
"scripthost",
|
|
13
|
-
"es2015",
|
|
14
|
-
"es2015.promise",
|
|
15
|
-
"es2016.array.include",
|
|
16
|
-
"es2018",
|
|
17
|
-
"es2020"
|
|
18
|
-
],
|
|
19
|
-
"noEmit": true
|
|
20
|
-
},
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
21
3
|
"include": ["src/**/*"],
|
|
22
4
|
"exclude": ["src/**/*.test.tsx", "src/**/*.outdated.tsx"]
|
|
23
5
|
}
|
package/webpack.config.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const config = require("openmrs/default-webpack-config");
|
|
3
|
-
const webpack = require("webpack");
|
|
4
|
-
|
|
5
|
-
config.additionalConfig.resolve = {
|
|
6
|
-
fallback: {
|
|
7
|
-
process: require.resolve("process/browser"),
|
|
8
|
-
zlib: require.resolve("browserify-zlib"),
|
|
9
|
-
stream: require.resolve("stream-browserify"),
|
|
10
|
-
util: require.resolve("util"),
|
|
11
|
-
buffer: require.resolve("buffer"),
|
|
12
|
-
asset: require.resolve("assert"),
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
config.additionalConfig.plugins = [
|
|
16
|
-
new webpack.ProvidePlugin({
|
|
17
|
-
Buffer: ["buffer", "Buffer"],
|
|
18
|
-
process: "process/browser",
|
|
19
|
-
}),
|
|
20
|
-
]
|
|
21
|
-
config.additionalConfig.module= {
|
|
22
|
-
rules:[
|
|
23
|
-
{
|
|
24
|
-
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
25
|
-
type: 'asset/resource',
|
|
26
|
-
},
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
module.exports = config;
|
|
30
|
-
|
|
1
|
+
module.exports = require("openmrs/default-webpack-config");
|
package/.babelrc
DELETED
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
coverage
|
package/.eslintrc
DELETED
package/.gitattributes
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* text=auto
|
package/.husky/pre-commit
DELETED
package/.prettierignore
DELETED
package/README.md
DELETED