Browse Source

住院发票重打和作废重打开发

hurugang 4 years ago
parent
commit
a8d4d274e4

+ 102 - 347
src/main/java/cn/hnthyy/thmz/controller/zy/ZyReceiptlController.java

@@ -44,8 +44,9 @@ public class ZyReceiptlController {
     private ZyLedgerFileService zyLedgerFileService;
     @Autowired
     private ZdUnitCodeService zdUnitCodeService;
+
     /**
-     * 根据住院号与住院次数号查所有本次住院发票
+     * 根据住院号与住院次数号查本次住院所有未打印发票
      *
      * @param inpatientNo
      * @param admissTimes
@@ -83,8 +84,50 @@ public class ZyReceiptlController {
         } catch (Exception e) {
             e.printStackTrace();
             resultMap.put("code", -1);
-            resultMap.put("message", "根据住院号与住院次数号查所有本次住院发票失败,系统出错,请联系管理员");
-            log.error("根据住院号与住院次数号查所有本次住院发票失败,系统异常,错误信息{}", e.getMessage());
+            resultMap.put("message", "根据住院号与住院次数号查本次住院所有未打印发票失败,系统出错,请联系管理员");
+            log.error("根据住院号与住院次数号查本次住院所有未打印发票失败,系统异常,错误信息{}", e.getMessage());
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 根据住院号与住院次数号查本次住院所有已经打印发票
+     *
+     * @param inpatientNo
+     * @param admissTimes
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getAllPrintReceipt", method = {RequestMethod.GET})
+    public Map<String, Object> getAllPrintReceipt(@RequestParam("inpatientNo") String inpatientNo, @RequestParam("admissTimes") Integer admissTimes) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(inpatientNo)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "住院号参数不能为空");
+                return resultMap;
+            }
+            if (admissTimes == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "住院次数不能为空");
+                return resultMap;
+            }
+            List<ZyReceipt> zyReceipts = zyReceiptService.queryAllPrintReceipt(inpatientNo, admissTimes);
+            if (zyReceipts == null || zyReceipts.size() == 0) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "该患者本次住院发票暂未打印!");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "住院发票查询成功!");
+            resultMap.put("data", zyReceipts);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "根据住院号与住院次数号查本次住院所有已经打印发票失败,系统出错,请联系管理员");
+            log.error("根据住院号与住院次数号查本次住院所有已经打印发票失败,系统异常,错误信息{}", e.getMessage());
             return resultMap;
         }
     }
@@ -182,7 +225,7 @@ public class ZyReceiptlController {
             resultMap.put("jeMap", jeMap);
             resultMap.put("days", days);
             resultMap.put("printer", tokenUser.getUserName());
-            resultMap.put("grhjzfje", NumberToCN.number2CNMontrayUnit((BigDecimal)jeMap.get("zfje")));
+            resultMap.put("grhjzfje", NumberToCN.number2CNMontrayUnit((BigDecimal) jeMap.get("zfje")));
             return resultMap;
         } catch (MzException e) {
             resultMap.put("code", -1);
@@ -199,349 +242,61 @@ public class ZyReceiptlController {
     }
 
 
-//    /**
-//     * 将发票列表转换成发票视图列表
-//     *
-//     * @param mzReceiptSerial
-//     * @param timesList
-//     * @return
-//     */
-//    private List<MzReceiptSerialVo> getMzReceiptSerialVos(MzReceiptSerial mzReceiptSerial, List<Integer> timesList, String receipt) {
-//        List<MzReceiptSerialVo> mzReceiptSerialVos = new ArrayList<>();
-//        MzReceiptSerialVo mzReceiptSerialVo = new MzReceiptSerialVo();
-//        mzReceiptSerialVo.setMzReceiptSerial(mzReceiptSerial);
-//        List<String> feeList = new ArrayList<>();
-//        if (mzReceiptSerial.getCharge1() != null && mzReceiptSerial.getCharge1().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("挂号:" + mzReceiptSerial.getCharge1().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge2() != null && mzReceiptSerial.getCharge2().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("床位:" + mzReceiptSerial.getCharge2().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge3() != null && mzReceiptSerial.getCharge3().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("诊察:" + mzReceiptSerial.getCharge3().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge4() != null && mzReceiptSerial.getCharge4().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("检查:" + mzReceiptSerial.getCharge4().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge5() != null && mzReceiptSerial.getCharge5().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("治疗:" + mzReceiptSerial.getCharge5().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge6() != null && mzReceiptSerial.getCharge6().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("护理:" + mzReceiptSerial.getCharge6().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge7() != null && mzReceiptSerial.getCharge7().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("手术:" + mzReceiptSerial.getCharge7().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge8() != null && mzReceiptSerial.getCharge8().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("化验:" + mzReceiptSerial.getCharge8().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge9() != null && mzReceiptSerial.getCharge9().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("其他:" + mzReceiptSerial.getCharge9().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge10() != null && mzReceiptSerial.getCharge10().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("西药:" + mzReceiptSerial.getCharge10().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge11() != null && mzReceiptSerial.getCharge11().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("成药:" + mzReceiptSerial.getCharge11().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge12() != null && mzReceiptSerial.getCharge12().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("草药:" + mzReceiptSerial.getCharge12().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge13() != null && mzReceiptSerial.getCharge13().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("特材:" + mzReceiptSerial.getCharge13().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge14() != null && mzReceiptSerial.getCharge14().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("输血:" + mzReceiptSerial.getCharge14().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge15() != null && mzReceiptSerial.getCharge15().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("鉴定:" + mzReceiptSerial.getCharge15().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge16() != null && mzReceiptSerial.getCharge16().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("消毒:" + mzReceiptSerial.getCharge16().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge17() != null && mzReceiptSerial.getCharge17().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("器械:" + mzReceiptSerial.getCharge17().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge18() != null && mzReceiptSerial.getCharge18().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("材料:" + mzReceiptSerial.getCharge18().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge19() != null && mzReceiptSerial.getCharge19().compareTo(BigDecimal.ZERO) == 1) {
-//            feeList.add("麻醉:" + mzReceiptSerial.getCharge19().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-//        if (mzReceiptSerial.getCharge20() != null && mzReceiptSerial.getCharge20().compareTo(BigDecimal.ZERO) != 0) {
-//            feeList.add("舍入:" + mzReceiptSerial.getCharge20().setScale(2, BigDecimal.ROUND_FLOOR));
-//        }
-////        if (totalPay.compareTo(BigDecimal.ZERO) == 1) {
-////            mzReceiptSerial.setTotalCharge(totalPay);
-////        }
-//        if (mzReceiptSerial.getTotalCharge() != null) {
-//            mzReceiptSerial.setTotalCharge(mzReceiptSerial.getTotalCharge().setScale(1, BigDecimal.ROUND_FLOOR));
-//            mzReceiptSerialVo.setTotalChargeStr(NumberToCN.number2CNMontrayUnit(mzReceiptSerial.getTotalCharge()));
-//        }
-//        mzReceiptSerialVo.setFeeList(feeList);
-//        List<MzChargeDetail> mzChargeDetailList = mzChargeDetailService.queryFyJl(mzReceiptSerial.getPatientId(), mzReceiptSerial.getTimes());
-//        if (mzChargeDetailList != null && mzChargeDetailList.size() > 0) {
-//            List<String> qyxxs = new ArrayList<>();
-//            StringBuffer sbf = new StringBuffer();
-//            for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
-//                if (mzChargeDetail != null) {
-//                    if (StringUtils.isNotBlank(mzChargeDetail.getGroupNo()) && StringUtils.isNotBlank(mzChargeDetail.getWindowsNoYf())) {
-//                        MzDrugWin mzDrugWin = mzDrugWinService.queryMzDrugWinByGroupNoAndWinNo(mzChargeDetail.getGroupNo(), mzChargeDetail.getWindowsNoYf());
-//                        if (mzDrugWin != null) {
-//                            sbf.append(mzDrugWin.getWinName());
-//                            sbf.append(",");
-//                            sbf.append(mzChargeDetail.getBackSerial());
-//                            qyxxs.add(sbf.toString());
-//                            sbf.setLength(0);
-//                        }
-//                    }
-//                }
-//            }
-//            mzReceiptSerialVo.setQyxxs(qyxxs);
-//        }
-//        setChargeDate(mzReceiptSerial, mzReceiptSerialVo);
-//        if (StringUtils.isNotBlank(mzReceiptSerial.getOperatorId())) {
-//            User user = userService.queryUserByUserIdCode(mzReceiptSerial.getOperatorId());
-//            if (user != null) {
-//                mzReceiptSerial.setOperatorId(user.getUserName());
-//            }
-//            if (Constants.BRZZJF_CODE.equals(mzReceiptSerial.getPayId())) {
-//                mzReceiptSerial.setOperatorId(mzReceiptSerial.getOperatorId() + "(" + Constants.BRZZJF_NAME + ")");
-//            }
-//        }
-//        //退费重收的发票号码都是大于10的拼接字符串
-//        if (StringUtils.isNotBlank(mzReceiptSerial.getReceiptBill()) && mzReceiptSerial.getReceiptBill().length() > 8 && Constants.BYJZ.equals(mzReceiptSerial.getChequeType())) {
-//            mzReceiptSerial.setReceiptBill(receipt + "(退费重收)");
-//        } else {
-//            mzReceiptSerial.setReceiptBill(receipt);
-//        }
-//        mzReceiptSerialVos.add(mzReceiptSerialVo);
-//        timesList.add(mzReceiptSerial.getTimes());
-//        return mzReceiptSerialVos;
-//    }
-//
-//    /**
-//     * 设置发票的年月日
-//     *
-//     * @param mzReceiptSerial
-//     * @param mzReceiptSerialVo
-//     */
-//    private void setChargeDate(MzReceiptSerial mzReceiptSerial, MzReceiptSerialVo mzReceiptSerialVo) {
-//        Date chargeDate = mzReceiptSerial.getChargeDate();
-//        if (chargeDate == null) {
-//            chargeDate = new Date();
-//        }
-//        Calendar calendar = Calendar.getInstance();
-//        calendar.setTime(chargeDate);
-//        mzReceiptSerialVo.setYear(calendar.get(Calendar.YEAR));
-//        Integer month = calendar.get(Calendar.MONTH) + 1;
-//        if (month < 10) {
-//            mzReceiptSerialVo.setMonth("0" + month);
-//        } else {
-//            mzReceiptSerialVo.setMonth(month.toString());
-//        }
-//        Integer day = calendar.get(Calendar.DAY_OF_MONTH);
-//        if (day < 10) {
-//            mzReceiptSerialVo.setDay("0" + day);
-//        } else {
-//            mzReceiptSerialVo.setDay(day.toString());
-//        }
-//    }
-
-//    /**
-//     * 查询当前发票号码
-//     *
-//     * @param patientId
-//     * @param times
-//     * @return
-//     */
-//    @UserLoginToken
-//    @RequestMapping(value = "/getReceiptForThisTime", method = {RequestMethod.GET})
-//    public Map<String, Object> getReceiptForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times, @RequestParam("receiptNo") Integer receiptNo) {
-//        Map<String, Object> resultMap = new HashMap<>();
-//        try {
-//            if (StringUtils.isBlank(patientId)) {
-//                resultMap.put("code", -1);
-//                resultMap.put("message", "病人编号参数不能为空");
-//                return resultMap;
-//            }
-//            if (times == null) {
-//                resultMap.put("code", -1);
-//                resultMap.put("message", "病人就诊次数不能为空");
-//                return resultMap;
-//            }
-//            if (receiptNo == null) {
-//                resultMap.put("code", -1);
-//                resultMap.put("message", "病人缴费次数不能为空");
-//                return resultMap;
-//            }
-//            List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryPrintedSerialForThisTime(patientId, times, null);
-//            if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
-//                List<String> receiptBills = new ArrayList<>();
-//                for (MzReceiptSerial mzReceiptSerial : mzReceiptSerials) {
-//                    if (StringUtils.isNotBlank(mzReceiptSerial.getReceiptBill()) && receiptNo.equals(mzReceiptSerial.getReceiptNo())) {
-//                        receiptBills.add(mzReceiptSerial.getReceiptBill());
-//                    }
-//                }
-//                resultMap.put("code", 0);
-//                resultMap.put("message", "查询当前发票号码成功");
-//                resultMap.put("data", mzReceiptSerials);
-//                return resultMap;
-//            }
-//            resultMap.put("code", -1);
-//            resultMap.put("message", "查询当前发票号码失败,系统出错,请联系管理员");
-//            log.error("查询当前发票号码失败");
-//            return resultMap;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            resultMap.put("code", -1);
-//            resultMap.put("message", "查询当前发票号码失败,系统出错,请联系管理员");
-//            log.error("查询当前发票号码失败,系统异常,错误信息{}", e.getMessage());
-//            return resultMap;
-//        }
-//    }
-
+    /**
+     * 重新打印当前发票 或者作废当前发票重打
+     *
+     * @param obsolete           Yes 作废重打  no 重新打印
+     * @param receiptNo
+     * @param httpServletRequest
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/repPrintZyReceipt", method = {RequestMethod.GET})
+    public Map<String, Object> repPrintZyReceipt(@RequestParam("obsolete") String obsolete, @RequestParam("receiptNo") String receiptNo, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(receiptNo)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "需要重打的发票号码不能为空");
+                return resultMap;
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            ZyReceipt zyReceipt = zyReceiptService.obsoleteAndRepPrint(receiptNo, obsolete, tokenUser);
+            if (zyReceipt == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "重打失败,请稍后重试");
+                return resultMap;
+            }
+            ZyActpatient zyActpatient = zyActpatientService.queryByInpatientNo(ZyActpatient.ZY_INACTPATIENT, zyReceipt.getInpatientNo(), zyReceipt.getAdmissTimes());
+            if (zyActpatient == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "打印住院发票失败,病人出院信息不存在");
+                return resultMap;
+            }
+            GenderEnum genderEnum = GenderEnum.getGenderByCode(Integer.valueOf(zyActpatient.getSex()));
+            zyActpatient.setSex(genderEnum == null ? GenderEnum.UNKNOWN.name : genderEnum.name);
+            zyActpatient.setResponceTypeName(ResponceTypeEnum.getReportTypeByCode(zyActpatient.getResponceType()).name);
+            Map<String, Object> jeMap = zyLedgerFileService.queryTellerInfo(zyReceipt.getInpatientNo(), zyReceipt.getAdmissTimes(), zyReceipt.getLedgerSn().intValue());
+            int days = DateUtil.getBetweenDatesDesc(DateUtil.pase(zyActpatient.getAdmissDate(), "yyyy-MM-dd"), DateUtil.pase(zyActpatient.getDisDate(), "yyyy-MM-dd")).size();
+            zyActpatient.setWardName(zdUnitCodeService.queryDeptNameByIdInCache(zyActpatient.getWard()));
+            resultMap.put("code", 0);
+            resultMap.put("message", "重新打印当前发票成功");
+            resultMap.put("zyReceipt", zyReceipt);
+            resultMap.put("zyActpatient", zyActpatient);
+            resultMap.put("jeMap", jeMap);
+            resultMap.put("days", days);
+            resultMap.put("printer", tokenUser.getUserName());
+            resultMap.put("grhjzfje", NumberToCN.number2CNMontrayUnit((BigDecimal) jeMap.get("zfje")));
+            log.info("院发票receiptNo=" + receiptNo + "已经重新打印了");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "重新打印当前住院发票失败,系统出错,请联系管理员");
+            log.error("重新打印当前住院发票失败,系统异常,错误信息{}", e.getMessage());
+            return resultMap;
+        }
+    }
 
-//    /**
-//     * 重新打印当前发票 或者作废当前发票重打
-//     *
-//     * @param patientId
-//     * @param times
-//     * @param obsolete  Yes 作废重打  no 重新打印
-//     * @return
-//     */
-//    @UserLoginToken
-//    @RequestMapping(value = "/repPrintForThisTime", method = {RequestMethod.GET})
-//    public Map<String, Object> repPrintForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times, @RequestParam("obsolete") String obsolete, @RequestParam("receiptBill") String receiptBill, HttpServletRequest httpServletRequest) {
-//        Map<String, Object> resultMap = new HashMap<>();
-//        try {
-////            if (StringUtils.isBlank(patientId)) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "病人编号参数不能为空");
-////                return resultMap;
-////            }
-////            if (times == null) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "病人编号参数不能为空");
-////                return resultMap;
-////            }
-////            if (StringUtils.isBlank(receiptBill)) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "需要重打的发票号码不能为空");
-////                return resultMap;
-////            }
-////            String token = TokenUtil.getToken(httpServletRequest);
-////            if (StringUtils.isBlank(token)) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "缴费失败,用户Token不存在");
-////                return resultMap;
-////            }
-////            List<MzDepositFile> mzDepositFiles = mzDepositFileService.queryMzDepositFile(new MzDepositFile(patientId, times));
-////            //非本院记账金额
-////            BigDecimal totalPay = BigDecimal.ZERO;
-////            if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
-////                for (MzDepositFile mzDepositFile : mzDepositFiles) {
-////                    if (!Constants.BYJZ.equals(mzDepositFile.getChequeType())) {
-////                        totalPay = totalPay.add(mzDepositFile.getAmount());
-////                    }
-////                }
-////            }
-////            if (BigDecimal.ZERO.compareTo(totalPay) == 0) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "当前病人没有实际缴费,暂时不打印发票");
-////                log.info("当前病人没有实际缴费,暂时不打印发票,patientId={},time={}", patientId, times);
-////                return resultMap;
-////            }
-////            resultMap.put("code", 0);
-////            resultMap.put("message", "重新打印当前发票成功");
-////            List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryPrintedSerialForThisTime(patientId, times, receiptBill);
-////            MzReceiptSerial mzReceiptSerial = mzReceiptSerials.get(0);
-////            String receipt = mzReceiptSerial.getReceiptBill();
-////            if (YesNoEnum.YES.code.toString().equals(obsolete)) {
-////                User tokenUser = TokenUtil.getUser(httpServletRequest);
-////                receipt = mzReceiptSerialService.obsoleteAndRepPrint(mzReceiptSerial, tokenUser);
-////                resultMap.put("message", "作废重新打印发票成功");
-////            }
-////            List<Integer> timesList = new ArrayList<>();
-////            List<MzReceiptSerialVo> mzReceiptSerialVos = getMzReceiptSerialVos(mzReceiptSerial, timesList, receipt);
-////            resultMap.put("data", mzReceiptSerialVos);
-////
-////            MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
-////            if (Constants.JZ_IC_CARD.equals(mzPatientMi.getIcCardNo())) {
-////                String name = mzChargeDetailService.queryJZName(patientId, times);
-////                if (StringUtils.isNotBlank(name)) {
-////                    mzPatientMi.setName(name);
-////                }
-////            }
-////            resultMap.put("mzPatientMi", mzPatientMi);
-////            log.info("病人id=" + patientId + ",times=" + times + "的发票已经重新打印了");
-//            return resultMap;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            resultMap.put("code", -1);
-//            resultMap.put("message", "重新打印当前发票失败,系统出错,请联系管理员");
-//            log.error("重新打印当前发票失败,系统异常,错误信息{}", e.getMessage());
-//            return resultMap;
-//        }
-//    }
-//
-//
-//
-//
-//    /**
-//     * 根据病人编号和就诊次数查询其当次缴费对应的所有支付方式列表
-//     *
-//     * @param patientId
-//     * @param times
-//     * @return
-//     */
-//    @UserLoginToken
-//    @RequestMapping(value = "/getAllDepositFileForThisTime", method = {RequestMethod.GET})
-//    public Map<String, Object> getAllDepositFileForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times, @RequestParam("receiptNo") Integer receiptNo) {
-//        Map<String, Object> resultMap = new HashMap<>();
-//        try {
-////            if (StringUtils.isBlank(patientId)) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "病人编号参数不能为空");
-////                return resultMap;
-////            }
-////            if (times == null) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "病人就诊不能为空");
-////                return resultMap;
-////            }
-////            if (receiptNo == null) {
-////                resultMap.put("code", -1);
-////                resultMap.put("message", "病人缴费次数不能为空");
-////                return resultMap;
-////            }
-////            MzDepositFile mz = new MzDepositFile(patientId, times);
-////            mz.setReceiptNo(receiptNo);
-////            List<MzDepositFile> mzDepositFiles = mzDepositFileService.queryMzDepositFile(mz);
-////            List<ZdChequeType> chequeTypes = zdChequeTypeService.queryAllZdChequeTypeForMz();
-////            Map<String, String> chequeTypeMap = null;
-////            if (chequeTypes != null) {
-////                chequeTypeMap = chequeTypes.stream().collect(Collectors.toMap(ZdChequeType::getCode, ZdChequeType::getName));
-////            }
-////            if(chequeTypes!=null && chequeTypes.size()>0){
-////                for(MzDepositFile zd:mzDepositFiles){
-////                    if (chequeTypeMap != null) {
-////                        String paymode = chequeTypeMap.get(zd.getChequeType());
-////                        zd.setChequeTypeName(paymode == null ? "" : paymode);
-////                    }
-////                }
-////            }
-////            resultMap.put("code", 0);
-////            resultMap.put("data", mzDepositFiles);
-////            resultMap.put("message", "根据病人编号和就诊次数查询其当次缴费对应的所有支付方式列表成功");
-//            return resultMap;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            resultMap.put("code", -1);
-//            resultMap.put("message", "根据病人编号和就诊次数查询其当次缴费对应的所有支付方式列表失败,系统出错,请联系管理员");
-//            log.error("根据病人编号和就诊次数查询其当次缴费对应的所有支付方式列表失败,系统异常,错误信息{}", e.getMessage());
-//            return resultMap;
-//        }
-//    }
 
 }

+ 12 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zy/ZyReceipt.java

@@ -248,6 +248,18 @@ public class ZyReceipt  implements Serializable {
 	 * 住院流水号:新系统使用
 	 */
 	private String zySerialNo;
+	/**
+	 * 发票状态   2 作废
+	 */
+	private Integer receiptStatus;
+	/**
+	 * 修改时间
+	 */
+	private Date updateTime;
+	/**
+	 * 修改人id
+	 */
+	private String updateId;
 
 	public ZyReceipt() {
 	}

+ 50 - 6
src/main/java/cn/hnthyy/thmz/mapper/his/zy/ZyReceiptMapper.java

@@ -28,7 +28,7 @@ public interface ZyReceiptMapper {
      * @param admissTimes
      * @return
      */
-    @Select("select top 1* from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} order by ledger_sn desc ")
+    @Select("select top 1* from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes}order by ledger_sn desc ")
     ZyReceipt selectLastZyReceipt(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
 
 
@@ -38,7 +38,7 @@ public interface ZyReceiptMapper {
      * @param admissTimes
      * @return
      */
-    @Select("select * from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn >0 ")
+    @Select("select * from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn >0  ")
     List<ZyReceipt> selectAllValidReceipt(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
 
 
@@ -52,6 +52,16 @@ public interface ZyReceiptMapper {
     List<ZyReceipt> selectAllValidAndNotPrintReceipt(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
 
 
+    /**
+     * 查询当前病人本次住院所有有效且已经打印发票信息
+     * @param inpatientNo
+     * @param admissTimes
+     * @return
+     */
+    @Select("select * from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn >0  and (receipt_no is not null and receipt_no <>'00000000')")
+    List<ZyReceipt> selectAllPrintReceipt(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
+
+
     /**
      * 根据住院号与住院次数以及账页号获取住院发票信息
      *
@@ -59,10 +69,19 @@ public interface ZyReceiptMapper {
      * @param admissTimes
      * @return
      */
-    @Select("select * from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn =#{ledgerSn} ")
+    @Select("select * from zy_receipt where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn =#{ledgerSn}  ")
     ZyReceipt selectZyReceiptByLedgerSn(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Long ledgerSn);
 
 
+    /**
+     * 根据发票号获取住院发票信息
+     *
+     * @param receiptNo
+     * @return
+     */
+    @Select("select * from zy_receipt where receipt_no =#{receiptNo} and  ledger_sn >0 ")
+    ZyReceipt selectZyReceiptByReceiptNo(@Param("receiptNo") String receiptNo);
+
     /**
      * 插入住院收费发票
      * @param zyReceipt
@@ -77,6 +96,22 @@ public interface ZyReceiptMapper {
             " #{charge20} , #{charge21} , #{charge22} , #{charge23} , #{charge24} , #{charge25} , #{charge26} ,#{charge27} ,#{charge28} , #{charge29} , #{charge30})")
     int insertZyReceipt(ZyReceipt zyReceipt);
 
+
+
+    /**
+     * 插入作废住院收费发票
+     * @param zyReceipt
+     * @return
+     */
+    @Insert("INSERT INTO zy_receipt_obsolete ( inpatient_no , admiss_times , ledger_sn , receipt_sn , receipt_no , account_date , date_1 , date_2 , ward , dept , print_date , " +
+            "responce_unit , op_id_code , total_charge , charge1 , charge2 , charge3 , charge4 , charge5 , charge6 , charge7 , charge8 , charge9 , charge10 , charge11 , " +
+            "charge12 , charge13 , charge14 , charge15 , charge16 , charge17 , charge18 , charge19 , charge20 , charge21 , charge22 , charge23 , charge24 , charge25 ," +
+            " charge26 , charge27 , charge28 , charge29 , charge30,receipt_status,update_time,update_id ) VALUES (#{inpatientNo},#{admissTimes},#{ledgerSn},#{receiptSn},#{receiptNo},#{accountDate},#{date1}," +
+            "#{date2},#{ward},#{dept},#{printDate},#{responceUnit},#{opIdCode},#{totalCharge},#{charge1}, #{charge2} ,#{charge3} ,#{charge4},#{charge5} , #{charge6}, #{charge7} ," +
+            " #{charge8}, #{charge9} , #{charge10} ,#{charge11} , #{charge12}, #{charge13} , #{charge14}, #{charge15} ,#{charge16} , #{charge17},#{charge18}, #{charge19}," +
+            " #{charge20} , #{charge21} , #{charge22} , #{charge23} , #{charge24} , #{charge25} , #{charge26} ,#{charge27} ,#{charge28} , #{charge29} , #{charge30},#{receiptStatus} , #{updateTime} , #{updateId})")
+    int insertZyReceiptObsolete(ZyReceipt zyReceipt);
+
     /**
      * 清空住院发票发票号与打印时间以及打印人信息
      * @param zyReceipt
@@ -102,14 +137,23 @@ public interface ZyReceiptMapper {
     @Update({"<script>",
             "update zy_receipt ",
             "<trim prefix='set' prefixOverrides=',' suffix=' where inpatient_no =#{inpatientNo} AND admiss_times =#{admissTimes} AND ledger_sn =#{ledgerSn}' >",
-            "<when test='ledgerSn!=null'>",
+            "<when test='receiptNo!=null'>",
             "receipt_no =#{receiptNo}",
             "</when>",
             "<when test='printDate!=null'>",
-            "print_date =#{printDate}",
+            ",print_date =#{printDate}",
             "</when>",
             "<when test='opIdCode!=null'>",
-            "op_id_code =#{opIdCode}",
+            ",op_id_code =#{opIdCode}",
+            "</when>",
+            "<when test='receiptStatus!=null'>",
+            ",receipt_status =#{receiptStatus}",
+            "</when>",
+            "<when test='updateTime!=null'>",
+            ",update_time =#{updateTime}",
+            "</when>",
+            "<when test='updateId!=null'>",
+            ",update_id =#{updateId}",
             "</when>",
             "</trim>",
             "</script>"})

+ 20 - 0
src/main/java/cn/hnthyy/thmz/service/his/zy/ZyReceiptService.java

@@ -3,6 +3,8 @@ package cn.hnthyy.thmz.service.his.zy;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.zy.ZyReceipt;
 import cn.hnthyy.thmz.entity.thmz.User;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -28,6 +30,13 @@ public interface ZyReceiptService {
     List<ZyReceipt> queryAllValidAndNotPrintReceipt(String inpatientNo, Integer admissTimes);
 
 
+    /**
+     * 查询当前病人本次住院所有有效且已经打印发票信息
+     * @param inpatientNo
+     * @param admissTimes
+     * @return
+     */
+    List<ZyReceipt> queryAllPrintReceipt(String inpatientNo,  Integer admissTimes);
     /**
      * 根据住院号与住院次数以及账页号获取住院发票信息
      *
@@ -48,4 +57,15 @@ public interface ZyReceiptService {
      * @throws MzException
      */
     ZyReceipt printReceipt(String inpatientNo, Integer admissTimes, Long ledgerSn,User user) throws MzException;
+
+
+    /**
+     * 作废当前发票并重新打印发票
+     * @param receiptNo 发票号
+     * @param obsolete 是否作废 1 作废 0 不作废
+     * @param user 操作用户
+     * @return
+     * @throws MzException
+     */
+    ZyReceipt obsoleteAndRepPrint(String receiptNo,String obsolete, User user) throws MzException;
 }

+ 52 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/ZyReceiptServiceImpl.java

@@ -1,10 +1,13 @@
 package cn.hnthyy.thmz.service.impl.his.zy;
 
+import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.zy.ZyReceipt;
 import cn.hnthyy.thmz.entity.thmz.Receipt;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.enums.PayMarkEnum;
+import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.his.zy.ZyReceiptMapper;
 import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
 import cn.hnthyy.thmz.service.his.zy.ZyReceiptService;
@@ -41,6 +44,11 @@ public class ZyReceiptServiceImpl implements ZyReceiptService {
         return zyReceiptMapper.selectAllValidAndNotPrintReceipt(inpatientNo,admissTimes);
     }
 
+    @Override
+    public List<ZyReceipt> queryAllPrintReceipt(String inpatientNo, Integer admissTimes) {
+        return zyReceiptMapper.selectAllPrintReceipt(inpatientNo,admissTimes);
+    }
+
     @Override
     public ZyReceipt queryZyReceiptByLedgerSn(String inpatientNo, Integer admissTimes, Long ledgerSn) {
         return zyReceiptMapper.selectZyReceiptByLedgerSn(inpatientNo,admissTimes,ledgerSn);
@@ -69,8 +77,51 @@ public class ZyReceiptServiceImpl implements ZyReceiptService {
             Integer temp = Integer.valueOf(receipt.getZyReceiptCurrent()) + 1;
             receipt.setZyReceiptCurrent(temp.toString());
         }
-        receipt.setUpdateDate(new Date());
+        receipt.setUpdateDate(now);
         receiptMapper.updateReceipt(receipt);
         return zyReceiptMapper.selectZyReceiptByLedgerSn(inpatientNo,admissTimes,ledgerSn);
     }
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
+    public ZyReceipt obsoleteAndRepPrint(String receiptNo,String obsolete, User user) throws MzException {
+        ZyReceipt zyReceipt = zyReceiptMapper.selectZyReceiptByReceiptNo(receiptNo);
+        if(zyReceipt==null){
+            throw new  MzException("发票号未查询到对应的住院发票信息");
+        }
+        if(YesNoEnum.NO.code.toString().equals(obsolete)){
+            return zyReceipt;
+        }
+        Receipt receipt = receiptMapper.selectByUserIdCode(user.getUserIdCode());
+        if (receipt == null || StringUtils.isBlank(receipt.getZyReceiptCurrent())) {
+            throw new MzException("用户id=" + user.getUserName() + "没有可用的住院发票,请先维护发票。");
+        }
+        Date now = new Date();
+        zyReceipt.setReceiptStatus(Integer.valueOf(PayMarkEnum.CANCELLATION.code));
+        zyReceipt.setUpdateId(user.getUserIdCode());
+        zyReceipt.setUpdateTime(now);
+        zyReceiptMapper.insertZyReceiptObsolete(zyReceipt);
+        ZyReceipt updateZyReceipt = new ZyReceipt(zyReceipt.getInpatientNo(),zyReceipt.getAdmissTimes(),zyReceipt.getLedgerSn());
+//        updateZyReceipt.setReceiptNo(ZyReceipt.DEFAULT_RECEIPT_NO);
+//        updateZyReceipt.setPrintDate(DateUtil.pase("1970-01-01", "yyyy-MM-dd"));
+//        updateZyReceipt.setOpIdCode("");
+//        zyReceiptMapper.updateZyReceiptCommon(updateZyReceipt);
+        updateZyReceipt.setReceiptNo(receipt.getZyReceiptCurrent());
+        updateZyReceipt.setPrintDate(now);
+        updateZyReceipt.setOpIdCode(user.getUserIdCode());
+        int num =zyReceiptMapper.updateZyReceiptCommon(updateZyReceipt);
+        if (num == 0) {
+            throw new MzException("发票作废重打失败,请联系管理员!");
+        }
+        if (receipt.getZyReceiptCurrent() == receipt.getZyReceiptEnd()) {
+            //此时发票号已经用完,当前发票号是最后一个
+            receipt.setZyReceiptCurrent(null);
+        } else {
+            Integer temp = Integer.valueOf(receipt.getZyReceiptCurrent()) + 1;
+            receipt.setZyReceiptCurrent(temp.toString());
+        }
+        receipt.setUpdateDate(now);
+        receiptMapper.updateReceipt(receipt);
+        return zyReceiptMapper.selectZyReceiptByLedgerSn(zyReceipt.getInpatientNo(),zyReceipt.getAdmissTimes(),zyReceipt.getLedgerSn());
+    }
 }

+ 8 - 0
src/main/resources/otherSource/thyy_mz_system.sql

@@ -325,3 +325,11 @@ CREATE TABLE `t_user_role_relation`  (
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户和角色关联表' ROW_FORMAT = Dynamic;
 
 SET FOREIGN_KEY_CHECKS = 1;
+
+
+
+
+
+
+
+

+ 96 - 0
src/main/resources/otherSource/thyy_zy_system.sql

@@ -0,0 +1,96 @@
+-- ----------------------------
+-- Table structure for zy_receipt
+-- ----------------------------
+IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[zy_receipt_obsolete]') AND type IN ('U'))
+	DROP TABLE [dbo].[zy_receipt_obsolete]
+GO
+
+CREATE TABLE [dbo].[zy_receipt_obsolete] (
+  [inpatient_no] char(12) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [admiss_times] smallint  NOT NULL,
+  [ledger_sn] int  NOT NULL,
+  [receipt_sn] int  NOT NULL,
+  [receipt_no] char(12) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [account_date] datetime  NULL,
+  [date_1] datetime  NOT NULL,
+  [date_2] datetime  NOT NULL,
+  [ward] char(7) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [dept] char(7) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [print_date] datetime  NOT NULL,
+  [responce_unit] char(2) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [op_id_code] char(5) COLLATE Chinese_PRC_BIN  NOT NULL,
+  [total_charge] decimal(12,2)  NOT NULL,
+  [charge1] decimal(12,2)  NOT NULL,
+  [charge2] decimal(12,2)  NOT NULL,
+  [charge3] decimal(12,2)  NOT NULL,
+  [charge4] decimal(12,2)  NOT NULL,
+  [charge5] decimal(12,2)  NOT NULL,
+  [charge6] decimal(12,2)  NOT NULL,
+  [charge7] decimal(12,2)  NOT NULL,
+  [charge8] decimal(12,2)  NOT NULL,
+  [charge9] decimal(12,2)  NOT NULL,
+  [charge10] decimal(12,2)  NOT NULL,
+  [charge11] decimal(12,2)  NOT NULL,
+  [charge12] decimal(12,2)  NOT NULL,
+  [charge13] decimal(12,2)  NOT NULL,
+  [charge14] decimal(12,2)  NOT NULL,
+  [charge15] decimal(12,2)  NOT NULL,
+  [charge16] decimal(12,2)  NOT NULL,
+  [charge17] decimal(12,2)  NOT NULL,
+  [charge18] decimal(12,2)  NOT NULL,
+  [charge19] decimal(12,2)  NOT NULL,
+  [charge20] decimal(12,2)  NOT NULL,
+  [charge21] decimal(12,2)  NOT NULL,
+  [charge22] decimal(12,2)  NOT NULL,
+  [charge23] decimal(12,2)  NOT NULL,
+  [charge24] decimal(12,2)  NOT NULL,
+  [charge25] decimal(12,2)  NOT NULL,
+  [charge26] decimal(12,2)  NOT NULL,
+  [charge27] decimal(12,2)  NOT NULL,
+  [charge28] decimal(12,2)  NOT NULL,
+  [charge29] decimal(12,2)  NOT NULL,
+  [charge30] decimal(12,2)  NOT NULL,
+  [doctor] char(5) COLLATE Chinese_PRC_BIN  NULL,
+  [zy_serial_no] varchar(14) COLLATE Chinese_PRC_BIN  NULL,
+  [receipt_status] tinyint DEFAULT ((0)) NOT NULL,
+  [update_time] datetime2(0)  NULL,
+  [update_id] varchar(255) COLLATE Chinese_PRC_BIN  NULL
+)
+GO
+
+ALTER TABLE [dbo].[zy_receipt_obsolete] SET (LOCK_ESCALATION = TABLE)
+GO
+
+EXEC sp_addextendedproperty
+'MS_Description', N'发票状态   2 作废',
+'SCHEMA', N'dbo',
+'TABLE', N'zy_receipt',
+'COLUMN', N'receipt_status'
+GO
+
+EXEC sp_addextendedproperty
+'MS_Description', N'修改时间',
+'SCHEMA', N'dbo',
+'TABLE', N'zy_receipt',
+'COLUMN', N'update_time'
+GO
+
+EXEC sp_addextendedproperty
+'MS_Description', N'修改人id',
+'SCHEMA', N'dbo',
+'TABLE', N'zy_receipt',
+'COLUMN', N'update_id'
+GO
+
+
+-- ----------------------------
+-- Indexes structure for table zy_receipt
+-- ----------------------------
+CREATE UNIQUE NONCLUSTERED INDEX [ix_zy_receipt_obsolete_1]
+ON [dbo].[zy_receipt_obsolete] (
+  [inpatient_no] ASC,
+  [admiss_times] ASC,
+  [ledger_sn] ASC,
+  [receipt_sn] ASC
+)
+GO

+ 4 - 4
src/main/resources/static/js/mz/toll_administration.js

@@ -1391,7 +1391,7 @@ function repPrint(patientId, times, receiptNo) {
             if (res.code == 0) {
                 if (res.data.length == 1) {
                     var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";
-                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill=" + res.data[0].receiptBill;
+                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + res.data[0].receiptBill;
                     confirmMessage(patientId, times, message, url);
                 } else {
                     $("#tip_message").text("请选择需要重新打印的发票号");
@@ -1401,7 +1401,7 @@ function repPrint(patientId, times, receiptNo) {
                         $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
                             $("#repPrintModal").modal("hide");
                             var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
-                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill=" + $(this).text();
+                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + $(this).text();
                             confirmMessage(patientId, times, message, url);
                         });
                     }
@@ -1447,7 +1447,7 @@ function obsoleteAndRepPrint(patientId, times, receiptNo) {
             if (res.code == 0) {
                 if (res.data.length == 1) {
                     var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";
-                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1" + "&receiptBill=" + res.data[0].receiptBill;
+                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + res.data[0].receiptBill;
                     confirmMessage(patientId, times, message, url);
                 } else {
                     $("#tip_message").text("请选择需要作废的发票号");
@@ -1457,7 +1457,7 @@ function obsoleteAndRepPrint(patientId, times, receiptNo) {
                         $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
                             $("#repPrintModal").modal("hide");
                             var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";
-                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1" + "&receiptBill=" + $(this).text();
+                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + $(this).text();
                             confirmMessage(patientId, times, message, url);
                         });
                     }

+ 44 - 42
src/main/resources/static/js/zy/actpatient.js

@@ -357,8 +357,8 @@ function initFeeTable() {
                                 var key = row.inpatientNo.trim() + "_" + row.admissTimes;
                                 str += '<button type="button" id="button_' + key + '" class="registration-no-color-foot-button" title="发票打印" onclick="prn1PrintHand(\'' + row.inpatientNo.trim() + '\',' + row.admissTimes + ',\'' + key + '\');" style="color: #35D082;"><i class="fa fa-print"></i></button>';
                             } else if (row.printFlag == 1) {
-                                str += '<button type="button" class="registration-no-color-foot-button" title="发票重打" onclick="repPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
-                                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>';
+                                str += '<button type="button" class="registration-no-color-foot-button" title="发票重打" onclick="repPrint(\'' + row.inpatientNo.trim() + '\',' + row.admissTimes + ');" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
+                                str += '<button type="button" class="registration-no-color-foot-button" title="发票作废重打" onclick="obsoleteAndRepPrint(\'' + row.inpatientNo.trim() + '\',' + row.admissTimes + ');" style="color: #E73E48;"><i class="fa fa-print"></i></button>';
                             }
                         }
                     }
@@ -1780,7 +1780,7 @@ function prn1PrintHand(inpatientNo, admissTimes, key) {
 
 
 /**
- * 获取当前住院的所有发票
+ * 获取当前住院的所有未打印发票
  * @param inpatientNo
  * @param admissTimes
  */
@@ -1805,7 +1805,7 @@ function getAllReceiptForThisTime(inpatientNo, admissTimes) {
                     $("#repPrintModal").modal();
                     $("#repPrintTable").html(null);
                     for (var i = 0; i < res.data.length; i++) {
-                        $("<tr><td>" + res.data[i].ledgerSn + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
+                        $("<tr><td style=\"font-size: 1px;padding-left: 30px;\">" + res.data[i].ledgerSn + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
                             $("#repPrintModal").modal("hide");
                             prn1Print(inpatientNo, admissTimes, $(this).text());
                         });
@@ -1827,7 +1827,7 @@ function getAllReceiptForThisTime(inpatientNo, admissTimes) {
  */
 function prn1Print(inpatientNo, admissTimes, ledgerSn) {
     var url = '/thmz/printReceiptForThisLedgerSn?inpatientNo=' + inpatientNo + "&admissTimes=" + admissTimes + "&ledgerSn=" + ledgerSn;
-    printCommon(url, inpatientNo, admissTimes, ledgerSn);
+    printCommon(url);
 }
 
 
@@ -1836,10 +1836,10 @@ function prn1Print(inpatientNo, admissTimes, ledgerSn) {
  * @param patientId
  * @param times
  */
-function repPrint(patientId, times, receiptNo) {
+function repPrint(inpatientNo, admissTimes) {
     $.ajax({
         type: "GET",
-        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
+        url: '/thmz/getAllPrintReceipt?inpatientNo=' + inpatientNo + "&admissTimes=" + admissTimes,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -1850,19 +1850,20 @@ function repPrint(patientId, times, receiptNo) {
             }
             if (res.code == 0) {
                 if (res.data.length == 1) {
-                    var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";
-                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill=" + res.data[0].receiptBill;
-                    confirmMessage(patientId, times, message, url);
+                    var message = "确定要重新打印发票号码为【" + res.data[0].receiptNo.trim() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
+                    var url = '/thmz/repPrintZyReceipt?obsolete=0&receiptNo=' + res.data[0].receiptNo.trim();
+                    confirmMessage(message, url);
                 } else {
+                    $("#tip_title").text("发票重打");
                     $("#tip_message").text("请选择需要重新打印的发票号");
                     $("#repPrintModal").modal();
                     $("#repPrintTable").html(null);
                     for (var i = 0; i < res.data.length; i++) {
-                        $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
+                        $("<tr><td style=\"font-size: 1px;padding-left: 30px;\">" + res.data[i].receiptNo.trim() + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
                             $("#repPrintModal").modal("hide");
                             var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
-                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill=" + $(this).text();
-                            confirmMessage(patientId, times, message, url);
+                            var url = '/thmz/repPrintZyReceipt?obsolete=0&receiptNo=' + $(this).text();
+                            confirmMessage(message, url);
                         });
                     }
                 }
@@ -1878,24 +1879,24 @@ function repPrint(patientId, times, receiptNo) {
  * @param times
  * @param name
  */
-function confirmMessage(patientId, times, message, url) {
+function confirmMessage(message, url) {
     if (!confirm(message)) {
         return;
     }
-    //var url='/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill="+receiptBill;
-    printCommon(url, patientId, times, true);
+    printCommon(url);
 }
 
 
 /**
  * 作废重打发票
- * @param patientId
- * @param times
+ * @param inpatientNo
+ * @param admissTimes
+ * @param ledgerSn
  */
-function obsoleteAndRepPrint(patientId, times, receiptNo) {
+function obsoleteAndRepPrint(inpatientNo, admissTimes) {
     $.ajax({
         type: "GET",
-        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
+        url: '/thmz/getAllPrintReceipt?inpatientNo=' + inpatientNo + "&admissTimes=" + admissTimes,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -1906,19 +1907,20 @@ function obsoleteAndRepPrint(patientId, times, receiptNo) {
             }
             if (res.code == 0) {
                 if (res.data.length == 1) {
-                    var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";
-                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1" + "&receiptBill=" + res.data[0].receiptBill;
-                    confirmMessage(patientId, times, message, url);
+                    var message = "确定要作废发票号码为【" + res.data[0].receiptNo.trim() + "】的发票吗?请确认需要作废发票编号";
+                    var url = '/thmz/repPrintZyReceipt?obsolete=1&receiptNo=' + res.data[0].receiptNo.trim();
+                    confirmMessage(message, url);
                 } else {
+                    $("#tip_title").text("发票重打");
                     $("#tip_message").text("请选择需要作废的发票号");
                     $("#repPrintModal").modal();
                     $("#repPrintTable").html(null);
                     for (var i = 0; i < res.data.length; i++) {
-                        $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
+                        $("<tr><td style=\"font-size: 1px;padding-left: 30px;\">" + res.data[i].receiptNo.trim() + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
                             $("#repPrintModal").modal("hide");
                             var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";
-                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1" + "&receiptBill=" + $(this).text();
-                            confirmMessage(patientId, times, message, url);
+                            var url = '/thmz/repPrintZyReceipt?obsolete=1&receiptNo=' + $(this).text();
+                            confirmMessage(message, url);
                         });
                     }
                 }
@@ -1934,7 +1936,7 @@ function obsoleteAndRepPrint(patientId, times, receiptNo) {
  * @param patientId
  * @param times
  */
-function printCommon(url, inpatientNo, admissTimes, ledgerSn) {
+function printCommon(url) {
     setPrint();
     var height = "102mm";
     // if (countReceiot % 2 == 0) {
@@ -2014,30 +2016,30 @@ function printCommon(url, inpatientNo, admissTimes, ledgerSn) {
                 LODOP.ADD_PRINT_TEXT("74.5mm", "95mm", "17mm", "3mm", (zyReceipt.charge24 == null || zyReceipt.charge24 == "0.00" || zyReceipt.charge24 == 0) ? "" : zyReceipt.charge24.toFixed(2));
 
                 LODOP.ADD_PRINT_TEXT("35mm", "128mm", "17mm", "3mm", (zyReceipt.charge25 == null || zyReceipt.charge25 == "0.00" || zyReceipt.charge25 == 0) ? "" : zyReceipt.charge25.toFixed(2));
-                var itemHeight=40.5;
+                var itemHeight = 40.5;
                 if (zyReceipt.charge5 != null && zyReceipt.charge5 != "0.00" && zyReceipt.charge5 != 0) {
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "110mm", "17mm", "3mm", "手术器械");
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "128mm", "17mm", "3mm", (zyReceipt.charge5 == null || zyReceipt.charge5 == "0.00" || zyReceipt.charge5 == 0) ? "" : zyReceipt.charge5.toFixed(2));
-                    itemHeight+=5.5;
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "110mm", "17mm", "3mm", "手术器械");
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "128mm", "17mm", "3mm", (zyReceipt.charge5 == null || zyReceipt.charge5 == "0.00" || zyReceipt.charge5 == 0) ? "" : zyReceipt.charge5.toFixed(2));
+                    itemHeight += 5.5;
                 }
                 if (zyReceipt.charge10 != null && zyReceipt.charge10 != "0.00" && zyReceipt.charge10 != 0) {
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "110mm", "17mm", "3mm", "麻醉费");
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "128mm", "17mm", "3mm", (zyReceipt.charge10 == null || zyReceipt.charge10 == "0.00" || zyReceipt.charge10 == 0) ? "" : zyReceipt.charge10.toFixed(2));
-                    itemHeight+=5.5;
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "110mm", "17mm", "3mm", "麻醉费");
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "128mm", "17mm", "3mm", (zyReceipt.charge10 == null || zyReceipt.charge10 == "0.00" || zyReceipt.charge10 == 0) ? "" : zyReceipt.charge10.toFixed(2));
+                    itemHeight += 5.5;
                 }
                 if (zyReceipt.charge26 != null && zyReceipt.charge26 != "0.00" && zyReceipt.charge26 != 0) {
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "110mm", "17mm", "3mm", "其他");
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "128mm", "17mm", "3mm", (zyReceipt.charge26 == null || zyReceipt.charge26 == "0.00" || zyReceipt.charge26 == 0) ? "" : zyReceipt.charge26.toFixed(2));
-                    itemHeight+=5.5;
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "110mm", "17mm", "3mm", "其他");
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "128mm", "17mm", "3mm", (zyReceipt.charge26 == null || zyReceipt.charge26 == "0.00" || zyReceipt.charge26 == 0) ? "" : zyReceipt.charge26.toFixed(2));
+                    itemHeight += 5.5;
                 }
                 if (zyReceipt.charge27 != null && zyReceipt.charge27 != "0.00" && zyReceipt.charge27 != 0) {
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "110mm", "17mm", "3mm", "材料费");
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "128mm", "17mm", "3mm", (zyReceipt.charge27 == null || zyReceipt.charge27 == "0.00" || zyReceipt.charge27 == 0) ? "" : zyReceipt.charge27.toFixed(2));
-                    itemHeight+=5.5;
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "110mm", "17mm", "3mm", "材料费");
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "128mm", "17mm", "3mm", (zyReceipt.charge27 == null || zyReceipt.charge27 == "0.00" || zyReceipt.charge27 == 0) ? "" : zyReceipt.charge27.toFixed(2));
+                    itemHeight += 5.5;
                 }
                 if (zyReceipt.charge28 != null && zyReceipt.charge28 != "0.00" && zyReceipt.charge28 != 0) {
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "110mm", "17mm", "3mm", "中成药费");
-                    LODOP.ADD_PRINT_TEXT(itemHeight+"mm", "128mm", "17mm", "3mm", (zyReceipt.charge28 == null || zyReceipt.charge28 == "0.00" || zyReceipt.charge28 == 0) ? "" : zyReceipt.charge28.toFixed(2));
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "110mm", "17mm", "3mm", "中成药费");
+                    LODOP.ADD_PRINT_TEXT(itemHeight + "mm", "128mm", "17mm", "3mm", (zyReceipt.charge28 == null || zyReceipt.charge28 == "0.00" || zyReceipt.charge28 == 0) ? "" : zyReceipt.charge28.toFixed(2));
                     //itemHeight+=5.5;
                 }
 

+ 1 - 1
src/main/resources/templates/zy/actpatient.html

@@ -380,7 +380,7 @@
                     <table class="table table-striped table-bordered">
                         <thead>
                         <tr>
-                            <th>发票号<span style="font-size: 1px;margin-left: 20px;" id="tip_message">请选择需要打印发票的账页</span></th>
+                            <th><span style="font-size: 1px;margin-left: 20px;" id="tip_message">请选择需要打印发票的账页</span></th>
                         </tr>
                         </thead>
                         <tbody id="repPrintTable">