Browse Source

控制台-病案首页统计

zhaops 5 years ago
parent
commit
12b5748f91

+ 4 - 0
src/main/java/com/diagbot/vo/FilterOrderVO.java

@@ -25,5 +25,9 @@ public class FilterOrderVO extends FilterVO {
      * 排序(降序)
      */
     private String desc;
+
+    /**
+     * 科室名称/主管医生名称
+     */
     private String name;
 }

+ 5 - 0
src/main/java/com/diagbot/vo/FilterPageVO.java

@@ -47,4 +47,9 @@ public class FilterPageVO extends Page {
      * 科室名称
      */
     private String deptName;
+
+    /**
+     * 模块id:243=病案首页
+     */
+    private Long casesId;
 }

+ 2 - 1
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -115,7 +115,8 @@ public class ConsoleByDeptController {
     @ApiOperation(value = "条目缺陷占比-科室(分页)-内页[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
                     "name: 缺陷名称<br>" +
-                    "deptName: 科室名称(必填)<br>")
+                    "deptName: 科室名称(必填)<br>"+
+                    "casesId: 模块id:243=病案首页 <br>")
     @PostMapping("/entryCountGroupByEntryAndDeptPage")
     @SysLogger("entryCountGroupByEntryAndDeptPage")
     public RespDTO<IPage<DeptNumDTO>> entryCountGroupByEntryAndDeptPage(@RequestBody FilterPageByDeptVO filterPageByDeptVO) {

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

@@ -214,14 +214,15 @@ public class ConsoleController {
     }
 
     /**
-     * 各模块缺陷占比(分页)
+     * 条目缺陷占比(分页)
      *
      * @param filterPageVO
      * @return
      */
     @ApiOperation(value = "条目缺陷占比(分页)[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>"+
-                    "deptName: 科室名称 <br>")
+                    "deptName: 科室名称 <br>"+
+                    "casesId: 模块id:243=病案首页 <br>")
     @PostMapping("/entryCountGroupByEntryPage")
     @SysLogger("entryCountGroupByEntryPage")
     public RespDTO<IPage<NumDTO>> entryCountGroupByEntryPage(@RequestBody FilterPageVO filterPageVO) {

+ 65 - 52
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -881,7 +881,6 @@
         )t
     </select>
 
-
     <!-- 各科室缺陷占比(组合) -->
     <select id="levelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
         SELECT
@@ -901,7 +900,8 @@
         t1.secondLevelPercentStr,
         t1.thirdLevelPercentStr
         FROM
-        (SELECT
+        (
+        SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
         count( DISTINCT c.id ) AS mrNum,
@@ -912,7 +912,7 @@
         COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
-        1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) - ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
         concat(
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
@@ -922,8 +922,7 @@
         '%'
         ) AS secondLevelPercentStr,
         concat(
-        (
-        100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ) - ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 )),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS thirdLevelPercentStr
         FROM
@@ -956,16 +955,18 @@
         </if>
         GROUP BY
         a.beh_dept_id,
-        a.beh_dept_name)t1,
-        (SELECT
+        a.beh_dept_name
+        ) t1,
+        (
+        SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count( DISTINCT d.id ) AS entryNum
+        count( * ) AS entryNum
         FROM
         med_behospital_info a,
         med_home_page b,
-        med_qcresult_info c,
-        med_qcresult_detail d
+        med_qcresult_detail c,
+        qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
         AND b.is_deleted = 'N'
@@ -973,10 +974,10 @@
         AND d.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.hospital_id = d.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND a.behospital_code = d.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
@@ -995,9 +996,11 @@
         </if>
         GROUP BY
         a.beh_dept_id,
-        a.beh_dept_name)t2
-        where t1.deptId=t2.deptId
-        and t1.deptName=t2.deptName
+        a.beh_dept_name
+        ) t2
+        WHERE
+        t1.deptId = t2.deptId
+        AND t1.deptName = t2.deptName
         <if test="asc != null and asc !=''">
             order by
             <choose>
@@ -1058,7 +1061,8 @@
         t1.firstLevelPercentStr,
         t1.secondLevelPercentStr
         FROM
-        (SELECT
+        (
+        SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
         count( DISTINCT c.id ) AS mrNum,
@@ -1067,13 +1071,13 @@
         COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
         COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
-        1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
         concat(
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS firstLevelPercentStr,
         concat(
-        100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS secondLevelPercentStr
         FROM
@@ -1107,16 +1111,18 @@
         </if>
         GROUP BY
         a.beh_dept_id,
-        a.beh_dept_name)t1,
-        (SELECT
+        a.beh_dept_name
+        ) t1,
+        (
+        SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count( DISTINCT d.id ) AS entryNum
+        count( * ) AS entryNum
         FROM
         med_behospital_info a,
         med_home_page b,
-        med_qcresult_cases c,
-        med_qcresult_detail d
+        med_qcresult_detail c,
+        qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
         AND b.is_deleted = 'N'
@@ -1124,11 +1130,10 @@
         AND d.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.hospital_id = d.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND a.behospital_code = d.behospital_code
         AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         AND c.cases_id = 243
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
@@ -1148,9 +1153,11 @@
         </if>
         GROUP BY
         a.beh_dept_id,
-        a.beh_dept_name) t2
-        where t1.deptId=t2.deptId
-        and t1.deptName=t2.deptName
+        a.beh_dept_name
+        ) t2
+        WHERE
+        t1.deptId = t2.deptId
+        AND t1.deptName = t2.deptName
         <if test="asc != null and asc !=''">
             order by
             <choose>
@@ -1208,7 +1215,8 @@
         t1.secondLevelPercentStr,
         t1.thirdLevelPercentStr
         FROM
-        (SELECT
+        (
+        SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
         count( DISTINCT c.id ) AS mrNum,
@@ -1219,7 +1227,7 @@
         COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
-        1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) - ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
         concat(
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
@@ -1229,8 +1237,7 @@
         '%'
         ) AS secondLevelPercentStr,
         concat(
-        (
-        100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ) - ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 )),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS thirdLevelPercentStr
         FROM
@@ -1272,16 +1279,18 @@
         </if>
         GROUP BY
         a.doctor_id,
-        a.doctor_name)t1,
-        (SELECT
+        a.doctor_name
+        ) t1,
+        (
+        SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
-        count( DISTINCT d.id ) AS entryNum
+        count( * ) AS entryNum
         FROM
         med_behospital_info a,
         med_home_page b,
-        med_qcresult_info c,
-        med_qcresult_detail d,
+        med_qcresult_detail c,
+        qc_cases_entry d,
         sys_user_dept e
         WHERE
         a.is_deleted = 'N'
@@ -1291,10 +1300,10 @@
         AND e.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.hospital_id = d.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND a.behospital_code = d.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         AND a.beh_dept_id = e.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
@@ -1320,7 +1329,8 @@
         </if>
         GROUP BY
         a.doctor_id,
-        a.doctor_name)t2
+        a.doctor_name
+        ) t2
         WHERE
         t1.doctorId = t2.doctorId
         AND t1.doctorName = t2.doctorName
@@ -1384,7 +1394,8 @@
         t1.firstLevelPercentStr,
         t1.secondLevelPercentStr
         FROM
-        (SELECT
+        (
+        SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
         count( DISTINCT c.id ) AS mrNum,
@@ -1393,13 +1404,13 @@
         COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
         COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
-        1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
         concat(
         ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS firstLevelPercentStr,
         concat(
-        100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS secondLevelPercentStr
         FROM
@@ -1438,20 +1449,22 @@
             AND e.user_id = #{userId}
         </if>
         <if test="deptName!=null and deptName !=''">
-        AND a.beh_dept_name = #{deptName}
+            AND a.beh_dept_name = #{deptName}
         </if>
         GROUP BY
         a.doctor_id,
-        a.doctor_name)t1,
-        (SELECT
+        a.doctor_name
+        ) t1,
+        (
+        SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
-        count( DISTINCT d.id ) AS entryNum
+        count( * ) AS entryNum
         FROM
         med_behospital_info a,
         med_home_page b,
-        med_qcresult_cases c,
-        med_qcresult_detail d,
+        med_qcresult_detail c,
+        qc_cases_entry d,
         sys_user_dept e
         WHERE
         a.is_deleted = 'N'
@@ -1461,12 +1474,11 @@
         AND e.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.hospital_id = d.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND a.behospital_code = d.behospital_code
         AND a.beh_dept_id = e.dept_id
         AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         AND c.cases_id = 243
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
@@ -1492,7 +1504,8 @@
         </if>
         GROUP BY
         a.doctor_id,
-        a.doctor_name)t2
+        a.doctor_name
+        ) t2
         WHERE
         t1.doctorId = t2.doctorId
         AND t1.doctorName = t2.doctorName

+ 21 - 3
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -515,7 +515,7 @@
         ) t
     </select>
 
-    <!-- 条目缺陷分组统计(分页) -->
+    <!-- 条目缺陷占比(分页) -->
     <select id="entryCountGroupByEntryPage"  resultType="com.diagbot.dto.NumDTO">
         SELECT t.*
         FROM
@@ -546,6 +546,9 @@
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="filterPageVO.casesId != null and filterPageVO.casesId != ''">
+            AND c.cases_id = #{filterPageVO.casesId}
+        </if>
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
@@ -581,6 +584,9 @@
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="filterPageVO.casesId != null and filterPageVO.casesId != ''">
+            AND c.cases_id = #{filterPageVO.casesId}
+        </if>
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
@@ -839,7 +845,7 @@
         ) t
     </select>
 
-    <!-- 条目缺陷分组统计-科室(分页) -->
+    <!-- 条目缺陷占比-科室(分页) -->
     <select id="entryCountGroupByEntryAndDeptPage"  resultType="com.diagbot.dto.DeptNumDTO">
         SELECT
         t.*
@@ -878,6 +884,9 @@
         AND c.cases_entry_id = d.id
         AND a.beh_dept_id = e.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != ''">
+            AND c.cases_id = #{filterPageByDeptVO.casesId}
+        </if>
         <if test="filterPageByDeptVO.userId!=null">
             AND e.user_id = #{filterPageByDeptVO.userId}
         </if>
@@ -896,6 +905,9 @@
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
         </if>
+        <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
+            AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+        </if>
         ) t1,(
         SELECT
         count(*) AS totleNum
@@ -920,6 +932,9 @@
         AND c.cases_entry_id = d.id
         AND a.beh_dept_id = e.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != ''">
+            AND c.cases_id = #{filterPageByDeptVO.casesId}
+        </if>
         <if test="filterPageByDeptVO.userId!=null">
             AND e.user_id = #{filterPageByDeptVO.userId}
         </if>
@@ -936,7 +951,10 @@
             AND d.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
-            AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
+            AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
+        </if>
+        <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
+            AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
         </if>
         ) t2
         GROUP BY