@medicus.ai/medicus-report-pdf-generator 1.3.2 → 1.3.3

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.
@@ -1137,6 +1137,8 @@ let generateHTMLWellbeingReportWithSmartReport = async (data, isDebugging, clien
1137
1137
 
1138
1138
  if (client.toLowerCase() === 'pha') {
1139
1139
  $('#content').append('<style>.patient-details .details-label, .patient-details .details-value { padding: 4px !important; }</style>');
1140
+ // PHA-only: Prevent first page content from overlapping PDF footer (email/address)
1141
+ $('#content').append('<style>body { padding-bottom: 60px !important; } #content { padding-bottom: 35px !important; } .first-section-scores { overflow: visible; clear: both; } .report-header { overflow: auto; } .row.scores-parts { clear: both; }</style>');
1140
1142
  }
1141
1143
 
1142
1144
  // Handle missing photo
@@ -1433,6 +1435,7 @@ let generateHTMLWellbeingReportWithSmartReport = async (data, isDebugging, clien
1433
1435
  historyData,
1434
1436
  profileInfo,
1435
1437
  language,
1438
+ selectedLabs,
1436
1439
  pdfHeader: cleanStyledHeader(renderedPdfHeader, profileInfo, language, clientName, selectedLabs, showHeaderLogo)
1437
1440
  };
1438
1441
  };
@@ -1612,25 +1615,39 @@ const cleanStyledHeader = (html, profileInfo, language = 'ar', clientName = 'med
1612
1615
  /**
1613
1616
  * Get PDF footer template HTML (client-specific contact info)
1614
1617
  * @param {string} [client='mediclinic'] - Client identifier: 'mediclinic' | 'pha' | other
1618
+ * @param {array} [selectedLabs=[]] - Selected divisions/labs (e.g. ['wp'])
1615
1619
  * @returns {string} Footer template HTML
1616
1620
  */
1617
- const getPdfFooterTemplate = (client = 'mediclinic') => {
1621
+ const getPdfFooterTemplate = (client = 'mediclinic', selectedLabs = []) => {
1618
1622
  const clientKey = (client || 'mediclinic').toLocaleLowerCase();
1623
+ const isPhaWithWp = clientKey === 'pha' && selectedLabs?.some(lab => lab?.toLowerCase() === 'wp');
1619
1624
  let contactBlock = '';
1620
1625
  if (clientKey === 'mediclinic') {
1621
1626
  contactBlock = `
1622
1627
  <div style="font-family: 'Open Sans', sans-serif; font-feature-settings: 'tnum';">Telephone: 800 20 33</div>
1623
1628
  <div style="font-family: 'Open Sans', sans-serif;">Email: info@mediclinic.ae</div>`;
1624
1629
  } else if (clientKey === 'pha') {
1625
- contactBlock = `
1630
+ // Professional order: Address, Telephone, Email
1631
+ if (isPhaWithWp) {
1632
+ contactBlock = `
1633
+ <div style="font-family: 'Open Sans', sans-serif;">Address: 106 W 3rd St, McCook, NE 69001</div>
1626
1634
  <div style="font-family: 'Open Sans', sans-serif; font-feature-settings: 'tnum';">Telephone: (877) 345-7775</div>
1627
1635
  <div style="font-family: 'Open Sans', sans-serif;">Email: processing@wellness-partners.org</div>`;
1636
+ } else {
1637
+ contactBlock = `
1638
+ <div style="font-family: 'Open Sans', sans-serif; font-feature-settings: 'tnum';">Tel: (877) 345-7775</div>
1639
+ <div style="font-family: 'Open Sans', sans-serif;">Email: processing@wellness-partners.org</div>`;
1640
+ }
1628
1641
  } else {
1629
1642
  contactBlock = `
1630
1643
  <div style="font-family: 'Open Sans', sans-serif;">&nbsp;</div>`;
1631
1644
  }
1645
+ const isPha = clientKey === 'pha';
1646
+ const footerStyle = isPha
1647
+ ? 'width: 100%; font-size: 6px; line-height: 1.2; color: ' + config.colors.footerText + '; padding: 0 20px 2px; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; font-family: \'Open Sans\', sans-serif;'
1648
+ : 'width: 100%; font-size:7.3px; color: ' + config.colors.footerText + '; padding: 0 20px; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; font-family: \'Open Sans\', sans-serif;';
1632
1649
  return `
1633
- <div style="width: 100%; font-size:7.3px; color: ${config.colors.footerText}; padding: 0 20px; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; font-family: 'Open Sans', sans-serif;">
1650
+ <div style="${footerStyle}">
1634
1651
  <div style="display: flex; align-items: center;font-family: 'Open Sans', sans-serif;">
1635
1652
  <span style="font-style: italic; font-family: 'Open Sans', sans-serif;">Page
1636
1653
  <span class="pageNumber" style="font-family: 'Open Sans', sans-serif; font-feature-settings: 'tnum';"></span>
@@ -1701,7 +1718,7 @@ const generatePDFReport = async (data, hideWellbeingUI = false) => {
1701
1718
  try {
1702
1719
  const contentHtml = data.html;
1703
1720
  const OUT_FILE = data.outputFile;
1704
- const footerTemplate = getPdfFooterTemplate(data.client);
1721
+ const footerTemplate = getPdfFooterTemplate(data.client, data.selectedLabs);
1705
1722
 
1706
1723
  // Launch browser and setup page
1707
1724
  const browser = await launchExtendedBrowser();
@@ -1710,7 +1727,8 @@ const generatePDFReport = async (data, hideWellbeingUI = false) => {
1710
1727
  // Setup content
1711
1728
  await setupExtendedPageContent(page, contentHtml, Pdf_file);
1712
1729
 
1713
- // Generate PDF with header and footer
1730
+ // Generate PDF with header and footer (PHA needs larger bottom margin to prevent content overlapping footer)
1731
+ const bottomMargin = (data.client || '').toLowerCase() === 'pha' ? '60px' : '50px';
1714
1732
  const buffer = await page.pdf({
1715
1733
  format: 'A4',
1716
1734
  displayHeaderFooter: true,
@@ -1719,7 +1737,7 @@ const generatePDFReport = async (data, hideWellbeingUI = false) => {
1719
1737
  width: "220mm",
1720
1738
  margin: {
1721
1739
  top: '125px',
1722
- bottom: '50px',
1740
+ bottom: bottomMargin,
1723
1741
  left: '20px',
1724
1742
  right: '20px'
1725
1743
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicus.ai/medicus-report-pdf-generator",
3
- "version": "1.3.02",
3
+ "version": "1.3.03",
4
4
  "description": "Nasco corporate report - latest update in 12/10/2023 - Fix HRC for bionext",
5
5
  "main": "index.js",
6
6
  "scripts": {