@pih/esm-pathology-app 1.0.1 → 1.0.4

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 (54) hide show
  1. package/dist/00ebb57bb20c59433e84.gif +0 -0
  2. package/dist/16.js +3 -0
  3. package/dist/16.js.LICENSE.txt +1 -0
  4. package/dist/16.js.map +1 -0
  5. package/dist/24.js +3 -0
  6. package/dist/24.js.LICENSE.txt +16 -0
  7. package/dist/24.js.map +1 -0
  8. package/dist/248.js +3 -0
  9. package/dist/248.js.LICENSE.txt +99 -0
  10. package/dist/248.js.map +1 -0
  11. package/dist/294.js +3 -0
  12. package/dist/294.js.LICENSE.txt +14 -0
  13. package/dist/294.js.map +1 -0
  14. package/dist/574.js +1 -0
  15. package/dist/5b8bb278fcab4da4972e.ttf +0 -0
  16. package/dist/861.js +2 -0
  17. package/dist/861.js.map +1 -0
  18. package/dist/867.js +2 -0
  19. package/dist/867.js.map +1 -0
  20. package/dist/976.js +3 -0
  21. package/dist/976.js.LICENSE.txt +8 -0
  22. package/dist/976.js.map +1 -0
  23. package/dist/a5fad24f075c978ac04b.ttf +0 -0
  24. package/dist/pih-esm-pathology-app.js +1 -1
  25. package/dist/pih-esm-pathology-app.js.buildmanifest.json +153 -25
  26. package/dist/pih-esm-pathology-app.js.map +1 -1
  27. package/package.json +21 -10
  28. package/src/Fonts/georgia/GEORGIA4.TTF +0 -0
  29. package/src/Fonts/georgia/Georgia Bold Italic font.ttf +0 -0
  30. package/src/Fonts/georgia/Georgia Regular font.ttf +0 -0
  31. package/src/Fonts/georgia/Georgia.ttf +0 -0
  32. package/src/Fonts/georgia/georgia bold italic.ttf +0 -0
  33. package/src/Fonts/georgia/georgia italic.ttf +0 -0
  34. package/src/Fonts/georgia/georgia-bold.ttf +0 -0
  35. package/src/Fonts/georgia/georgiab.ttf +0 -0
  36. package/src/Fonts/georgia/georgiai.ttf +0 -0
  37. package/src/Fonts/georgia/georgiaz.ttf +0 -0
  38. package/src/Fonts/georgia/seriffic.ttf +0 -0
  39. package/src/Fonts/georgia/sharefonts.net.txt +1 -0
  40. package/src/Print-to-PDF/Document-Component.tsx +256 -0
  41. package/src/config-schema.ts +105 -6
  42. package/src/declarations.d.tsx +3 -0
  43. package/src/images/ButaroHospitalLogo.gif +0 -0
  44. package/src/pathology-report/ReportComponent.css +37 -36
  45. package/src/pathology-report/ReportComponent.resource.ts +37 -34
  46. package/src/pathology-report/ReportComponent.tsx +46 -9
  47. package/src/test.html +0 -0
  48. package/webpack.config.js +30 -1
  49. package/dist/574.pih-esm-pathology-app.js +0 -1
  50. package/dist/633.pih-esm-pathology-app.js +0 -3
  51. package/dist/633.pih-esm-pathology-app.js.LICENSE.txt +0 -29
  52. package/dist/633.pih-esm-pathology-app.js.map +0 -1
  53. package/dist/66.pih-esm-pathology-app.js +0 -2
  54. package/dist/66.pih-esm-pathology-app.js.map +0 -1
@@ -0,0 +1,256 @@
1
+ import React from "react";
2
+ import { Document, Page, Text,Image, View, StyleSheet,Font } from "@react-pdf/renderer";
3
+ import ButaroLogo from '../images/ButaroHospitalLogo.gif';
4
+ import GeorgiaFontBold from '../Fonts/georgia/georgia-bold.ttf';
5
+ import GeorgiaFont from '../Fonts/georgia/Georgia.ttf';
6
+
7
+ // import { Font } from '@react-pdf/renderer';
8
+ Font.register({ family: 'GeorgiaBold', src: GeorgiaFontBold});
9
+ Font.register({ family: 'Georgia', src: GeorgiaFont});
10
+
11
+ // Font.register({ family: 'Georgia', src: '../Fonts/georgia/Georgia.ttf', fontStyle: 'normal', fontWeight: 'normal' });
12
+
13
+
14
+
15
+
16
+ // Create styles
17
+ const styles = StyleSheet.create({
18
+ page: {
19
+ flexDirection: "row",
20
+ },
21
+ section: {
22
+ margin: 10,
23
+ padding: 20,
24
+ flexGrow: 1,
25
+ },
26
+ textLabels: {
27
+ padding: 7,
28
+ fontFamily:"GeorgiaBold",
29
+ fontSize: 16,
30
+ fontWeight: 'bold',
31
+ paddingBottom:30,
32
+ },
33
+ sentenceLabels: {
34
+ paddingTop: 7,
35
+ fontFamily:"GeorgiaBold",
36
+ fontSize: 16,
37
+ fontWeight: 'bold',
38
+ paddingBottom:3,
39
+ },
40
+ textAnswers: {
41
+ margin: 10,
42
+ padding: 20,
43
+ fontFamily:"Georgia",
44
+ fontSize: 14,
45
+ },
46
+ sentenceAnswers: {
47
+ marginBottom: 10,
48
+ paddingBottom: 20,
49
+ fontFamily:"Georgia",
50
+ fontSize: 14,
51
+ },
52
+ logo: {
53
+ width: 61,
54
+
55
+ }
56
+ });
57
+
58
+ // Create Document Component
59
+ const MyDocument = (props) => (
60
+
61
+ <Document title={`Pathology report
62
+ ${props.encounterInfo.family_name}
63
+ ${props.encounterInfo.given_name}
64
+ ${props.encounterInfo.middle_name} `}
65
+ >
66
+ <Page size="A4" style={styles.page}>
67
+
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}>
73
+ Lab phone number:
74
+ </Text>
75
+ <Text>{" "}{" "}0784433618</Text>
76
+ </Text>
77
+ <Text style={{ position: "absolute",top: 15,left: 300,width: 300 }}>
78
+ <Text style={styles.textAnswers}>
79
+ Accession number:
80
+ </Text>
81
+ <Text >
82
+ {" "}{" "}
83
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.AccessionNumberconceptUUID && obser.value)}
84
+ </Text>
85
+ </Text>
86
+ <Text style={{ backgroundColor: "#E4E4E4",borderBottom:'1px', textAlign: 'center',fontWeight: 1500, marginBottom: 30,fontFamily:"GeorgiaBold" }}>
87
+ Pathology Report
88
+ </Text>
89
+ <Text style={{ paddingBottom: 10 }} >
90
+ <Text style={styles.textAnswers}>
91
+ Patient Name:
92
+ </Text>
93
+ <Text style={styles.textAnswers}>
94
+ {" "}{" "}
95
+ {props.encounterInfo.family_name} {" "}
96
+ {props.encounterInfo.given_name} {" "}
97
+ {props.encounterInfo.middle_name}
98
+ </Text>
99
+
100
+ </Text>
101
+ <Text style={{ paddingBottom: 10, position: "absolute",top: 140,left: 335 }}>
102
+ <Text style={styles.textAnswers}>
103
+ Surgery Date:
104
+ </Text>
105
+ <Text style={styles.textAnswers}>
106
+ {" "}{" "}
107
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.DateBiopsySpecimenTakenconceptUUID &&
108
+ new Date(obser.value)
109
+ .toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'})
110
+ )}
111
+ </Text>
112
+
113
+ </Text>
114
+ <Text style={{ paddingBottom: 10 }} >
115
+ <Text style={styles.textAnswers}>
116
+ Patient Birthday:
117
+ </Text>
118
+ <Text style={styles.textAnswers}>
119
+ {" "}{" "}
120
+ {
121
+ new Date(props.encounterInfo.personBirthdate)
122
+ .toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'})
123
+ }
124
+ </Text>
125
+
126
+ </Text>
127
+ <Text style={{ paddingBottom: 10, position: "absolute",top: 168,left: 335,width: 200 }}>
128
+ <Text style={styles.textAnswers}>
129
+ Specimen Reception Date:
130
+ </Text>
131
+ <Text style={styles.textAnswers}>
132
+ {" "}{" "}
133
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.SpecimenSubmissionDateconceptUUID &&
134
+ new Date(obser.value)
135
+ .toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'})
136
+ )}
137
+ </Text>
138
+ </Text>
139
+ <Text style={{ paddingBottom: 10,borderBottom:'1px' }} >
140
+ <Text style={styles.textAnswers}>
141
+ Patient Gender:
142
+ </Text>
143
+ <Text style={styles.textAnswers}>
144
+ {" "}{" "}
145
+ {props.encounterInfo.personGender}
146
+ </Text>
147
+
148
+ </Text>
149
+ <Text style={{ paddingBottom: 10, position: "absolute",top: 200,left: 335,width: 250 }}>
150
+ <Text style={styles.textAnswers}>
151
+ Signout Date:
152
+ </Text>
153
+ <Text style={styles.textAnswers}>
154
+ {" "}{" "}
155
+ {
156
+ new Date(props.encounterInfo.resultsEncounter.encounterDatetime)
157
+ .toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'})
158
+ }
159
+ </Text>
160
+ </Text>
161
+
162
+ <Text style={{ backgroundColor: "#E4E4E4",paddingBottom: 10 }}>
163
+ <Text style={styles.textLabels}>
164
+ Sending Physician:
165
+ </Text>
166
+ <Text style={styles.textAnswers}>
167
+ {" "}{" "}
168
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.SendingPhysicianconceptUUID && obser.value)}
169
+ </Text>
170
+ </Text>
171
+ <Text style={{ backgroundColor: "#E4E4E4",paddingBottom: 10 }}>
172
+ <Text style={styles.textLabels}>
173
+ Sending Facility:
174
+ </Text>
175
+ <Text style={styles.textAnswers}>
176
+ {" "}{" "}
177
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.OtherBiopsyLocationconceptUUID && obser.value)}
178
+ </Text>
179
+ </Text>
180
+ <Text style={{backgroundColor: "#E4E4E4",paddingBottom: 10 ,fontFamily:"Georgia"}}>Anatomical location:</Text>
181
+ <Text style={{backgroundColor: "#E4E4E4", paddingBottom: 10,paddingLeft:10 }}>
182
+ <Text style={styles.textLabels}>
183
+ i.System:
184
+ </Text>
185
+ <Text style={styles.textAnswers}>
186
+ {" "}{" "}
187
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.OrganSystemconceptUUID && (obser.value.name.display+ ", "))}
188
+ </Text>
189
+ </Text>
190
+ <Text style={{backgroundColor: "#E4E4E4", paddingBottom: 10,paddingLeft:10 }}>
191
+ <Text style={styles.textLabels}>
192
+ ii.Organ:
193
+ </Text>
194
+ <Text style={styles.textAnswers}>
195
+ {" "}{" "}
196
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.OrganconceptUUID && (obser.value.name.display+ ", "))}
197
+ </Text>
198
+ </Text>
199
+ <Text style={{backgroundColor: "#E4E4E4", paddingBottom: 10,paddingLeft:10 }}>
200
+ <Text style={styles.textLabels}>
201
+ iii.Detail:
202
+ </Text>
203
+ <Text style={styles.textAnswers}>
204
+ {" "}{" "}
205
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.SpecimenDetailconceptUUID && obser.value)}
206
+ </Text>
207
+ </Text>
208
+ <Text style={{backgroundColor: "#E4E4E4", paddingBottom: 10 }}>
209
+ <Text style={styles.textLabels}>
210
+ Procedure type:
211
+ </Text>
212
+ <Text style={styles.textAnswers}>
213
+ {" "}{" "}
214
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.OtherTestsOrProceduresconceptUUID && obser.value)}
215
+ </Text>
216
+ </Text>
217
+ <Text style={[styles.sentenceLabels]}>
218
+ Gross Description:
219
+ </Text>
220
+ <Text style={[styles.sentenceAnswers]}>
221
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.GrossDescriptionconceptUUID && obser.value)}
222
+
223
+ </Text>
224
+ <Text style={styles.sentenceLabels}>
225
+ Microscopic Examination:
226
+ </Text>
227
+ <Text style={styles.sentenceAnswers}>
228
+
229
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.MacroscopicExaminationconceptUUID && obser.value)}
230
+
231
+ </Text>
232
+ <Text style={styles.sentenceLabels}>
233
+ Conclusion:
234
+ </Text>
235
+ <Text style={styles.sentenceAnswers}>
236
+
237
+ {props.encounterInfo.resultsEncounter.obs.map((obser) => obser.concept.uuid==props.config.COMMENTSATCONCLUSIONOFEXAMINATIONconceptUUID && obser.value)}
238
+
239
+ </Text>
240
+
241
+ <Text style={{backgroundColor: "#E4E4E4", paddingBottom: 10 }}>
242
+ <Text style={styles.textLabels}>
243
+ Validated by pathologist:
244
+ </Text>
245
+ <Text style= {[styles.textAnswers, { fontWeight: 'bold' }]}>
246
+ {" "}{" "}
247
+ {props.encounterInfo.approvedBy}
248
+ </Text>
249
+ </Text>
250
+ </View>
251
+ </Page>
252
+ </Document>
253
+ );
254
+
255
+ export default MyDocument;
256
+
@@ -17,7 +17,7 @@ import { Type, validator } from "@openmrs/esm-framework";
17
17
  export const configSchema = {
18
18
  pathologyEncTypeUUID: {
19
19
  _type: Type.String,
20
- _default: "4d911f5c-26fe-102b-80cb-0017a47871b2",
20
+ _default: "70f18a24-92ec-4de5-acdc-7cae77414e32",
21
21
  _description:
22
22
  "This is to determine the UUID of the Pathology encounterType in the instance",
23
23
  },
@@ -29,25 +29,25 @@ export const configSchema = {
29
29
  },
30
30
  pathologyFullAllowedLocationUUID: {
31
31
  _type: Type.String,
32
- _default: "38c4b94b-97a6-4f2c-bca6-c28a37cf60ed",
32
+ _default: "a62fd59a-6577-43e0-b39c-ba42ac8cfbc9",
33
33
  _description:
34
34
  "This is to determine the location allowed to view all other location data",
35
35
  },
36
36
  sampleStatusConceptUUID: {
37
37
  _type: Type.String,
38
- _default: "3ce163d8-26fe-102b-80cb-0017a47871b2",
38
+ _default: "3adca58e-9334-4be5-9bd3-74f7bbf82776",
39
39
  _description:
40
40
  "This is to determine the UUID of the sample status concept in the instance",
41
41
  },
42
42
  referralStatusConceptUUID: {
43
43
  _type: Type.String,
44
- _default: "3cd93302-26fe-102b-80cb-0017a47871b2",
44
+ _default: "5a7a931f-97b8-4d59-b0de-3a83603aaad9",
45
45
  _description:
46
46
  "This is to determine the UUID of the referral status concept in the instance",
47
47
  },
48
48
  sampleDropOffconceptUUID: {
49
49
  _type: Type.String,
50
- _default: "13662f27-9be5-4595-8bab-07b0e859d9f4",
50
+ _default: "dc288e6c-84a4-4fd3-9136-ef9e13961b1e",
51
51
  _description:
52
52
  "This is to determine the UUID of the sample drop off concept in the instance",
53
53
  },
@@ -66,10 +66,94 @@ export const configSchema = {
66
66
 
67
67
  pathologyResultsFromID: {
68
68
  _type: Type.Number,
69
- _default: 131,
69
+ _default: 5613,
70
70
  _description:
71
71
  "This is to determine the ID of the pathology results form in the instance",
72
72
  },
73
+ pathologyResultsApprovedconceptUUID: {
74
+ _type: Type.String,
75
+ _default: "1f7742f0-4571-44d8-a88b-8bc60dc11e29",
76
+ _description:
77
+ "This is to determine the pathology results approved concept uuid",
78
+ },
79
+ AccessionNumberconceptUUID: {
80
+ _type: Type.String,
81
+ _default: "0e466f59-8070-45b5-97d1-575ec5cfd85d",
82
+ _description:
83
+ "This is to determine the Accession Number concept uuid",
84
+ },
85
+ DateBiopsySpecimenTakenconceptUUID: {
86
+ _type: Type.String,
87
+ _default: "e0436a5b-dc19-4cb9-ac1b-acc005272c08",
88
+ _description:
89
+ "This is to determine the Date Biopsy Specimen Taken concept uuid",
90
+ },
91
+ SpecimenSubmissionDateconceptUUID: {
92
+ _type: Type.String,
93
+ _default: "3928b7fc-b3ae-40a5-846f-d480120b04f6",
94
+ _description:
95
+ "This is to determine the Specimen Submission Date concept uuid",
96
+ },
97
+ SendingPhysicianconceptUUID: {
98
+ _type: Type.String,
99
+ _default: "0a4a22db-0e82-4669-9aba-086d841505b5",
100
+ _description:
101
+ "This is to determine the Sending Physician concept uuid",
102
+ },
103
+ OtherBiopsyLocationconceptUUID: {
104
+ _type: Type.String,
105
+ _default: "7c4650ee-45d5-435a-b968-511ef127a016",
106
+ _description:
107
+ "This is to determine the Other Biopsy Location concept uuid",
108
+ },
109
+ OrganSystemconceptUUID: {
110
+ _type: Type.String,
111
+ _default: "b88f9524-6b39-41b3-9b3a-f9a7a4b08fed",
112
+ _description:
113
+ "This is to determine the Organ System concept uuid",
114
+ },
115
+ OrganconceptUUID: {
116
+ _type: Type.String,
117
+ _default: "488fe4a2-7903-41da-b21e-fb236a1ee356",
118
+ _description:
119
+ "This is to determine the Organ concept uuid",
120
+ },
121
+ SpecimenDetailconceptUUID: {
122
+ _type: Type.String,
123
+ _default: "e99170a5-f46b-490b-8fbb-bb9eacba3500",
124
+ _description:
125
+ "This is to determine the Specimen Detail concept uuid",
126
+ },
127
+ OtherTestsOrProceduresconceptUUID: {
128
+ _type: Type.String,
129
+ _default: "66ad3230-59b2-4232-821e-a9ae86819e03",
130
+ _description:
131
+ "This is to determine the Other tests or procedures concept uuid",
132
+ },
133
+ GrossDescriptionconceptUUID: {
134
+ _type: Type.String,
135
+ _default: "1e97a4d3-1691-4fb7-be78-18e526e82b0b",
136
+ _description:
137
+ "This is to determine the Gross Description concept uuid",
138
+ },
139
+ MacroscopicExaminationconceptUUID: {
140
+ _type: Type.String,
141
+ _default: "5d149510-0767-4da7-82cd-be406b34877d",
142
+ _description:
143
+ "This is to determine the Macroscopic Examination concept uuid",
144
+ },
145
+ COMMENTSATCONCLUSIONOFEXAMINATIONconceptUUID: {
146
+ _type: Type.String,
147
+ _default: "3cdc5938-26fe-102b-80cb-0017a47871b2",
148
+ _description:
149
+ "This is to determine the COMMENTS AT CONCLUSION OF EXAMINATION concept uuid",
150
+ },
151
+ CanregCodeconceptUUID: {
152
+ _type: Type.String,
153
+ _default: "16931672-e068-4ea8-a89c-2ee7dbc07ad1",
154
+ _description:
155
+ "This is to determine the Canreg Code concept uuid",
156
+ },
73
157
  };
74
158
 
75
159
  export type Config = {
@@ -82,4 +166,19 @@ export type Config = {
82
166
  yesConceptUUID: string;
83
167
  yesConceptName: string;
84
168
  pathologyResultsFromID: number;
169
+ pathologyResultsApprovedconceptUUID: string;
170
+
171
+ AccessionNumberconceptUUID: string;
172
+ DateBiopsySpecimenTakenconceptUUID: string;
173
+ SpecimenSubmissionDateconceptUUID: string;
174
+ SendingPhysicianconceptUUID: string;
175
+ OtherBiopsyLocationconceptUUID: string;
176
+ OrganSystemconceptUUID: string;
177
+ OrganconceptUUID: string;
178
+ SpecimenDetailconceptUUID: string;
179
+ OtherTestsOrProceduresconceptUUID: string;
180
+ GrossDescriptionconceptUUID: string;
181
+ MacroscopicExaminationconceptUUID: string;
182
+ COMMENTSATCONCLUSIONOFEXAMINATIONconceptUUID: string;
183
+ CanregCodeconceptUUID: string;
85
184
  };
@@ -1 +1,4 @@
1
1
  declare module "*.css";
2
+ declare module '*.png';
3
+ declare module '*.gif';
4
+ declare module '*.ttf';
@@ -1,38 +1,39 @@
1
- .tableContainer {
2
- height: 500px;
3
- overflow-x: auto;
4
- margin: 0 1rem;
5
- border: 2px solid lightgrey;
6
- border-radius: 0.25rem;
7
- }
1
+ .tableContainer {
2
+ height: 500px;
3
+ overflow-x: auto;
4
+ margin: 0 1rem;
5
+ border: 2px solid lightgrey;
6
+ border-radius: 0.25rem;
7
+ }
8
8
 
9
- .filtersContainer {
10
- border-radius: 0.25rem;
11
- margin: 0 1rem;
12
- }
9
+ .filtersContainer {
10
+ border-radius: 0.25rem;
11
+ margin: 0 1rem;
12
+ padding-top: 4%;
13
+ }
13
14
 
14
- .dropdown {
15
- width: 10%;
16
- height: 2rem;
17
- background: transparent;
18
- border: 1px solid var(--omrs-color-ink-lowest-contrast);
19
- background-clip: padding-box;
20
- border-radius: 4px;
21
- margin: 1rem;
22
- }
23
- .dropdown:disabled {
24
- opacity: 0.8;
25
- background: lightgrey;
26
- cursor: not-allowed;
27
- }
28
- .dropdown:focus {
29
- border: 2px solid var(--omrs-color-interaction);
30
- outline: 0;
31
- }
32
- .textBox {
33
- background: transparent;
34
- border: 1px solid var(--omrs-color-ink-lowest-contrast);
35
- background-clip: padding-box;
36
- border-radius: 4px;
37
- margin: 1rem;
38
- }
15
+ .dropdown {
16
+ width: 10%;
17
+ height: 2rem;
18
+ background: transparent;
19
+ border: 1px solid var(--omrs-color-ink-lowest-contrast);
20
+ background-clip: padding-box;
21
+ border-radius: 4px;
22
+ margin: 1rem;
23
+ }
24
+ .dropdown:disabled {
25
+ opacity: 0.8;
26
+ background: lightgrey;
27
+ cursor: not-allowed;
28
+ }
29
+ .dropdown:focus {
30
+ border: 2px solid var(--omrs-color-interaction);
31
+ outline: 0;
32
+ }
33
+ .textBox {
34
+ background: transparent;
35
+ border: 1px solid var(--omrs-color-ink-lowest-contrast);
36
+ background-clip: padding-box;
37
+ border-radius: 4px;
38
+ margin: 1rem;
39
+ }
@@ -1,4 +1,6 @@
1
1
  import { openmrsFetch } from "@openmrs/esm-framework";
2
+ import cloneDeep from "lodash-es/cloneDeep";
3
+
2
4
 
3
5
  export interface EncounterResult {
4
6
  family_name: string;
@@ -15,6 +17,11 @@ export interface EncounterResult {
15
17
  referralStatusObs: string;
16
18
  sampleDropoffObs: string;
17
19
  resultsEncounterId: string;
20
+ resultsEncounterUuid: string;
21
+ resultsEncounter: [];
22
+ approvedBy: string;
23
+ approvalObsUuid: string;
24
+ pathologicDiagnosisObs: string;
18
25
  }
19
26
  export interface Patient {
20
27
  uuid: string;
@@ -24,6 +31,7 @@ export interface Concept {
24
31
  name: string;
25
32
  display: string;
26
33
  }
34
+
27
35
  export interface Obs {
28
36
  patientUuid: string;
29
37
  obsDateTime: string;
@@ -34,35 +42,9 @@ export interface Obs {
34
42
  encounterUuid: string;
35
43
  valueCodedName: string;
36
44
  voided: boolean;
45
+ resultsEncounterUuid: string;
37
46
  }
38
47
 
39
- // export async function getPatientEncounters(patientUuid): Promise<Array<EncounterResult>> {
40
- // const searchPatientEncounters = await openmrsFetch(
41
- // `/ws/rest/v1/encounter?encounterType=${ENCOUNTERTYPEUUID}&patient=${patientUuid}`,
42
- // );
43
- // const fullPatientEncounterData = searchPatientEncounters.data.results.map(async (searchEnc) => {
44
- // const enc = await openmrsFetch(`/ws/rest/v1/encounter/${searchEnc.uuid}?v=full`);
45
- // const searchPatient = await openmrsFetch(`/ws/rest/v1/patient/${patientUuid}?v=full`);
46
- // const retrievedObject = {
47
- // patientName: searchPatient.data.person.names[0],
48
- // patientPhoneNumber: searchPatient.data.person.attributes.filter(
49
- // (attribute) => attribute.attributeType.uuid == PHONENUMBERATTRUUID,
50
- // )[0],
51
- // patientHealthCenter: searchPatient.data.person.attributes.filter(
52
- // (attribute) => attribute.attributeType.uuid == HEALTHCENTERATTRTYPEUUID,
53
- // )[0],
54
- // patientUuid: searchPatient.data.uuid,
55
- // encUuid: enc.data.uuid,
56
- // encounterDatetime: enc.data.encounterDatetime,
57
- // sampleStatusObs: enc.data.obs.filter((obs) => obs.concept.uuid === SAMPLESTATUSUUID)[0],
58
- // referralStatusObs: enc.data.obs.filter((obs) => obs.concept.uuid === REFERRALSTATUSUUID)[0],
59
- // sampleDropoffObs: enc.data.obs.filter((obs) => obs.concept.uuid === SAMPLEDROPOFFUUID)[0],
60
- // };
61
-
62
- // return retrievedObject;
63
- // });
64
- // return Promise.all(fullPatientEncounterData);
65
- // }
66
48
 
67
49
  export async function getUserLocation(healthCenterAttrTypeUUID) {
68
50
  const session = await openmrsFetch(`/ws/rest/v1/session`);
@@ -73,7 +55,7 @@ export async function getUserLocation(healthCenterAttrTypeUUID) {
73
55
  const hcPersonAttribute = person.data.results.filter(
74
56
  (attr) => attr.attributeType.uuid === healthCenterAttrTypeUUID
75
57
  );
76
- return hcPersonAttribute[0]?.value.uuid;
58
+ return hcPersonAttribute[0] && hcPersonAttribute.value.uuid;
77
59
  }
78
60
 
79
61
  export async function getConceptAnswers(conceptUuid) {
@@ -89,11 +71,6 @@ export async function getLocations() {
89
71
  return location.data.results;
90
72
  }
91
73
 
92
- // export async function getPatient(patientUuid): Promise<Patient> {
93
- // const searchPatient = await openmrsFetch(`/ws/rest/v1/patient/c604dabc-2700-102b-80cb-0017a47871b2?v=full`);
94
- // return searchPatient.data;
95
- // }
96
-
97
74
  export async function getEncounters(
98
75
  healthCenterAttrTypeUUID: string,
99
76
  pathologyFullAllowedLocationUUID: string
@@ -113,7 +90,20 @@ export async function getEncounters(
113
90
  `/ws/rest/v1/reportingrest/reportdata/996cf192-ff54-11eb-a63a-080027ce9ca0`
114
91
  );
115
92
  }
116
- return searchEncounter.data.dataSets[0].rows;
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);
117
107
  }
118
108
 
119
109
  export async function postSampleDropoffObs(
@@ -274,3 +264,16 @@ export async function updateReferralStatusChangeObs(
274
264
 
275
265
  return response;
276
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
+ }