Browse Source

Merge branch 'dev-1.0.4' into dev-1.0.5

# Conflicts:
#	src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java
hurugang 5 years ago
parent
commit
f33a5ec353

+ 15 - 0
src/main/java/cn/hnthyy/thmz/Utils/DateUtil.java

@@ -110,4 +110,19 @@ public class DateUtil {
             return null;
         }
     }
+
+    /**
+     * 根据给定日期获取给定日期当月的第一天的0点0分0秒
+     * @return
+     */
+    public static Date getFirstSecondForMonth(Date date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.DAY_OF_MONTH,1);
+        calendar.set(Calendar.HOUR_OF_DAY,0);
+        calendar.set(Calendar.MINUTE,0);
+        calendar.set(Calendar.SECOND,0);
+        return calendar.getTime();
+    }
+
 }

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

@@ -170,5 +170,7 @@ public class YpZdDict {
     private String wjwYpid;
     private String yjjYpid;
     private String rsbYpid;
+    //门诊限购量 每月
+    private Integer mzRestrict;
 
 }

+ 17 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailMapper.java

@@ -547,7 +547,7 @@ public interface MzChargeDetailMapper {
     @Select({"<script>",
             "SELECT distinct rtrim(a.patient_id) patient_id,name,a.times,a.receipt_no,charge_date=convert(char(10),a.charge_date,111) ,a.serial_no,real_no ,a.responce_type," +
                     " cheque_type=case when mz_receipt_serial.cheque_type='Y' and cash_id <![CDATA[<>]]> '99999' " +
-                    " and len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) <![CDATA[>=]]> 10 then '本院记账' else '自费' end " +
+                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end " +
                     "    FROM mz_charge_detail a,mz_receipt_serial " +
                     "    WHERE a.charge_date <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and a.charge_date <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}  " +
                     "<when test='patientId!=null'>",
@@ -559,10 +559,20 @@ public interface MzChargeDetailMapper {
             "<when test='serialNo!=null'>",
             " and mz_receipt_serial.serial_no like #{serialNo}",
             "</when>",
-            " and  real_no=receipt_sn" +
+            " and  real_no=receipt_sn order by a.times desc" +
                     "</script>"})
     List<Map<String, Object>> selectChargeListByPatient(@Param("patientId") String patientId, @Param("name") String name, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
+    /**
+     * 查询某个病人当月购买某一药品的总数量
+     * @param patientId
+     * @param chargeItemCode
+     * @param serial
+     * @param beginDate
+     * @return
+     */
+    @Select("select sum(quantity*drug_win) from mz_charge_detail where patient_id =#{patientId} and charge_date>=#{beginDate,jdbcType=TIMESTAMP} and pay_mark=0 and charge_item_code=#{chargeItemCode,jdbcType=CHAR} and  serial=#{serial} ")
+    Integer selectTotalQuantityForMonth(@Param("patientId") String patientId,@Param("chargeItemCode") String chargeItemCode,@Param("serial") String serial,@Param("beginDate") Date beginDate);
 
     /**
      * 根据病人编码和收费流水号查询缴费明细
@@ -647,7 +657,7 @@ public interface MzChargeDetailMapper {
     @Select({"<script>",
             "SELECT distinct rtrim(a.patient_id) patient_id,name,a.times,a.receipt_no,charge_date=convert(char(10),a.charge_date,111) ,a.serial_no,real_no ,a.responce_type," +
                     " cheque_type=case when mz_receipt_serial_b.cheque_type='Y' " +
-                    " and len(ltrim(rtrim(mz_receipt_serial_b.receipt_bill))) <![CDATA[>=]]> 10 then '本院记账' else '自费' end " +
+                    " and (len(ltrim(rtrim(mz_receipt_serial.receipt_bill))) >= 10 or len(ltrim(rtrim(mz_receipt_serial.receipt_bill)))=0) then '本院记账' else '自费' end " +
                     "    FROM mz_charge_detail_b a,mz_receipt_serial_b " +
                     "  WHERE a.charge_date <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and a.charge_date <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}   " +
                     "<when test='patientId!=null'>",
@@ -659,7 +669,7 @@ public interface MzChargeDetailMapper {
             "<when test='serialNo!=null'>",
             " and mz_receipt_serial_b.serial_no =#{serialNo}",
             "</when>",
-            " and  real_no=receipt_sn" +
+            " and  real_no=receipt_sn order by a.times desc" +
                     "</script>"})
     List<Map<String, Object>> selectHisChargeListByPatient(@Param("patientId") String patientId, @Param("name") String name, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
@@ -812,4 +822,7 @@ public interface MzChargeDetailMapper {
     List<Map<String, Object>> selectDepetBusinessReport(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
 
+
+
+
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/YpZdDictMapper.java

@@ -13,7 +13,7 @@ public interface YpZdDictMapper {
      * @param code
      * @return
      */
-    @Select("select code,name,specification from yp_zd_dict where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
+    @Select("select code,name,specification,mz_restrict from yp_zd_dict where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
     YpZdDict selectYpZdDictByCode(@Param("code") String code,@Param("serial") String serial);
 
     /**

+ 100 - 44
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.impl.his;
 
 import cn.hnthyy.thmz.Utils.CloneUtil;
+import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.common.SpringUtil;
 import cn.hnthyy.thmz.entity.MzException;
@@ -337,7 +338,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.setTempDataReceiptNo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), receiptNo);
         mzChargeDetailMapper.updatePayMakAndPrintFlag(mzChargeDetail);
         //入库收费明细数据结束
 
@@ -585,9 +586,6 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 m.setCashId(opId);
                 m.setChargeDate(now);
                 m.setPayMark(PayMarkEnum.CHARGED.code);
-                if (Constants.BYJZ.equals(chequeType)) {
-                    m.setRealNo(Integer.valueOf("1" + serialNo));
-                }
                 setChargeDetail(mzDrugWinMap, yffyNoMap, orderNoMap, m);
                 mzChargeDetailMapper.updateMzChargeDetail(m);
                 itemNoMap.put(m.getChargeItemCode().trim(), m.getItemNo());
@@ -753,12 +751,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //updateMzReceiptSerial.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
         updateMzReceiptSerial.setTfFlag(YesNoEnum.YES.code);
         mzReceiptSerialMapper.updateMzReceiptSerial(updateMzReceiptSerial);
-        List<MzDepositFile> newMzDepositFiles = new ArrayList<>();
+        //包含退费的付款方式
+        List<MzDepositFile> fullNewMzDepositFiles = new ArrayList<>();
         int times = 0;
         if (allRefund) {
-            getDeposFiles(opId, mzDepositFileVo, now, 0, 0, null, null, newMzDepositFiles, allRefund);
+            getDeposFiles(opId, mzDepositFileVo, now, 0, 0, null, null, fullNewMzDepositFiles, allRefund,null);
             //新增收费方式记录
-            mzDepositFileMapper.batchInsertMzDepositFile(newMzDepositFiles);
+            mzDepositFileMapper.batchInsertMzDepositFile(fullNewMzDepositFiles);
             times = 0;
         } else {
             times = mzChargeDetails.get(0).getTimes();
@@ -801,11 +800,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             //实际应付金额
             BigDecimal totalPayable = getTotalPayable(mzChargeDetails, feeMap);
             MzReceiptSerial mzReceiptSerial = new MzReceiptSerial();
+            //退费后新的收款方式
+            List<MzDepositFile> newMzDepositFiles = new ArrayList<>();
             String payWay = Constants.CASH;
-            payWay = getDeposFiles(opId, mzDepositFileVo, now, times, serialNo, totalPayable, payWay, newMzDepositFiles, allRefund);
-            setMzReceiptSerial(opId, mzDepositFileVo.getPatientId(), times, windows, mzChargeDetails.get(0).getResponceType(), feeMap, now, serialNo, mzReceiptSerial, payWay, totalPayable, 1);
+            payWay = getDeposFiles(opId, mzDepositFileVo, now, times, serialNo, totalPayable, payWay, fullNewMzDepositFiles, allRefund,newMzDepositFiles);
+            //setMzReceiptSerial(opId, mzDepositFileVo.getPatientId(), times, windows, mzChargeDetails.get(0).getResponceType(), feeMap, now, serialNo, mzReceiptSerial, payWay, totalPayable, 1);
+            MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(mzDepositFileVo.getPatientId());
+            mzDepositFileVo.setMzDepositFiles(newMzDepositFiles);
+            mzDepositFileVo.setTimes(times);
+            getHadPayable(opId, mzDepositFileVo, windows, mzPatientMi, feeMap, now, serialNo, mzReceiptSerial, 1);
             getMzChargeDetailService().updateChargeFlag(opId, mzDepositFileVo.getPatientId(), times, mzChargeDetails.get(0).getName(), mzChargeDetails, now, serialNo, payWay, mzDepositFileVo.getTimes());
-            getMzChargeDetailService().afterChargeFee(mzDepositFileVo.getPatientId(), times, newMzDepositFiles, now, serialNo, mzReceiptSerial, totalPayable);
+            getMzChargeDetailService().afterChargeFee(mzDepositFileVo.getPatientId(), times, fullNewMzDepositFiles, now, serialNo, mzReceiptSerial, totalPayable);
             MzPatientMi updateMzPatientMi = new MzPatientMi();
             updateMzPatientMi.setPatientId(mzDepositFileVo.getPatientId());
             updateMzPatientMi.setTimes(times);
@@ -860,7 +865,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             mz.setCharge18(BigDecimal.ZERO.subtract(mz.getCharge18()));
             mz.setCharge19(BigDecimal.ZERO.subtract(mz.getCharge19()));
             mz.setCharge20(BigDecimal.ZERO.subtract(mz.getCharge20()));
-            mz.setChequeType(Constants.CASH);
+            if(Constants.BYJZ.equals(mz.getChequeType())){
+                mz.setChequeType(Constants.BYJZ);
+            }else {
+                mz.setChequeType(Constants.CASH);
+            }
             mz.setDcountNo(YesNoEnum.NO.code);
             mz.setDcountDate(null);
             mz.setChargeDcountDate(null);
@@ -914,12 +923,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
      * @param serialNo
      * @param totalPayable
      * @param payWay
+     * @param fullNewMzDepositFiles
      * @param newMzDepositFiles
      * @return
      */
-    private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> newMzDepositFiles, boolean allRefund) {
+    private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> fullNewMzDepositFiles, boolean allRefund,List<MzDepositFile> newMzDepositFiles) {
         List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
         if (mzDepositFiles != null || mzDepositFiles.size() > 0) {
+            //本院记账总额
+            BigDecimal byjzAmount = BigDecimal.ZERO;
+            //非本院记账总额
+            BigDecimal notByjzAmount = BigDecimal.ZERO;
             MzDepositFile temp = CloneUtil.clone(mzDepositFiles.get(0));
             temp.setReceiptNo(-temp.getReceiptNo());
             temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
@@ -935,17 +949,28 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             temp.setPsordnum(null);
             temp.setAgtordnum(null);
             temp.setHisrefundnum(null);
-            newMzDepositFiles.add(temp);
-            BigDecimal amount = BigDecimal.ZERO;
             for (MzDepositFile ms : mzDepositFiles) {
                 if (ms != null) {
-                    if (StringUtils.isNotBlank(ms.getChequeType())) {
-                        payWay = ms.getChequeType();
+                    if (Constants.BYJZ.equals(ms.getChequeType())) {
+                        byjzAmount = byjzAmount.add(ms.getAmount());
+                    } else {
+                        notByjzAmount = notByjzAmount.add(ms.getAmount());
                     }
-                    amount = amount.add(ms.getAmount());
                 }
             }
-            temp.setAmount(BigDecimal.ZERO.subtract(amount));
+            temp.setAmount(BigDecimal.ZERO.subtract(notByjzAmount));
+            //复制一个本院记账的退款记录
+            MzDepositFile byjzTemp = CloneUtil.clone(temp);
+            byjzTemp.setChequeType(Constants.BYJZ);
+            byjzTemp.setAmount(BigDecimal.ZERO.subtract(byjzAmount));
+            //如果有本院记账的退款金额,本院记账记录保持入库
+            if (byjzAmount.compareTo(BigDecimal.ZERO) == 1) {
+                fullNewMzDepositFiles.add(byjzTemp);
+            }
+            //如果有非本院记账的退款金额,非本院记账记录保持入库
+            if (notByjzAmount.compareTo(BigDecimal.ZERO) == 1) {
+                fullNewMzDepositFiles.add(temp);
+            }
             if (!allRefund) {
                 MzDepositFile m = mzDepositFiles.get(0);
                 m.setTimes(times);
@@ -957,12 +982,30 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 m.setOpId(opId);
                 m.setReceiptSn(serialNo);
                 m.setSerialNo(serialNo);
-                m.setChequeType(Constants.CASH);
-                m.setAmount(totalPayable);
                 m.setPsordnum(null);
                 m.setAgtordnum(null);
                 m.setHisrefundnum(null);
-                newMzDepositFiles.add(m);
+                //应付小于等于实际已经支付的非记账总额
+                if (totalPayable.compareTo(notByjzAmount) <= 0) {
+                    m.setAmount(totalPayable);
+                    m.setChequeType(Constants.CASH);
+                    fullNewMzDepositFiles.add(m);
+                    //应付大于实际已经支付的非记账总额,需要用记账收一部分
+                    payWay = Constants.CASH;
+                    newMzDepositFiles.add(m);
+                } else if (totalPayable.compareTo(notByjzAmount) == 1) {
+                    m.setAmount(notByjzAmount);
+                    m.setChequeType(Constants.CASH);
+                    fullNewMzDepositFiles.add(m);
+                    //复制一个本院记账的收款记录
+                    MzDepositFile byjzNeedPayTemp = CloneUtil.clone(m);
+                    byjzNeedPayTemp.setChequeType(Constants.BYJZ);
+                    byjzNeedPayTemp.setAmount(totalPayable.subtract(notByjzAmount).setScale(1, BigDecimal.ROUND_HALF_UP));
+                    fullNewMzDepositFiles.add(byjzNeedPayTemp);
+                    newMzDepositFiles.add(m);
+                    newMzDepositFiles.add(byjzNeedPayTemp);
+                    payWay = Constants.BYJZ;
+                }
             }
         }
         return payWay;
@@ -1307,20 +1350,22 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //排除本院记账的金额
         BigDecimal excludeByjzPay = BigDecimal.ZERO;
         for (MzDepositFile m : mzDepositFileVo.getMzDepositFiles()) {
-            m.setPatientId(mzDepositFileVo.getPatientId());
-            m.setTimes(mzDepositFileVo.getTimes());
-            m.setReceiptNo(receiptNo);
-            m.setPayMark(PayMarkEnum.CHARGED.code);
-            m.setChargeDate(now);
-            m.setDcountNo(YesNoEnum.NO.code);
-            m.setOpId(opId);
-            m.setReceiptSn(serialNo);
-            m.setSerialNo(serialNo);
-            m.setResponceType(mzPatientMi == null ? "" : mzPatientMi.getResponseType());
-            m.setDeptNo(windows.getDeptNo());
+            if(m.getPatientId()==null){
+                //此时是直接收费,需要设置相关参数
+                m.setPatientId(mzDepositFileVo.getPatientId());
+                m.setTimes(mzDepositFileVo.getTimes());
+                m.setReceiptNo(receiptNo);
+                m.setPayMark(PayMarkEnum.CHARGED.code);
+                m.setChargeDate(now);
+                m.setDcountNo(YesNoEnum.NO.code);
+                m.setOpId(opId);
+                m.setReceiptSn(serialNo);
+                m.setSerialNo(serialNo);
+                m.setResponceType(mzPatientMi == null ? "" : mzPatientMi.getResponseType());
+                m.setDeptNo(windows.getDeptNo());
+            }
             hadPayable = hadPayable.add(m.getAmount());
             if (Constants.BYJZ.equals(m.getChequeType())) {
-                m.setReceiptSn(Integer.valueOf("1" + serialNo));
                 if (chequeType == null) {
                     chequeType = Constants.BYJZ;
                 }
@@ -1381,14 +1426,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         mzReceiptSerial.setTotalCharge(hadPayable);
         mzReceiptSerial.setChargeDate(now);
         mzReceiptSerial.setChequeType(chequeType);
-        if (Constants.BYJZ.equals(chequeType)) {
-            String str = serialNo + patientId.split("-")[0] + times + "1";
-            mzReceiptSerial.setReceiptBill(str);
-            mzReceiptSerial.setReceiptSn(Integer.valueOf("1" + serialNo));
-        } else {
-            mzReceiptSerial.setReceiptSn(serialNo);
-            mzReceiptSerial.setReceiptBill("");
-        }
+        mzReceiptSerial.setReceiptSn(serialNo);
+        mzReceiptSerial.setReceiptBill("");
         mzReceiptSerial.setWindowsNo(windows.getWindowsNo().toString());
         mzReceiptSerial.setDcountNo(YesNoEnum.NO.code);
         mzReceiptSerial.setChargeDcountNo(YesNoEnum.NO.code);
@@ -1499,7 +1538,7 @@ 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){
+        if (mzDepositFiles == null || mzDepositFiles.size() == 0) {
             mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimesInHisData(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
         }
         if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
@@ -1843,8 +1882,25 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
      * @return
      * @throws Exception
      */
-    private Integer formatSupplyFee(List<MzChargeDetail> mzChargeDetails, List<MzChargeDetail> mzChargeDetailList, Integer itemNo, Integer receiptNo) {
+    private Integer formatSupplyFee(List<MzChargeDetail> mzChargeDetails, List<MzChargeDetail> mzChargeDetailList, Integer itemNo, Integer receiptNo) throws MzException {
         for (MzChargeDetail mcd : mzChargeDetailList) {
+            YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCode(mcd.getChargeItemCode(), mcd.getSerial());
+            if (ypZdDict != null && ypZdDict.getMzRestrict() != null) {
+                //当前处方购药量
+                BigDecimal thisQuantity = BigDecimal.valueOf(mcd.getQuantity()).multiply(BigDecimal.valueOf(mcd.getDrugWin()));
+                //本月已经购买量
+                Integer quantityDb = mzChargeDetailMapper.selectTotalQuantityForMonth(mcd.getPatientId(), mcd.getChargeItemCode(), mcd.getSerial(), DateUtil.getFirstSecondForMonth(new Date()));
+                quantityDb = quantityDb == null ? 0 : quantityDb;
+                BigDecimal totalQuantity = thisQuantity.add(BigDecimal.valueOf(quantityDb));
+                if (totalQuantity.compareTo(BigDecimal.valueOf(ypZdDict.getMzRestrict())) == 1) {
+                    //当前还可以购药量,小于0时为0
+                    BigDecimal tempCount = BigDecimal.valueOf(ypZdDict.getMzRestrict()).subtract(BigDecimal.valueOf(quantityDb));
+                    if (tempCount.compareTo(BigDecimal.ZERO) == -1) {
+                        tempCount = BigDecimal.ZERO;
+                    }
+                    throw new MzException("药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的药品超过限购量,最大购买量为【" + ypZdDict.getMzRestrict() + "】,本月已购买量为【" + quantityDb + "】,本次最大可购量为【" + tempCount + "】,当前处方购药数量【" + thisQuantity + "】请联系医生修改处方限制购药品种的数量");
+                }
+            }
             //非口服用药方式,需要写入收费记录
             if (StringUtils.isNotBlank(mcd.getSupplyCode()) && !Constants.KOU_FU_SUPPLY_CODE.equals(mcd.getSupplyCode())) {
                 List<MzZdSupplyCharge> mzZdSupplyChargeList = mzZdSupplyChargeService.queryMzZdSupplyChargeByCode(mcd.getSupplyCode());
@@ -1885,7 +1941,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                             newMzChargeDetail.setTcName(zdChargeItem.getName());
                             newMzChargeDetail.setBillItemCode(Constants.ZLF);
                             //给药方式执行次数如果为空,默认为1次
-                            newMzChargeDetail.setQuantity(Double.valueOf(newMzChargeDetail.getSupplyAmount()==null?1:newMzChargeDetail.getSupplyAmount()));
+                            newMzChargeDetail.setQuantity(Double.valueOf(newMzChargeDetail.getSupplyAmount() == null ? 1 : newMzChargeDetail.getSupplyAmount()));
                             newMzChargeDetail.setSupplyAmount(null);
                             mzChargeDetails.add(newMzChargeDetail);
                         }

+ 3 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -219,7 +219,9 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             dbMzyReqrec.setOpId(tokenUser.getUserIdCode());
             dbMzyReqrec.setDcountNo(YesNoEnum.NO.code);
             dbMzyReqrec.setClosingDate(null);
-            dbMzyReqrec.setPaymode(Constants.CASH);
+            if(!Constants.BYJZ.equals(dbMzyReqrec.getPaymode())){
+                dbMzyReqrec.setPaymode(Constants.CASH);
+            }
             mzyReqrecMapper.insertMzyReqrec(dbMzyReqrec);
             reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
         }