@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
@@ -9,6 +9,7 @@ import DataTable, {
9
9
  TableBody,
10
10
  TableCell,
11
11
  } from "carbon-components-react/es/components/DataTable";
12
+ import { PDFDownloadLink, PDFViewer } from "@react-pdf/renderer";
12
13
 
13
14
  import styles from "./ReportComponent.css";
14
15
  import {
@@ -23,8 +24,13 @@ import {
23
24
  postReferralStatusChangeObs,
24
25
  updateReferralStatusChangeObs,
25
26
  EncounterResult,
27
+ // postApproval,
28
+ // voidApprovalObs,
29
+ getUser,
26
30
  Concept,
31
+ getEncounter,
27
32
  } from "./ReportComponent.resource";
33
+ import MyDocument from "../Print-to-PDF/Document-Component";
28
34
  import { Config } from "../config-schema";
29
35
 
30
36
  const ReportComponent = () => {
@@ -77,10 +83,18 @@ const ReportComponent = () => {
77
83
  key: "sampleDropOff",
78
84
  header: "Sample drop off?",
79
85
  },
86
+ {
87
+ key: "pathologicDiagnosisObs",
88
+ header: "Pathologic diagnosis",
89
+ },
80
90
  {
81
91
  key: "resultsEncounter",
82
92
  header: "Results",
83
93
  },
94
+ {
95
+ key: "PDFReport",
96
+ header: "Report",
97
+ },
84
98
  ];
85
99
 
86
100
  React.useEffect(() => {
@@ -95,7 +109,9 @@ const ReportComponent = () => {
95
109
  getEncounters(
96
110
  config.healthCenterAttrTypeUUID,
97
111
  config.pathologyFullAllowedLocationUUID
98
- ).then(setEncountersList);
112
+ ).then(
113
+ setEncountersList
114
+ );
99
115
  }, []);
100
116
 
101
117
  const filteredEncList = encountersList
@@ -129,12 +145,6 @@ const ReportComponent = () => {
129
145
  );
130
146
  }
131
147
  });
132
- //replace(/\s+/g, '');
133
- // const rows = filteredEncList.map(
134
- // (encounterInfo) => {
135
- // return {
136
- // // patientLink: <a href={`/openmrs/patientDashboard.form?patientId=${encounterInfo.personId}`} >Link</a>,
137
- // ...
138
148
 
139
149
  const rows = filteredEncList.map((encounterInfo) => {
140
150
  return {
@@ -192,7 +202,8 @@ const ReportComponent = () => {
192
202
  ))}
193
203
  </select>
194
204
  ),
195
- dateOfRequest: encounterInfo.encounterDatetime,
205
+ dateOfRequest: new Date(encounterInfo.encounterDatetime)
206
+ .toLocaleString(["en-GB","en-US","en","fr-RW"],{day: 'numeric',month: 'numeric',year: 'numeric'}),
196
207
  referralStatus: (
197
208
  <select
198
209
  onChange={(e) =>
@@ -228,6 +239,7 @@ const ReportComponent = () => {
228
239
  onChange={(e) => sampleDropOffChange(encounterInfo)}
229
240
  />
230
241
  ),
242
+ pathologicDiagnosisObs: encounterInfo.pathologicDiagnosisObs,
231
243
  resultsEncounter: encounterInfo.resultsEncounterId ? (
232
244
  <a
233
245
  data-testid="resultsEncounter"
@@ -237,7 +249,8 @@ const ReportComponent = () => {
237
249
  Results{" "}
238
250
  </a>
239
251
  ) : (
240
- !userLocation && (
252
+ (!userLocation ||
253
+ userLocation === config.pathologyFullAllowedLocationUUID) && (
241
254
  <a
242
255
  href={`/openmrs/module/htmlformentry/htmlFormEntry.form?personId=${encounterInfo.personId}&patientId=${encounterInfo.personId}&returnUrl=&formId=${config.pathologyResultsFromID}&uuid=${encounterInfo.encounterUuid}`}
243
256
  >
@@ -246,6 +259,18 @@ const ReportComponent = () => {
246
259
  </a>
247
260
  )
248
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
+
249
274
  };
250
275
  });
251
276
 
@@ -282,6 +307,7 @@ const ReportComponent = () => {
282
307
  }
283
308
  };
284
309
 
310
+
285
311
  const sampleStatusChange = (
286
312
  newStatus: { uuid: string; display: string },
287
313
  encounterInfo
@@ -371,6 +397,7 @@ const ReportComponent = () => {
371
397
  });
372
398
  }
373
399
  };
400
+
374
401
 
375
402
  return (
376
403
  <div>
@@ -435,6 +462,7 @@ const ReportComponent = () => {
435
462
  onChange={(e) => setPatientName(e.target.value)}
436
463
  />
437
464
  </div>
465
+ {console.log( encountersList)}
438
466
  <div className={styles.tableContainer}>
439
467
  <DataTable rows={rows} headers={headers}>
440
468
  {({ rows, headers, getTableProps, getHeaderProps, getRowProps }) => (
@@ -461,6 +489,15 @@ const ReportComponent = () => {
461
489
  )}
462
490
  </DataTable>
463
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>
464
501
  </div>
465
502
  );
466
503
  };
package/src/test.html ADDED
File without changes
package/webpack.config.js CHANGED
@@ -1 +1,30 @@
1
- module.exports = require("openmrs/default-webpack-config");
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 +0,0 @@
1
- "use strict";(self.webpackChunk_pih_esm_pathology_app=self.webpackChunk_pih_esm_pathology_app||[]).push([[574],{574:p=>{p.exports={}}}]);