Browse Source

报表优化

hurugang 5 years ago
parent
commit
ade5c866df

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

@@ -96,7 +96,7 @@ public class ChargeFeeVoController {
                 PayMarkEnum payMark = PayMarkEnum.getPayMarkByCode(co.getPayMark());
                 co.setPayMark(payMark == null ? co.getPayMark() : payMark.name);
                 if (Constants.BRZZJF_CODE.equalsIgnoreCase(co.getOpId())) {
-                    if (Constants.WX.equalsIgnoreCase(co.getChequeType())) {
+                    if (Constants.WX.equalsIgnoreCase(co.getChequeType()) || Constants.BYJZ.equalsIgnoreCase(co.getChequeType())) {
                         co.setChequeType(Constants.ZZWX);
                     } else if (Constants.ZFB.equalsIgnoreCase(co.getChequeType())) {
                         co.setChequeType(Constants.ZZZFB);

+ 64 - 88
src/main/java/cn/hnthyy/thmz/mapper/his/ChargeFeeVoMapper.java

@@ -17,25 +17,21 @@ public interface ChargeFeeVoMapper {
      * @param userIdCode
      * @return
      */
-    @Select("  SELECT patient_id=max(mz_receipt_serial.patient_id)," +
-            "         serial_no =max(mz_receipt_serial.serial_no)," +
-            "         pay_mark  =mz_receipt_serial.pay_mark , " +
-            "         total_charge=isnull(max(b.amount),0), " +
-            "         receipt_bill," +
-            "         pay_id=max(pay_id)," +
-            "         charge_date=max(mz_receipt_serial.charge_date)," +
-            "         receipt_sn=mz_receipt_serial.receipt_sn ," +
-            "         b.cheque_type,b.op_id  " +
-            "  FROM   mz_receipt_serial,mz_deposit_file b " +
-            "  where  mz_receipt_serial.pay_id=#{userIdCode} and " +
-            "         mz_receipt_serial.dcount_no=0 and " +
-            "         mz_receipt_serial.patient_id*=b.patient_id and " +
-            "         mz_receipt_serial.times     *=b.times and " +
-            "         mz_receipt_serial.receipt_no*=b.receipt_no and " +
-            "         mz_receipt_serial.receipt_sn*=b.receipt_sn and " +
-            "         (b.cheque_type <> 'Z' or  b.cheque_type <> 'Y') " +
-            "group by mz_receipt_serial.receipt_sn,mz_receipt_serial.receipt_bill,b.cheque_type,mz_receipt_serial.pay_mark,b.op_id  " +
-            "order by abs(mz_receipt_serial.receipt_sn),mz_receipt_serial.receipt_bill")
+
+    @Select("   select " +
+            "   patient_id=max(m.patient_id), " +
+            "  serial_no =max(m.serial_no), " +
+            "   total_charge=isnull(max(m.amount),0), " +
+            "   r.pay_mark," +
+            "    charge_date=max(r.charge_date)," +
+            "  r.receipt_bill," +
+            "   receipt_sn=r.receipt_sn , " +
+            "   m.cheque_type, " +
+            "   m.op_id from mz_deposit_file  m left join mz_receipt_serial r on m.serial_no =r.serial_no where   r.pay_id=#{userIdCode} and" +
+            "   m.dcount_no=0 and m.cheque_type <>'Z' and m.cheque_type <>'Y' " +
+            "  group by r.receipt_sn,r.receipt_bill,m.cheque_type,r.pay_mark,m.op_id " +
+            "   order by abs(r.receipt_sn),r.receipt_bill")
+
     List<ChargeFeeVo> selectChargeFeeVoUnAccount(@Param("userIdCode") String userIdCode);
 
     /**
@@ -46,28 +42,21 @@ public interface ChargeFeeVoMapper {
      * @param endDate   结束时间
      * @return
      */
-    @Select("  SELECT patient_id=max(mz_receipt_serial.patient_id), " +
-            "         serial_no =max(mz_receipt_serial.serial_no), " +
-            "         pay_mark  =mz_receipt_serial.pay_mark , " +
-            "         total_charge=isnull(max(b.amount),0), " +
-            "         receipt_bill, " +
-            "         pay_id=max(pay_id), " +
-            "         charge_date=max(mz_receipt_serial.charge_date), " +
-            "         receipt_sn=mz_receipt_serial.receipt_sn , " +
-            "         b.cheque_type, " +
-            "         op_id " +
-            "  FROM   mz_receipt_serial,mz_deposit_file b " +
-            "  where" +
-            "         mz_receipt_serial.dcount_no=1 and " +
-            "         case '1' when #{caseType} then mz_receipt_serial.charge_date else  mz_receipt_serial.charge_dcount_date end >=#{beginDate,jdbcType=TIMESTAMP}  and " +
-            "         case '1' when #{caseType} then mz_receipt_serial.charge_date else  mz_receipt_serial.charge_dcount_date end <=#{endDate,jdbcType=TIMESTAMP}  and " +
-            "         mz_receipt_serial.patient_id*=b.patient_id and " +
-            "         mz_receipt_serial.times     *=b.times and " +
-            "         mz_receipt_serial.receipt_no*=b.receipt_no and " +
-            "         mz_receipt_serial.receipt_sn*=b.receipt_sn and " +
-            "         b.cheque_type <>'Z' " +
-            "group by mz_receipt_serial.receipt_sn,mz_receipt_serial.receipt_bill,b.cheque_type,mz_receipt_serial.pay_mark,b.op_id " +
-            "order by abs(mz_receipt_serial.receipt_sn),mz_receipt_serial.receipt_bill")
+    @Select("   select " +
+            "   patient_id=max(m.patient_id), " +
+            "  serial_no =max(m.serial_no), " +
+            "   total_charge=isnull(max(m.amount),0), " +
+            "   r.pay_mark," +
+            "    charge_date=max(r.charge_date)," +
+            "  r.receipt_bill," +
+            "   receipt_sn=r.receipt_sn , " +
+            "   m.cheque_type, " +
+            "   m.op_id from mz_deposit_file  m left join mz_receipt_serial r on m.serial_no =r.serial_no where " +
+            "   case '1' when #{caseType} then r.charge_date else  m.dcount_date end >=#{beginDate,jdbcType=TIMESTAMP}  " +
+            "  and  case '1' when #{caseType} then r.charge_date else  m.dcount_date end <=#{endDate,jdbcType=TIMESTAMP} " +
+            "  and m.pay_mark <> 2 and m.cheque_type <>'Z' " +
+            "  group by r.receipt_sn,r.receipt_bill,m.cheque_type,r.pay_mark,m.op_id " +
+            "   order by abs(r.receipt_sn),r.receipt_bill")
     List<ChargeFeeVo> selectChargeFeeVoCollect(@Param("caseType") String caseType, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
 
@@ -79,28 +68,21 @@ public interface ChargeFeeVoMapper {
      * @param endDate   结束时间
      * @return
      */
-    @Select("  SELECT patient_id=max(mz_receipt_serial_b.patient_id), " +
-            "         serial_no =max(mz_receipt_serial_b.serial_no), " +
-            "         pay_mark  =mz_receipt_serial_b.pay_mark , " +
-            "         total_charge=isnull(max(b.amount),0), " +
-            "         receipt_bill, " +
-            "         pay_id=max(pay_id), " +
-            "         charge_date=max(mz_receipt_serial_b.charge_date), " +
-            "         receipt_sn=mz_receipt_serial_b.receipt_sn , " +
-            "         b.cheque_type, " +
-            "         b.op_id " +
-            "  FROM   mz_receipt_serial_b,mz_deposit_file b " +
-            "  where" +
-            "         mz_receipt_serial_b.dcount_no=1 and " +
-            "         case '1' when #{caseType} then mz_receipt_serial_b.charge_date else  mz_receipt_serial_b.charge_dcount_date end >=#{beginDate,jdbcType=TIMESTAMP}  and " +
-            "         case '1' when #{caseType} then mz_receipt_serial_b.charge_date else  mz_receipt_serial_b.charge_dcount_date end <=#{endDate,jdbcType=TIMESTAMP}  and " +
-            "         mz_receipt_serial_b.patient_id*=b.patient_id and " +
-            "         mz_receipt_serial_b.times     *=b.times and " +
-            "         mz_receipt_serial_b.receipt_no*=b.receipt_no and " +
-            "         mz_receipt_serial_b.receipt_sn*=b.receipt_sn and " +
-            "         b.cheque_type <>'Z' " +
-            "group by mz_receipt_serial_b.receipt_sn,mz_receipt_serial_b.receipt_bill,b.cheque_type,mz_receipt_serial_b.pay_mark,b.op_id " +
-            "order by abs(mz_receipt_serial_b.receipt_sn),mz_receipt_serial_b.receipt_bill")
+    @Select("   select " +
+            "   patient_id=max(m.patient_id), " +
+            "  serial_no =max(m.serial_no), " +
+            "   total_charge=isnull(max(m.amount),0), " +
+            "   r.pay_mark," +
+            "    charge_date=max(r.charge_date)," +
+            "  r.receipt_bill," +
+            "   receipt_sn=r.receipt_sn , " +
+            "   m.cheque_type, " +
+            "   m.op_id from mz_deposit_file_b  m left join mz_receipt_serial_b r on m.serial_no =r.serial_no where " +
+            "   case '1' when #{caseType} then r.charge_date else  m.dcount_date end >=#{beginDate,jdbcType=TIMESTAMP}  " +
+            "  and  case '1' when #{caseType} then r.charge_date else  m.dcount_date end <=#{endDate,jdbcType=TIMESTAMP} " +
+            "  and m.pay_mark <> 2 and m.cheque_type <>'Z' " +
+            "  group by r.receipt_sn,r.receipt_bill,m.cheque_type,r.pay_mark,m.op_id " +
+            "   order by abs(r.receipt_sn),r.receipt_bill")
     List<ChargeFeeVo> selectHisChargeFeeVoCollect(@Param("caseType") String caseType, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     /**
@@ -111,27 +93,21 @@ public interface ChargeFeeVoMapper {
      * @param dcountDate
      * @return
      */
-    @Select("  SELECT patient_id=max(mz_receipt_serial.patient_id), " +
-            "         serial_no =max(mz_receipt_serial.serial_no), " +
-            "         pay_mark  =mz_receipt_serial.pay_mark , " +
-            "         total_charge=isnull(max(b.amount),0), " +
-            "         receipt_bill, " +
-            "         pay_id=max(pay_id), " +
-            "         charge_date=max(mz_receipt_serial.charge_date), " +
-            "         receipt_sn=mz_receipt_serial.receipt_sn , " +
-            "         b.cheque_type,b.op_id " +
-            "  FROM   mz_receipt_serial,mz_deposit_file b " +
-            "  where " +
-            "         mz_receipt_serial.dcount_no=1 and " +
-            "         case '1' when #{caseType} then mz_receipt_serial.charge_date else  mz_receipt_serial.charge_dcount_date end=#{dcountDate,jdbcType=TIMESTAMP}  and " +
-            "         mz_receipt_serial.pay_id=#{userIdCode} and " +
-            "         mz_receipt_serial.patient_id*=b.patient_id and " +
-            "         mz_receipt_serial.times     *=b.times and" +
-            "         mz_receipt_serial.receipt_no*=b.receipt_no and " +
-            "         mz_receipt_serial.receipt_sn*=b.receipt_sn and " +
-            "         b.cheque_type  <> 'Z' " +
-            "group by mz_receipt_serial.receipt_sn,mz_receipt_serial.receipt_bill,b.cheque_type,mz_receipt_serial.pay_mark,b.op_id " +
-            "order by abs(mz_receipt_serial.receipt_sn),mz_receipt_serial.receipt_bill")
+    @Select("   select " +
+            "   patient_id=max(m.patient_id), " +
+            "  serial_no =max(m.serial_no), " +
+            "   total_charge=isnull(max(m.amount),0), " +
+            "   r.pay_mark," +
+            "    charge_date=max(r.charge_date)," +
+            "  r.receipt_bill," +
+            "   receipt_sn=r.receipt_sn , " +
+            "   m.cheque_type, " +
+            "   m.op_id from mz_deposit_file  m left join mz_receipt_serial r on m.serial_no =r.serial_no where " +
+            "   case '1' when #{caseType} then r.charge_date else  m.dcount_date end =#{dcountDate,jdbcType=TIMESTAMP}  " +
+            "  and m.pay_mark <> 2 and m.cheque_type <>'Z' " +
+            "  group by r.receipt_sn,r.receipt_bill,m.cheque_type,r.pay_mark,m.op_id " +
+            "   order by abs(r.receipt_sn),r.receipt_bill")
+
     List<ChargeFeeVo> selectChargeFeeVoReprint(@Param("userIdCode") String userIdCode, @Param("caseType") String caseType, @Param("dcountDate") Date dcountDate);
 
     /**
@@ -647,9 +623,9 @@ public interface ChargeFeeVoMapper {
                     " sum ( case when times  <![CDATA[>]]> 0 and paymode ='E'  then req_fee + oth_fee + clinic_fee + isnull ( brochure_fee , 0 ) + isnull ( bl_fee , 0 ) + isnull ( ck_fee , 0 ) else 0 end ) wxsk, " +
                     " count ( case when times  <![CDATA[<]]> 0 and paymode ='E' then 1 else null end ) wxthhs," +
                     " ABS(sum ( case when times  <![CDATA[<]]> 0 and paymode ='E' then req_fee + oth_fee + clinic_fee + isnull ( brochure_fee , 0 ) + isnull ( bl_fee , 0 ) + isnull ( ck_fee , 0 ) else 0 end )) wxth, " +
-                    " count ( case when times  <![CDATA[>]]> 0 and paymode ='E'  then 1 else null end ) wxsshs," +
+                    " count ( case when times  <![CDATA[>]]> 0 and paymode ='E'  then 1 else null end ) -count ( case when times  <![CDATA[<]]> 0 and paymode ='E' then 1 else null end ) wxsshs," +
                     " sum ( case when paymode ='E'  then req_fee + oth_fee + clinic_fee + isnull ( brochure_fee , 0 ) + isnull ( bl_fee , 0 ) + isnull ( ck_fee , 0 ) else 0 end ) wxss," +
-                    " count ( case when times  <![CDATA[>]]> 0 and paymode ='Y' then 1 else null end ) - count ( case when  times  <![CDATA[<]]> 0 and paymode ='E'  then 1 else null end ) byjzhs," +
+                    " count ( case when times  <![CDATA[>]]> 0 and paymode ='Y' then 1 else null end ) - count ( case when  times  <![CDATA[<]]> 0 and paymode ='Y'  then 1 else null end ) byjzhs," +
                     " sum ( case when times  <![CDATA[>]]> 0 and paymode ='Y'  then req_fee + oth_fee + clinic_fee + isnull ( brochure_fee , 0 ) + isnull ( bl_fee , 0 ) + isnull ( ck_fee , 0 ) else 0 end ) byjzsk, " +
                     " count ( case when times  <![CDATA[<]]> 0 and paymode ='Y' then 1 else null end ) byjzthhs," +
                     " ABS(sum ( case when times  <![CDATA[<]]> 0 and paymode ='Y' then req_fee + oth_fee + clinic_fee + isnull ( brochure_fee , 0 ) + isnull ( bl_fee , 0 ) + isnull ( ck_fee , 0 ) else 0 end )) byjzth, " +
@@ -918,7 +894,6 @@ public interface ChargeFeeVoMapper {
     int refeshNomalPayManData(@Param("userIdCode") String userIdCode, @Param("dcountDate") Date dcountDate);
 
 
-
     /**
      * 刷新退费产生的新数据
      *
@@ -930,6 +905,7 @@ public interface ChargeFeeVoMapper {
 
     /**
      * 查询发票表和收费表中不一致的数据
+     *
      * @param beginDate
      * @param endDate
      * @return
@@ -939,6 +915,6 @@ public interface ChargeFeeVoMapper {
             "select serial_no from mz_deposit_file where 1=1 and pay_mark <> 2 and dcount_date >=#{beginDate} and dcount_date <=#{endDate} and serial_no not in ( " +
             " SELECT serial_no FROM mz_receipt_serial where 1=1 and pay_mark <> 2 and charge_dcount_date >=#{beginDate} and charge_dcount_date <=#{endDate} " +
             ")")
-    List<Integer>  selectInconformityData(@Param("beginDate") Date beginDate,@Param("endDate") Date endDate);
+    List<Integer> selectInconformityData(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
 }

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

@@ -217,7 +217,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             dbMzyReqrec.setOpId(tokenUser.getUserIdCode());
             dbMzyReqrec.setDcountNo(YesNoEnum.NO.code);
             dbMzyReqrec.setClosingDate(null);
-            dbMzyReqrec.setChargeType(Constants.CASH);
+            dbMzyReqrec.setPaymode(Constants.CASH);
             mzyReqrecMapper.insertMzyReqrec(dbMzyReqrec);
             reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
         }

+ 4 - 4
src/main/resources/templates/daily_repeat_print.html

@@ -59,18 +59,18 @@
                                     id="rjList" onchange="initFeeTable()">
                             </select>
                         </div>
-                        <div class="col-md-1 col-sm-1 col-xs-12" style="text-align:left;">
-                            <button type="button" style="margin-left:50px" id="btn_clean" class="btn btn-primary"
+                        <div class="col-md-1 col-sm-1 col-xs-12" style="text-align:left;margin-left: 50px;">
+                            <button type="button"  id="btn_clean" class="btn btn-primary"
                                     title="重置"><i class="fa fa-rotate-left"></i>
                             </button>
                         </div>
                         <div class="col-md-1 col-sm-1 col-xs-12" style="text-align:left;">
-                            <button type="button" style="margin-left:50px" id="btn_daily" class="btn btn-primary"
+                            <button type="button" id="btn_daily" class="btn btn-primary"
                                     title="打印"><i class="fa fa-print"></i>
                             </button>
                         </div>
                         <div class="col-md-1 col-sm-1 col-xs-12" style="text-align:left;">
-                            <button type="button" style="margin-left:50px" id="btn_excel" class="btn btn-primary"
+                            <button type="button"  id="btn_excel" class="btn btn-primary"
                                     title="导出EXCEL"><i class="fa fa-file-excel-o"></i>
                             </button>
                         </div>