@medicus.ai/medicus-report-pdf-generator 1.3.11 → 1.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicus.ai/medicus-report-pdf-generator",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "Nasco corporate report - latest update in 12/10/2023 - Fix HRC for bionext",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+ /**
3
+ * Standalone HTML preview for the Big Integral Questionnaire section.
4
+ * Writes output/big-integral-preview.html and opens it in the default browser.
5
+ * Does NOT need puppeteer or canvas.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+
11
+ const { renderBigIntegralQuestionnaire } = require('./lib/big_integral_questionnaire');
12
+
13
+ // Load raw config
14
+ const clientConfig = JSON.parse(
15
+ fs.readFileSync(path.resolve(__dirname, 'config/maisonsante.json'), 'utf8')
16
+ );
17
+
18
+ const sectionHtml = renderBigIntegralQuestionnaire({ clientConfig });
19
+
20
+ const fullHtml = `<!DOCTYPE html>
21
+ <html lang="en">
22
+ <head>
23
+ <meta charset="UTF-8">
24
+ <meta name="viewport" content="width=device-width,initial-scale=1">
25
+ <title>Big Integral Questionnaire — Design Preview</title>
26
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet">
27
+ <style>
28
+ *, *::before, *::after { box-sizing: border-box; }
29
+ body {
30
+ font-family: 'Open Sans', sans-serif;
31
+ background: #f4f6fb;
32
+ margin: 0;
33
+ padding: 20px;
34
+ }
35
+ .page-title {
36
+ font-size: 15px;
37
+ font-weight: 700;
38
+ color: #0F2062;
39
+ margin-bottom: 6px;
40
+ letter-spacing: .5px;
41
+ }
42
+ .page-sub {
43
+ font-size: 11px;
44
+ color: #888;
45
+ margin-bottom: 30px;
46
+ }
47
+ .a4-wrapper {
48
+ width: 794px; /* approximate A4 @ 96 dpi */
49
+ margin: 0 auto;
50
+ background: #fff;
51
+ border-radius: 6px;
52
+ box-shadow: 0 4px 20px rgba(0,0,0,.10);
53
+ padding: 32px 36px;
54
+ }
55
+ </style>
56
+ </head>
57
+ <body>
58
+ <div class="a4-wrapper">
59
+ <div class="page-title">Maison Sante — Doctor PDF: Big Integral Questionnaire</div>
60
+ <div class="page-sub">Maison Sante colors &mdash; dummy data &mdash; Doctor PDF only</div>
61
+ ${sectionHtml}
62
+ </div>
63
+ </body>
64
+ </html>`;
65
+
66
+ const outPath = path.resolve(__dirname, 'output/big-integral-preview.html');
67
+ fs.mkdirSync(path.dirname(outPath), { recursive: true });
68
+ fs.writeFileSync(outPath, fullHtml, 'utf8');
69
+ console.log('Preview written to:', outPath);
70
+
71
+ // Open in default browser (Windows)
72
+ const { exec } = require('child_process');
73
+ exec(`start "" "${outPath}"`, (err) => {
74
+ if (err) console.log('Open manually:', outPath);
75
+ });
@@ -27,6 +27,7 @@
27
27
  <div id="smart-report">
28
28
  </div>
29
29
  <div class="doctor-details"></div>
30
+ <div id="big-integral-section" class="big-integral-section"></div>
30
31
  </div>
31
32
 
32
33
  <!-- JS ------------------------------------>
@@ -32,6 +32,7 @@
32
32
  <div id="smart-report">
33
33
 
34
34
  </div>
35
+ <div id="big-integral-section" class="big-integral-section"></div>
35
36
  </div>
36
37
 
37
38
  <!-- JS ------------------------------------>
package/test.js CHANGED
@@ -10,20 +10,17 @@ const CLIENTS = {
10
10
  MaisonSante: 'maisonsante'
11
11
  };
12
12
 
13
- const client = CLIENTS.MaisonSante;
13
+ const client = CLIENTS.PHA;
14
14
 
15
15
  const path = require("path");
16
- const phaReportWithWellbeing = require("./testing-reports/pha/with-wellbeing");
17
- const phaReportWithoutWellbeing = require("./testing-reports/pha/without-wellbeing");
18
- const phaReportWithWellbeingFullData = require("./testing-reports/pha/with-wellbeing-full-data");
19
- const phaReportEx2 = require("./testing-reports/pha/ex2");
20
- const phaReportEx1 = require("./testing-reports/pha/ex1");
16
+ const phaNotesExample = require("./testing-reports/pha/notes-example");
21
17
  const mediclinicReportWithWellbeing = require("./testing-reports/mediclinic/with-wellbeing");
22
18
  const mediclinicDoctorData = require("./testing-reports/mediclinic/doctor-data");
23
19
  const mediclinicArabicData = require("./testing-reports/mediclinic/arabic-data");
24
- // Data objects moved to testing-reports/mediclinic/
25
- // PHA examples: phaReportEx1 | phaReportEx2 | phaReportWithWellbeingFullData | phaReportWithWellbeing | phaReportWithoutWellbeing
26
- const data = phaReportEx1; // switch to phaReportEx2, phaReportWithWellbeingFullData, etc. to test different PHA examples
20
+ // PHA examples: phaNotesExample
21
+ // Mediclinic examples: mediclinicReportWithWellbeing | mediclinicDoctorData | mediclinicArabicData
22
+ // Using mediclinicDoctorData (IsDoctor:true) so the Big Integral Questionnaire section renders for Maison Sante
23
+ const data = phaNotesExample;
27
24
  const doctorData = mediclinicDoctorData;
28
25
  const arabicData = mediclinicArabicData;
29
26
 
@@ -31,7 +28,7 @@ async function generateTestPDF() {
31
28
  const PDF_FILE_PATH = path.resolve(__dirname, "output/nasco-sample.pdf");
32
29
  const ENCRYPTED_PATH = path.resolve(__dirname, "output/nasco-sample-encrypted.pdf");
33
30
 
34
- // Generate HTML - uses `data` (PHA example: phaEx1, phaEx2, phaReportWithWellbeingFullData, etc.)
31
+ // Generate HTML - uses `data` (swap with any example variable above)
35
32
  const html = await generateHTMLWellbeingReportWithSmartReport(
36
33
  data,
37
34
  true,