Browse Source

Merge branch 'dev-1.0.4' into dev-1.0.5

hurugang 5 năm trước cách đây
mục cha
commit
44fbc236d5

+ 8 - 3
src/main/java/cn/hnthyy/thmz/controller/MzChargeDetailController.java

@@ -308,7 +308,7 @@ public class MzChargeDetailController {
             }
             DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
             User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
-            List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryTallyReceiptSerialByIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
+            List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryTallyReceiptSerialByIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),mzDepositFileVo.getReceiptNo());
             if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
                 //本院记账退费重收操作
 //                for (MzDepositFile m : mzDepositFileVo.getMzDepositFiles()) {
@@ -321,8 +321,8 @@ public class MzChargeDetailController {
                 int receiptNo = mzChargeDetailService.chargeFeeForByjz(tokenUser.getUserIdCode(), mzDepositFileVo);
                 resultMap.put("receiptNo", receiptNo);
             } else {
-                mzChargeDetailService.chargeFee(tokenUser.getUserIdCode(), mzDepositFileVo);
-                resultMap.put("receiptNo", 1);
+                int receiptNo =mzChargeDetailService.chargeFee(tokenUser.getUserIdCode(), mzDepositFileVo);
+                resultMap.put("receiptNo", receiptNo);
             }
             resultMap.put("code", 0);
             resultMap.put("message", "缴费成功");
@@ -665,6 +665,11 @@ public class MzChargeDetailController {
                 resultMap.put("message", "病人就诊次数参数不能为空");
                 return resultMap;
             }
+            if (mzDepositFileVo.getReceiptNo() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人缴费次数参数不能为空");
+                return resultMap;
+            }
             if (StringUtils.isBlank(mzDepositFileVo.getChargeItemCodes())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "没有选择需要退费的收费明细,无法退费");

+ 19 - 8
src/main/java/cn/hnthyy/thmz/controller/MzReceiptSerialController.java

@@ -119,7 +119,7 @@ public class MzReceiptSerialController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getAllSerialForThisTime", method = {RequestMethod.GET})
-    public Map<String, Object> getAllSerialForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times, HttpServletRequest httpServletRequest) {
+    public Map<String, Object> getAllSerialForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times, @RequestParam("receiptNo") Integer receiptNo, HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if (StringUtils.isBlank(patientId)) {
@@ -129,7 +129,12 @@ public class MzReceiptSerialController {
             }
             if (times == null) {
                 resultMap.put("code", -1);
-                resultMap.put("message", "病人编号参数不能为空");
+                resultMap.put("message", "病人就诊不能为空");
+                return resultMap;
+            }
+            if (receiptNo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人缴费次数不能为空");
                 return resultMap;
             }
             String token = TokenUtil.getToken(httpServletRequest);
@@ -138,7 +143,9 @@ public class MzReceiptSerialController {
                 resultMap.put("message", "缴费失败,用户Token不存在");
                 return resultMap;
             }
-            List<MzDepositFile> mzDepositFiles = mzDepositFileService.queryMzDepositFile(new MzDepositFile(patientId, times));
+            MzDepositFile mz= new MzDepositFile(patientId, times);
+            mz.setReceiptNo(receiptNo);
+            List<MzDepositFile> mzDepositFiles = mzDepositFileService.queryMzDepositFile(mz);
             //非本院记账金额
             BigDecimal totalPay = BigDecimal.ZERO;
             if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
@@ -153,13 +160,13 @@ public class MzReceiptSerialController {
                 resultMap.put("message", "当前病人没有实际缴费,暂时不打印发票");
                 log.info("当前病人没有实际缴费,暂时不打印发票,patientId={},time={}", patientId, times);
                 return resultMap;
-            }
+        }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
             resultMap.put("code", 0);
             resultMap.put("message", "根据病人编号和就诊次数查询其当次缴费对应的所有发票成功");
             //将打印标志改为已经打印
             //mzChargeDetailService.modifyPrintFlag(patientId,timesList);
-            MzReceiptSerial mzReceiptSerial = mzReceiptSerialService.queryAllSerialForThisTime(patientId, times);
+            MzReceiptSerial mzReceiptSerial = mzReceiptSerialService.queryAllSerialForThisTime(patientId, times,receiptNo);
             if (mzReceiptSerial != null && StringUtils.isBlank(mzReceiptSerial.getChequeType())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "当前病人发票表中的收费类型为空,无法打印发票,请及时联系管理员");
@@ -347,7 +354,7 @@ public class MzReceiptSerialController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getReceiptForThisTime", method = {RequestMethod.GET})
-    public Map<String, Object> getReceiptForThisTime(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times) {
+    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)) {
@@ -357,14 +364,18 @@ public class MzReceiptSerialController {
             }
             if (times == null) {
                 resultMap.put("code", -1);
-                resultMap.put("message", "病人编号参数不能为空");
+                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())) {
+                    if (StringUtils.isNotBlank(mzReceiptSerial.getReceiptBill()) && receiptNo.equals(mzReceiptSerial.getReceiptNo())) {
                         receiptBills.add(mzReceiptSerial.getReceiptBill());
                     }
                 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/MzChargeDetail.java

@@ -198,6 +198,8 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private String unitPriceStr;
     //原价格的字符串
     private String origPriceStr;
+    //新的收费次数
+    private Integer newReceiptNo;
 
     public MzChargeDetail(String patientId, Integer times) {
         this.patientId = patientId;

+ 13 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailMapper.java

@@ -381,6 +381,16 @@ public interface MzChargeDetailMapper {
             "</script>"})
     List<Map<String, Object>> selectUnPaidChargeDetail(@Param(value = "patientId") String patientId);
 
+    /**
+     * 将临时数据的receiptNo设置成最新的数据
+     * @param patientId
+     * @param times
+     * @param receiptNo
+     * @return
+     */
+    @Update("update mz_charge_detail set receipt_no =#{receiptNo,jdbcType=INTEGER} where patient_id = #{patientId} and times=#{times} and receipt_no=0 ")
+    int setTempDataReceiptNo(@Param(value = "patientId") String patientId,@Param(value = "times") Integer times,@Param(value = "receiptNo") Integer receiptNo);
+
     /**
      * 修改当前病人当前就诊次数下的所有记录的付款状态和打印标记以及确认标记
      *
@@ -389,15 +399,15 @@ public interface MzChargeDetailMapper {
      */
     @Update({"<script>",
             "update mz_charge_detail ",
-            "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times}' >",
+            "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times} and receipt_no=#{receiptNo}' >",
             "<when test='payMark!=null'>",
             ",pay_mark =#{payMark,jdbcType=CHAR}",
             "</when>",
             "<when test='printFlag!=null'>",
             ",print_flag =#{printFlag,jdbcType=CHAR}",
             "</when>",
-            "<when test='receiptNo!=null'>",
-            ",receipt_no =#{receiptNo,jdbcType=INTEGER}",
+            "<when test='newReceiptNo!=null'>",
+            ",receipt_no =#{newReceiptNo,jdbcType=INTEGER}",
             "</when>",
             "<when test='confirmFlag!=null'>",
             ",confirm_flag =#{confirmFlag,jdbcType=CHAR}",

+ 18 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzDepositFileMapper.java

@@ -77,6 +77,24 @@ public interface MzDepositFileMapper {
             "</script>"})
     List<MzDepositFile> selectMzDepositFileByTimes(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
 
+
+    /**
+     * 根据病人id和次数查询缴费记录 再历史数据中查询
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,receipt_no,rtrim(pay_mark) pay_mark,rtrim(cheque_type) cheque_type,rtrim(cheque_no) cheque_no,amount,charge_date,dcount_date,",
+            "rtrim(dcount_no) dcount_no,rtrim(op_id) op_id,receipt_sn,serial_no,rtrim(responce_type) responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum",
+            "from mz_deposit_file_b where patient_id =#{patientId,jdbcType=CHAR} and pay_mark=0 and times =  #{times}",
+            "<when test='receiptNo!=null'>",
+            " and receipt_no=#{receiptNo}",
+            "</when>",
+            "</script>"})
+    List<MzDepositFile> selectMzDepositFileByTimesInHisData(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
+
     /**
      * 根据发票流水号查询收费方式表
      *

+ 6 - 6
src/main/java/cn/hnthyy/thmz/mapper/his/MzReceiptSerialMapper.java

@@ -34,10 +34,10 @@ public interface MzReceiptSerialMapper {
     @Select(" select rtrim(patient_id) patient_id,times,receipt_no,serial_no,rtrim(operator_id) operator_id,charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9," +
             "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill," +
             "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type," +
-            "cheque_no,rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no from mz_receipt_serial where patient_id =#{patientId,jdbcType=CHAR} and times = #{times} and cheque_type ='Y' and operator_id <> '99999' " +
-            "and receipt_sn not in ( select 0 - receipt_sn from mz_receipt_serial where cheque_type ='Y' and patient_id =#{patientId,jdbcType=CHAR} and times = #{times} and tf_flag =1 and operator_id <> '99999' ) " +
-            "and receipt_sn not in ( select receipt_sn from mz_receipt_serial where cheque_type ='Y' and patient_id =#{patientId,jdbcType=CHAR} and times = #{times} and tf_flag =1 and operator_id <> '99999' ) ")
-    List<MzReceiptSerial> selectTallyReceiptSerialByIdAndTimes(@Param("patientId") String patientId, @Param("times") Integer times);
+            "cheque_no,rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no from mz_receipt_serial where patient_id =#{patientId,jdbcType=CHAR} and times = #{times} and receipt_no = #{receiptNo} and cheque_type ='Y' and operator_id <> '99999' " +
+            "and receipt_sn not in ( select 0 - receipt_sn from mz_receipt_serial where cheque_type ='Y' and patient_id =#{patientId,jdbcType=CHAR} and times = #{times} and receipt_no = #{receiptNo} and tf_flag =1 and operator_id <> '99999' ) " +
+            "and receipt_sn not in ( select receipt_sn from mz_receipt_serial where cheque_type ='Y' and patient_id =#{patientId,jdbcType=CHAR} and times = #{times}  and receipt_no = #{receiptNo} and tf_flag =1 and operator_id <> '99999' ) ")
+    List<MzReceiptSerial> selectTallyReceiptSerialByIdAndTimes(@Param("patientId") String patientId, @Param("times") Integer times,@Param("receiptNo") Integer receiptNo);
 
 
     /**
@@ -129,9 +129,9 @@ public interface MzReceiptSerialMapper {
             "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
             "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
                     "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no",
-            "from mz_receipt_serial where patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and (cheque_type  <![CDATA[<>]]> 'Y' or cheque_type is null or operator_id =99999) order by receipt_no desc",
+            "from mz_receipt_serial where patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and receipt_no = #{receiptNo,jdbcType=INTEGER} and (cheque_type  <![CDATA[<>]]> 'Y' or cheque_type is null or operator_id =99999) order by receipt_no desc",
             "</script>"})
-    MzReceiptSerial selectAllSerialForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times);
+    MzReceiptSerial selectAllSerialForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times,@Param("receiptNo") Integer receiptNo);
 
 
     /**

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/his/MzReceiptSerialService.java

@@ -49,7 +49,7 @@ public interface MzReceiptSerialService {
      * @param times
      * @return
      */
-    MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times);
+    MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times,Integer receiptNo);
 
 
     /**
@@ -67,7 +67,7 @@ public interface MzReceiptSerialService {
      * @param patientId
      * @return
      */
-    List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times);
+    List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times,Integer receiptNo);
 
     /**打印发票
      * @param mzReceiptSerial

+ 8 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -331,6 +331,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         getMzChargeDetailService().saveMzChargeDetail(mzChargeDetails);
         mzChargeDetail.setPrintFlag(YesNoEnum.NO.code.toString());
         mzChargeDetail.setReceiptNo(receiptNo);
+        mzChargeDetailMapper.setTempDataReceiptNo(mzChargeDetail.getPatientId(),mzChargeDetail.getTimes(),receiptNo);
         mzChargeDetailMapper.updatePayMakAndPrintFlag(mzChargeDetail);
         //入库收费明细数据结束
 
@@ -355,7 +356,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         if (Constants.JZ_IC_CARD.equals(mzPatientMi.getIcCardNo())) {
             mzChargeDetailMapper.updateNameByPatientIdAndTimes(mzPatientMi.getName(), mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         }
-        return 1;
+        return receiptNo;
     }
 
     /**
@@ -440,7 +441,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         mzChargeDetail.setSerialNo(serialNo);
         mzChargeDetail.setRealNo(serialNo);
-        mzChargeDetail.setReceiptNo(newMzDepositFileList.get(0).getReceiptNo());
+        mzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
+        mzChargeDetail.setNewReceiptNo(newMzDepositFileList.get(0).getReceiptNo());
         //如果有发药队列,修改发药统计的流水号
         MzYpFydl mzYpFydl = new MzYpFydl();
         mzYpFydl.setSerialNo(serialNo);
@@ -686,6 +688,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         getMzChargeDetailService().saveMzChargeDetail(mzChargeDetails);
         getMzChargeDetailService().saveMzChargeDetail(refundOriMzChargeDetails);
         MzChargeDetail updateMzChargeDetail = new MzChargeDetail(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
+        updateMzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
         updateMzChargeDetail.setConfirmFlag(ConfirmFlagEnum.CANCEL.code);
         mzChargeDetailMapper.updatePayMakAndPrintFlag(updateMzChargeDetail);
         List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectSerialForThisTime(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
@@ -1440,6 +1443,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     private List<MzDepositFile> getMzDepositFiles(MzDepositFileVo mzDepositFileVo, Date now, int serialNo, String opId) {
         List<MzDepositFile> newList = new ArrayList<>();
         List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
+        if(mzDepositFiles==null || mzDepositFiles.size()==0){
+            mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimesInHisData(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
+        }
         if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
             mzDepositFiles.stream().forEach(j -> {
                 if (Constants.BYJZ.equals(j.getChequeType())) {

+ 21 - 6
src/main/java/cn/hnthyy/thmz/service/impl/his/MzReceiptSerialServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.MzDepositFile;
 import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.his.MzVisitTable;
 import cn.hnthyy.thmz.entity.thmz.Receipt;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
@@ -11,6 +12,7 @@ import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.his.MzChargeDetailMapper;
 import cn.hnthyy.thmz.mapper.his.MzDepositFileMapper;
 import cn.hnthyy.thmz.mapper.his.MzReceiptSerialMapper;
+import cn.hnthyy.thmz.mapper.his.MzVisitTableMapper;
 import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
 import cn.hnthyy.thmz.service.his.MzReceiptSerialService;
 import cn.hnthyy.thmz.service.his.MzSerialNoService;
@@ -39,6 +41,9 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
     @SuppressWarnings("all")
     @Autowired
     private MzDepositFileMapper mzDepositFileMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private MzVisitTableMapper mzVisitTableMapper;
     @Autowired
     private MzSerialNoService mzSerialNoService;
 
@@ -83,8 +88,8 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
     }
 
     @Override
-    public MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times) {
-        return mzReceiptSerialMapper.selectAllSerialForThisTime(patientId, times);
+    public MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times,Integer receiptNo) {
+        return mzReceiptSerialMapper.selectAllSerialForThisTime(patientId, times,receiptNo);
     }
 
     @Override
@@ -93,8 +98,8 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
     }
 
     @Override
-    public List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times) {
-        return mzReceiptSerialMapper.selectTallyReceiptSerialByIdAndTimes(patientId, times);
+    public List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times,Integer receiptNo) {
+        return mzReceiptSerialMapper.selectTallyReceiptSerialByIdAndTimes(patientId, times,receiptNo);
     }
 
     @Override
@@ -163,6 +168,11 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         if (receipt == null || StringUtils.isBlank(receipt.getReceiptCurrent())) {
             throw new MzException("用户id=" + user.getUserName() + "没有可用的发票,请先维护发票。");
         }
+        MzVisitTable mzVisitTable=mzVisitTableMapper.selectByPatientIdAndTimes(mzReceiptSerial.getPatientId(), mzReceiptSerial.getTimes());
+        if (mzVisitTable == null) {
+            throw new MzException("当前病人就诊基础资料【MzVisitTable】不存在,请检查");
+        }
+        Integer receiptNo = mzVisitTable.getReceiptNo() + 1;
         Integer oriSerialNo = mzReceiptSerial.getSerialNo();
         int serialNo = mzSerialNoService.getSerialNo();
         //将原发票作废
@@ -172,7 +182,7 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         updateMzReceiptSerial.setChequeType(mzReceiptSerial.getChequeType());
         mzReceiptSerialMapper.updateMzReceiptSerialByReceiptNo(updateMzReceiptSerial);
         //创建新发票
-        mzReceiptSerial.setReceiptNo(mzReceiptSerial.getReceiptNo() + 1);
+        mzReceiptSerial.setReceiptNo(receiptNo);
         mzReceiptSerial.setSerialNo(serialNo);
         mzReceiptSerial.setReceiptSn(serialNo);
         mzReceiptSerial.setReceiptBill(receipt.getReceiptCurrent());
@@ -183,7 +193,7 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         mzReceiptSerialMapper.insertMzReceiptSerial(mzReceiptSerial);
         //更新收费明细表发票流水号
         Date now = new Date();
-        mzChargeDetailMapper.updateBySerialNo(mzReceiptSerial.getReceiptNo(), mzReceiptSerial.getSerialNo(), oriSerialNo);
+        mzChargeDetailMapper.updateBySerialNo(receiptNo, mzReceiptSerial.getSerialNo(), oriSerialNo);
         List<MzDepositFile> mzDepositFiles=mzDepositFileMapper.selectMzDepositFileBySerialNo(oriSerialNo);
         //原收费方式记录设置为作废
         mzDepositFileMapper.updatePayMark(PayMarkEnum.CANCELLATION.code,oriSerialNo);
@@ -206,6 +216,11 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         }
         receipt.setUpdateDate(now);
         receiptMapper.updateReceipt(receipt);
+        MzVisitTable updateMzVisitTable = new MzVisitTable();
+        updateMzVisitTable.setPatientId(mzReceiptSerial.getPatientId());
+        updateMzVisitTable.setTimes(mzReceiptSerial.getTimes());
+        updateMzVisitTable.setReceiptNo(receiptNo);
+        mzVisitTableMapper.updateMzVisitTable(updateMzVisitTable);
         return mzReceiptSerial.getReceiptBill();
     }
 

+ 9 - 9
src/main/resources/static/js/toll_administration.js

@@ -372,9 +372,9 @@ function initFeeTable() {
                     if (payMarkGroup == 1) {
                         str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.printFlag + ');"><i class="fa fa-reply"></i></button>';
                         if (row.printFlag == 0) {
-                            str += '<button type="button" class="registration-no-color-foot-button" title="发票打印" onclick="prn1Print(\'' + row.patientId + '\',' + row.times + ',true);" style="color: #35D082;"><i class="fa fa-print"></i></button>';
+                            str += '<button type="button" class="registration-no-color-foot-button" title="发票打印" onclick="prn1Print(\'' + row.patientId + '\',' + row.times + ',true,' + row.receiptNo + ');" 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 + ');" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
+                            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>';
                         }
                     }
@@ -1219,7 +1219,7 @@ function saveConfirmFee() {
                 return;
             }
             if (res.code == 0) {
-                prn1Print(patientId, times, true);
+                prn1Print(patientId, times, true,res.receiptNo);
                 new PNotify({
                     title: '操作提示',
                     text: res.message,
@@ -1228,10 +1228,10 @@ function saveConfirmFee() {
                     styling: 'bootstrap3'
                 });
                 $("#confirmFeeModal").modal("hide");
-                initFeeTable();
                 $("#patientId").val(null);
                 $("#cardNo").val(null);
                 $("#name").val(null);
+                initFeeTable();
                 //默认光标在卡号输入框
                 $("#cardNo").focus();
             } else {
@@ -1254,8 +1254,8 @@ function saveConfirmFee() {
  * @param times
  * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源
  */
-function prn1Print(patientId, times, chargeFeeFlag) {
-    var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times;
+function prn1Print(patientId, times, chargeFeeFlag,receiptNo) {
+    var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times+"&receiptNo="+receiptNo;
     printCommon(url, patientId, times, chargeFeeFlag);
 }
 
@@ -1264,10 +1264,10 @@ function prn1Print(patientId, times, chargeFeeFlag) {
  * @param patientId
  * @param times
  */
-function repPrint(patientId, times) {
+function repPrint(patientId, times,receiptNo) {
     $.ajax({
         type: "GET",
-        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times,
+        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times+"&receiptNo="+receiptNo,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -2026,7 +2026,7 @@ function saveRefundFee() {
                 });
                 $("#refundFeeModal").modal("hide");
                 if (res.times > 0) {
-                    prn1Print(res.patientId, res.times, false);
+                    prn1Print(res.patientId, res.times, false,$("#receiptNoRefund").val());
                 } else {
                     initFeeTable();
                 }