@pih/esm-pathology-app 1.0.5 → 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 -489
- 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 -256
- 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,504 +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
|
-
// postApproval,
|
|
28
|
-
// voidApprovalObs,
|
|
29
|
-
getUser,
|
|
30
|
-
Concept,
|
|
31
|
-
getEncounter,
|
|
32
|
-
} from "./ReportComponent.resource";
|
|
33
|
-
import MyDocument from "../Print-to-PDF/Document-Component";
|
|
34
|
-
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";
|
|
35
6
|
|
|
36
7
|
const ReportComponent = () => {
|
|
37
|
-
const
|
|
38
|
-
const [
|
|
39
|
-
|
|
40
|
-
Array<EncounterResult>
|
|
41
|
-
>([]);
|
|
42
|
-
const [sendingHospital, setSendingHospital] = React.useState("");
|
|
43
|
-
const [listOfHospitals, setListOfHospitals] = React.useState([]);
|
|
44
|
-
const [sampleStatusAnswers, setSampleStatusAnswers] = React.useState<
|
|
45
|
-
Array<Concept>
|
|
46
|
-
>([]);
|
|
47
|
-
const [referralStatusAnswers, setReferralStatusAnswers] = React.useState<
|
|
48
|
-
Array<Concept>
|
|
49
|
-
>([]);
|
|
50
|
-
const [sampleStatus, setSampleStatus] = React.useState("");
|
|
51
|
-
const [referralStatus, setReferralStatus] = React.useState("");
|
|
52
|
-
const [patientName, setPatientName] = React.useState("");
|
|
53
|
-
const headers = [
|
|
54
|
-
{
|
|
55
|
-
key: "patientNames",
|
|
56
|
-
header: "Patient name",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
key: "pathologyRequest",
|
|
60
|
-
header: "pathology request",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: "sendingHospital",
|
|
64
|
-
header: "Sending Hospital",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
key: "phoneNumber",
|
|
68
|
-
header: "Phone number",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
key: "sampleStatus",
|
|
72
|
-
header: "Sample status",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: "dateOfRequest",
|
|
76
|
-
header: "Date of Request",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
key: "referralStatus",
|
|
80
|
-
header: "Referral status",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
key: "sampleDropOff",
|
|
84
|
-
header: "Sample drop off?",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
key: "pathologicDiagnosisObs",
|
|
88
|
-
header: "Pathologic diagnosis",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: "resultsEncounter",
|
|
92
|
-
header: "Results",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
key: "PDFReport",
|
|
96
|
-
header: "Report",
|
|
97
|
-
},
|
|
98
|
-
];
|
|
8
|
+
const [encountersList, setEncountersList] = React.useState([]);
|
|
9
|
+
// const [selectedEncounter, setSelectedEncounter] = React.useState();
|
|
10
|
+
let selectedEncounter;
|
|
99
11
|
|
|
100
12
|
React.useEffect(() => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
setSampleStatusAnswers
|
|
105
|
-
);
|
|
106
|
-
getConceptAnswers(config.referralStatusConceptUUID).then(
|
|
107
|
-
setReferralStatusAnswers
|
|
108
|
-
);
|
|
109
|
-
getEncounters(
|
|
110
|
-
config.healthCenterAttrTypeUUID,
|
|
111
|
-
config.pathologyFullAllowedLocationUUID
|
|
112
|
-
).then(
|
|
113
|
-
setEncountersList
|
|
114
|
-
);
|
|
13
|
+
getPatientEncounters("").then((encs) => {
|
|
14
|
+
setEncountersList(encs.data.results);
|
|
15
|
+
});
|
|
115
16
|
}, []);
|
|
116
17
|
|
|
117
|
-
const
|
|
118
|
-
.
|
|
119
|
-
|
|
120
|
-
!sampleStatus ||
|
|
121
|
-
encList.sampleStatusObs?.toLowerCase() == sampleStatus.toLowerCase()
|
|
122
|
-
)
|
|
123
|
-
.filter(
|
|
124
|
-
(encList) =>
|
|
125
|
-
!referralStatus ||
|
|
126
|
-
encList.referralStatusObs?.toLowerCase() == referralStatus.toLowerCase()
|
|
127
|
-
)
|
|
128
|
-
.filter(
|
|
129
|
-
(encList) =>
|
|
130
|
-
!sendingHospital ||
|
|
131
|
-
encList.patientHealthCenter?.toLowerCase() ==
|
|
132
|
-
sendingHospital.toLowerCase()
|
|
133
|
-
)
|
|
134
|
-
.filter((encList) => {
|
|
135
|
-
if (!patientName) {
|
|
136
|
-
return true;
|
|
137
|
-
} else {
|
|
138
|
-
// Given a patient name filter input, break it up into tokens.
|
|
139
|
-
// Filter to patients for which each token matches.
|
|
140
|
-
// Matching is case-insensitive and matches the beginning of each name.
|
|
141
|
-
const nameTokens = patientName.split(/\s+/);
|
|
142
|
-
const name = `${encList.family_name} ${encList.middle_name} ${encList.given_name}`;
|
|
143
|
-
return nameTokens.every((token) =>
|
|
144
|
-
new RegExp("\\b" + token, "i").test(name)
|
|
145
|
-
);
|
|
146
|
-
}
|
|
18
|
+
const encounterInfo = (encUUID) => {
|
|
19
|
+
getEncounters(encUUID).then((enc) => {
|
|
20
|
+
return enc.data;
|
|
147
21
|
});
|
|
148
|
-
|
|
149
|
-
const rows = filteredEncList.map((encounterInfo) => {
|
|
150
|
-
return {
|
|
151
|
-
// rows.push({
|
|
152
|
-
// patientLink: <a href={`/openmrs/patientDashboard.form?patientId=${encounterInfo.personId}`} >Link</a>,
|
|
153
|
-
id: encounterInfo.encounterId,
|
|
154
|
-
patientNames: (
|
|
155
|
-
<a
|
|
156
|
-
data-testid="patientNames"
|
|
157
|
-
href={`/openmrs/patientDashboard.form?patientId=${encounterInfo.personId}`}
|
|
158
|
-
>
|
|
159
|
-
{encounterInfo.family_name}
|
|
160
|
-
{" "}
|
|
161
|
-
{encounterInfo.given_name}
|
|
162
|
-
{" "}
|
|
163
|
-
{encounterInfo.middle_name}
|
|
164
|
-
</a>
|
|
165
|
-
),
|
|
166
|
-
pathologyRequest: (
|
|
167
|
-
<a
|
|
168
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=${encounterInfo.encounterId}&mode=VIEW`}
|
|
169
|
-
>
|
|
170
|
-
{" "}
|
|
171
|
-
Link{" "}
|
|
172
|
-
</a>
|
|
173
|
-
),
|
|
174
|
-
sendingHospital: encounterInfo.patientHealthCenter,
|
|
175
|
-
phoneNumber: encounterInfo.patientPhoneNumber || "",
|
|
176
|
-
sampleStatus: (
|
|
177
|
-
<select
|
|
178
|
-
onChange={(e) =>
|
|
179
|
-
sampleStatusChange(
|
|
180
|
-
{
|
|
181
|
-
uuid: e.target.value,
|
|
182
|
-
display: e.target.options[e.target.selectedIndex].text,
|
|
183
|
-
},
|
|
184
|
-
encounterInfo
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
>
|
|
188
|
-
<option value=""></option>
|
|
189
|
-
{sampleStatusAnswers.map((ans) => (
|
|
190
|
-
<option
|
|
191
|
-
data-testid="sampleStatus-option"
|
|
192
|
-
value={ans.uuid}
|
|
193
|
-
key={ans.uuid}
|
|
194
|
-
selected={
|
|
195
|
-
encounterInfo.sampleStatusObs
|
|
196
|
-
? encounterInfo.sampleStatusObs === ans.display && true
|
|
197
|
-
: false
|
|
198
|
-
}
|
|
199
|
-
>
|
|
200
|
-
{ans.display}
|
|
201
|
-
</option>
|
|
202
|
-
))}
|
|
203
|
-
</select>
|
|
204
|
-
),
|
|
205
|
-
dateOfRequest: new Date(encounterInfo.encounterDatetime)
|
|
206
|
-
.toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'}),
|
|
207
|
-
referralStatus: (
|
|
208
|
-
<select
|
|
209
|
-
onChange={(e) =>
|
|
210
|
-
referralStatusChange(
|
|
211
|
-
{
|
|
212
|
-
uuid: e.target.value,
|
|
213
|
-
display: e.target.options[e.target.selectedIndex].text,
|
|
214
|
-
},
|
|
215
|
-
encounterInfo
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
>
|
|
219
|
-
<option data-testid="referralStatus-option" value=""></option>
|
|
220
|
-
{referralStatusAnswers.map((ans) => (
|
|
221
|
-
<option
|
|
222
|
-
value={ans.uuid}
|
|
223
|
-
key={ans.uuid}
|
|
224
|
-
selected={
|
|
225
|
-
encounterInfo.referralStatusObs &&
|
|
226
|
-
encounterInfo.referralStatusObs === ans.display
|
|
227
|
-
}
|
|
228
|
-
>
|
|
229
|
-
{ans.display}
|
|
230
|
-
</option>
|
|
231
|
-
))}
|
|
232
|
-
</select>
|
|
233
|
-
),
|
|
234
|
-
sampleDropOff: (
|
|
235
|
-
<input
|
|
236
|
-
data-testid="sampleDropOff"
|
|
237
|
-
type="checkbox"
|
|
238
|
-
checked={Boolean(encounterInfo.sampleDropoffObs)}
|
|
239
|
-
onChange={(e) => sampleDropOffChange(encounterInfo)}
|
|
240
|
-
/>
|
|
241
|
-
),
|
|
242
|
-
pathologicDiagnosisObs: encounterInfo.pathologicDiagnosisObs,
|
|
243
|
-
resultsEncounter: encounterInfo.resultsEncounterId ? (
|
|
244
|
-
<a
|
|
245
|
-
data-testid="resultsEncounter"
|
|
246
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=${encounterInfo.resultsEncounterId}&mode=VIEW`}
|
|
247
|
-
>
|
|
248
|
-
{" "}
|
|
249
|
-
Results{" "}
|
|
250
|
-
</a>
|
|
251
|
-
) : (
|
|
252
|
-
(!userLocation ||
|
|
253
|
-
userLocation === config.pathologyFullAllowedLocationUUID) && (
|
|
254
|
-
<a
|
|
255
|
-
href={`/openmrs/module/htmlformentry/htmlFormEntry.form?personId=${encounterInfo.personId}&patientId=${encounterInfo.personId}&returnUrl=&formId=${config.pathologyResultsFromID}&uuid=${encounterInfo.encounterUuid}`}
|
|
256
|
-
>
|
|
257
|
-
{" "}
|
|
258
|
-
Fill in results{" "}
|
|
259
|
-
</a>
|
|
260
|
-
)
|
|
261
|
-
),
|
|
262
|
-
PDFReport:
|
|
263
|
-
encounterInfo.resultsEncounterId &&
|
|
264
|
-
(
|
|
265
|
-
encounterInfo.approvedBy &&
|
|
266
|
-
<PDFDownloadLink document={<MyDocument encounterInfo={encounterInfo} config={config} />} fileName="Pathology Report">
|
|
267
|
-
{({loading}) => (loading ? 'loading...' : <button>Download</button>)}
|
|
268
|
-
</PDFDownloadLink>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
)
|
|
273
|
-
|
|
274
|
-
};
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
const sampleDropOffChange = (encounterInfo) => {
|
|
278
|
-
const tempEncList = cloneDeep(encountersList);
|
|
279
|
-
if (!encounterInfo.sampleDropoffObs) {
|
|
280
|
-
postSampleDropoffObs(
|
|
281
|
-
encounterInfo,
|
|
282
|
-
config.sampleDropOffconceptUUID,
|
|
283
|
-
config.healthCenterAttrTypeUUID,
|
|
284
|
-
config.yesConceptUUID
|
|
285
|
-
).then((response) => {
|
|
286
|
-
if (response.ok) {
|
|
287
|
-
const encIndex = tempEncList.findIndex(
|
|
288
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
289
|
-
);
|
|
290
|
-
tempEncList[encIndex].sampleDropoffObs = config.yesConceptName;
|
|
291
|
-
tempEncList[encIndex].sampleDropoffObsUuid = response.data.uuid;
|
|
292
|
-
setEncountersList(tempEncList);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
} else {
|
|
296
|
-
voidSampleDropoff(encounterInfo.sampleDropoffObsUuid).then((response) => {
|
|
297
|
-
if (response.ok) {
|
|
298
|
-
const encIndex = tempEncList.findIndex(
|
|
299
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
300
|
-
);
|
|
301
|
-
tempEncList[encIndex].sampleDropoffObs = "";
|
|
302
|
-
tempEncList[encIndex].sampleDropoffObsUuid = "";
|
|
303
|
-
|
|
304
|
-
setEncountersList(tempEncList);
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const sampleStatusChange = (
|
|
312
|
-
newStatus: { uuid: string; display: string },
|
|
313
|
-
encounterInfo
|
|
314
|
-
) => {
|
|
315
|
-
const tempEncList = cloneDeep(encountersList);
|
|
316
|
-
if (!encounterInfo.sampleStatusObs) {
|
|
317
|
-
postSampleStatusChangeObs(
|
|
318
|
-
newStatus.uuid,
|
|
319
|
-
encounterInfo,
|
|
320
|
-
config.sampleStatusConceptUUID,
|
|
321
|
-
config.healthCenterAttrTypeUUID
|
|
322
|
-
).then((response) => {
|
|
323
|
-
if (response.ok) {
|
|
324
|
-
const encIndex = tempEncList.findIndex(
|
|
325
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
326
|
-
);
|
|
327
|
-
tempEncList[encIndex].sampleStatusObs = newStatus.display;
|
|
328
|
-
tempEncList[encIndex].sampleStatusObsUuid = response.data.uuid;
|
|
329
|
-
|
|
330
|
-
setEncountersList(tempEncList);
|
|
331
|
-
} else {
|
|
332
|
-
setEncountersList(tempEncList);
|
|
333
|
-
//Need error message
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
} else {
|
|
337
|
-
updateSampleStatusChangeObs(
|
|
338
|
-
newStatus,
|
|
339
|
-
encounterInfo,
|
|
340
|
-
config.sampleStatusConceptUUID,
|
|
341
|
-
config.healthCenterAttrTypeUUID
|
|
342
|
-
).then((response) => {
|
|
343
|
-
if (response.ok) {
|
|
344
|
-
const encIndex = tempEncList.findIndex(
|
|
345
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
346
|
-
);
|
|
347
|
-
tempEncList[encIndex].sampleStatusObs = newStatus.display;
|
|
348
|
-
tempEncList[encIndex].sampleStatusObsUuid = response.data.uuid;
|
|
349
|
-
setEncountersList(tempEncList);
|
|
350
|
-
} else {
|
|
351
|
-
setEncountersList(tempEncList);
|
|
352
|
-
//Need error message
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
22
|
};
|
|
357
23
|
|
|
358
|
-
const referralStatusChange = (targetedElem, encounterInfo) => {
|
|
359
|
-
const tempEncList = cloneDeep(encountersList);
|
|
360
|
-
if (!encounterInfo.referralStatusObs) {
|
|
361
|
-
postReferralStatusChangeObs(
|
|
362
|
-
targetedElem.uuid,
|
|
363
|
-
encounterInfo,
|
|
364
|
-
config.referralStatusConceptUUID,
|
|
365
|
-
config.healthCenterAttrTypeUUID
|
|
366
|
-
).then((response) => {
|
|
367
|
-
if (response.ok) {
|
|
368
|
-
const encIndex = tempEncList.findIndex(
|
|
369
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
370
|
-
);
|
|
371
|
-
tempEncList[encIndex].referralStatusObs = targetedElem.display;
|
|
372
|
-
tempEncList[encIndex].referralStatusObsUuid = response.data.uuid;
|
|
373
|
-
setEncountersList(tempEncList);
|
|
374
|
-
} else {
|
|
375
|
-
setEncountersList(tempEncList);
|
|
376
|
-
//Need error message
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
} else {
|
|
380
|
-
updateReferralStatusChangeObs(
|
|
381
|
-
targetedElem,
|
|
382
|
-
encounterInfo,
|
|
383
|
-
config.referralStatusConceptUUID,
|
|
384
|
-
config.healthCenterAttrTypeUUID
|
|
385
|
-
).then((response) => {
|
|
386
|
-
if (response.ok) {
|
|
387
|
-
const encIndex = tempEncList.findIndex(
|
|
388
|
-
(enc) => enc.encounterUuid == encounterInfo.encounterUuid
|
|
389
|
-
);
|
|
390
|
-
tempEncList[encIndex].referralStatusObs = targetedElem.display;
|
|
391
|
-
tempEncList[encIndex].referralStatusObsUuid = response.data.uuid;
|
|
392
|
-
setEncountersList(tempEncList);
|
|
393
|
-
} else {
|
|
394
|
-
setEncountersList(tempEncList);
|
|
395
|
-
//Need error message
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
|
|
402
24
|
return (
|
|
403
|
-
<
|
|
404
|
-
<
|
|
405
|
-
<
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
<
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
<select
|
|
430
|
-
id="sample-status"
|
|
431
|
-
className={styles.dropdown}
|
|
432
|
-
value={sampleStatus}
|
|
433
|
-
onChange={(e) => setSampleStatus(e.target.value)}
|
|
434
|
-
>
|
|
435
|
-
<option value=""></option>
|
|
436
|
-
{sampleStatusAnswers.map((ans) => (
|
|
437
|
-
<option value={ans.display} key={ans.uuid}>
|
|
438
|
-
{ans.display}
|
|
439
|
-
</option>
|
|
440
|
-
))}
|
|
441
|
-
</select>
|
|
442
|
-
<label htmlFor="referral-status">Referral Status </label>
|
|
443
|
-
<select
|
|
444
|
-
id="referral-status"
|
|
445
|
-
className={styles.dropdown}
|
|
446
|
-
value={referralStatus}
|
|
447
|
-
onChange={(e) => setReferralStatus(e.target.value)}
|
|
448
|
-
>
|
|
449
|
-
<option value=""></option>
|
|
450
|
-
{referralStatusAnswers.map((ans) => (
|
|
451
|
-
<option value={ans.display} key={ans.uuid}>
|
|
452
|
-
{ans.display}
|
|
453
|
-
</option>
|
|
454
|
-
))}
|
|
455
|
-
</select>
|
|
456
|
-
|
|
457
|
-
<label htmlFor="patient-name">Patient Name </label>
|
|
458
|
-
<input
|
|
459
|
-
id="patient-name"
|
|
460
|
-
className={styles.textBox}
|
|
461
|
-
type="text"
|
|
462
|
-
onChange={(e) => setPatientName(e.target.value)}
|
|
463
|
-
/>
|
|
464
|
-
</div>
|
|
465
|
-
{console.log( encountersList)}
|
|
466
|
-
<div className={styles.tableContainer}>
|
|
467
|
-
<DataTable rows={rows} headers={headers}>
|
|
468
|
-
{({ rows, headers, getTableProps, getHeaderProps, getRowProps }) => (
|
|
469
|
-
<Table {...getTableProps()}>
|
|
470
|
-
<TableHead>
|
|
471
|
-
<TableRow>
|
|
472
|
-
{headers.map((header) => (
|
|
473
|
-
<TableHeader {...getHeaderProps({ header })}>
|
|
474
|
-
{header.header}
|
|
475
|
-
</TableHeader>
|
|
476
|
-
))}
|
|
477
|
-
</TableRow>
|
|
478
|
-
</TableHead>
|
|
479
|
-
<TableBody>
|
|
480
|
-
{rows.map((row) => (
|
|
481
|
-
<TableRow {...getRowProps({ row })}>
|
|
482
|
-
{row.cells.map((cell) => (
|
|
483
|
-
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
484
|
-
))}
|
|
485
|
-
</TableRow>
|
|
486
|
-
))}
|
|
487
|
-
</TableBody>
|
|
488
|
-
</Table>
|
|
489
|
-
)}
|
|
490
|
-
</DataTable>
|
|
491
|
-
</div>
|
|
492
|
-
<div>
|
|
493
|
-
{/* <PDFViewer>
|
|
494
|
-
<MyDocument />
|
|
495
|
-
</PDFViewer> */}
|
|
496
|
-
{/* <PDFDownloadLink document={<MyDocument />} fileName="Pathology Report">
|
|
497
|
-
{({loading}) => (loading ? 'loading...' : <button>Download</button>)}
|
|
498
|
-
</PDFDownloadLink> */}
|
|
499
|
-
|
|
500
|
-
</div>
|
|
501
|
-
</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>
|
|
502
51
|
);
|
|
503
52
|
};
|
|
504
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
|