@medicus.ai/medicus-report-pdf-generator 1.3.23 → 1.3.25

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/lib/template.js CHANGED
@@ -6,6 +6,11 @@ const path = require('path');
6
6
 
7
7
  let useMonospace = false;
8
8
  function setUseMonospace(val) { useMonospace = val; }
9
+ // Maison Santé-only rendering switches. Set per request by
10
+ // generateHTMLWellbeingReportWithSmartReport (reset after), like useMonospace,
11
+ // so other clients are never affected.
12
+ let isMaisonSante = false;
13
+ function setIsMaisonSante(val) { isMaisonSante = val; }
9
14
  const INDENTATION = {
10
15
  PANEL_TITLE: 12,
11
16
  BIOMARKER_DETAILS: 12,
@@ -1182,6 +1187,20 @@ function renderBiomarkerV3(biomarker, nestingLevel, isChildBiomarker, isCompactV
1182
1187
 
1183
1188
  function renderPanelV3(panel, nestingLevel, isCompactView, counter = null, isRectified = false, isAllergyItem = false) {
1184
1189
 
1190
+ // Maison Santé: the LIS sometimes sends a prescription under a panel whose
1191
+ // name is the literal string "undefined" (a sender bug). That wrapper panel
1192
+ // carries no biomarkers of its own (the prescription biomarker + its details
1193
+ // table are sibling items), so rendering its header just prints an
1194
+ // "undefined" title bar. Drop the header entirely in that exact case; the
1195
+ // prescription content still renders from the sibling items. Other clients
1196
+ // and any panel that actually has biomarkers are untouched.
1197
+ if (isMaisonSante
1198
+ && /^\s*(undefined|null)\s*$/i.test(String(panel && panel.name))
1199
+ && (!panel.biomarkers || panel.biomarkers.length === 0)
1200
+ && !panel.panelBiomarker) {
1201
+ return '';
1202
+ }
1203
+
1185
1204
 
1186
1205
  const panelCssId = `panel-${panel.panelId}db${Math.floor(Math.random() * 3)}`;
1187
1206
  // Each panel note is a separate line from the lab; joining with '' glued them
@@ -2224,6 +2243,7 @@ module.exports = {
2224
2243
  renderHTMLTemplate,
2225
2244
  renderAllergyClasses,
2226
2245
  setUseMonospace,
2246
+ setIsMaisonSante,
2227
2247
  }
2228
2248
 
2229
2249
 
@@ -7,7 +7,7 @@ const path = require("path");
7
7
  const LocaleService = require('../app/services/localeService.js');
8
8
  const i18n = require('../app/i18n_wellbeing.config.js');
9
9
  const puppeteer = require("puppeteer");
10
- const { renderReportItems, find, renderSummary, renderReportSummary, renderHTMLTemplate, renderAllergyClasses, setUseMonospace } = require("./template.js");
10
+ const { renderReportItems, find, renderSummary, renderReportSummary, renderHTMLTemplate, renderAllergyClasses, setUseMonospace, setIsMaisonSante } = require("./template.js");
11
11
  const { cli } = require("webpack");
12
12
 
13
13
 
@@ -1475,7 +1475,9 @@ let generateHTMLWellbeingReportWithSmartReport = async (data, isDebugging, clien
1475
1475
  // Add smart report if available
1476
1476
  if (!empty(smartReport)) {
1477
1477
  setUseMonospace(client.toLowerCase() === 'pha');
1478
+ setIsMaisonSante(client.toLowerCase() === 'maisonsante');
1478
1479
  let smartReportHtml = generateReportHtml(smartReport, isRtl, false, false, language).html;
1480
+ setIsMaisonSante(false);
1479
1481
  setUseMonospace(false);
1480
1482
 
1481
1483
  if (shouldHideWellbeingUI) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicus.ai/medicus-report-pdf-generator",
3
- "version": "1.3.23",
3
+ "version": "1.3.25",
4
4
  "description": "Nasco corporate report - latest update in 12/10/2023 - Fix HRC for bionext",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,6 +5,28 @@
5
5
  <title>TEMPLATE</title>
6
6
  <link rel="stylesheet" href="../assets/Mediclinic/css/nasco_report.css" type="text/css">
7
7
  <link rel="stylesheet" href="../assets/Mediclinic/css/style.css" type="text/css">
8
+ <style>
9
+ /* Detailed biomarker rows: the shared Mediclinic sheet floats every
10
+ .biomarker-container. Chromium 78's print fragmentation mishandles a float
11
+ that crosses a page break (rows with a history-chart canvas), leaving
12
+ ~300pt of blank space between a biomarker and its insight. Keep the rows
13
+ in normal flow; flow-root still contains their floated columns. */
14
+ .biomarker-container {
15
+ float: none !important;
16
+ display: flow-root;
17
+ }
18
+
19
+ /* Sub-panel headers carry an inline width (e.g. "margin-left:14px;width:780px")
20
+ to sit indented under their parent. A stray global rule
21
+ `.panel-title { float: right }` in the shared sheet makes those
22
+ fixed-width headers float to the right edge, so the sub-panel looks
23
+ shifted far to the right. Force nested headers back to the left so the
24
+ indent reads correctly. Only nested headers match [style*="width:"];
25
+ top-level panel titles (full width) are untouched. */
26
+ .score-main .section.panel .panel-title[style*="width:"] {
27
+ float: left !important;
28
+ }
29
+ </style>
8
30
  <script>
9
31
  var IS_ARABIC = false;
10
32
  </script>
@@ -60,6 +60,26 @@
60
60
  direction: ltr !important;
61
61
  unicode-bidi: isolate !important;
62
62
  }
63
+
64
+ /* Detailed biomarker rows: the shared Mediclinic sheet floats every
65
+ .biomarker-container. Chromium 78's print fragmentation mishandles a float
66
+ that crosses a page break (rows with a history-chart canvas), leaving
67
+ ~300pt of blank space between a biomarker and its insight. Keep the rows
68
+ in normal flow; flow-root still contains their floated columns. */
69
+ .biomarker-container {
70
+ float: none !important;
71
+ display: flow-root;
72
+ }
73
+
74
+ /* RTL mirror of the sub-panel indent fix: nested headers (identified by
75
+ their inline width) must indent from the right. The inline style sets
76
+ margin-left for LTR; in RTL move that indent to the right side so the
77
+ sub-panel sits inset from the right edge, not flush against it. */
78
+ .score-main .section.panel .panel-title[style*="width:"] {
79
+ float: right !important;
80
+ margin-left: 0 !important;
81
+ margin-right: 14px !important;
82
+ }
63
83
  </style>
64
84
  <script>
65
85
  var IS_ARABIC = true;