Sfoglia il codice sorgente

优化报表查询

hurugang 4 anni fa
parent
commit
4634ab58b4

+ 2 - 2
src/main/java/cn/hnthyy/thmz/controller/MzyRequestController.java

@@ -330,8 +330,8 @@ public class MzyRequestController {
                 for (MzyRequest o : oneDateList) {
                     MzyRequest mrc = CloneUtil.clone(o);
                     mrc.setRequestDay(days.get(i));
-                    mrc.setLeftNum(60);
-                    mrc.setTotalNum(60);
+                    mrc.setLeftNum(30);
+                    mrc.setTotalNum(30);
                     newMzyRequest.add(mrc);
                 }
             }

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

@@ -123,13 +123,13 @@ public interface ChargeFeeVoMapper {
             "         mz_receipt_serial.dcount_date " +
             "    FROM mz_receipt_serial " +
             "where  operator_id = #{userIdCode} and " +
-            "       dcount_date >=#{beginDate,jdbcType=TIMESTAMP} and dcount_date <= #{endDate,jdbcType=TIMESTAMP} " +
+            "       CONVERT(varchar(100), dcount_date, 20) >=#{beginDate,jdbcType=TIMESTAMP} and CONVERT(varchar(100), dcount_date, 20) <= #{endDate,jdbcType=TIMESTAMP} " +
             "union " +
             "SELECT distinct mzy_reqrec.op_id," +
             "         mzy_reqrec.closing_date " +
             "    FROM mzy_reqrec " +
             "where  op_id =#{userIdCode} and " +
-            "       closing_date >= #{beginDate,jdbcType=TIMESTAMP} and closing_date <= #{endDate,jdbcType=TIMESTAMP} " +
+            "       CONVERT(varchar(100), closing_date, 20) >= #{beginDate,jdbcType=TIMESTAMP} and CONVERT(varchar(100), closing_date, 20) <= #{endDate,jdbcType=TIMESTAMP} " +
             " order by dcount_date desc")
     List<DcountDateListVo> selectDcountDateList(@Param("userIdCode") String userIdCode, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
@@ -397,10 +397,10 @@ public interface ChargeFeeVoMapper {
             " and dcount_date=#{dcountDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='beginDate!=null'>",
-            " and dcount_date &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), dcount_date, 20) &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='endDate!=null'>",
-            " and dcount_date &lt;=#{endDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), dcount_date, 20) &lt;=#{endDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='dcountDate == null and beginDate == null and endDate == null'>",
             " and dcount_no =0 ",
@@ -453,10 +453,10 @@ public interface ChargeFeeVoMapper {
             " and charge_dcount_date=#{dcountDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='beginDate!=null'>",
-            " and charge_dcount_date &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), charge_dcount_date, 20) &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='endDate!=null'>",
-            " and charge_dcount_date &lt;=#{endDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), charge_dcount_date, 20) &lt;=#{endDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='dcountDate == null and beginDate == null and endDate == null'>",
             " and charge_dcount_no =0 ",
@@ -668,10 +668,10 @@ public interface ChargeFeeVoMapper {
             " and closing_date=#{dcountDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='beginDate!=null'>",
-            " and closing_date &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), closing_date, 20) &gt;=#{beginDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='endDate!=null'>",
-            " and closing_date &lt;=#{endDate,jdbcType=TIMESTAMP} ",
+            " and CONVERT(varchar(100), closing_date, 20) &lt;=#{endDate,jdbcType=TIMESTAMP} ",
             "</when>",
             "<when test='dcountDate == null and beginDate == null and endDate == null'>",
             " and dcount_no =0 ",
@@ -808,7 +808,7 @@ public interface ChargeFeeVoMapper {
      * @param endDate
      * @return
      */
-    @Select("select operator_id from  mz_receipt_serial where dcount_date >=#{beginDate,jdbcType=TIMESTAMP} and dcount_date <=#{endDate,jdbcType=TIMESTAMP} group by operator_id")
+    @Select("select operator_id from  mz_receipt_serial where CONVERT(varchar(100), dcount_date, 20) >=#{beginDate,jdbcType=TIMESTAMP} and CONVERT(varchar(100), dcount_date, 20) <=#{endDate,jdbcType=TIMESTAMP} group by operator_id")
     List<String> selectAllOperatorFromReceipt(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     /**
@@ -818,7 +818,7 @@ public interface ChargeFeeVoMapper {
      * @param endDate
      * @return
      */
-    @Select("select op_id from  mzy_reqrec where closing_date >=#{beginDate,jdbcType=TIMESTAMP} and closing_date <=#{endDate,jdbcType=TIMESTAMP} group by op_id")
+    @Select("select op_id from  mzy_reqrec where CONVERT(varchar(100), closing_date, 20) >=#{beginDate,jdbcType=TIMESTAMP} and CONVERT(varchar(100), closing_date, 20) <=#{endDate,jdbcType=TIMESTAMP} group by op_id")
     List<String> selectAllOperatorFromReqrec(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     /**
@@ -840,8 +840,8 @@ public interface ChargeFeeVoMapper {
             "           total_amount=sum((case  when b.cancel_mark in ('0','1') then  b.req_fee + b.clinic_fee + b.oth_fee + isnull(b.bl_fee,0) + isnull(b.ck_fee,0) else 0 end)) " +
             "    FROM ${tableName}   b " +
             "   WHERE " +
-            "         (case when 1=0 then b.op_day else b.closing_date end) <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and " +
-            "         (case when 1=0 then b.op_day else b.closing_date end) <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}  " +
+            "         (case when 1=0 then CONVERT(varchar(100), b.op_day, 20) else CONVERT(varchar(100), b.closing_date, 20) end) <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and " +
+            "         (case when 1=0 then CONVERT(varchar(100), b.op_day, 20) else CONVERT(varchar(100), b.closing_date, 20) end) <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}  " +
             "<when test='cashId!=null'>" +
             " and b.op_id =#{cashId}" +
             "</when>" +
@@ -873,8 +873,8 @@ public interface ChargeFeeVoMapper {
             "       total_amount=sum(case when pay_mark in ('0','1') then amount else 0 end) " +
             " from " +
             " ${tableName} " +
-            " where dcount_date <![CDATA[>=]]> #{beginDate} and " +
-            "      dcount_date <![CDATA[<=]]> #{endDate}  and pay_mark <![CDATA[<>]]> 2 " +
+            " where CONVERT(varchar(100),dcount_date, 20) <![CDATA[>=]]> #{beginDate} and " +
+            "      CONVERT(varchar(100),dcount_date, 20) <![CDATA[<=]]> #{endDate}  and pay_mark <![CDATA[<>]]> 2 " +
             "<when test='cashId!=null'>" +
             " and op_id =#{cashId} " +
             "</when>" +