diff --git a/public/templates/report-template.html b/public/templates/report-template.html
index 983ac02..2148ec4 100644
--- a/public/templates/report-template.html
+++ b/public/templates/report-template.html
@@ -943,22 +943,52 @@
-
+
-
+
检查结果汇总
在本次体检的项目中,您有以下几方面的情况敬请注意:
+
+
温馨提示:本次体检未发现异常的部分,不代表完全没有潜在性疾病,如有疾病或身体不适,要立即就医。
+
+
+
+
+
第3页
+
+
+
+
+
+
+
检查结果汇总
+
+
在本次体检的项目中,您有以下几方面的情况敬请注意:
+
+
+
@@ -969,7 +999,7 @@
-
第3页
+
第4页
@@ -1032,7 +1062,7 @@
-
第4页
+
第5页
@@ -1070,7 +1100,7 @@
- 第5页
+ 第6页
@@ -1102,7 +1132,7 @@
- 第6页
+ 第7页
@@ -1134,7 +1164,7 @@
- 第7页
+ 第8页
@@ -1166,7 +1196,7 @@
- 第8页
+ 第9页
@@ -1192,7 +1222,7 @@
- 第9页
+ 第10页
@@ -1216,7 +1246,7 @@
- 第10页
+ 第11页
@@ -1394,6 +1424,109 @@
});
}
});
+
+ // 更新后续页码
+ function updatePageNumbers() {
+ // 获取所有页码元素
+ const pageNumbers = document.querySelectorAll('.page-number');
+ const summaryPage2Visible = document.getElementById('summary-page-2').style.display !== 'none';
+
+ // 从第1页开始计数
+ let pageIndex = 1;
+
+ pageNumbers.forEach((element) => {
+ // 更新页码文本
+ element.textContent = `第${pageIndex}页`;
+ pageIndex++;
+
+ // 如果第二页汇总不显示,并且这是第四页的页码元素(即原本应该是汇总第二页),则跳过该元素
+ if (!summaryPage2Visible && element.closest('#summary-page-2')) {
+ // 不增加pageIndex,因为这一页不会显示
+ pageIndex--;
+ }
+ });
+ }
+
+ // 处理汇总内容分页修改
+ function handleSummaryPagination(summaryText) {
+ if (!summaryText || summaryText === '--') {
+ // 如果没有汇总内容,隐藏第二页
+ document.getElementById('summary-page-2').style.display = 'none';
+ document.getElementById('summary-content-1').textContent = '--';
+ document.getElementById('summary-tip-1').style.display = '';
+ // 更新页码
+ updatePageNumbers();
+ return;
+ }
+
+ // 创建临时元素测量内容高度
+ const testElement = document.createElement('div');
+ testElement.className = 'summary-content';
+ testElement.style.position = 'absolute';
+ testElement.style.visibility = 'hidden';
+ testElement.style.width = document.getElementById('summary-content-1').offsetWidth + 'px';
+ testElement.textContent = summaryText;
+ document.body.appendChild(testElement);
+
+ // 获取第一页汇总内容区域的可用高度 (调整这个值根据实际布局)
+ const availableHeight = 800; // 大约可用高度,根据实际情况调整
+
+ if (testElement.offsetHeight <= availableHeight) {
+ // 内容不超过一页,隐藏第二页
+ document.getElementById('summary-content-1').textContent = summaryText;
+ document.getElementById('summary-page-2').style.display = 'none';
+ document.getElementById('summary-tip-1').style.display = '';
+
+ // 更新页码
+ updatePageNumbers();
+ } else {
+ // 内容超过一页,需要分割
+ // 计算每个字符占用的平均高度
+ const avgCharHeight = testElement.offsetHeight / summaryText.length;
+ // 计算第一页可容纳的字符数
+ const firstPageChars = Math.floor(availableHeight / avgCharHeight);
+
+ // 分割文本
+ let firstPageText = summaryText.substring(0, firstPageChars);
+ let secondPageText = summaryText.substring(firstPageChars);
+
+ // 尝试在更合适的位置分割,如句号或逗号
+ const breakPoints = ['.', '。', '\n'];
+ for (let i = 30; i > 0; i--) {
+ const checkPos = firstPageChars - i;
+ if (checkPos <= 0) continue;
+ const char = summaryText.charAt(checkPos);
+ if (breakPoints.includes(char)) {
+ firstPageText = summaryText.substring(0, checkPos + 1);
+ secondPageText = summaryText.substring(checkPos + 1);
+ break;
+ }
+ }
+
+ // 更新内容并显示第二页
+ document.getElementById('summary-content-1').textContent = firstPageText;
+ document.getElementById('summary-content-2').textContent = secondPageText;
+ document.getElementById('summary-page-2').style.display = 'block';
+ document.getElementById('summary-tip-1').style.display = 'none';
+
+ // 更新页码
+ updatePageNumbers();
+ }
+
+ // 移除测试元素
+ document.body.removeChild(testElement);
+ }
+
+ // 页面加载完成后执行
+ document.addEventListener('DOMContentLoaded', () => {
+ // 现有代码...
+
+ // 等待数据填充后处理汇总分页
+ setTimeout(() => {
+ const summaryText = document.getElementById('summary-content-1').textContent;
+ handleSummaryPagination(summaryText);
+ }, 2000);
+ });