Browse Source

病案排版地址

‘chenzhilei’ 4 days ago
parent
commit
b682612dc7

+ 11 - 11
src/components/inpatient/frontsheet-printpage/FullPage.vue

@@ -268,7 +268,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 300px;
+              width: 480px;
             ">{{ patient.hkPlaceName }}</span>
           邮编:
           <span style="
@@ -322,7 +322,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 100px;
+              width: 260px;
             ">
             {{
               filterNameInDic(patient.contactRelation, "getRelations")
@@ -337,7 +337,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 300px;
+              width: 350px;
             ">{{ patient.contactAddrName }}</span>
           联系人电话:
           <span style="
@@ -385,7 +385,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 118px;
+              width: 100px;
             ">{{ patient.admissDept }}</span>
           病房:
           <span style="
@@ -393,14 +393,14 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 80px;
+              width: 120px;
             ">{{ patient.admissWard }}</span>
           转科科别:
           <span style="
               display: inline-block;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 118px;
+              width: 60px;
             ">{{ patient.transDept }}</span>
         </div>
         <div style="margin: 8px 8px 8px 0">
@@ -418,7 +418,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 118px;
+              width: 100px;
             ">{{ patient.dismissDept }}</span>
           病房:
           <span style="
@@ -426,7 +426,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 80px;
+              width: 120px;
             ">{{ patient.dismissWard }}</span>
           住院天数:
           <span style="
@@ -434,7 +434,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 118px;
+              width: 60px;
             ">{{ patient.admissDays }}</span>
         </div>
 
@@ -618,7 +618,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 380px;
+              width: 410px;
             ">{{ patient.hurtReasonName }}</span>
           疾病编码:
           <span style="
@@ -626,7 +626,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 110px;
+              width: 70px;
             ">{{ patient.hurtReasonCode }}</span>
         </div>
         <div style="margin: 8px 8px 8px 0">

+ 23 - 23
src/components/inpatient/frontsheet-printpage/HeadPage.vue

@@ -217,7 +217,7 @@
           >{{patient.addrZipCode}}</span>
         </div>
 
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           户口地址:
           <span
             style="
@@ -225,7 +225,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 300px;
+              width: 480px;
             "
             >{{ patient.hkPlaceName }}</span
           >
@@ -241,7 +241,7 @@
             >{{ patient.hkZipCode }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           工作单位及地址:
           <span
             style="
@@ -250,7 +250,7 @@
               padding: 0 4px;
               border-bottom: 1px solid black;
               margin-right: 0;
-              width: 330px;
+              width: 310px;
             "
           >
           {{ patient.unitPlace  }}
@@ -279,7 +279,7 @@
             >{{ patient.unitZipCode }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           联系人姓名:
           <span
             style="
@@ -304,7 +304,7 @@
             }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           联系人地址:
           <span
             style="
@@ -328,7 +328,7 @@
             >{{ patient.contactPhone }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           入院途径:
           <span
             style="
@@ -363,7 +363,7 @@
               margin-right: 8px;
               padding-left: 4px;
               border-bottom: 1px solid black;
-              width: 126px;
+              width: 60px;
             "
           >
             {{ patient.admissDept }}
@@ -375,7 +375,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 80px;
+              width: 160px;
             "
             >{{ patient.admissWard }}</span
           >
@@ -385,7 +385,7 @@
               display: inline-block;
               padding-left: 4px;
               border-bottom: 1px solid black;
-              width: 126px;
+              width: 80px;
             "
             >{{ patient.transDept }}</span
           >
@@ -410,7 +410,7 @@
               margin-right: 8px;
               padding-left: 4px;
               border-bottom: 1px solid black;
-              width: 126px;
+              width: 60px;
             "
           >
             {{ patient.dismissDept }}
@@ -422,7 +422,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 80px;
+              width: 160px;
             "
             >{{ patient.dismissWard }}</span
           >
@@ -432,12 +432,12 @@
               display: inline-block;
               padding-left: 4px;
               border-bottom: 1px solid black;
-              width: 126px;
+              width: 80px;
             "
             >{{ patient.admissDays }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           门(急)诊诊断:
           <span
             style="
@@ -558,7 +558,7 @@
           >
           1.治愈,2.好转,3.未愈,4.死亡,9.其他
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           损伤、中毒的外部原因:
           <span
             style="
@@ -566,7 +566,7 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 340px;
+              width: 390px;
             "
             >{{ patient.hurtReasonName }}</span
           >
@@ -577,12 +577,12 @@
               margin-right: 8px;
               padding: 0 4px;
               border-bottom: 1px solid black;
-              width: 110px;
+              width: 80px;
             "
             >{{ patient.hurtReasonCode }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           病理诊断:
           <span
             style="
@@ -617,7 +617,7 @@
             >{{ patient.blh }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           药物过敏:
           <span
             style="
@@ -656,7 +656,7 @@
               {{ item.code }}.{{ item.name }}
             </span>&nbsp;&nbsp;&nbsp;&nbsp;
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           血型:
           <span
             style="
@@ -684,7 +684,7 @@
               {{ item.code }}.{{ item.name }}
             </span>&nbsp;&nbsp;&nbsp;&nbsp;
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           科室主任:
           <span
             style="
@@ -730,7 +730,7 @@
             >{{ patient.admissDoctorName }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           责任护士:
           <span
             style="
@@ -776,7 +776,7 @@
             >{{ patient.coderName }}</span
           >
         </div>
-        <div style="margin: 6px 8px 6px 0">
+        <div style="margin: 5px 8px 6px 0">
           病案质量:
           <span
             style="

+ 57 - 145
src/views/hospitalization/case-front-sheet/FillCaseFrontSheet.vue

@@ -454,7 +454,7 @@
             <input
               id="unitPlace"
               v-model.trim="patient.unitPlace"
-              style="width: 280px"
+              style="width: 380px"
             />
             单位电话:
             <input
@@ -538,12 +538,12 @@
             病房:<input
               v-model="patient.admissWard"
               readonly
-              style="width: 80px"
+              style="width: 160px"
             />
             转科科别:<input
               v-model="patientTransformData.transDept"
               readonly
-              style="width: 120px"
+              style="width: 80px"
             />
           </div>
           <div>
@@ -561,12 +561,12 @@
             病房:<input
               v-model="patient.dismissWard"
               readonly
-              style="width: 80px"
+              style="width: 160px"
             />
             住院天数:<input
               id="admissDays"
               v-model="patient.admissDays"
-              style="width: 70px"
+              style="width: 80px"
             />
           </div>
           <div id="clinicDiag" style="display: flex; align-items: center">
@@ -815,7 +815,7 @@
           <div style="border-bottom: 1px solid black; font-size: 12px">
             备注:
             <span>入院病情:</span>1.有,2.临床未确定,3.情况不明,4.无
-            <span style="margin-left: 10px">出院病情:</span
+            <span style="margin-left: 10px">治疗转归:</span
             >1.治愈,2.好转,3.未愈,4.死亡,9.其他
           </div>
           <div>
@@ -824,14 +824,14 @@
               id="hurtReasonName"
               v-model="patientTransformData.hurtReasonName"
               readonly
-              style="width: 360px"
+              style="width: 440px"
               @click="showSearchData('hurt')"
             />
             疾病编码:
             <input
               id="hurtReasonCode"
               v-model="patientTransformData.hurtReasonCode"
-              style="width: 110px"
+              style="width: 80px"
               readonly
             />
             &nbsp;&nbsp;<el-button
@@ -2213,6 +2213,7 @@ import { useDialog } from "@/components/cy/CyDialog/index";
 import env from "../../../utils/setting";
 import {isNumeric} from "@/utils/validate.js";
 // import html2canvas from 'html2canvas';
+import {canvasPrint} from "@/utils/print.js";
 
 const userStore = useUserStore();
 const userWards = ref([]);
@@ -2332,9 +2333,9 @@ const showGoSearchBtn1 = ref(false);
 const showGoSearchBtn2 = ref(false);
 const showDel = initShowDel();
 const asideTable = ref(null);
-// const previewImage = ref(null);
-// const paperSize = ref('a4');
-// const orientation = ref('portrait');
+const previewImage = ref(null);
+const paperSize = ref('a4');
+const orientation = ref('portrait');
 const showDateTimePicker = ref(false);
 const showDateTimePickerData = ref(null);
 
@@ -3601,150 +3602,61 @@ const beforePrint = page => {
   });
 };
 
-const execPrint = page => {
-  
-  const LODOP = getLodop();
-  const prntStyle = `<style>*{font-size:10pt} table,th,td {border: 1px solid black;border-collapse: collapse;} td,th {height: 24px;padding-left: 4px;}</style>`;
-  let prntContent;
-  if(page === 1){
-    mergePrintHeadpage()
-    prntContent = document.getElementById("headpage").innerHTML
-  } else {
-    mergePrintTailpage()
-    prntContent = document.getElementById("tailpage").innerHTML
-  }
-  // const prntContent =
-  //   page === 1
-  //     ? document.getElementById("headpage").innerHTML
-  //     : document.getElementById("tailpage").innerHTML;
-  let pagePrint = prntStyle + "<body>" + prntContent + "</body>";
-  LODOP.PRINT_INIT("casefrontsheet");
-  LODOP.SET_PRINT_PAGESIZE(1, "210mm", "297mm", "");
-  LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW", true); // 整宽不变形
-  LODOP.ADD_PRINT_HTM("2mm", "5mm", "100%", "100%", pagePrint);
-  LODOP.SET_PRINT_STYLE("ItemType", 3);
-  LODOP.PREVIEW();
-};
-
 // const execPrint = page => {
+  
+//   const LODOP = getLodop();
+//   const prntStyle = `<style>*{font-size:10pt} table,th,td {border: 1px solid black;border-collapse: collapse;} td,th {height: 24px;padding-left: 4px;}</style>`;
 //   let prntContent;
 //   if(page === 1){
 //     mergePrintHeadpage()
-//     prntContent = document.getElementById("headpage")
+//     prntContent = document.getElementById("headpage").innerHTML
 //   } else {
 //     mergePrintTailpage()
-//     prntContent = document.getElementById("tailpage")
+//     prntContent = document.getElementById("tailpage").innerHTML
 //   }
-//   console.log("prntContent",prntContent);
-//   prntContent.style.opacity = 1
-
-//   // 使用 html2canvas 转换
-//   html2canvas(prntContent, {
-//       scale: 2, // 提高输出图片的缩放倍数,例如2倍,更清晰
-//       useCORS: true, // 尝试加载跨域图片
-//       allowTaint: true // 允许跨域图片,但可能会污染 canvas
-//   }).then(canvas => {
-//       // canvas 就是转换后的画布元素
-//       // 你可以将其转换为图片数据 URL
-//       previewImage.value =  canvas.toDataURL('image/png');
-//       printImage()
-//       // 接下来可以处理 dataUrl,比如打印
-//       console.log(dataUrl);
-//   }).catch(error => {
-//       console.error('转换失败:', error);
-//   });
-
+//   // const prntContent =
+//   //   page === 1
+//   //     ? document.getElementById("headpage").innerHTML
+//   //     : document.getElementById("tailpage").innerHTML;
+//   let pagePrint = prntStyle + "<body>" + prntContent + "</body>";
+//   LODOP.PRINT_INIT("casefrontsheet");
+//   LODOP.SET_PRINT_PAGESIZE(1, "210mm", "297mm", "");
+//   LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW", true); // 整宽不变形
+//   LODOP.ADD_PRINT_HTM("2mm", "5mm", "100%", "100%", pagePrint);
+//   LODOP.SET_PRINT_STYLE("ItemType", 3);
+//   LODOP.PREVIEW();
 // };
 
-// const printImage = () => {
-//   if (!previewImage.value) {
-//     xcMessage.error("请先生成预览图片");
-//       return;
-//   }
-
-//   // showStatus('准备打印中...', 'success');
-
-//   // 创建打印窗口
-//   const printWindow = window.open('', '_blank');
-//   if (!printWindow) {
-//     xcMessage.error("请允许弹出窗口以进行打印");
-//       return;
-//   }
-
-//   // 构建打印内容
-//   printWindow.document.write(`
-//       <!DOCTYPE html>
-//       <html>
-//       <head>
-//           <title>打印文档</title>
-//           <style>
-//               body {
-//                   margin: 0;
-//                   padding: 20px;
-//                   display: flex;
-//                   justify-content: center;
-//                   align-items: center;
-//                   min-height: 100vh;
-//               }
-//               img {
-//                   max-width: 100%;
-//                   height: auto;
-//                   box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
-//               }
-//               @media print {
-//                   body {
-//                       padding: 0;
-//                   }
-//                   @page {
-//                       size: ${paperSize.value} ${orientation.value};
-//                       margin: 0;
-//                   }
-//               }
-//           </style>
-//       </head>
-//       <body>
-//           <img src="${previewImage.value}" />
-//       </body>
-//       </html>
-//   `);
-//   printWindow.document.close();
-
-//   // 等待图片加载完成后打印
-//   printWindow.onload = function() {
-//       printWindow.focus();
-//       printWindow.print();
-//       xcMessage.success("准备打印");
-      
-//       // 监听打印后的事件
-//       if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
-//         xcMessage.success("谷歌清理打印");
-//           // Chrome浏览器
-//           printWindow.onafterprint = function() {
-//               cleanupPrint(printWindow);
-//           };
-//       } else {
-//           // 其他浏览器
-//           xcMessage.success("其他浏览器清理打印");
-//           setTimeout(function() {
-//               cleanupPrint(printWindow);
-//           }, 500);
-//       }
-//   };
-// }
-
-// const cleanupPrint = printWindow => {
-//   try {
-//       printWindow.close();
-//       xcMessage.success("打印完成,临时资源已清理");
-//   } catch (e) {
-//       console.log('清理打印窗口:', e);
-//   }
-// }
+const execPrint = page => {
+  let prntContent;
+  if(page === 1){
+    mergePrintHeadpage()
+    prntContent = document.getElementById("headpage")
+  } else {
+    mergePrintTailpage()
+    prntContent = document.getElementById("tailpage")
+  }
+  prntContent.style.opacity = 1
+
+  canvasPrint(prntContent);
+
+  // // 使用 html2canvas 转换
+  // html2canvas(prntContent, {
+  //     scale: 2, // 提高输出图片的缩放倍数,例如2倍,更清晰
+  //     useCORS: true, // 尝试加载跨域图片
+  //     allowTaint: true // 允许跨域图片,但可能会污染 canvas
+  // }).then(canvas => {
+  //     // canvas 就是转换后的画布元素
+  //     // 你可以将其转换为图片数据 URL
+  //     previewImage.value =  canvas.toDataURL('image/png');
+  //     printImage()
+  //     // 接下来可以处理 dataUrl,比如打印
+  //     console.log(dataUrl);
+  // }).catch(error => {
+  //     console.error('转换失败:', error);
+  // });
 
-// const paresetPreviewge = () => {
-//   previewImage.value = null;
-//   statusMessage.value = '';
-// }
+};
 
 onActivated(async () => {
   const params = router.currentRoute.value.query;