Browse Source

修改电子发票凭据展示时间

‘chenzhilei’ 2 weeks ago
parent
commit
de576cc495

+ 88 - 54
src/main/resources/static/js/mz/toll_administration.js

@@ -2386,75 +2386,109 @@ function prn1PrintAndQRCode(patientId, times,serialNo,name,fee,doctorName) {
         receiptNo:'1',
     }
 //    initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);
-//    var projectList = [];
     $("#printProjectName").empty();
     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 {
-        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) {
 try {
     // 创建不可见的临时容器

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

@@ -789,6 +789,7 @@
                     <span>票据代码:</span><span style="margin-left: 3px;" id="printDate4"></span><br />
                     <span>发票日期:</span><span style="margin-left: 3px;" id="printDate5"></span><br />
                     <span>就诊医师:</span><span style="margin-left: 3px;" id="printDate6"></span><br />
+                    <span>就诊日期:</span><span style="margin-left: 3px;" id="printDate7"></span><br />
                 </div>
             </div>
             <div id="report_table_2" style="float:left;width:170px;margin-top:10px">
@@ -800,9 +801,6 @@
         </div>
         <div style="clear: both;">
             <div id="report_table_3" style="float:left;width:300px">
-<!--                <div style="margin-top:50px;font-size:15px;">-->
-<!--                    <span>就诊日期:</span><span style="margin-left: 3px;" id="printDate7"></span><br />-->
-<!--                </div>-->
                 <div style="font-size:15px;float:left;width:300px;">
                     <div style="font-size:15px;float:left;width:150px;">
                         <span style="width:105px;display:inline-block;overflow:hidden;white-space: nowrap;line-height:15px;" >项目名称</span><span style="margin-left: 5px;line-height:15px;">金额</span><br />