Explorar o código

入院时间修改

gaodm %!s(int64=4) %!d(string=hai) anos
pai
achega
316047b8a5

+ 51 - 51
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -63,7 +63,6 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletResponse;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -975,16 +974,16 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
             }
         }
-        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
-        behospitalPageVO.setIsPlacefile("1");
-        if (null != behospitalPageVO.getStatisticsType()
-                && null == behospitalPageVO.getLeaveHosDateStart()
-                && null == behospitalPageVO.getLeaveHosDateEnd()) {
-            String startDate = filterFacade.getStartDateStr(behospitalPageVO.getStatisticsType(), null);
-            String endDate = filterFacade.getEndDateStr(behospitalPageVO.getStatisticsType(), null);
-            behospitalPageVO.setLeaveHosDateStart(DateUtil.parseDate(startDate));
-            behospitalPageVO.setLeaveHosDateEnd(DateUtil.parseDate(endDate));
-        }
+//        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+//        behospitalPageVO.setIsPlacefile("1");
+//        if (null != behospitalPageVO.getStatisticsType()
+//                && null == behospitalPageVO.getLeaveHosDateStart()
+//                && null == behospitalPageVO.getLeaveHosDateEnd()) {
+//            String startDate = filterFacade.getStartDateStr(behospitalPageVO.getStatisticsType(), null);
+//            String endDate = filterFacade.getEndDateStr(behospitalPageVO.getStatisticsType(), null);
+//            behospitalPageVO.setLeaveHosDateStart(DateUtil.parseDate(startDate));
+//            behospitalPageVO.setLeaveHosDateEnd(DateUtil.parseDate(endDate));
+//        }
     }
 
     public void exportExcelFac(HttpServletResponse response) {
@@ -1000,23 +999,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param exportQcresultVO
      */
     public void exportQcresult(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         exportQcresultVO.setHospitalId(hospitalId);
-        Date startDate = exportQcresultVO.getLeaveHosDateStart();
-        Date endDate = exportQcresultVO.getLeaveHosDateEnd();
-        //时间间隔7天
-        long interval = 7 * 24 * 60 * 60 * 1000;
-        if (endDate.getTime() < startDate.getTime()) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
-        }
-        if (endDate.getTime() - startDate.getTime() > interval) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
-        }
-
-        exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
+        //时间设置
+        exportQcresultVOSet(exportQcresultVO);
         List<ExportExcelDTO> res = this.exportQcresult(exportQcresultVO);
-        String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
+        String fileName = "抽查住院病历质量情况.xls";
         response.setContentType("text/html;charset=UTF-8");
         ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
@@ -1028,24 +1016,14 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param exportQcresultVO
      */
     public void exportQcresultByDept(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         String userId = SysUserUtils.getCurrentPrincipleID();
         exportQcresultVO.setHospitalId(hospitalId);
         exportQcresultVO.setUserId(Long.valueOf(userId));
-        Date startDate = exportQcresultVO.getLeaveHosDateStart();
-        Date endDate = exportQcresultVO.getLeaveHosDateEnd();
-        //时间间隔7天
-        long interval = 7 * 24 * 60 * 60 * 1000;
-        if (endDate.getTime() < startDate.getTime()) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
-        }
-        if (endDate.getTime() - startDate.getTime() > interval) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
-        }
-        exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
+        //时间设置
+        exportQcresultVOSet(exportQcresultVO);
         List<ExportExcelDTO> res = this.exportQcresultByDept(exportQcresultVO);
-        String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
+        String fileName = "抽查住院病历质量情况.xls";
         response.setContentType("text/html;charset=UTF-8");
         ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
@@ -1057,28 +1035,50 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param exportQcresultVO
      */
     public void exportQcresultByGroup(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         String userId = SysUserUtils.getCurrentPrincipleID();
         exportQcresultVO.setHospitalId(hospitalId);
         exportQcresultVO.setUserId(Long.valueOf(userId));
-        Date startDate = exportQcresultVO.getLeaveHosDateStart();
-        Date endDate = exportQcresultVO.getLeaveHosDateEnd();
-        //时间间隔7天
-        long interval = 7 * 24 * 60 * 60 * 1000;
-        if (endDate.getTime() < startDate.getTime()) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
-        }
-        if (endDate.getTime() - startDate.getTime() > interval) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
-        }
-        exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
+        //时间设置
+        exportQcresultVOSet(exportQcresultVO);
         List<ExportExcelDTO> res = this.exportQcresultByGroup(exportQcresultVO);
-        String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
+        String fileName = "抽查住院病历质量情况.xls";
         response.setContentType("text/html;charset=UTF-8");
         ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
 
+    private void exportQcresultVOSet(ExportQcresultVO exportQcresultVO){
+        //入参验证
+        long interval = 7 * 24 * 60 * 60 * 1000;
+        //入院时间
+        if (null != exportQcresultVO && null != exportQcresultVO.getBehosDateStart() && null != exportQcresultVO.getBehosDateEnd()) {
+            Date startDate = exportQcresultVO.getBehosDateStart();
+            Date endDate = exportQcresultVO.getBehosDateEnd();
+            //时间间隔7天
+            if (endDate.getTime() < startDate.getTime()) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+            }
+            if (endDate.getTime() - startDate.getTime() > interval) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+            }
+            exportQcresultVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getBehosDateStart()));
+            exportQcresultVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getBehosDateEnd(), 1)));
+        }
+        //出院时间
+        if (null != exportQcresultVO && null != exportQcresultVO.getLeaveHosDateStart() && null != exportQcresultVO.getLeaveHosDateEnd()) {
+            Date startDate = exportQcresultVO.getLeaveHosDateStart();
+            Date endDate = exportQcresultVO.getLeaveHosDateEnd();
+            //时间间隔7天
+            if (endDate.getTime() < startDate.getTime()) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+            }
+            if (endDate.getTime() - startDate.getTime() > interval) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+            }
+            exportQcresultVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getLeaveHosDateStart()));
+            exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getLeaveHosDateEnd(), 1)));
+        }
+    }
 
     /**
      * 设置共用code数据

+ 9 - 0
src/main/java/com/diagbot/vo/ExportQcresultVO.java

@@ -14,6 +14,15 @@ import java.util.Date;
 @Getter
 @Setter
 public class ExportQcresultVO {
+    /**
+     * 入院时间开始时间
+     */
+    private Date behosDateStart;
+
+    /**
+     * 入院时间结束时间
+     */
+    private Date behosDateEnd;
     private Date leaveHosDateStart;
     private Date leaveHosDateEnd;
     @ApiModelProperty(hidden = true)

+ 36 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2828,6 +2828,12 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>
@@ -2877,6 +2883,12 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>
@@ -3023,6 +3035,12 @@
         <if test="userId != null ">
             AND e.user_id = #{userId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>
@@ -3079,6 +3097,12 @@
         <if test="userId != null ">
             AND c.user_id = #{userId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>
@@ -3228,6 +3252,12 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>
@@ -3287,6 +3317,12 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
         <if test="leaveHosDateStart != null ">
             <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
         </if>