|  | @@ -2386,75 +2386,109 @@ function prn1PrintAndQRCode(patientId, times,serialNo,name,fee,doctorName) {
 | 
											
												
													
														|  |          receiptNo:'1',
 |  |          receiptNo:'1',
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  //    initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);
 |  |  //    initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);
 | 
											
												
													
														|  | -//    var projectList = [];
 |  | 
 | 
											
												
													
														|  |      $("#printProjectName").empty();
 |  |      $("#printProjectName").empty();
 | 
											
												
													
														|  |      postAjaxJsonHttpRequst("/thmz/getMzChargeDetailByBillItem",params,true,function (res) {
 |  |      postAjaxJsonHttpRequst("/thmz/getMzChargeDetailByBillItem",params,true,function (res) {
 | 
											
												
													
														|  | -        if(res.code == 0){
 |  | 
 | 
											
												
													
														|  | -            res.data.forEach((item,index)=>{
 |  | 
 | 
											
												
													
														|  | -            console.log("item",item.tcName,item.amount)
 |  | 
 | 
											
												
													
														|  | -    //            projectList.add({
 |  | 
 | 
											
												
													
														|  | -    //                name:item.name,
 |  | 
 | 
											
												
													
														|  | -    //                fee:item.chargeAmount
 |  | 
 | 
											
												
													
														|  | -    //            })
 |  | 
 | 
											
												
													
														|  | -                var html = '<div style="font-size:15px;line-height:15px;float:left;width:150px;"><span style="width:105px;display:inline-block;overflow:hidden;white-space: nowrap;" id="printProjectName'+(index+1)+'">'+item.tcName+'</span><span style="margin-left: 5px;line-height:15px;" id="printProjectFee'+(index+1)+'">'+item.amount+'</span><br /></div>'
 |  | 
 | 
											
												
													
														|  | -                $('#printProjectName').append(html);
 |  | 
 | 
											
												
													
														|  | -            })
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if(res.code == 0){
 | 
											
												
													
														|  | 
 |  | +                res.data.forEach((item,index)=>{
 | 
											
												
													
														|  | 
 |  | +                    var html = '<div style="font-size:15px;line-height:15px;float:left;width:150px;"><span style="width:105px;display:inline-block;overflow:hidden;white-space: nowrap;" id="printProjectName'+(index+1)+'">'+item.tcName+'</span><span style="margin-left: 5px;line-height:15px;" id="printProjectFee'+(index+1)+'">'+item.amount+'</span><br /></div>'
 | 
											
												
													
														|  | 
 |  | +                    $('#printProjectName').append(html);
 | 
											
												
													
														|  | 
 |  | +                })
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -            postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (dzfp) {
 |  | 
 | 
											
												
													
														|  | -                    if(dzfp.code == 0){
 |  | 
 | 
											
												
													
														|  | -                        if(dzfp.data.resUrl){
 |  | 
 | 
											
												
													
														|  | -                            JsBarcode('#barcode', patientId, {
 |  | 
 | 
											
												
													
														|  | -                                renderer: "svg",
 |  | 
 | 
											
												
													
														|  | -                                lineColor: '#000000', //线条颜色
 |  | 
 | 
											
												
													
														|  | -                                width: 1, //线宽
 |  | 
 | 
											
												
													
														|  | -                                height: 30, //条码高度
 |  | 
 | 
											
												
													
														|  | -                                displayValue: true, //是否显示文字信息
 |  | 
 | 
											
												
													
														|  | -                                fontSize: 14,
 |  | 
 | 
											
												
													
														|  | -                            });
 |  | 
 | 
											
												
													
														|  | -                            $("#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);
 |  | 
 | 
											
												
													
														|  | -                            $("#printDate6").text(doctorName);
 |  | 
 | 
											
												
													
														|  | -                            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("未获取到电子发票,请重新上传发票!");
 |  | 
 | 
											
												
													
														|  | -                        }
 |  | 
 | 
											
												
													
														|  | 
 |  | +                postAjaxJsonHttpRequst("/thmz/getVisitTableByPatientIdAndTimes",params,true,function (visitTable) {
 | 
											
												
													
														|  | 
 |  | +                    if(visitTable.code == 0){
 | 
											
												
													
														|  | 
 |  | +                        $("#printDate7").text(formatISODate(visitTable.data.visitDate,"yyyy-MM-dd"));
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +                        postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (dzfp) {
 | 
											
												
													
														|  | 
 |  | +                            if(dzfp.code == 0){
 | 
											
												
													
														|  | 
 |  | +                                if(dzfp.data.resUrl){
 | 
											
												
													
														|  | 
 |  | +                                    JsBarcode('#barcode', patientId, {
 | 
											
												
													
														|  | 
 |  | +                                        renderer: "svg",
 | 
											
												
													
														|  | 
 |  | +                                        lineColor: '#000000', //线条颜色
 | 
											
												
													
														|  | 
 |  | +                                        width: 1, //线宽
 | 
											
												
													
														|  | 
 |  | +                                        height: 30, //条码高度
 | 
											
												
													
														|  | 
 |  | +                                        displayValue: true, //是否显示文字信息
 | 
											
												
													
														|  | 
 |  | +                                        fontSize: 14,
 | 
											
												
													
														|  | 
 |  | +                                    });
 | 
											
												
													
														|  | 
 |  | +                                    $("#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);
 | 
											
												
													
														|  | 
 |  | +                                    $("#printDate6").text(doctorName);
 | 
											
												
													
														|  | 
 |  | +                                    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)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                            }else {
 | 
											
												
													
														|  | 
 |  | +                                errorMesage(res)
 | 
											
												
													
														|  | 
 |  | +                            }
 | 
											
												
													
														|  | 
 |  | +                        })
 | 
											
												
													
														|  | 
 |  | +                    } else {
 | 
											
												
													
														|  | 
 |  | +                        errorMesage("未获取到就诊记录,请重试!");
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |                  })
 |  |                  })
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  | -        errorMesage("未获取到收费项目,请重试!");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            errorMesage("未获取到收费项目,请重试!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      })
 |  |      })
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  };
 |  |  };
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +function formatISODate(isoString, format) {
 | 
											
												
													
														|  | 
 |  | +  try {
 | 
											
												
													
														|  | 
 |  | +    const date = new Date(isoString);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    if (isNaN(date.getTime())) {
 | 
											
												
													
														|  | 
 |  | +      return "无效的日期格式";
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 获取日期组件
 | 
											
												
													
														|  | 
 |  | +    const year = date.getFullYear();
 | 
											
												
													
														|  | 
 |  | +    const month = String(date.getMonth() + 1).padStart(2, '0');
 | 
											
												
													
														|  | 
 |  | +    const day = String(date.getDate()).padStart(2, '0');
 | 
											
												
													
														|  | 
 |  | +    const hours = String(date.getHours()).padStart(2, '0');
 | 
											
												
													
														|  | 
 |  | +    const minutes = String(date.getMinutes()).padStart(2, '0');
 | 
											
												
													
														|  | 
 |  | +    const seconds = String(date.getSeconds()).padStart(2, '0');
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 替换格式标记
 | 
											
												
													
														|  | 
 |  | +    return format
 | 
											
												
													
														|  | 
 |  | +      .replace('yyyy', year)
 | 
											
												
													
														|  | 
 |  | +      .replace('MM', month)
 | 
											
												
													
														|  | 
 |  | +      .replace('dd', day)
 | 
											
												
													
														|  | 
 |  | +      .replace('HH', hours)
 | 
											
												
													
														|  | 
 |  | +      .replace('mm', minutes)
 | 
											
												
													
														|  | 
 |  | +      .replace('ss', seconds);
 | 
											
												
													
														|  | 
 |  | +  } catch (error) {
 | 
											
												
													
														|  | 
 |  | +    return "转换错误: " + error.message;
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  function createInMemoryQR(url) {
 |  |  function createInMemoryQR(url) {
 | 
											
												
													
														|  |  try {
 |  |  try {
 | 
											
												
													
														|  |      // 创建不可见的临时容器
 |  |      // 创建不可见的临时容器
 |