فهرست منبع

控制台-病历相关统计

zhaops 5 سال پیش
والد
کامیت
4c7f695baa

+ 27 - 24
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -2,7 +2,6 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.ResultDetailDTO;
-import com.diagbot.dto.ResultStatisticsDTO;
 import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.enums.IsDeleteEnum;
@@ -11,7 +10,6 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.FilterVO;
-import com.fasterxml.jackson.datatype.jsr310.DecimalUtils;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -44,7 +42,7 @@ public class ConsoleFacade {
      *
      * @return
      */
-    public Map<String, Object> mrStatistics() {
+    public Map<String, Object> mrStatistics(FilterVO filterVO) {
         Map<String, Object> retMap = new HashMap<>();
         retMap.put("本月病历数", 0);
         retMap.put("本月质控数-人工", 0);
@@ -57,11 +55,10 @@ public class ConsoleFacade {
         retMap.put("本月不合格病历-机器", 0);
 
         String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String startDate = getStartDateStr(filterVO.getType());
+        filterVO.setStartDate(startDate);
+        filterVO.setHospitalId(hospitalId);
 
-        Date date = new Date();
-        String year = DateUtil.getYear(date);
-        int month = DateUtil.getMonth(date);
-        String startDate = year + "-" + month + "-1";
         QueryWrapper<BehospitalInfo> behospitalInfoQueryWrapper = new QueryWrapper<>();
         behospitalInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", hospitalId)
@@ -72,11 +69,7 @@ public class ConsoleFacade {
             retMap.put("本月病历数", behospitalInfoList.size());
         }
 
-        QueryWrapper<QcresultInfo> qcresultInfoQueryWrapper = new QueryWrapper<>();
-        qcresultInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId)
-                .ge("gmt_create", startDate);
-        List<QcresultInfo> qcresultInfoList = qcresultInfoFacade.list(qcresultInfoQueryWrapper);
+        List<QcresultInfo> qcresultInfoList = qcresultInfoFacade.getQcresultSelectively(filterVO);
         if (ListUtil.isNotEmpty(qcresultInfoList)) {
             retMap.put("本月质控数-人工", qcresultInfoList
                     .stream()
@@ -121,7 +114,6 @@ public class ConsoleFacade {
         }
 
         return retMap;
-
     }
 
     /**
@@ -135,17 +127,7 @@ public class ConsoleFacade {
         retMap.put("缺陷排行列表", Lists.newLinkedList());
         retMap.put("各科室缺陷占比", Lists.newLinkedList());
         String hospitalId = SysUserUtils.getCurrentHospitalID();
-        Date date = new Date();
-        String startDate = "";
-        String year = DateUtil.getYear(date);
-        int month = DateUtil.getMonth(date);
-        if (filterVO.getType().equals(1)) {
-            //本月统计
-            startDate = year + "-" + month + "-1";
-        } else if (filterVO.getType().equals(2)) {
-            //本年统计
-            startDate = year + "-1-1";
-        }
+        String startDate = getStartDateStr(filterVO.getType());
         filterVO.setStartDate(startDate);
         filterVO.setHospitalId(hospitalId);
         filterVO.setLimitCount(10);
@@ -197,4 +179,25 @@ public class ConsoleFacade {
         }
         return retMap;
     }
+
+    /**
+     * 筛选起始时间
+     * @param type
+     * @return
+     */
+    public String  getStartDateStr(Integer type) {
+        Date date = new Date();
+        String startDate = "";
+        String year = DateUtil.getYear(date);
+        int month = DateUtil.getMonth(date);
+        if (type.equals(1)) {
+            //本月统计
+            startDate = year + "-" + month + "-1";
+        } else if (type.equals(2)) {
+            //本年统计
+            startDate = year + "-1-1";
+        }
+        return startDate;
+    }
+
 }

+ 10 - 0
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -2,6 +2,9 @@ package com.diagbot.mapper;
 
 import com.diagbot.entity.QcresultInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.FilterVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -14,4 +17,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
 
+    /**
+     * 筛选质控记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO);
 }

+ 10 - 0
src/main/java/com/diagbot/service/QcresultInfoService.java

@@ -2,6 +2,9 @@ package com.diagbot.service;
 
 import com.diagbot.entity.QcresultInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.FilterVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -14,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface QcresultInfoService extends IService<QcresultInfo> {
 
+    /**
+     * 筛选质控记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO);
 }

+ 14 - 1
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -1,11 +1,14 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.mapper.QcresultInfoMapper;
 import com.diagbot.service.QcresultInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.FilterVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 质控评分结果信息
@@ -18,4 +21,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, QcresultInfo> implements QcresultInfoService {
 
+    /**
+     * 筛选质控记录
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO) {
+        return baseMapper.getQcresultSelectively(filterVO);
+    }
 }

+ 2 - 2
src/main/java/com/diagbot/web/ConsoleController.java

@@ -32,8 +32,8 @@ public class ConsoleController {
             notes = "")
     @PostMapping("/mrStatistics")
     @SysLogger("mrStatistics")
-    public RespDTO<Map<String, Object>> mrStatistics() {
-        Map<String, Object> data = consoleFacade.mrStatistics();
+    public RespDTO<Map<String, Object>> mrStatistics(@RequestBody FilterVO filterVO) {
+        Map<String, Object> data = consoleFacade.mrStatistics(filterVO);
         return RespDTO.onSuc(data);
     }
 

+ 20 - 0
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -18,4 +18,24 @@
         <result column="remark" property="remark" />
     </resultMap>
 
+    <!-- 缺陷排行列表 -->
+    <select id="getQcresultSelectively"  parameterType="com.diagbot.vo.FilterVO" resultMap="BaseResultMap">
+        SELECT
+        b.*
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b
+        WHERE
+        a.hospital_id = b.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= #{startDate}]]>
+        </if>
+    </select>
+
 </mapper>