Ver código fonte

报表bug优化

hurugang 5 anos atrás
pai
commit
c772718de9

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/ChargeFeeVoController.java

@@ -432,7 +432,7 @@ public class ChargeFeeVoController {
         try {
             User tokenUser = TokenUtil.getUser(httpServletRequest);
 //            //数据清洗,将已经做了日结的发票数据清洗,
-//            chargeFeeVoService.dataRefsh();
+            chargeFeeVoService.setPayId();
             //挂号收入构成表格数据
             ReqrecVo reqrecVo = chargeFeeVoService.queryMzReceiptSerialCount(tokenUser.getUserIdCode(), null, null, null).get(0);
             reqrecVo.fomartReqrecVo();

+ 13 - 7
src/main/java/cn/hnthyy/thmz/mapper/his/ChargeFeeVoMapper.java

@@ -339,14 +339,14 @@ public interface ChargeFeeVoMapper {
                     "sum ( case when cheque_type in ('5' ,'3') and pay_mark ='0' then amount else 0 end ) yhksk," +
                     "sum ( case cheque_type when '6' then amount else 0 end ) sybkss," +
                     "sum ( case when cheque_type='6' and pay_mark ='0' then amount else 0 end ) sybksk," +
-                    "sum ( case when cheque_type = 'Y'  then amount else 0 end ) zfss," +
-                    "sum ( case when cheque_type = 'Y'  and pay_mark ='0' then amount else 0 end ) zfsk," +
+                    "sum ( case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' then amount else 0 end ) zfss," +
+                    "sum ( case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' and pay_mark ='0' then amount else 0 end ) zfsk," +
                     "sum ( case when cheque_type ='2'   then amount else 0 end ) ybjzss," +
                     "sum ( case when cheque_type = '2'  and pay_mark ='0'  then amount else 0 end ) ybjzsk," +
                     "sum ( case when cheque_type ='1' and pay_mark ='1' then amount else 0 end ) xjtf," +
                     "sum ( case when ( cheque_type ='5' or cheque_type ='3' ) and pay_mark ='1' then amount else 0 end ) yhktf," +
                     "sum ( case when cheque_type ='6' and pay_mark ='1' then amount else 0 end ) sybtf," +
-                    "sum ( case when cheque_type = 'Y'  and pay_mark &gt; '0'  then amount else 0 end ) zftf," +
+                    "sum ( case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' and pay_mark &gt; '0'  then amount else 0 end ) zftf," +
                     "sum ( case when cheque_type = '2' and pay_mark &gt; '0'  then amount else 0 end ) ybjztf," +
                     "sum ( amount) zjss," +
                     "sum ( case when pay_mark ='0'  then amount else 0 end ) zjsk," +
@@ -364,15 +364,15 @@ public interface ChargeFeeVoMapper {
                     "count ( distinct case when cheque_type ='1' and pay_mark ='0' then receipt_sn else null end ) xjbs," +
                     "  count ( distinct case when ( cheque_type ='5' or cheque_type ='3' ) and pay_mark ='0' then receipt_sn else null end ) yhsbs," +
                     "  count ( distinct case when cheque_type ='6' and pay_mark ='0' then receipt_sn else null end ) sybbs," +
-                    " count ( distinct case when cheque_type = 'Y'  and pay_mark ='0'  then receipt_sn else null end ) zfbs," +
+                    " count ( distinct case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999'  and pay_mark ='0'  then receipt_sn else null end ) zfbs," +
                     " count ( distinct case when cheque_type = '2'  and pay_mark ='0'  then receipt_sn else null end ) ybjzbs," +
                     " count ( distinct case when cheque_type ='1' and pay_mark &gt; '0' then receipt_sn else null end ) xjtfbs," +
                     "count ( distinct case when ( cheque_type ='5' or cheque_type ='3' ) and pay_mark &gt; '0' then receipt_sn else null end ) yhktfbs," +
                     "count ( distinct case when cheque_type ='6' and pay_mark &gt; '0' then receipt_sn else null end ) sybtfbs," +
-                    "   count ( distinct case when cheque_type = 'Y'  and pay_mark &gt; '0'  then receipt_sn else null end ) zftfbs," +
+                    "   count ( distinct case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' and pay_mark &gt; '0'  then receipt_sn else null end ) zftfbs," +
                     "   count ( distinct case when cheque_type ='2'  and pay_mark &gt; '0'  then receipt_sn else null end ) ybjztfbs," +
                     "    count ( distinct case when pay_mark ='0' then cast(serial_no as char)+cheque_type else null end ) zjbs," +
-                    "count ( distinct case when pay_mark  <![CDATA[<>]]> '0' then receipt_sn else null end ) ztfbs," +
+                    "count ( distinct case when pay_mark  <![CDATA[<>]]> '0' then cast(serial_no as char)+cheque_type else null end ) ztfbs," +
                     "count ( distinct case when cheque_type ='E' and op_id <![CDATA[<>]]> '99999' and pay_mark ='0' then receipt_sn else null end ) wxbs," +
                     "count ( distinct case when cheque_type ='F' and op_id <![CDATA[<>]]> '99999' and pay_mark ='0' then receipt_sn else null end ) zfbbs," +
                     "count ( distinct case when cheque_type ='E' and op_id <![CDATA[<>]]> '99999' and pay_mark  <![CDATA[<>]]> '0' then receipt_sn else null end ) wxtfbs," +
@@ -899,7 +899,7 @@ public interface ChargeFeeVoMapper {
      *
      * @return
      */
-    @Update("update mz_receipt_serial set pay_id=operator_id,charge_dcount_date=dcount_date,charge_dcount_no=dcount_no  where operator_id =#{userIdCode}   and dcount_date=#{dcountDate} and receipt_no>0 and isnull(cheque_type,1)<> 'Y' and pay_id='99999' ")
+    @Update("update mz_receipt_serial set pay_id=operator_id,charge_dcount_date=dcount_date,charge_dcount_no=dcount_no  where operator_id =#{userIdCode}   and dcount_date=#{dcountDate} and receipt_no>0 and isnull(cheque_type,1) not in ('Y','E','F','W','M','Z') and pay_id='99999' ")
     int refeshRefundNewData(@Param("userIdCode") String userIdCode, @Param("dcountDate") Date dcountDate);
 
 
@@ -917,4 +917,10 @@ public interface ChargeFeeVoMapper {
             ")")
     List<Integer> selectInconformityData(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
+    /**
+     * 清洗payId
+     * @return
+     */
+    @Update("update mz_receipt_serial set pay_id ='99999' where operator_id='99999' and pay_id=''")
+    int setPayId();
 }

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

@@ -86,7 +86,7 @@ public interface MzDepositFileMapper {
     @Select("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 where serial_no = #{serialNo}")
-    MzDepositFile selectMzDepositFileBySerialNo(Integer serialNo);
+    List<MzDepositFile> selectMzDepositFileBySerialNo(Integer serialNo);
 
     /**
      * 更新收费表的退款标志等信息,发票作废重打时调用
@@ -116,4 +116,5 @@ public interface MzDepositFileMapper {
      */
     @Select("select count(1) from mz_deposit_file where patient_id=#{patientId} and times = #{times} and receipt_no=#{receiptNo} and pay_mark=#{payMark} and cheque_type=#{chequeType} and amount=#{amount} and op_id=#{opId}")
     int selectBySameParams(MzDepositFile mzDepositFile);
+
 }

+ 7 - 0
src/main/java/cn/hnthyy/thmz/service/his/ChargeFeeVoService.java

@@ -278,4 +278,11 @@ public interface ChargeFeeVoService {
      * @return
      */
     int refeshInconformityData(Date beginDate,Date endDate);
+
+
+    /**
+     * 清洗payId
+     * @return
+     */
+    int setPayId();
 }

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

@@ -212,8 +212,9 @@ public class ChargeFeeVoServiceImpl implements ChargeFeeVoService {
             return 0;
         }
         for (Integer serialNo:serialNos){
-            MzDepositFile mzDepositFile=mzDepositFileMapper.selectMzDepositFileBySerialNo(serialNo);
-            if(mzDepositFile!=null){
+            List<MzDepositFile> mzDepositFiles=mzDepositFileMapper.selectMzDepositFileBySerialNo(serialNo);
+            if(mzDepositFiles!=null && mzDepositFiles.size()>0){
+                MzDepositFile mzDepositFile= mzDepositFiles.get(0);
                 MzReceiptSerial mzReceiptSerial = new MzReceiptSerial();
                 mzReceiptSerial.setSerialNo(mzDepositFile.getSerialNo());
                 mzReceiptSerial.setChargeDcountDate(mzDepositFile.getDcountDate());
@@ -223,4 +224,9 @@ public class ChargeFeeVoServiceImpl implements ChargeFeeVoService {
         }
         return serialNos.size();
     }
+
+    @Override
+    public int setPayId() {
+        return chargeFeeVoMapper.setPayId();
+    }
 }

+ 6 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -809,6 +809,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             temp.setChequeType(Constants.CASH);
             temp.setDcountNo(YesNoEnum.NO.code);
             temp.setDcountDate(null);
+            temp.setPsordnum(null);
+            temp.setAgtordnum(null);
+            temp.setHisrefundnum(null);
             newMzDepositFiles.add(temp);
             BigDecimal amount = BigDecimal.ZERO;
             for (MzDepositFile ms : mzDepositFiles) {
@@ -832,6 +835,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 m.setSerialNo(serialNo);
                 m.setChequeType(Constants.CASH);
                 m.setAmount(totalPayable);
+                m.setPsordnum(null);
+                m.setAgtordnum(null);
+                m.setHisrefundnum(null);
                 newMzDepositFiles.add(m);
             }
         }

+ 12 - 10
src/main/java/cn/hnthyy/thmz/service/impl/his/MzReceiptSerialServiceImpl.java

@@ -119,7 +119,7 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         }
         //如果是手机缴费,设置缴费方式为自助缴费
         if(Constants.BRZZJF_CODE.equals(mzReceiptSerial.getOperatorId()) && Constants.BYJZ.equals(mzReceiptSerial.getChequeType())){
-            MzDepositFile mzDepositFile=mzDepositFileMapper.selectMzDepositFileBySerialNo(mzReceiptSerial.getSerialNo());
+            MzDepositFile mzDepositFile=mzDepositFileMapper.selectMzDepositFileBySerialNo(mzReceiptSerial.getSerialNo()).get(0);
             if(Constants.WX.equals(mzDepositFile.getChequeType())){
                 updateMzReceiptSerial.setNewChequeType(Constants.ZZWX);
             }else if(Constants.ZFB.equals(mzDepositFile.getChequeType())){
@@ -185,17 +185,19 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         //更新收费明细表发票流水号
         Date now = new Date();
         mzChargeDetailMapper.updateBySerialNo(mzReceiptSerial.getReceiptNo(), mzReceiptSerial.getSerialNo(), oriSerialNo);
-        MzDepositFile mzDepositFile=mzDepositFileMapper.selectMzDepositFileBySerialNo(oriSerialNo);
+        List<MzDepositFile> mzDepositFiles=mzDepositFileMapper.selectMzDepositFileBySerialNo(oriSerialNo);
         //原收费方式记录设置为作废
         mzDepositFileMapper.updatePayMark(PayMarkEnum.CANCELLATION.code,oriSerialNo);
-        //新增新的收费方式记录
-        mzDepositFile.setReceiptNo(mzReceiptSerial.getReceiptNo());
-        mzDepositFile.setReceiptSn(mzReceiptSerial.getSerialNo());
-        mzDepositFile.setSerialNo(mzReceiptSerial.getSerialNo());
-        mzDepositFile.setChargeDate(now);
-        mzDepositFile.setDcountNo(YesNoEnum.NO.code);
-        mzDepositFile.setDcountDate(null);
-        mzDepositFileMapper.insertMzDepositFile(mzDepositFile);
+        for (MzDepositFile mzDepositFile:mzDepositFiles){
+            //新增新的收费方式记录
+            mzDepositFile.setReceiptNo(mzReceiptSerial.getReceiptNo());
+            mzDepositFile.setReceiptSn(mzReceiptSerial.getSerialNo());
+            mzDepositFile.setSerialNo(mzReceiptSerial.getSerialNo());
+            mzDepositFile.setChargeDate(now);
+            mzDepositFile.setDcountNo(YesNoEnum.NO.code);
+            mzDepositFile.setDcountDate(null);
+            mzDepositFileMapper.insertMzDepositFile(mzDepositFile);
+        }
         if (receipt.getReceiptCurrent() == receipt.getReceiptEnd()) {
             //此时发票号已经用完,当前发票号是最后一个
             receipt.setReceiptCurrent(null);

+ 10 - 1
src/main/java/cn/hnthyy/thmz/vo/ChargeCountVo.java

@@ -266,7 +266,16 @@ public class ChargeCountVo {
         if(ybjzss==null){
             ybjzss=BigDecimal.ZERO;
         }
-        sjhj=xjss.add(yhkss).add(zfbss).add(wxss).add(sybkss).setScale(2, BigDecimal.ROUND_HALF_UP);
+        if(zfbzzss==null){
+            zfbzzss=BigDecimal.ZERO;
+        }
+        if(wxzzss==null){
+            wxzzss=BigDecimal.ZERO;
+        }
+        if(ybjzss==null){
+            ybjzss=BigDecimal.ZERO;
+        }
+        sjhj=xjss.add(yhkss).add(zfbss).add(wxss).add(sybkss).add(zfbzzss).add(wxzzss).setScale(2, BigDecimal.ROUND_HALF_UP);
         sjhjdx=NumberToCN.number2CNMontrayUnit(sjhj);
         ybkjzhjdx=NumberToCN.number2CNMontrayUnit(ybjzss);
     }