@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,296 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Document,
|
|
4
|
-
Page,
|
|
5
|
-
Text,
|
|
6
|
-
Image,
|
|
7
|
-
View,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
Font,
|
|
10
|
-
} from "@react-pdf/renderer";
|
|
11
|
-
import ButaroLogo from "../images/ButaroHospitalLogo.gif";
|
|
12
|
-
import GeorgiaFontBold from "../Fonts/georgia/georgia-bold.ttf";
|
|
13
|
-
import GeorgiaFont from "../Fonts/georgia/Georgia.ttf";
|
|
14
|
-
|
|
15
|
-
Font.register({ family: "GeorgiaBold", src: GeorgiaFontBold });
|
|
16
|
-
Font.register({ family: "Georgia", src: GeorgiaFont });
|
|
17
|
-
|
|
18
|
-
// Create styles
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
page: {
|
|
21
|
-
flexDirection: "row",
|
|
22
|
-
},
|
|
23
|
-
section: {
|
|
24
|
-
margin: 10,
|
|
25
|
-
padding: 20,
|
|
26
|
-
flexGrow: 1,
|
|
27
|
-
},
|
|
28
|
-
textLabels: {
|
|
29
|
-
padding: 7,
|
|
30
|
-
fontFamily: "GeorgiaBold",
|
|
31
|
-
fontSize: 16,
|
|
32
|
-
fontWeight: "bold",
|
|
33
|
-
paddingBottom: 30,
|
|
34
|
-
},
|
|
35
|
-
sentenceLabels: {
|
|
36
|
-
paddingTop: 7,
|
|
37
|
-
fontFamily: "GeorgiaBold",
|
|
38
|
-
fontSize: 16,
|
|
39
|
-
fontWeight: "bold",
|
|
40
|
-
paddingBottom: 3,
|
|
41
|
-
},
|
|
42
|
-
textAnswers: {
|
|
43
|
-
margin: 10,
|
|
44
|
-
padding: 20,
|
|
45
|
-
fontFamily: "Georgia",
|
|
46
|
-
fontSize: 14,
|
|
47
|
-
},
|
|
48
|
-
sentenceAnswers: {
|
|
49
|
-
marginBottom: 10,
|
|
50
|
-
paddingBottom: 20,
|
|
51
|
-
fontFamily: "Georgia",
|
|
52
|
-
fontSize: 14,
|
|
53
|
-
},
|
|
54
|
-
logo: {
|
|
55
|
-
width: 61,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Create Document Component
|
|
60
|
-
const MyDocument = (props) => (
|
|
61
|
-
<Document
|
|
62
|
-
title={`Pathology report
|
|
63
|
-
${props.encounterInfo.family_name}
|
|
64
|
-
${props.encounterInfo.given_name}
|
|
65
|
-
${props.encounterInfo.middle_name} `}
|
|
66
|
-
>
|
|
67
|
-
<Page size="A4" style={styles.page}>
|
|
68
|
-
<View style={styles.section}>
|
|
69
|
-
<Image style={styles.logo} src={ButaroLogo} />
|
|
70
|
-
<Text style={{ fontSize: 8 }}>Butaro Hospital</Text>
|
|
71
|
-
<Text style={{ position: "absolute", top: 0, left: 300, width: 300 }}>
|
|
72
|
-
<Text style={styles.textAnswers}>Lab phone number:</Text>
|
|
73
|
-
<Text> 0784433618</Text>
|
|
74
|
-
</Text>
|
|
75
|
-
<Text style={{ position: "absolute", top: 15, left: 300, width: 300 }}>
|
|
76
|
-
<Text style={styles.textAnswers}>Accession number:</Text>
|
|
77
|
-
<Text>
|
|
78
|
-
{" "}
|
|
79
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
80
|
-
(obser) =>
|
|
81
|
-
obser.concept.uuid == props.config.AccessionNumberconceptUUID &&
|
|
82
|
-
obser.value
|
|
83
|
-
)}
|
|
84
|
-
</Text>
|
|
85
|
-
</Text>
|
|
86
|
-
<Text
|
|
87
|
-
style={{
|
|
88
|
-
borderBottom: "1px",
|
|
89
|
-
textAlign: "center",
|
|
90
|
-
fontWeight: 1500,
|
|
91
|
-
marginBottom: 30,
|
|
92
|
-
fontFamily: "GeorgiaBold",
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
Pathology Report
|
|
96
|
-
</Text>
|
|
97
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
98
|
-
<Text style={styles.textAnswers}>Patient Name:</Text>
|
|
99
|
-
<Text style={styles.textAnswers}>
|
|
100
|
-
{" "}
|
|
101
|
-
{props.encounterInfo.family_name} {props.encounterInfo.given_name}{" "}
|
|
102
|
-
{props.encounterInfo.middle_name}
|
|
103
|
-
</Text>
|
|
104
|
-
</Text>
|
|
105
|
-
<Text
|
|
106
|
-
style={{
|
|
107
|
-
paddingBottom: 10,
|
|
108
|
-
position: "absolute",
|
|
109
|
-
top: 140,
|
|
110
|
-
left: 335,
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
<Text style={styles.textAnswers}>Surgery Date:</Text>
|
|
114
|
-
<Text style={styles.textAnswers}>
|
|
115
|
-
{" "}
|
|
116
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
117
|
-
(obser) =>
|
|
118
|
-
obser.concept.uuid ==
|
|
119
|
-
props.config.DateBiopsySpecimenTakenconceptUUID &&
|
|
120
|
-
new Date(obser.value).toLocaleString(
|
|
121
|
-
["en-GB", "en-US", "en", "fr-RW"],
|
|
122
|
-
{ day: "numeric", month: "numeric", year: "numeric" }
|
|
123
|
-
)
|
|
124
|
-
)}
|
|
125
|
-
</Text>
|
|
126
|
-
</Text>
|
|
127
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
128
|
-
<Text style={styles.textAnswers}>Patient Birthdate:</Text>
|
|
129
|
-
<Text style={styles.textAnswers}>
|
|
130
|
-
{" "}
|
|
131
|
-
{new Date(props.encounterInfo.personBirthdate).toLocaleString(
|
|
132
|
-
["en-GB", "en-US", "en", "fr-RW"],
|
|
133
|
-
{ day: "numeric", month: "numeric", year: "numeric" }
|
|
134
|
-
)}
|
|
135
|
-
</Text>
|
|
136
|
-
</Text>
|
|
137
|
-
<Text
|
|
138
|
-
style={{
|
|
139
|
-
paddingBottom: 10,
|
|
140
|
-
position: "absolute",
|
|
141
|
-
top: 168,
|
|
142
|
-
left: 335,
|
|
143
|
-
width: 200,
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
146
|
-
<Text style={styles.textAnswers}>Specimen Reception Date:</Text>
|
|
147
|
-
<Text style={styles.textAnswers}>
|
|
148
|
-
{" "}
|
|
149
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
150
|
-
(obser) =>
|
|
151
|
-
obser.concept.uuid ==
|
|
152
|
-
props.config.SpecimenSubmissionDateconceptUUID &&
|
|
153
|
-
new Date(obser.value).toLocaleString(
|
|
154
|
-
["en-GB", "en-US", "en", "fr-RW"],
|
|
155
|
-
{ day: "numeric", month: "numeric", year: "numeric" }
|
|
156
|
-
)
|
|
157
|
-
)}
|
|
158
|
-
</Text>
|
|
159
|
-
</Text>
|
|
160
|
-
<Text style={{ paddingBottom: 10, borderBottom: "1px" }}>
|
|
161
|
-
<Text style={styles.textAnswers}>Patient Gender:</Text>
|
|
162
|
-
<Text style={styles.textAnswers}>
|
|
163
|
-
{" "}
|
|
164
|
-
{props.encounterInfo.personGender}
|
|
165
|
-
</Text>
|
|
166
|
-
</Text>
|
|
167
|
-
<Text
|
|
168
|
-
style={{
|
|
169
|
-
paddingBottom: 10,
|
|
170
|
-
position: "absolute",
|
|
171
|
-
top: 200,
|
|
172
|
-
left: 335,
|
|
173
|
-
width: 250,
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
<Text style={styles.textAnswers}>Signout Date:</Text>
|
|
177
|
-
<Text style={styles.textAnswers}>
|
|
178
|
-
{" "}
|
|
179
|
-
{new Date(
|
|
180
|
-
props.encounterInfo.resultsEncounter.encounterDatetime
|
|
181
|
-
).toLocaleString(["en-GB", "en-US", "en", "fr-RW"], {
|
|
182
|
-
day: "numeric",
|
|
183
|
-
month: "numeric",
|
|
184
|
-
year: "numeric",
|
|
185
|
-
})}
|
|
186
|
-
</Text>
|
|
187
|
-
</Text>
|
|
188
|
-
|
|
189
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
190
|
-
<Text style={styles.textLabels}>Sending Physician:</Text>
|
|
191
|
-
<Text style={styles.textAnswers}>
|
|
192
|
-
{" "}
|
|
193
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
194
|
-
(obser) =>
|
|
195
|
-
obser.concept.uuid ==
|
|
196
|
-
props.config.SendingPhysicianconceptUUID && obser.value
|
|
197
|
-
)}
|
|
198
|
-
</Text>
|
|
199
|
-
</Text>
|
|
200
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
201
|
-
<Text style={styles.textLabels}>Sending Facility:</Text>
|
|
202
|
-
<Text style={styles.textAnswers}>
|
|
203
|
-
{" "}
|
|
204
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
205
|
-
(obser) =>
|
|
206
|
-
obser.concept.uuid ==
|
|
207
|
-
props.config.OtherBiopsyLocationconceptUUID && obser.value
|
|
208
|
-
)}
|
|
209
|
-
</Text>
|
|
210
|
-
</Text>
|
|
211
|
-
<Text style={{ paddingBottom: 10, fontFamily: "Georgia" }}>
|
|
212
|
-
Anatomical location:
|
|
213
|
-
</Text>
|
|
214
|
-
<Text style={{ paddingBottom: 10, paddingLeft: 10 }}>
|
|
215
|
-
<Text style={styles.textLabels}>i.System:</Text>
|
|
216
|
-
<Text style={styles.textAnswers}>
|
|
217
|
-
{" "}
|
|
218
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
219
|
-
(obser) =>
|
|
220
|
-
obser.concept.uuid == props.config.OrganSystemconceptUUID &&
|
|
221
|
-
obser.value.name.display + ", "
|
|
222
|
-
)}
|
|
223
|
-
</Text>
|
|
224
|
-
</Text>
|
|
225
|
-
<Text style={{ paddingBottom: 10, paddingLeft: 10 }}>
|
|
226
|
-
<Text style={styles.textLabels}>ii.Organ:</Text>
|
|
227
|
-
<Text style={styles.textAnswers}>
|
|
228
|
-
{" "}
|
|
229
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
230
|
-
(obser) =>
|
|
231
|
-
obser.concept.uuid == props.config.OrganconceptUUID &&
|
|
232
|
-
obser.value.name.display + ", "
|
|
233
|
-
)}
|
|
234
|
-
</Text>
|
|
235
|
-
</Text>
|
|
236
|
-
<Text style={{ paddingBottom: 10, paddingLeft: 10 }}>
|
|
237
|
-
<Text style={styles.textLabels}>iii.Detail:</Text>
|
|
238
|
-
<Text style={styles.textAnswers}>
|
|
239
|
-
{" "}
|
|
240
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
241
|
-
(obser) =>
|
|
242
|
-
obser.concept.uuid == props.config.SpecimenDetailconceptUUID &&
|
|
243
|
-
obser.value
|
|
244
|
-
)}
|
|
245
|
-
</Text>
|
|
246
|
-
</Text>
|
|
247
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
248
|
-
<Text style={styles.textLabels}>Procedure type:</Text>
|
|
249
|
-
<Text style={styles.textAnswers}>
|
|
250
|
-
{" "}
|
|
251
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
252
|
-
(obser) =>
|
|
253
|
-
obser.concept.uuid ==
|
|
254
|
-
props.config.OtherTestsOrProceduresconceptUUID && obser.value
|
|
255
|
-
)}
|
|
256
|
-
</Text>
|
|
257
|
-
</Text>
|
|
258
|
-
<Text style={[styles.sentenceLabels]}>Gross Description:</Text>
|
|
259
|
-
<Text style={[styles.sentenceAnswers]}>
|
|
260
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
261
|
-
(obser) =>
|
|
262
|
-
obser.concept.uuid == props.config.GrossDescriptionconceptUUID &&
|
|
263
|
-
obser.value
|
|
264
|
-
)}
|
|
265
|
-
</Text>
|
|
266
|
-
<Text style={styles.sentenceLabels}>Microscopic Examination:</Text>
|
|
267
|
-
<Text style={styles.sentenceAnswers}>
|
|
268
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
269
|
-
(obser) =>
|
|
270
|
-
obser.concept.uuid ==
|
|
271
|
-
props.config.MacroscopicExaminationconceptUUID && obser.value
|
|
272
|
-
)}
|
|
273
|
-
</Text>
|
|
274
|
-
<Text style={styles.sentenceLabels}>Conclusion:</Text>
|
|
275
|
-
<Text style={styles.sentenceAnswers}>
|
|
276
|
-
{props.encounterInfo.resultsEncounter.obs.map(
|
|
277
|
-
(obser) =>
|
|
278
|
-
obser.concept.uuid ==
|
|
279
|
-
props.config.COMMENTSATCONCLUSIONOFEXAMINATIONconceptUUID &&
|
|
280
|
-
obser.value
|
|
281
|
-
)}
|
|
282
|
-
</Text>
|
|
283
|
-
|
|
284
|
-
<Text style={{ paddingBottom: 10 }}>
|
|
285
|
-
<Text style={styles.textLabels}>Validated by pathologist:</Text>
|
|
286
|
-
<Text style={[styles.textAnswers, { fontWeight: "bold" }]}>
|
|
287
|
-
{" "}
|
|
288
|
-
{props.encounterInfo.approvedBy}
|
|
289
|
-
</Text>
|
|
290
|
-
</Text>
|
|
291
|
-
</View>
|
|
292
|
-
</Page>
|
|
293
|
-
</Document>
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
export default MyDocument;
|
|
Binary file
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
|
2
|
-
import cloneDeep from "lodash-es/cloneDeep";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface EncounterResult {
|
|
6
|
-
family_name: string;
|
|
7
|
-
given_name: string;
|
|
8
|
-
middle_name: string;
|
|
9
|
-
patientPhoneNumber: { value: string };
|
|
10
|
-
patientHealthCenter: string;
|
|
11
|
-
patientUuid: string;
|
|
12
|
-
encounterUuid: string;
|
|
13
|
-
encounterId: number;
|
|
14
|
-
personId: number;
|
|
15
|
-
encounterDatetime: Date;
|
|
16
|
-
sampleStatusObs: string;
|
|
17
|
-
referralStatusObs: string;
|
|
18
|
-
sampleDropoffObs: string;
|
|
19
|
-
resultsEncounterId: string;
|
|
20
|
-
resultsEncounterUuid: string;
|
|
21
|
-
resultsEncounter: [];
|
|
22
|
-
approvedBy: string;
|
|
23
|
-
approvalObsUuid: string;
|
|
24
|
-
pathologicDiagnosisObs: string;
|
|
25
|
-
}
|
|
26
|
-
export interface Patient {
|
|
27
|
-
uuid: string;
|
|
28
|
-
}
|
|
29
|
-
export interface Concept {
|
|
30
|
-
uuid: string;
|
|
31
|
-
name: string;
|
|
32
|
-
display: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Obs {
|
|
36
|
-
patientUuid: string;
|
|
37
|
-
obsDateTime: string;
|
|
38
|
-
sampleDropoffObsUuid: string;
|
|
39
|
-
referralStatusObsUuid: string;
|
|
40
|
-
sampleStatusObsUuid: string;
|
|
41
|
-
location: string;
|
|
42
|
-
encounterUuid: string;
|
|
43
|
-
valueCodedName: string;
|
|
44
|
-
voided: boolean;
|
|
45
|
-
resultsEncounterUuid: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export async function getUserLocation(healthCenterAttrTypeUUID) {
|
|
50
|
-
const session = await openmrsFetch(`/ws/rest/v1/session`);
|
|
51
|
-
const personUuid = session.data.user.person.uuid;
|
|
52
|
-
const person = await openmrsFetch(
|
|
53
|
-
`/ws/rest/v1/person/${personUuid}/attribute`
|
|
54
|
-
);
|
|
55
|
-
const hcPersonAttribute = person.data.results.filter(
|
|
56
|
-
(attr) => attr.attributeType.uuid === healthCenterAttrTypeUUID
|
|
57
|
-
);
|
|
58
|
-
return hcPersonAttribute[0] && hcPersonAttribute[0].value.uuid;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export async function getConceptAnswers(conceptUuid) {
|
|
62
|
-
const concept = await openmrsFetch(
|
|
63
|
-
`/ws/rest/v1/concept/${conceptUuid}?v=full`
|
|
64
|
-
);
|
|
65
|
-
return concept.data.answers;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function getLocations() {
|
|
69
|
-
const location = await openmrsFetch(`/ws/rest/v1/location`);
|
|
70
|
-
|
|
71
|
-
return location.data.results;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export async function getEncounters(
|
|
75
|
-
healthCenterAttrTypeUUID: string,
|
|
76
|
-
pathologyFullAllowedLocationUUID: string
|
|
77
|
-
): Promise<Array<EncounterResult>> {
|
|
78
|
-
const userLocationUUID = await getUserLocation(healthCenterAttrTypeUUID);
|
|
79
|
-
|
|
80
|
-
let searchEncounter = null;
|
|
81
|
-
if (
|
|
82
|
-
userLocationUUID &&
|
|
83
|
-
userLocationUUID != pathologyFullAllowedLocationUUID
|
|
84
|
-
) {
|
|
85
|
-
searchEncounter = await openmrsFetch(
|
|
86
|
-
`/ws/rest/v1/reportingrest/reportdata/996cf192-ff54-11eb-a63a-080027ce9ca0?location=${userLocationUUID}`
|
|
87
|
-
);
|
|
88
|
-
} else {
|
|
89
|
-
searchEncounter = await openmrsFetch(
|
|
90
|
-
`/ws/rest/v1/reportingrest/reportdata/996cf192-ff54-11eb-a63a-080027ce9ca0`
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const EncListClone = searchEncounter.data.dataSets[0].rows.map(async (encObject)=>{
|
|
95
|
-
if(encObject.resultsEncounterUuid){
|
|
96
|
-
const encIndex = searchEncounter.data.dataSets[0].rows.findIndex(
|
|
97
|
-
(enc) => enc.encounterUuid == encObject.encounterUuid
|
|
98
|
-
);
|
|
99
|
-
const resultsEnc =await getEncounter(encObject.resultsEncounterUuid);
|
|
100
|
-
encObject.resultsEncounter = resultsEnc;
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return encObject;
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
return Promise.all(EncListClone);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export async function postSampleDropoffObs(
|
|
110
|
-
obsObject: Obs,
|
|
111
|
-
sampleDropOffconceptUUID: string,
|
|
112
|
-
healthCenterAttrTypeUUID: string,
|
|
113
|
-
yesConceptName: string
|
|
114
|
-
) {
|
|
115
|
-
const ObsObjectTocreate = {
|
|
116
|
-
person: obsObject.patientUuid,
|
|
117
|
-
obsDatetime: new Date().toISOString(),
|
|
118
|
-
concept: sampleDropOffconceptUUID,
|
|
119
|
-
location: await getUserLocation(healthCenterAttrTypeUUID),
|
|
120
|
-
encounter: obsObject.encounterUuid,
|
|
121
|
-
value: yesConceptName,
|
|
122
|
-
voided: false,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const response = await openmrsFetch("/ws/rest/v1/obs", {
|
|
126
|
-
method: "POST",
|
|
127
|
-
headers: {
|
|
128
|
-
"content-type": "application/json",
|
|
129
|
-
},
|
|
130
|
-
body: ObsObjectTocreate,
|
|
131
|
-
});
|
|
132
|
-
return response;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export async function voidSampleDropoff(sampleDropoffObsUuid: string) {
|
|
136
|
-
const ObsObjectTocreate = {
|
|
137
|
-
voided: true,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const response = await openmrsFetch(
|
|
141
|
-
`/ws/rest/v1/obs/${sampleDropoffObsUuid}`,
|
|
142
|
-
{
|
|
143
|
-
method: "POST",
|
|
144
|
-
headers: {
|
|
145
|
-
"content-type": "application/json",
|
|
146
|
-
},
|
|
147
|
-
body: ObsObjectTocreate,
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
return response;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export async function postSampleStatusChangeObs(
|
|
155
|
-
newStatusUuid: string,
|
|
156
|
-
obs: Obs,
|
|
157
|
-
sampleStatusConceptUUID: string,
|
|
158
|
-
healthCenterAttrTypeUUID: string
|
|
159
|
-
) {
|
|
160
|
-
const postBody = {
|
|
161
|
-
person: obs.patientUuid,
|
|
162
|
-
obsDatetime: new Date().toISOString(),
|
|
163
|
-
concept: sampleStatusConceptUUID,
|
|
164
|
-
location: await getUserLocation(healthCenterAttrTypeUUID),
|
|
165
|
-
encounter: obs.encounterUuid,
|
|
166
|
-
value: newStatusUuid,
|
|
167
|
-
voided: false,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const response = await openmrsFetch("/ws/rest/v1/obs", {
|
|
171
|
-
method: "POST",
|
|
172
|
-
headers: {
|
|
173
|
-
"content-type": "application/json",
|
|
174
|
-
},
|
|
175
|
-
body: postBody,
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
return response;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export async function updateSampleStatusChangeObs(
|
|
182
|
-
newStatus: null | { uuid: string; display: string },
|
|
183
|
-
obsObject: Obs,
|
|
184
|
-
sampleStatusConceptUUID: string,
|
|
185
|
-
healthCenterAttrTypeUUID: string
|
|
186
|
-
) {
|
|
187
|
-
const ObsObjectTocreate = {
|
|
188
|
-
person: obsObject.patientUuid,
|
|
189
|
-
obsDatetime: new Date().toISOString(),
|
|
190
|
-
concept: sampleStatusConceptUUID,
|
|
191
|
-
location: await getUserLocation(healthCenterAttrTypeUUID),
|
|
192
|
-
encounter: obsObject.encounterUuid,
|
|
193
|
-
value: newStatus.uuid,
|
|
194
|
-
voided: newStatus ? false : true,
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const response = await openmrsFetch(
|
|
198
|
-
`/ws/rest/v1/obs/${obsObject.sampleStatusObsUuid}`,
|
|
199
|
-
{
|
|
200
|
-
method: "POST",
|
|
201
|
-
headers: {
|
|
202
|
-
"content-type": "application/json",
|
|
203
|
-
},
|
|
204
|
-
body: ObsObjectTocreate,
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
return response;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export async function postReferralStatusChangeObs(
|
|
212
|
-
targetValueUuid: string,
|
|
213
|
-
obsObject: Obs,
|
|
214
|
-
referralStatusConceptUUID: string,
|
|
215
|
-
healthCenterAttrTypeUUID: string
|
|
216
|
-
) {
|
|
217
|
-
const ObsObjectTocreate = {
|
|
218
|
-
person: obsObject.patientUuid,
|
|
219
|
-
obsDatetime: new Date().toISOString(),
|
|
220
|
-
concept: referralStatusConceptUUID,
|
|
221
|
-
location: await getUserLocation(healthCenterAttrTypeUUID),
|
|
222
|
-
encounter: obsObject.encounterUuid,
|
|
223
|
-
value: targetValueUuid,
|
|
224
|
-
voided: false,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const response = await openmrsFetch("/ws/rest/v1/obs", {
|
|
228
|
-
method: "POST",
|
|
229
|
-
headers: {
|
|
230
|
-
"content-type": "application/json",
|
|
231
|
-
},
|
|
232
|
-
body: ObsObjectTocreate,
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
return response;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export async function updateReferralStatusChangeObs(
|
|
239
|
-
targetValue,
|
|
240
|
-
obsObject: Obs,
|
|
241
|
-
referralStatusConceptUUID,
|
|
242
|
-
healthCenterAttrTypeUUID
|
|
243
|
-
) {
|
|
244
|
-
const ObsObjectTocreate = {
|
|
245
|
-
person: obsObject.patientUuid,
|
|
246
|
-
obsDatetime: new Date().toISOString(),
|
|
247
|
-
concept: referralStatusConceptUUID,
|
|
248
|
-
location: await getUserLocation(healthCenterAttrTypeUUID),
|
|
249
|
-
encounter: obsObject.encounterUuid,
|
|
250
|
-
value: targetValue.uuid,
|
|
251
|
-
voided: targetValue ? false : true,
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const response = await openmrsFetch(
|
|
255
|
-
`/ws/rest/v1/obs/${obsObject.referralStatusObsUuid}`,
|
|
256
|
-
{
|
|
257
|
-
method: "POST",
|
|
258
|
-
headers: {
|
|
259
|
-
"content-type": "application/json",
|
|
260
|
-
},
|
|
261
|
-
body: ObsObjectTocreate,
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
return response;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
export async function getUser(userUuid: string) {
|
|
271
|
-
const user = await openmrsFetch(`/ws/rest/v1/user/${userUuid}`);
|
|
272
|
-
|
|
273
|
-
return user.data;
|
|
274
|
-
}
|
|
275
|
-
export async function getEncounter(encounterUuid) {
|
|
276
|
-
const encResult = await openmrsFetch(`/ws/rest/v1/encounter/${encounterUuid}?v=full`);
|
|
277
|
-
|
|
278
|
-
return encResult.data;
|
|
279
|
-
}
|