瀏覽代碼

发票冲红

‘chenzhilei’ 3 月之前
父節點
當前提交
1f03849e31

+ 11 - 0
src/main/java/cn/hnthyy/thmz/controller/mzdzfp/BswController.java

@@ -43,6 +43,17 @@ public class BswController {
     public R queryInvoiceFile(@RequestBody MzDzfpUpload mzDzfpUpload){
         return  dictDataService.getBswServer().queryInvoiceFile(mzDzfpUpload);
     }
+    /**
+     * @description: 发票版式文件查询
+     * @author: lihong
+     * @date: 2025/3/13 11:37
+     * @param: param
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/selectDzfpUploadAboutSerialNo")
+    public R selectDzfpUploadAboutSerialNo(@RequestBody MzDzfpUpload mzDzfpUpload){
+        return  dictDataService.getBswServer().selectDzfpUploadAboutSerialNo(mzDzfpUpload);
+    }
 
     /**
      * @description: typeFlag  1 门诊蓝字发票  2 门诊红字发票  ghFlag true 挂号

+ 4 - 4
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/JSMzInvoiceInfo.java

@@ -16,8 +16,8 @@ import java.util.stream.Collectors;
 
 /**
  * @Description:
- * @Author:lihong
- * @Date: 2025/3/4
+ * @Author:chenzhilei
+ * @Date: 2025/7/20
  */
 @Data
 @Builder
@@ -68,8 +68,8 @@ public class JSMzInvoiceInfo implements Serializable {
         List<InvoiceDetail> invoiceDetailList = mzInvoiceInfo.getInvoiceDetailList();
         List<DetailItemList> DetailItemList = invoiceDetailList.stream().map(e->{
             DetailItemList detailItemList = new DetailItemList();
-            detailItemList.setItem_name("挂号费");
-            detailItemList.setItem_code("32080101");
+            detailItemList.setItem_name(e.getItemName());
+            detailItemList.setItem_code(e.getItemCode());
             detailItemList.setItem_amount(e.getAmount());
 //            detailItemList.setNum();
             return detailItemList;

+ 64 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/JSRedMzInvoiceInfo.java

@@ -0,0 +1,64 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import cn.hnthyy.thmz.enums.InsutypeEnum;
+import com.alibaba.druid.util.StringUtils;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:chenzhilei
+ * @Date: 2025/7/20
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class JSRedMzInvoiceInfo implements Serializable {
+
+    private static final long serialVersionUID =  1L;
+
+    private String relatedInvoiceNumber;	//	票务号码
+    private String relatedInvoiceCode;	//	票务编码
+    private String busseqno;	//	流水号
+    private	String bustype = "02";	//	业务类型
+    private BigDecimal totalAmount;	//	总金额
+    private	String payerPartyType = "1";	//	交款人类型	1:个人2:单位
+    private	String payerPartyName;	//	交款人姓名
+    private	String handlingPerson;	//	开票人
+    private	String checker;	//	复核人
+    private List<DetailItemList> detail_item_list;
+
+    public JSRedMzInvoiceInfo transformFromMzInvoiceInfo(MzInvoiceInfo mzInvoiceInfo){
+        JSRedMzInvoiceInfo jsRedMzInvoiceInfo = new JSRedMzInvoiceInfo();
+        jsRedMzInvoiceInfo.setBusseqno(mzInvoiceInfo.getSpecialAttrDTO().getMedicalSerialNo());
+        jsRedMzInvoiceInfo.setTotalAmount(mzInvoiceInfo.getTotalAmount());
+        jsRedMzInvoiceInfo.setPayerPartyName(mzInvoiceInfo.getBuyerUsciName());
+        jsRedMzInvoiceInfo.setHandlingPerson(mzInvoiceInfo.getIssuer());
+        jsRedMzInvoiceInfo.setChecker(mzInvoiceInfo.getIssuer());
+        jsRedMzInvoiceInfo.setBusseqno(mzInvoiceInfo.getSpecialAttrDTO().getMedicalSerialNo());
+        jsRedMzInvoiceInfo.setRelatedInvoiceCode(mzInvoiceInfo.getRelatedInvoiceCode());
+        jsRedMzInvoiceInfo.setRelatedInvoiceNumber(mzInvoiceInfo.getRelatedInvoiceNumber());
+
+
+        List<InvoiceDetail> invoiceDetailList = mzInvoiceInfo.getInvoiceDetailList();
+        List<DetailItemList> DetailItemList = invoiceDetailList.stream().map(e->{
+            DetailItemList detailItemList = new DetailItemList();
+            detailItemList.setItem_name(e.getItemName());
+            detailItemList.setItem_code(e.getItemCode());
+            detailItemList.setItem_amount(e.getAmount());
+//            detailItemList.setNum();
+            return detailItemList;
+        }).collect(Collectors.toList());
+        jsRedMzInvoiceInfo.setDetail_item_list(DetailItemList);
+
+        return jsRedMzInvoiceInfo;
+    }
+}

+ 3 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MzInvoiceInfo.java

@@ -74,5 +74,8 @@ public class MzInvoiceInfo implements Serializable {
     private String patientId;	//	门诊号
     private String times;	//	就诊次数
 
+    private String relatedInvoiceNumber;	//	票务号码
+    private String relatedInvoiceCode;	//	票务编码
+
 
 }

+ 5 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/ResultInfo.java

@@ -15,6 +15,11 @@ public class ResultInfo implements Serializable {
     private static final long serialVersionUID =  1L;
     private String code;
     private String message;
+    private String invoice_code;
+    private String invoice_number;
+    private String invoice_url;
+    private String issue_date;
+    private String result;
     private Map<String,Object> data;
     /**  0000成功 9999失败 */
     public static final String SUCCESS_CODE = "00000";

+ 3 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDzfpUploadMapper.java

@@ -22,10 +22,12 @@ public interface MzDzfpUploadMapper extends BaseMapper<MzDzfpUpload> {
             "</if>"+
             "</script>")
     SetlInfo selectSetlInfo(@Param("patientId") String patientId, @Param("times")Integer times, @Param("ledgerSn")Integer ledgerSn);
+    @Select("select * from mz_dzfp_upload where patient_id = #{patientId} and  times = #{times} and serial_no = #{serialNo}")
+    MzDzfpUpload selectDzfpUploadAboutSerialNo(@Param("patientId") String patientId, @Param("times")Integer times, @Param("serialNo")String serialNo);
 
     @Select("select * from powersi_mip_setlinfo where med_org_ord ='${patientId}_${times}_1' and ord_state ='SETTLED' ")
     Map<String, Object> selectpowersiMipSetlinfo(@Param("patientId") String patientId, @Param("times")Integer times);
-    @Update(" update mz_dzfp_upload set fp_no =#{fpNo} ,res_code=#{resCode},blue_issue_date=#{blueIssueDate} where patient_id = #{patientId} and times =#{times} and receipt_no=#{receiptNo} and type_flag =#{typeFlag} and del_flag =#{delFlag}")
+    @Update(" update mz_dzfp_upload set fp_no =#{fpNo} ,op_code=#{opCode},blue_issue_date=#{blueIssueDate} where patient_id = #{patientId} and times =#{times} and receipt_no=#{receiptNo} and type_flag =#{typeFlag} and del_flag =#{delFlag}")
     int updateFpNo(MzDzfpUpload mzDzfpUpload);
     @Select(" select dis_diag mainDiagCode ,dis_diag_comment mainDiagName from zy_dis_diag_yb where inpatient_no = #{patientId} and admiss_times =#{times} and dis_diag_no = 1 ")
     Map<String,Object> selectYbDiag(MzDzfpUpload uploadParam);

+ 24 - 11
src/main/java/cn/hnthyy/thmz/service/his/mzdzfp/BswServer.java

@@ -11,17 +11,18 @@ import cn.hnthyy.thmz.entity.mzdzfp.MzDzfpUpload;
  */
 public interface BswServer {
 
-   /**
-    * @description: 上传门诊蓝字发票
-    * @author: lihong
-    * @date: 2025/3/13 16:04
-    * @param: patientId
-    * @param: times
-    * @param: receiptNo
-    * @param: ghFlag true 挂号 false 门诊发票
-    * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
-    **/
-   R getMzBlueInvoice(MzReceiptSerial mzReceiptSerial, boolean ghFlag);
+    /**
+     * @description: 上传门诊蓝字发票
+     * @author: lihong
+     * @date: 2025/3/13 16:04
+     * @param: patientId
+     * @param: times
+     * @param: receiptNo
+     * @param: ghFlag true 挂号 false 门诊发票
+     * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
+     **/
+    R getMzBlueInvoice(MzReceiptSerial mzReceiptSerial, boolean ghFlag);
+
    /**
     * @description: 上传红字发票
     * @author: lihong
@@ -66,5 +67,17 @@ public interface BswServer {
      **/
     R queryInvoiceFile(MzDzfpUpload mzDzfpUpload);
 
+    /**
+     * @description: 查询发票
+     * @author: lihong
+     * @date: 2025/3/13 16:04
+     * @param: patientId
+     * @param: times
+     * @param: serialNo
+     * @param: ghFlag true 挂号 false 门诊发票
+     * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
+     **/
+    R selectDzfpUploadAboutSerialNo(MzDzfpUpload mzDzfpUpload);
+
 
 }

+ 55 - 16
src/main/java/cn/hnthyy/thmz/service/impl/his/mzdzfp/BswServerImpl.java

@@ -354,15 +354,15 @@ public class BswServerImpl implements BswServer {
             return R.error("没有开具电子发票或者已经作废,不能作废");
         }
         MzDzfpUpload mzDzfpUpload = mzDzfpUploadList.get(0);
-        String blueInvoiceNo = mzDzfpUpload.getFpNo();
-        String blueIssueDate = mzDzfpUpload.getBlueIssueDate();
-        if (StrUtil.isBlank(blueInvoiceNo)) {
+        String relatedInvoiceNumber = mzDzfpUpload.getFpNo();
+        String relatedInvoiceCode = mzDzfpUpload.getOpCode();
+        if (StrUtil.isBlank(relatedInvoiceNumber)) {
             MzDzfpUpload dzfpState = getDzfpState(mzDzfpUpload, 1);
             if (dzfpState == null) {
                 return R.error("没有开具电子发票,不能作废");
             }
-            blueInvoiceNo = dzfpState.getFpNo();
-            blueIssueDate = dzfpState.getBlueIssueDate();
+            relatedInvoiceNumber = mzDzfpUpload.getFpNo();
+            relatedInvoiceCode = mzDzfpUpload.getOpCode();
         }
         List<MzDzfpUpload> redDzfp = mzDzfpUploadMapper.selectList(getQueryWrapper(MzDzfpUpload.builder()
                 .patientId(mzReceiptSerial.getPatientId())
@@ -401,14 +401,14 @@ public class BswServerImpl implements BswServer {
                 .build();
         mzDzfpUploadMapper.delete(getQueryWrapper(uploadParam));
         mzDzfpUploadMapper.insert(uploadParam);
-        mzInvoiceInfo.setBlueInvoiceNo(blueInvoiceNo);
-        mzInvoiceInfo.setBlueIssueDate(blueIssueDate);
+        mzInvoiceInfo.setRelatedInvoiceNumber(relatedInvoiceNumber);
+        mzInvoiceInfo.setRelatedInvoiceCode(relatedInvoiceCode);
         mzInvoiceInfo.setRedOffsetCode("02");
         ResultInfo resultInfo = mzRedInvoice(mzInvoiceInfo);
-        if (!ResultInfo.SUCCESS_CODE.equals(resultInfo.getCode())) {
+        if (!ResultInfo.SUCCESS_CODE.equals(resultInfo.getResult())) {
             return R.error(resultInfo.getMessage());
         }
-        mzReceiptSerial.setOperatorId(StrUtil.isNotBlank(uploadParam.getOpId()) ? uploadParam.getOpId() : TokenUtil.getUser().getUserIdCode());
+//        mzReceiptSerial.setOperatorId(StrUtil.isNotBlank(uploadParam.getOpId()) ? uploadParam.getOpId() : TokenUtil.getUser().getUserIdCode());
         return saveMzDzfpUpload(mzReceiptSerial, mzInvoiceInfo, resultInfo, 2);
     }
 
@@ -520,6 +520,7 @@ public class BswServerImpl implements BswServer {
                     invoiceDetail.setSerialNo(index);
                     invoiceDetail.setItemTypeName(ghMap.get(field.getName()).split("_")[1]);
                     invoiceDetail.setItemName(ghMap.get(field.getName()).split("_")[1]);
+                    invoiceDetail.setItemCode("32080101");
                     invoiceDetail.setAmount(typeFlag == 2 ? fee.negate() : fee);
                     invoiceDetail.setTaxAmount(BigDecimal.ZERO);
                     invoiceDetail.setTaxRate(BigDecimal.ZERO);
@@ -534,22 +535,36 @@ public class BswServerImpl implements BswServer {
     }
 
     private R saveMzDzfpUpload(MzReceiptSerial mzReceiptSerial, MzInvoiceInfo mzInvoiceInfo, ResultInfo resultInfo, Integer typeFlag) {
-        Map jsonData = (Map) resultInfo.getData();
+        String resultCode = "";
+        String invoiceNumber = "";
+        String invoiceCode = "";
+        String invoiceUrl = "";
+        if (resultInfo.getData() == null) {
+            resultCode = String.valueOf(resultInfo.getResult());
+            invoiceNumber = String.valueOf(resultInfo.getInvoice_number());
+            invoiceCode = String.valueOf(resultInfo.getInvoice_code());
+            invoiceUrl = String.valueOf(resultInfo.getInvoice_url());
+        } else {
+            resultCode = String.valueOf(resultInfo.getData().get("result"));
+            invoiceNumber = String.valueOf(resultInfo.getData().get("invoice_number"));
+            invoiceCode = String.valueOf(resultInfo.getData().get("invoice_code"));
+            invoiceUrl = String.valueOf(resultInfo.getData().get("invoice_url"));
+        }
         MzDzfpUpload mzDzfpUpload = MzDzfpUpload.builder()
                 .patientId(mzReceiptSerial.getPatientId())
                 .times(mzReceiptSerial.getTimes())
                 .receiptNo(mzReceiptSerial.getReceiptNo())
                 .serialNo(String.valueOf(mzReceiptSerial.getSerialNo()))
-                .fpNo(resultInfo.getData().get("invoice_code").toString())
-                .opCode(resultInfo.getData().get("invoice_number").toString())
+                .fpNo(invoiceNumber)
+                .opCode(invoiceCode)
                 .requestId(mzInvoiceInfo.getRequestId())
                 .typeFlag(typeFlag)
                 .delFlag(0)
                 .opId(mzReceiptSerial.getOperatorId())
                 .build();
-        if (ResultInfo.SUCCESS_CODE.equals(resultInfo.getData().get("result"))) {
+        if (ResultInfo.SUCCESS_CODE.equals(resultCode)) {
 //            mzDzfpUpload.setQrcode(Convert.toStr(jsonData.get("qrcode")));
-            mzDzfpUpload.setResUrl(Convert.toStr(jsonData.get("invoice_url")));
+            mzDzfpUpload.setResUrl(invoiceUrl);
             mzDzfpUpload.setResCode(2);
         } else {
             mzDzfpUpload.setResCode(3);
@@ -1123,9 +1138,15 @@ public class BswServerImpl implements BswServer {
      * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
      */
     public ResultInfo mzRedInvoice(MzInvoiceInfo mzInvoiceInfo) {
-        String url = getUrl() + "bsw-server/evasp/api/nscs/outpatient/redInvoice";
+//        String url = getUrl() + "bsw-server/evasp/api/nscs/outpatient/redInvoice";
+        String url = getUrl() + "public/ebill/invoicehiswriteoff";
         String paramJson = JsonUtil.object2Json(mzInvoiceInfo);
-        return requestInvoice(paramJson, url, "开具门诊红字发票");
+        JSRedMzInvoiceInfo jsRedMzInvoiceInfo = new JSRedMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo);
+        String paramJson1 = JsonUtil.object2Json(jsRedMzInvoiceInfo);
+
+        log.info("url:{}", url);
+        log.info("请求前参数:{}", paramJson);
+        return requestInvoice(paramJson1, url, "开具门诊红字发票");
     }
 
     private ResultInfo requestInvoice(String paramJson, String url, String paramStr) {
@@ -1343,4 +1364,22 @@ public class BswServerImpl implements BswServer {
         }
         return R.ok().put("data", zdTaxClassCodeMapper.selectByEntity(new ZdTaxClassCode()));
     }
+
+    /**
+     * @description: 税收分类编码查询
+     * @author: lihong
+     * @date: 2025/3/5 14:45
+     * @param: usciCode  统一社会信用代码
+     * @param: timestamp  yyyyMMddH Hmmss
+     * 首次下载时为 空;
+     * 非首次下载
+     * 时,传入上次 下载返回的时 间戳.格式:
+     * yyyyMMddH Hmmss
+     * @param: taxAuthorityCode 非必填 省级税务机关代码
+     * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public R selectDzfpUploadAboutSerialNo(MzDzfpUpload mzDzfpUpload) {
+        return R.ok().put("data", mzDzfpUploadMapper.selectDzfpUploadAboutSerialNo(mzDzfpUpload.getPatientId(),mzDzfpUpload.getTimes(),mzDzfpUpload.getSerialNo()));
+    }
 }

+ 15 - 27
src/main/resources/static/js/mz/registration_list.js

@@ -1399,11 +1399,11 @@ function loadTableList() {
                             }
                             if(fpVsesionNo == 1){
                                 html += '<button type="button" class="registration-no-color-foot-button" title="电子发票作废" onclick="uploadRedInvoice(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-mail-reply-all"></i></button>';
-                                html += '  <button type="button" class="registration-no-color-foot-button"  title="下载红字电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',2'+ ')"><i class="fa fa-download"></i></button>';
+                                html += '  <button type="button" class="registration-no-color-foot-button"  title="下载红字电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
                             }
                             html += '<button type="button" class="can-not-used" title="退号"><i class="fa fa-minus-square-o"></i></button><button type="button" class="can-not-used" title="打印" ><i class="fa fa-print"></i></button>';
                             html += '<button type="button" class="registration-no-color-foot-button" title="智能支付参数与条形码" onclick="createBarcode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-barcode"></i></button>';
-                            return html;
+                            return html;x``
                         }
                         if (row.mzyReqrec.visitedMark == 1) {
                             var html = '<button type="button" class="can-not-used" title="修改挂号"><i class="fa fa-edit"></i></button><button type="button" class="registration-no-color-foot-button"title="修改患者" onclick="editUserModal(\'' + row.mzyReqrec.patientId + '\')"><i class="fa fa-user"></i></button>';
@@ -1431,7 +1431,7 @@ function loadTableList() {
                             }
                             if(fpVsesionNo == 1){
                                 html += '                            <button type="button" class="registration-no-color-foot-button"  title="上传电子发票" onclick="uploadBlueInvoice(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-upload"></i></button>';
-                                html += '  <button type="button" class="registration-no-color-foot-button"  title="下载电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',1'+ ')"><i class="fa fa-download"></i></button>';
+                                html += '  <button type="button" class="registration-no-color-foot-button"  title="下载电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
                             }
                             html += '<button type="button" class="can-not-used" title="智能支付参数与条形码"><i class="fa fa-barcode"></i></button>';
                             // html += '<button type="button" class="registration-no-color-foot-button"  title="取消接诊" onclick="cancelClinic(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-mail-reply"></i></button>';
@@ -1463,7 +1463,7 @@ function loadTableList() {
                             html += '<i class="fa fa-print"></i></button>';
                            if(fpVsesionNo == 1){
                                html += '                            <button type="button" class="registration-no-color-foot-button"  title="上传电子发票" onclick="uploadBlueInvoice(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-upload"></i></button>';
-                               html += '  <button type="button" class="registration-no-color-foot-button"  title="下载电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',1'+ ')"><i class="fa fa-download"></i></button>';
+                               html += '  <button type="button" class="registration-no-color-foot-button"  title="下载电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
                            }
                         }
                         html += '<button type="button" class="registration-no-color-foot-button" title="智能支付参数与条形码" onclick="createBarcode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')"><i class="fa fa-barcode"></i></button>';
@@ -1757,12 +1757,12 @@ function uploadRedInvoice(patientId,times) {
 
 var dzfp_patientId ;
 var dzfp_times ;
-var dzfp_typeFlag;
+var dzfp_serialNo;
 //打开电子发票弹窗
-function openDzfpDownModal(patientId,times,typeFlag) {
+function openDzfpDownModal(patientId,times,serialNo) {
     dzfp_patientId = patientId;
     dzfp_times = times;
-    dzfp_typeFlag = typeFlag;
+    dzfp_serialNo = serialNo;
     $("#dzfpDownModal").modal();
 }
 
@@ -1770,32 +1770,20 @@ function openDzfpDownModal(patientId,times,typeFlag) {
  * @param type 1 打印二维码  2 下载pdf
  */
 function downOrPrintDzfp(type) {
-    downloadInvoice(dzfp_patientId,dzfp_times,dzfp_typeFlag,type)
+    downloadInvoice(dzfp_patientId,dzfp_times,dzfp_serialNo)
 }
 
 //下载电子发票
-function downloadInvoice(patientId,times,typeFlag,type) {
+function downloadInvoice(patientId,times,serialNo) {
     setPrint();
-    postAjaxJsonHttpRequst("/thmz/queryInvoiceFile",{patientId:patientId,times:times,typeFlag:typeFlag,receiptNo:0},true,function (res) {
+    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo,},true,function (res) {
         if(res.code == 0){
-            if(type == 1){
-                let height = "70mm"
-                let  bkimgWidth = "110mm"
-                LODOP = getLodop();
-                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", "3mm", "60mm", "3mm", hospitalName+"发票二维码");
-                LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);
-                LODOP.PRINT();
-            }else {
-                base64toPDF(res.data.pdfFileStr)
+            if(res.data.resUrl){
+                window.open(res.data.resUrl)
+            } else {
+                errorMesage("未获取到电子发票,请重新上传发票!");
             }
+
         }else {
             errorMesage(res)
         }

+ 37 - 29
src/main/resources/static/js/mz/toll_administration.js

@@ -632,7 +632,7 @@ function initFeeTable() {
                         if(fpVsesionNo == 1){
                             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.receiptNo + ',1'+')"><i class="fa fa-download"></i></button>';
+                            str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button"title="查询电子发票" onclick="getEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-search"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="downloadEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-download"></i></button>';
                         }
@@ -661,7 +661,7 @@ function initFeeTable() {
                         str += '<button type="button" class="registration-no-color-foot-button"title="支付明细" onclick="depositFileList(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-th-list"></i></button>';
                         if(fpVsesionNo == 1){
                             str += '<button type="button" class="registration-no-color-foot-button"title="电子发票作废" onclick="uploadMzInvoice(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',2'+ ')"><i class="fa fa-mail-reply-all"></i></button>';
-                            str += '<button type="button" class="registration-no-color-foot-button"title="下载已作废的电子发票" onclick="openDzfpDownModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',2'+ ')" style="color: red;"><i class="fa fa-download"></i></button>';
+                            str += '<button type="button" class="registration-no-color-foot-button"title="下载已作废的电子发票" onclick="onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
                         }
                         // str += '<button type="button" class="registration-no-color-foot-button" title="修改收款方式" onclick="showChequType(\'' + row.patientId + '\','+row.times+','+row.receiptNo+')"><i class="fa fa-credit-card"></i></button>' ;
                         return str;
@@ -1930,14 +1930,15 @@ function uploadMzInvoice(patientId,times,receiptNo,typeFlag) {
 
 var dzfp_patientId ;
 var dzfp_times ;
-var dzfp_receiptNo;
-var dzfp_typeFlag;
+var dzfp_serialNo;
+//var dzfp_typeFlag;
 //打开电子发票弹窗
-function openDzfpDownModal(patientId,times,receiptNo,typeFlag) {
+function openDzfpDownModal(patientId,times,serialNo) {
+console.log("dfds",patientId,times,serialNo)
     dzfp_patientId = patientId;
     dzfp_times = times;
-    dzfp_receiptNo = receiptNo;
-    dzfp_typeFlag = typeFlag;
+    dzfp_serialNo = serialNo;
+//    dzfp_typeFlag = typeFlag;
     $("#dzfpDownModal").modal();
 }
 
@@ -1945,36 +1946,43 @@ function openDzfpDownModal(patientId,times,receiptNo,typeFlag) {
  * @param type 1 打印二维码  2 下载pdf
  */
 function downOrPrintDzfp(type) {
-    downloadDzfp(dzfp_patientId,dzfp_times,dzfp_receiptNo,dzfp_typeFlag,type)
+console.log("11111111111111111111111111111")
+console.log("dfds",dzfp_patientId,dzfp_times,dzfp_serialNo)
+    downloadDzfp(dzfp_patientId,dzfp_times,dzfp_serialNo)
 }
 
 
 //下载电子发票
-function downloadDzfp(patientId,times,receiptNo,typeFlag,type) {
+function downloadDzfp(patientId,times,serialNo) {
     setPrint();
-    postAjaxJsonHttpRequst("/thmz/queryInvoiceFile",{patientId:patientId,times:times,typeFlag:typeFlag,receiptNo:receiptNo},true,function (res) {
+    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (res) {
         if(res.code == 0){
             $("#dzfpDownModal").modal("hide");
-            if(type == 2 || !stringNotBlank(type)){
-                base64toPDF(res.data.pdfFileStr)
-            }else {
-            //打印二维码
-               let height = "70mm"
-               let  bkimgWidth = "110mm"
-                LODOP = getLodop();
-                LODOP.PRINT_INITA(6, 0, bkimgWidth, height, hospitalName+"门诊电子发票二维码打印");
-                //设置默认打印机
-                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", "3mm", "60mm", "3mm", hospitalName+"发票二维码");
-                LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);
-                LODOP.PRINT();
-                // LODOP.PREVIEW();
+            if(res.data.resUrl){
+                window.open(res.data.resUrl)
+            } else {
+                errorMesage("未获取到电子发票,请重新上传发票!");
             }
+//            if(type == 2 || !stringNotBlank(type)){
+//                base64toPDF(res.data.pdfFileStr)
+//            }else {
+//            //打印二维码
+//               let height = "70mm"
+//               let  bkimgWidth = "110mm"
+//                LODOP = getLodop();
+//                LODOP.PRINT_INITA(6, 0, bkimgWidth, height, hospitalName+"门诊电子发票二维码打印");
+//                //设置默认打印机
+//                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", "3mm", "60mm", "3mm", hospitalName+"发票二维码");
+//                LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);
+//                LODOP.PRINT();
+//                // LODOP.PREVIEW();
+//            }
         }else {
             errorMesage(res)
         }