Explorar o código

病历质控统计

chengyao %!s(int64=3) %!d(string=hai) anos
pai
achega
0be3078e71

+ 23 - 51
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -11,6 +11,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.util.*;
 import com.diagbot.vo.*;
 import com.google.common.collect.Lists;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -125,57 +126,29 @@ public class ConsoleByDeptFacade {
         filterFacade.filterVOSet(filterVO);
         QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
         BeanUtil.copyProperties(filterVO, qcresultFilterVO);
-        //关联科室
-        Map<String, Object> deptMap = getDeptByUser(filterVO);
-        if (deptMap == null) {
+        //质控病历数
+        Map<String,Object> maps = qcresultInfoFacade.resultMrCountByDept(qcresultFilterVO);
+        if(MapUtils.isEmpty(maps)){
             return retMap;
         }
-        //质控病历总数
-        List<NumDTO> totleNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(totleNumList, "name");
-        //甲级病历
-        qcresultFilterVO.setLevel("甲");
-        List<NumDTO> firstNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> firstMap = ListUtil.isEmpty(firstNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(firstNumList, "name");
-        //乙级病历
-        qcresultFilterVO.setLevel("乙");
-        List<NumDTO> secondNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> secondMap = ListUtil.isEmpty(secondNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(secondNumList, "name");
-        //丙级病历
-        qcresultFilterVO.setLevel("丙");
-        List<NumDTO> thirdNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> thirdMap = ListUtil.isEmpty(thirdNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(thirdNumList, "name");
-        for (String deptName : deptMap.keySet()) {
-            List<NumDTO> retList = Lists.newLinkedList();
-            int totleNum = 0;
-            int firstLevelNum = 0;
-            int secondLevelNum = 0;
-            int thirdLevelNum = 0;
-            if (totleMap.containsKey(deptName)) {
-                totleNum = totleMap.get(deptName).getNum();
-            }
-            if (firstMap.containsKey(deptName)) {
-                firstLevelNum = firstMap.get(deptName).getNum();
-            }
-            if (secondMap.containsKey(deptName)) {
-                secondLevelNum = secondMap.get(deptName).getNum();
-            }
-            if (thirdMap.containsKey(deptName)) {
-                thirdLevelNum = thirdMap.get(deptName).getNum();
-            }
-            //总病历数为0
-            if (totleNum == 0) {
-                retMap.put(deptName, Lists.newLinkedList());
-                continue;
-            }
+        List<NumDTO> retList = Lists.newLinkedList();
+        int totleNum = 0;
+        int firstLevelNum = 0;
+        int secondLevelNum = 0;
+        int thirdLevelNum = 0;
+        if(null != maps.get("num")){
+            totleNum = Integer.parseInt(maps.get("num").toString());
+        }
+        if(null != maps.get("firNum")){
+            firstLevelNum = Integer.parseInt(maps.get("firNum").toString());
+        }
+        if(null != maps.get("secNum")){
+            secondLevelNum = Integer.parseInt(maps.get("secNum").toString());
+        }
+        if(null != maps.get("thrNum")){
+            thirdLevelNum = Integer.parseInt(maps.get("thrNum").toString());
+        }
+
             NumDTO totleNumDTO = new NumDTO();
             totleNumDTO.setName("累计质控病历数");
             totleNumDTO.setTotleNum(totleNum);
@@ -214,8 +187,7 @@ public class ConsoleByDeptFacade {
             retList.add(firstLevelNumDTO);
             retList.add(secondLevelNumDTO);
             retList.add(thirdLevelNumDTO);
-            retMap.put(deptName, retList);
-        }
+            retMap.put((String)maps.get("NAME"), retList);
         return retMap;
     }
 

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

@@ -89,6 +89,8 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      */
     public List<NumDTO> resultCountByDept(QcresultFilterVO qcresultFilterVO);
 
+    public Map<String,Object> resultMrCountByDept(QcresultFilterVO qcresultFilterVO);
+
     /**
      * 各模块缺陷占比-按科室
      *

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

@@ -17,6 +17,7 @@ import com.diagbot.vo.QcresultFilterVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -86,6 +87,8 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      */
     public List<NumDTO> resultCountByDept(QcresultFilterVO qcresultFilterVO);
 
+    public Map<String,Object> resultMrCountByDept(QcresultFilterVO qcresultFilterVO);
+
     /**
      * 各模块缺陷占比-按科室
      *

+ 4 - 0
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -113,6 +113,10 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
     public List<NumDTO> resultCountByDept(QcresultFilterVO qcresultFilterVO) {
         return baseMapper.resultCountByDept(qcresultFilterVO);
     }
+    @Override
+    public Map<String,Object> resultMrCountByDept(QcresultFilterVO qcresultFilterVO){
+        return baseMapper.resultMrCountByDept(qcresultFilterVO);
+    }
 
     /**
      * 各模块缺陷占比-按科室

+ 54 - 1
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -1040,7 +1040,7 @@
         SELECT
         a.beh_dept_id AS id,
         a.beh_dept_name AS NAME,
-        COUNT(*) AS num
+        COUNT(distinct a.behospital_code) AS num
         FROM
         med_behospital_info a,
         med_qcresult_info c,
@@ -1090,6 +1090,59 @@
         a.beh_dept_name
     </select>
 
+
+    <!-- 按科室统计质控病历数 -->
+    <select id="resultMrCountByDept" parameterType="com.diagbot.vo.QcresultFilterVO" resultType="java.util.Map">
+        SELECT
+        a.beh_dept_id AS id,
+        a.beh_dept_name AS NAME,
+        COUNT(distinct a.behospital_code) AS num,
+        COUNT(distinct case when c.level ='甲' then a.behospital_code end) AS firNum,
+        COUNT(distinct case when c.level ='乙' then a.behospital_code end) AS secNum,
+        COUNT(distinct case when c.level ='丙' then a.behospital_code end) AS thrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        sys_user_dept d
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = d.dept_id
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="userId!=null">
+            AND d.user_id = #{userId}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="gradeType != null and gradeType != ''">
+            AND c.grade_type = #{gradeType}
+        </if>
+    </select>
+
     <!-- 按模块统计质控缺陷数 -->
     <select id="entryCountGroupByCaseAndDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
         SELECT