فهرست منبع

门诊打印小票

‘chenzhilei’ 3 ماه پیش
والد
کامیت
00fd7e682c

+ 244 - 8
src/main/resources/static/js/mz/registration_list.js

@@ -1109,7 +1109,7 @@ function loadCardList() {
                             } else {
                                 var printFlag = isEmpty(mzyReqrecVo.mzyReqrec.printerId);
                                 if(fpVsesionNo == 1){
-                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
+                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times +',\'' + mzyReqrecVo.mzyReqrec.serialNo + '\'' + ')">';
                                 }
                                else if (printFlag && fpVsesionNo == 0) {
                                     html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
@@ -1170,7 +1170,7 @@ function loadCardList() {
                             } else {
                                 var printFlag = isEmpty(mzyReqrecVo.mzyReqrec.printerId);
                                 if(fpVsesionNo == 1){
-                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
+                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times +',\'' + mzyReqrecVo.mzyReqrec.serialNo + '\'' + ')">';
                                 }
                                else if (printFlag && fpVsesionNo ==0) {
                                     html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
@@ -1420,7 +1420,7 @@ function loadTableList() {
                             } else {
                                 var printFlag = isEmpty(row.mzyReqrec.printerId);
                                 if(fpVsesionNo == 1){
-                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
+                                    html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')">';
                                 }
                                else if (printFlag && fpVsesionNo == 0) {
                                     html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
@@ -1453,7 +1453,7 @@ function loadTableList() {
                         } else {
                             var printFlag = isEmpty(row.mzyReqrec.printerId);
                             if(fpVsesionNo == 1){
-                                html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
+                                html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')">';
                             }
                            else if (printFlag && fpVsesionNo == 0) {
                                 html += '                            <button type="button" class="registration-no-color-foot-button"  title="打印" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
@@ -1770,16 +1770,23 @@ function openDzfpDownModal(patientId,times,serialNo) {
  * @param type 1 打印二维码  2 下载pdf
  */
 function downOrPrintDzfp(type) {
-    downloadInvoice(dzfp_patientId,dzfp_times,dzfp_serialNo)
+    downloadInvoice(dzfp_patientId,dzfp_times,dzfp_serialNo,type)
 }
 
 //下载电子发票
-function downloadInvoice(patientId,times,serialNo) {
+function downloadInvoice(patientId,times,serialNo,type) {
+//createInMemoryQR()
     setPrint();
     postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo,},true,function (res) {
         if(res.code == 0){
+//            $("#dzfpDownModal").modal("hide");
             if(res.data.resUrl){
-                window.open(res.data.resUrl)
+
+                if(type == 2 || !stringNotBlank(type)){
+                    window.open(res.data.resUrl)
+                }else {
+                //打印二维码
+                }
             } else {
                 errorMesage("未获取到电子发票,请重新上传发票!");
             }
@@ -1789,7 +1796,115 @@ function downloadInvoice(patientId,times,serialNo) {
         }
     })
 }
+//获取电子发票地址base64
+function getInvoiceBase64(patientId,times,serialNo) {
+    var imgsrc = ""
+    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (res) {
+        if(res.code == 0){
+            if(res.data.resUrl){
+//
+                return createInMemoryQR(res.data.resUrl);
+
+            } else {
+                errorMesage("未获取到电子发票,请重新上传发票!");
+            }
 
+        }else {
+            errorMesage(res)
+        }
+    })
+    console.log("imgsrc",imgsrc)
+    return imgsrc;
+}
+
+function createInMemoryQR(url) {
+try {
+    // 创建不可见的临时容器
+    const tempContainer = document.createElement('div');
+    tempContainer.style.display = 'none';
+    document.body.appendChild(tempContainer);
+
+    // 在临时容器中生成二维码
+    new QRCode(tempContainer, {
+        text: url,
+        width: 200,
+        height: 200,
+        margin: 2,
+        color: {
+            dark: '#1a2980',
+            light: '#ffffff'
+        }
+    });
+
+    // 等待一小段时间确保二维码生成完成
+    // 注意:这是一个简化处理,实际生产环境中可能需要更可靠的检测机制
+    let attempts = 0;
+    while (!tempContainer.querySelector('canvas') && attempts < 10) {
+        attempts++;
+        // 短暂延迟
+        for (let i = 0; i < 1000000; i++);
+    }
+
+    // 获取生成的二维码canvas
+    const qrCanvas = tempContainer.querySelector('canvas');
+    if (!qrCanvas) {
+        throw new Error('二维码生成失败');
+    }
+
+    // 创建内存中的canvas并复制内容
+    const canvas = document.createElement('canvas');
+    canvas.width = qrCanvas.width;
+    canvas.height = qrCanvas.height;
+    const ctx = canvas.getContext('2d');
+    ctx.drawImage(qrCanvas, 0, 0);
+
+    // 清理临时容器
+    document.body.removeChild(tempContainer);
+
+    // 返回Base64数据
+    return canvas.toDataURL('image/png');
+} catch (error) {
+    alert('生成失败: ' + error.message);
+    return null;
+}
+
+}
+
+//function createInMemoryQR() {
+// const canvas = document.createElement('canvas');
+// new QRCode(canvas, {
+//         text: "http://einvoice.jsczt.cn/d/473012378d11a2052bf",
+//         width: 200,
+//         height: 200
+//       });
+//       // 显示二维码(可选)
+//                       const img = document.createElement('img');
+//                       img.src = canvas.toDataURL('image/png');
+//                       img.alt = '生成的二维码';
+//                       document.getElementById('qrcodeImg').appendChild(img);
+////    try {
+////        // 创建内存中的canvas
+////        const canvas = document.createElement('canvas');
+////
+////        // 直接在canvas上生成二维码
+////        new QRCode(canvas, {
+////            text: "http://einvoice.jsczt.cn/d/473012378d11a2052bf",
+////            width: 200,
+////            height: 200,
+////            margin: 2,
+////            color: {
+////                dark: '#1a2980',
+////                light: '#ffffff'
+////            }
+////        });
+////
+////        // 直接从canvas获取Base64数据
+//        return canvas.toDataURL('image/png');
+////    } catch (error) {
+////        alert('生成失败: ' + error.message);
+////        return null;
+////    }
+//}
 
 /**
  * 直接打印发票
@@ -1819,6 +1934,7 @@ function prn1Print(patientId, times) {
                 if (res.data == null || res.data.length == 0) {
                     return;
                 }
+//                getInvoiceBase64();
                 //    countReceiot++;
                 LODOP = getLodop();
                 var temp = res.data;
@@ -1868,8 +1984,128 @@ function prn1Print(patientId, times) {
                     LODOP.ADD_PRINT_TEXT("42mm", "3mm", "50mm", "3mm", "号段:" + temp.ampm);
                     LODOP.ADD_PRINT_TEXT("48mm", "3mm", "50mm", "3mm", "号别:" + temp.chargeType);
                     LODOP.ADD_PRINT_TEXT("54mm", "3mm", "50mm", "3mm", "收费员:"+res.user.userName);//收费员
+                    LODOP.ADD_PRINT_TEXT("60mm", "3mm", "60mm", "3mm", "发票二维码");
+//                    LODOP.ADD_PRINT_IMAGE("70mm", "3mm", "50mm", "50mm", createInMemoryQR("http://einvoice.jsczt.cn/d/473012378d11a2052bf"));
+//                    console.log("img",createInMemoryQR("http://einvoice.jsczt.cn/d/473012378d11a2052bf"))
+                }
+                LODOP.PREVIEW();
+                if(fpVsesionNo == 1){
+                    //上传电子发票
+                    uploadBlueInvoice(patientId, times)
+                }
+                if (times > 0) {
+                    loadTableCount();
+                    loadRegistrationList(true);
+                }
+            } else if (res.code == -1) {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
+};
+
+/**
+ * 直接打印发票
+ * @param patientId
+ */
+function prn1PrintAndQRCode(patientId, times,serialNo) {
+    getInvoiceBase64(patientId,times,serialNo)
+    setPrint();
+    var height = "93.15mm";
+    var bkimgWidth = "120mm"
+    if(fpVsesionNo == 1){
+        height = "60mm"
+        bkimgWidth = "110mm"
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/printMzyReqrecRecept?patientId=' + patientId + "&times=" + times,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        async: false,
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                if (res.data == null || res.data.length == 0) {
+                    return;
+                }
+                //    countReceiot++;
+                LODOP = getLodop();
+                var temp = res.data;
+                LODOP.PRINT_INITA(6, 0, bkimgWidth, height, "铭和门诊发票打印");
+                //设置默认打印机
+                LODOP.SET_PRINTER_INDEX(printIndex);
+                LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);
+                LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
+                LODOP.SET_PRINT_PAGESIZE(1,bkimgWidth, height, "CreateCustomPage");
+                LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
+                LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
+                LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);
+                if(fpVsesionNo == 0){
+                    LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
+                    LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
+                    LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
+                    LODOP.ADD_PRINT_TEXT("25mm", "7mm", "50mm", "3mm", temp.name);
+                    LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
+                    LODOP.ADD_PRINT_TEXT("32mm", "6mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
+                    LODOP.ADD_PRINT_TEXT("32mm", "56mm", "50mm", "3mm", "地点:" + res.officePos);
+                    LODOP.ADD_PRINT_TEXT("37mm", "6mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
+                    LODOP.ADD_PRINT_TEXT("37mm", "56mm", "50mm", "3mm", "号段:" + temp.ampm);
+                    LODOP.ADD_PRINT_TEXT("42mm", "6mm", "50mm", "3mm", "号别:" + temp.chargeType);
+                    LODOP.ADD_PRINT_TEXT("42mm", "56mm", "50mm", "3mm", "挂号费:" + temp.reqFee);
+                    LODOP.ADD_PRINT_TEXT("47mm", "6mm", "50mm", "3mm", "诊查费:" + temp.clinicFee);
+                    LODOP.ADD_PRINT_TEXT("47mm", "56mm", "50mm", "3mm", "其他:" + temp.othFee);
+                    var blbFee=temp.blbFee;
+                    if(blbFee==null){
+                        blbFee=0;
+                    }
+                    if (temp.zlkFee != null) {
+                        blbFee = blbFee + temp.zlkFee;
+                    }
+                    LODOP.ADD_PRINT_TEXT("52mm", "6mm", "50mm", "3mm", "工本费:" + blbFee);
+                    LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", res.totalFee + " 元");
+                    LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.totalFeeStr);
+                    LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.year);//年
+                    LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.month);//月
+                    LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.day);//日
+                    LODOP.ADD_PRINT_TEXT("79mm", "53mm", "23mm", "3mm", res.user.userName);//收费员
+                    LODOP.PREVIEW();
+                }else {
+                    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (dzfp) {
+                        if(dzfp.code == 0){
+                            if(dzfp.data.resUrl){
+                //              LODOP.ADD_PRINT_TEXT("12mm", "3mm", "50mm", "3mm", "姓名:"+temp.name);
+                                LODOP.ADD_PRINT_TEXT("18mm", "3mm", "50mm", "3mm", "门诊号:"+patientId);
+                                LODOP.ADD_PRINT_TEXT("24mm", "3mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
+                                LODOP.ADD_PRINT_TEXT("30mm", "3mm", "70mm", "3mm", "地点:" +  res.officePos);
+                                LODOP.ADD_PRINT_TEXT("36mm", "3mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
+                                LODOP.ADD_PRINT_TEXT("42mm", "3mm", "50mm", "3mm", "号段:" + temp.ampm);
+                                LODOP.ADD_PRINT_TEXT("48mm", "3mm", "50mm", "3mm", "号别:" + temp.chargeType);
+                                LODOP.ADD_PRINT_TEXT("54mm", "3mm", "50mm", "3mm", "收费员:"+res.user.userName);//收费员
+                                LODOP.ADD_PRINT_TEXT("60mm", "3mm", "60mm", "3mm", "发票二维码");
+                                LODOP.ADD_PRINT_IMAGE("70mm", "3mm", "50mm", "50mm", createInMemoryQR(dzfp.data.resUrl));
+                                LODOP.PREVIEW();
+                                console.log("img",createInMemoryQR(dzfp.data.resUrl))
+
+                            } else {
+                                errorMesage("未获取到电子发票,请重新上传发票!");
+                            }
+
+                        }else {
+                            errorMesage(res)
+                        }
+                    })
                 }
-                LODOP.PRINT();
                 if(fpVsesionNo == 1){
                     //上传电子发票
                     uploadBlueInvoice(patientId, times)

+ 140 - 5
src/main/resources/static/js/mz/toll_administration.js

@@ -12,6 +12,8 @@ var readTimes = null
 var fpVsesionNo = 0;
 var hospitalName ='沭阳铭和医院'
 $(function () {
+    $("#dzfpDownModal1").modal();
+    prn1PrintAndQRCode("1522962-4",12,"4691714",1);
     getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {
         hospitalName = res.data
     })
@@ -630,6 +632,7 @@ function initFeeTable() {
                             str += '<button type="button" class="registration-no-color-foot-button" title="发票作废重打" onclick="obsoleteAndRepPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #E73E48;"><i class="fa fa-print"></i></button>';
                         }
                         if(fpVsesionNo == 1){
+                            str += '<button type="button" class="registration-no-color-foot-button" title="发票重打" onclick="prn1PrintAndQRCode(\'' + row.patientId + '\',' + row.times +',\'' + row.serialNo + '\''+',\'' + row.name + '\''+',' + row.amount + ')" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button" title="上传电子发票" onclick="printDzfp(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',1'+ ');" style="color: #35D082;"><i class="fa fa-upload"></i></button>';
 //                            str += '<button type="button" class="registration-no-color-foot-button" title="开具电子发票" onclick="issueEBill(\'' + row.realNo + '\',' + row.amount + ',\'' + row.name + '\',\'' + row.doctorCode +'\'' + ');" style="color: #35D082;"><i class="fa fa-sign-in"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="openDzfpDownModal(\'' + row.patientId + '\',' + row.times +',\'' + row.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
@@ -2025,6 +2028,7 @@ function downloadDzfp(patientId,times,serialNo,type) {
         if(res.code == 0){
             $("#dzfpDownModal").modal("hide");
             if(res.data.resUrl){
+            console.log("11111111111111111111111111111",type)
                 if(type == 2 || !stringNotBlank(type)){
                     window.open(res.data.resUrl)
                 }else {
@@ -2041,9 +2045,9 @@ function downloadDzfp(patientId,times,serialNo,type) {
                     LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊电子发票二维码");//对新建的纸张重命名
                     LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
                     LODOP.ADD_PRINT_TEXT("6mm", "3mm", "60mm", "3mm", hospitalName+"发票二维码");
-                    LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);
-                    LODOP.PRINT();
-                    // LODOP.PREVIEW();
+                    LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", createInMemoryQR(res.data.resUrl));
+//                    LODOP.PRINT();
+                     LODOP.PREVIEW();
                 }
             } else {
                 errorMesage("未获取到电子发票,请重新上传发票!");
@@ -2055,6 +2059,7 @@ function downloadDzfp(patientId,times,serialNo,type) {
     })
 }
 
+
 /**
  * 直接打印发票
  * @param patientId
@@ -2324,8 +2329,8 @@ function printCommon(url, patientId, times, chargeFeeFlag) {
                     LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.data[i].month);//月
                     LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.data[i].day);//日
                     LODOP.ADD_PRINT_TEXT("79mm", "53mm", "50mm", "3mm", temp.operatorId);//收费员
-                    LODOP.PRINT();
-                    //LODOP.PREVIEW();
+//                    LODOP.PRINT();
+                    LODOP.PREVIEW();
                     initFeeTable();
                 }
 
@@ -2346,6 +2351,136 @@ function printCommon(url, patientId, times, chargeFeeFlag) {
     });
 }
 
+/**
+ * 打印发票通用方法
+ * @param patientId
+ * @param times
+ * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源
+ */
+/**
+ * 直接打印发票
+ * @param patientId
+ */
+function prn1PrintAndQRCode(patientId, times,serialNo,name,fee) {
+//    getInvoiceBase64(patientId,times,serialNo)
+//    setPrint();
+//    var height = "93.15mm";
+//    var bkimgWidth = "120mm"
+//    if(fpVsesionNo == 1){
+//        height = "60mm"
+//        bkimgWidth = "110mm"
+//    }
+//
+//    //    countReceiot++;
+//    LODOP = getLodop();
+//    var temp = res.data;
+//    LODOP.PRINT_INITA(6, 0, bkimgWidth, height, "铭和门诊发票打印");
+//    //设置默认打印机
+//    LODOP.SET_PRINTER_INDEX(printIndex);
+//    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);
+//    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
+//    LODOP.SET_PRINT_PAGESIZE(1,bkimgWidth, height, "CreateCustomPage");
+//    LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
+//    LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
+//    LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);
+    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (dzfp) {
+        if(dzfp.code == 0){
+            if(dzfp.data.resUrl){
+                JsBarcode('#barcode', patientId, {
+                    lineColor: '#333', //线条颜色
+                    width: 2, //线宽
+                    height: 50, //条码高度
+                    displayValue: true, //是否显示文字信息
+                });
+                $("#printDate1").text(name);
+                $("#printDate2").text(fee);
+                $("#printDate3").text(dzfp.data.fpNo);
+                $("#printDate4").text(dzfp.data.opCode);
+                $("#printDate5").text(dzfp.data.blueIssueDate);
+                $("#printDate5").text(dzfp.data.blueIssueDate);
+                let src = createInMemoryQR(dzfp.data.resUrl);
+                let wxPayQrCardHtml =`<img src="${src}" style="width: 100px;height: 100px"/><div style="width: 140px;margin-top: 2px;"></div>`;
+                $("#dzfpImg").html(wxPayQrCardHtml);
+                setPrint();
+                LODOP = getLodop();
+                //设置默认打印机
+                LODOP.SET_PRINTER_INDEX(printIndex);
+                LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
+                LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "192mm");
+                LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "97mm");
+                LODOP.SET_PRINT_PAGESIZE(1, "192mm", "97mm", "CreateCustomPage");
+                LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
+                var strStyle = "<style>table{width: 170mm;} table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse;padding: 8px;}</style>"
+                LODOP.ADD_PRINT_HTM("0mm", "8mm", "140mm", "380mm", strStyle + document.getElementById("report_table").innerHTML);
+                LODOP.PREVIEW();
+//                LODOP.ADD_PRINT_IMAGE("70mm", "3mm", "50mm", "50mm", createInMemoryQR(dzfp.data.resUrl));
+//                console.log("img",createInMemoryQR(dzfp.data.resUrl))
+
+            } else {
+                errorMesage("未获取到电子发票,请重新上传发票!");
+            }
+
+        }else {
+            errorMesage(res)
+        }
+    })
+};
+
+function createInMemoryQR(url) {
+try {
+    // 创建不可见的临时容器
+    const tempContainer = document.createElement('div');
+    tempContainer.style.display = 'none';
+    document.body.appendChild(tempContainer);
+
+    // 在临时容器中生成二维码
+    new QRCode(tempContainer, {
+        text: url,
+        width: 200,
+        height: 200,
+        margin: 2,
+        color: {
+            dark: '#1a2980',
+            light: '#ffffff'
+        }
+    });
+
+    // 等待一小段时间确保二维码生成完成
+    // 注意:这是一个简化处理,实际生产环境中可能需要更可靠的检测机制
+    let attempts = 0;
+    while (!tempContainer.querySelector('canvas') && attempts < 10) {
+        attempts++;
+        // 短暂延迟
+        for (let i = 0; i < 1000000; i++);
+    }
+
+    // 获取生成的二维码canvas
+    const qrCanvas = tempContainer.querySelector('canvas');
+    if (!qrCanvas) {
+        throw new Error('二维码生成失败');
+    }
+
+    // 创建内存中的canvas并复制内容
+    const canvas = document.createElement('canvas');
+    canvas.width = qrCanvas.width;
+    canvas.height = qrCanvas.height;
+    const ctx = canvas.getContext('2d');
+    ctx.drawImage(qrCanvas, 0, 0);
+
+    // 清理临时容器
+    document.body.removeChild(tempContainer);
+
+    // 返回Base64数据
+    return canvas.toDataURL('image/png');
+} catch (error) {
+    alert('生成失败: ' + error.message);
+    return null;
+}
+
+}
+
+
+
 
 //
 // /**

+ 2 - 1
src/main/resources/templates/mz/registration_list.html

@@ -10,6 +10,7 @@
 <script src="/thmz/js/dependent/jquery.webui-popover.min.js"></script>
 <script src="/thmz/js/dependent/validator.js"></script>
 <script src="/thmz/js/jBox/common.js"></script>
+<script src="/thmz/js/dependent/qrcode.min.js"></script>
 <script src="/thmz/js/dependent/JsBarcode.all.js"></script>
 <script src="/thmz/js/common/cw_tools.js"></script>
 <script src="/thmz/js/mz/registration_list.js"></script>
@@ -599,7 +600,7 @@
                 </h4>
             </div>
             <div class="modal-footer">
-                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="downOrPrintDzfp(1)">打印二维码</button>
+<!--                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="downOrPrintDzfp(1)">打印二维码</button>-->
                 <button type="button" class="btn btn-success" data-dismiss="modal" onclick="downOrPrintDzfp(2)">下载发票PDF文件</button>
             </div>
         </div>

+ 24 - 1
src/main/resources/templates/mz/toll_administration.html

@@ -5,6 +5,7 @@
 <script src="/thmz/js/dependent/bootstrap-select.js"></script>
 <script src="/thmz/js/dependent/daterangepicker.js"></script>
 <script src="/thmz/js/common/icd_read_card.js"></script>
+<script src="/thmz/js/dependent/qrcode.min.js"></script>
 <script src="/thmz/js/dependent/JsBarcode.all.js"></script>
 <script src="/thmz/js/common/cw_tools.js"></script>
 <script src="/thmz/js/mz/toll_administration.js"></script>
@@ -765,7 +766,7 @@
                 </h4>
             </div>
             <div class="modal-footer">
-                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="downOrPrintDzfp(1)">打印二维码</button>
+<!--                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="downOrPrintDzfp(1)">打印二维码</button>-->
                 <button type="button" class="btn btn-success" data-dismiss="modal" onclick="downOrPrintDzfp(2)">下载发票PDF文件</button>
             </div>
         </div>
@@ -773,6 +774,28 @@
 </div>
 <!-- 电子发票下载窗口结尾 -->
 
+<div class="in hide"
+     style="width:192mm;height:97mm;margin:0 auto;border: 1px solid #337ab7;font-size: 10px;padding-top: 5mm;overflow-y: auto; overflow-x:hidden;">
+    <div id="report_table">
+        `<div id="report_table_1" style="float:left;width:45%">
+            <svg id="barcode" height="20"></svg>
+            <div style="margin-top:35px">
+                <span>患者姓名:</span><span style="margin-left: 7mm;" id="printDate1"></span><br />
+                <span>结算金额:</span><span style="margin-left: 7mm;" id="printDate2"></span><br />
+                <span>票据号码:</span><span style="margin-left: 7mm;" id="printDate3"></span><br />
+                <span>票据代码:</span><span style="margin-left: 7mm;" id="printDate4"></span><br />
+                <span>发票日期:</span><span style="margin-left: 7mm;" id="printDate5"></span><br />
+            </div>
+        </div>
+        <div id="report_table_2" style="float:left;width:45%;margin-top:10px">
+            <div style="text-align:center;font-weight: 700;font-size:24px;padding-top: -8mm" class="hospitalName">沭阳铭和医院</div>
+            <div style="text-align:center;font-weight: 700;font-size:18px;margin-top: 5px;">电子发票信息</div>
+            <div style="text-align:center;font-weight: 700;font-size:14px;margin-top: 25px;">扫码下载电子票据</div>
+            <div style="text-align:center;font-weight: 700;margin-top: 15px;" id="dzfpImg"></div>
+        </div>`
+    </div>
+</div>
+
 
 <!--医保结算单打印弹窗开始-->
 <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="ybjsdModal">