Browse Source

Merge remote-tracking branch 'origin/dev/20200624_1.3.6.2' into test

zhaops 5 years ago
parent
commit
0f656eef99

+ 3 - 3
doc/011.20200619v1.3.6.1/qc_initv1.3.6.1.sql

@@ -2,7 +2,7 @@ use `qc`;
 
 -- 新增权限
 INSERT INTO `sys_permission`(`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES (100, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关键条目缺陷占比', 'FUNC000100', '/console/entryStatistics', 'ALL', '数据报表明细-关键条目缺陷占比', NULL);
-INSERT INTO `sys_role_permission`(`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES (1655, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 100, '数据报表明细-关键条目缺陷占比');
-INSERT INTO `sys_menu_permission`(`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `remark`) VALUES (72, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 34, 100, '数据报表明细-关键条目缺陷占比');
+INSERT INTO `sys_role_permission`(`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 100, '数据报表明细-关键条目缺陷占比');
+INSERT INTO `sys_menu_permission`(`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 34, 100, '数据报表明细-关键条目缺陷占比');
 INSERT INTO `sys_menu`(`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES (34, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关键条目缺陷占比', 17, 'YH-ZKK-GJTMQXZB', 1, 1, 10, '用户-质控科-关键条目缺陷占比');
-INSERT INTO `sys_role_menu`(`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES (826, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 34, '用户-质控科-关键条目缺陷占比');
+INSERT INTO `sys_role_menu`(`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 34, '用户-质控科-关键条目缺陷占比');

+ 0 - 53
src/main/java/com/diagbot/aggregate/ResultStatisticsAggregate.java

@@ -71,60 +71,7 @@ public class ResultStatisticsAggregate {
      */
     @DataProvider("entryCountGroupByCase")
     public List<NumDTO> entryCountGroupByCase(@InvokeParameter("filterVO") FilterVO filterVO) {
-        DecimalFormat df = new DecimalFormat("#0.00");
-        Integer limitCount = filterVO.getLimitCount();
-        QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
-        BeanUtil.copyProperties(filterVO, qcresultFilterVO);
-        int mrNum = qcresultInfoFacade.resultCount(qcresultFilterVO);
         List<NumDTO> qcEntryNumList = qcresultInfoFacade.entryCountGroupByCase(filterVO);
-        List<NumDTO> standardEntryNumList = qcCasesFacade.entryGroupByCase();
-        if (ListUtil.isEmpty(qcEntryNumList)) {
-            return qcEntryNumList;
-        }
-        if (ListUtil.isEmpty(standardEntryNumList)
-                && ListUtil.isNotEmpty(qcEntryNumList)) {
-            qcEntryNumList.forEach(entryNum -> {
-                entryNum.setNum(0);
-                entryNum.setPercent(0d);
-                entryNum.setPercentStr("0%");
-                entryNum.setTotleNum(0);
-            });
-        }
-        if (ListUtil.isNotEmpty(qcEntryNumList)) {
-            Map<String, Integer> standardMap
-                    = EntityUtil.makeMapWithKeyValue(standardEntryNumList, "name", "num");
-            qcEntryNumList.forEach(item -> {
-                if (!standardMap.containsKey(item.getName())) {
-                    item.setTotleNum(0);
-                    item.setPercent(0d);
-                    item.setPercentStr("0%");
-                } else {
-                    Integer totleNum = standardMap.get(item.getName()) * mrNum;
-                    Double percent = BigDecimal.valueOf(item.getNum())
-                            .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
-                            .doubleValue();
-                    String percentStr
-                            = df.format(BigDecimal.valueOf(percent).multiply(BigDecimal.valueOf(100))) + "%";
-                    item.setTotleNum(totleNum);
-                    item.setPercent(percent);
-                    item.setPercentStr(percentStr);
-                }
-            });
-            //降序排序
-            Collections.sort(qcEntryNumList, new Comparator<NumDTO>() {
-                @Override
-                public int compare(NumDTO o1, NumDTO o2) {
-                    return o2.getPercent().compareTo(o1.getPercent());
-                }
-            });
-        }
-
-        //取top10
-        qcEntryNumList = qcEntryNumList
-                .stream()
-                .limit(limitCount)
-                .collect(Collectors.toList());
-
         return qcEntryNumList;
     }
 

+ 1 - 1
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -453,7 +453,7 @@ public class ConsoleFacade {
     }
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
      *
      * @param filterOrderVO
      * @return

+ 2 - 2
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -182,7 +182,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计-关联上级科室
      *
      * @param filterOrderVO
      * @return
@@ -190,7 +190,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
     public List<LevelStatisticsTZDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)(台州)
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
      *
      * @param filterOrderVO
      * @return

+ 2 - 2
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -183,7 +183,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(关联上级科室
      *
      * @param filterOrderVO
      * @return
@@ -191,7 +191,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
     public List<LevelStatisticsTZDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)(台州)
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
      *
      * @param filterOrderVO
      * @return

+ 2 - 2
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -246,7 +246,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     }
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计-关联上级科室
      *
      * @param filterOrderVO
      * @return
@@ -257,7 +257,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     }
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)(台州)
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
      *
      * @param filterOrderVO
      * @return

+ 1 - 1
src/main/java/com/diagbot/vo/BehospitalPageVO.java

@@ -69,7 +69,7 @@ public class BehospitalPageVO extends Page implements Serializable {
     /**
      * 住院科室名称
      */
-    private Long deptId;
+    private String deptId;
 
     /**
      * 医生姓名

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

@@ -394,12 +394,12 @@ public class ConsoleController {
     }
 
     /**
-     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)
      *
      * @param filterOrderVO
      * @return
      */
-    @ApiOperation(value = "各科室缺陷占比(组合)-全院-根据内外科系统统计[by:zhaops]",
+    @ApiOperation(value = "各科室缺陷占比(组合)-全院-根据内外科系统统计(台州)[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
                     "level: 病历等级 <br>" +
                     "name: 科室名称 <br>" +

+ 64 - 110
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -617,8 +617,11 @@
         AND a.hospital_id = c.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.beh_dept_id = c.dept_id
-        AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
-        <![CDATA[AND ( b.newborn_month IS NOT NULL OR b.newborn_month <> '' OR b.newborn_day IS NOT NULL OR b.newborn_day <> '' )]]>
+        -- AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
+        AND (
+        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' )
+        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' )
+        )
         AND a.is_placefile = '1'
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="userId!=null">
@@ -929,33 +932,18 @@
         SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count( DISTINCT c.id ) AS mrNum,
+        count(*) AS mrNum,
         ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
-        COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
-        COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
-        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,
-        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 ),
-        '%'
-        ) AS firstLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
-        '%'
-        ) AS secondLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
-        '%'
-        ) AS thirdLevelPercentStr
+        ROUND( avg( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
+        SUM( c.`level` = '甲' ) AS firstLevelNum,
+        SUM( c.`level` = '乙' ) AS secondLevelNum,
+        SUM( c.`level` = '丙' ) AS thirdLevelNum,
+        ROUND( SUM( c.`level` = '甲' )/ count(*), 4 ) AS firstLevelPercent,
+        ROUND( SUM( c.`level` = '乙' )/ count(*), 4 ) AS secondLevelPercent,
+        ROUND( SUM( c.`level` = '丙' )/ count(*), 4 ) AS thirdLevelPercent,
+        concat( ROUND( SUM( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstLevelPercentStr,
+        concat( ROUND( SUM( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS secondLevelPercentStr,
+        concat( ROUND( SUM( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdLevelPercentStr
         FROM
         med_behospital_info a,
         med_qcresult_info c
@@ -965,7 +953,7 @@
         AND a.hospital_id = c.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.is_placefile = '1'
-        <![CDATA[AND a.qc_type_id <>0 ]]>
+        AND a.qc_type_id != 0
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -1007,7 +995,7 @@
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
         AND a.is_placefile = '1'
-        <![CDATA[AND a.qc_type_id <>0 ]]>
+        AND a.qc_type_id != 0
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -1074,7 +1062,7 @@
         </if>
     </select>
 
-    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州 -->
+    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计-关联上级科室 -->
     <select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO"
             resultType="com.diagbot.dto.LevelStatisticsTZDTO">
         SELECT
@@ -1281,7 +1269,7 @@
         </if>
     </select>
 
-    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空) -->
+    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州) -->
     <select id="levelStatisticsByDeptClass_TZ" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsTZDTO">
         SELECT
         t1.deptId,
@@ -1308,27 +1296,18 @@
         tt1.deptName,
         e.dept_id AS deptClassId,
         e.dept_name AS deptClass,
-        count( DISTINCT tt1.behospitalCode ) AS mrNum,
+        count(*) AS mrNum,
         ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
-        COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END ) AS firstLevelNum,
-        COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END ) AS secondLevelNum,
-        COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END ) AS thirdLevelNum,
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS firstLevelPercent,
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS secondLevelPercent,
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS thirdLevelPercent,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
-        '%'
-        ) AS firstLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
-        '%'
-        ) AS secondLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
-        '%'
-        ) AS thirdLevelPercentStr
+        ROUND( avg( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
+        sum( tt1.`level` = '甲' ) AS firstLevelNum,
+        sum( tt1.`level` = '乙' ) AS secondLevelNum,
+        sum( tt1.`level` = '丙' ) AS thirdLevelNum,
+        ROUND( sum( tt1.`level` = '甲' )/ count( * ), 4 ) AS firstLevelPercent,
+        ROUND( sum( tt1.`level` = '乙' )/ count( * ), 4 ) AS secondLevelPercent,
+        ROUND( sum( tt1.`level` = '丙' )/ count( * ), 4 ) AS thirdLevelPercent,
+        concat( ROUND( sum( tt1.`level` = '甲' )/ count( * )* 100, 2 ), '%' ) AS firstLevelPercentStr,
+        concat( ROUND( sum( tt1.`level` = '乙' )/ count( * )* 100, 2 ), '%' ) AS secondLevelPercentStr,
+        concat( ROUND( sum( tt1.`level` = '丙' )/ count( * )* 100, 2 ), '%' ) AS thirdLevelPercentStr
         FROM
         (
         SELECT
@@ -1352,7 +1331,8 @@
         AND a.behospital_code = c.behospital_code
         AND a.beh_dept_id = d.dept_id
         AND a.is_placefile = '1'
-        <![CDATA[AND a.qc_type_id <>0 ]]>
+        AND a.is_placefile = '1'
+        AND a.qc_type_id != 0
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -1417,7 +1397,8 @@
         AND d.cases_entry_id = e.id
         AND a.beh_dept_id = f.dept_id
         AND a.is_placefile = '1'
-        <![CDATA[AND a.qc_type_id <>0 ]]>
+        AND a.is_placefile = '1'
+        AND a.qc_type_id != 0
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -1525,21 +1506,15 @@
         SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count( DISTINCT a.behospital_code ) AS mrNum,
+        count( * ) AS mrNum,
         ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
-        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,
-        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(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
-        '%'
-        ) AS secondLevelPercentStr
+        ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
+        SUM( c.`level` = '合格' ) AS firstLevelNum,
+        SUM( c.`level` = '不合格' ) AS secondLevelNum,
+        ROUND( SUM( c.`level` = '合格' )/ count( * ), 4 ) AS firstLevelPercent,
+        ROUND( SUM( c.`level` = '不合格' )/ count( * ), 4 ) AS secondLevelPercent,
+        concat( ROUND( SUM( c.`level` = '合格' )/ count( * )* 100, 2 ),'%' ) AS firstLevelPercentStr,
+        concat( ROUND( SUM( c.`level` = '不合格' )/ count( * )* 100, 2 ),'%' ) AS secondLevelPercentStr
         FROM
         med_behospital_info a,
         med_qcresult_cases c
@@ -1763,33 +1738,18 @@
         SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
-        count( DISTINCT c.id ) AS mrNum,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
-        COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
-        COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
-        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,
-        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 ),
-        '%'
-        ) AS firstLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
-        '%'
-        ) AS secondLevelPercentStr,
-        concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
-        '%'
-        ) AS thirdLevelPercentStr
+        count(*) AS mrNum,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
+        SUM( c.`level` = '甲' ) AS firstLevelNum,
+        SUM( c.`level` = '乙' ) AS secondLevelNum,
+        SUM( c.`level` = '丙' ) AS thirdLevelNum,
+        ROUND( SUM( c.`level` = '甲' )/ count(*), 4 ) AS firstLevelPercent,
+        ROUND( SUM( c.`level` = '乙' )/ count(*), 4 ) AS secondLevelPercent,
+        ROUND( SUM( c.`level` = '丙' )/ count(*), 4 ) AS thirdLevelPercent,
+        concat( ROUND( SUM( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstLevelPercentStr,
+        concat( ROUND( SUM( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS secondLevelPercentStr,
+        concat( ROUND( SUM( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdLevelPercentStr
         FROM
         med_behospital_info a,
         med_qcresult_info c,
@@ -1954,21 +1914,15 @@
         SELECT
         CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
         CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
-        count( DISTINCT a.behospital_code ) AS mrNum,
+        count( * ) AS mrNum,
         ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
-        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,
-        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(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
-        '%'
-        ) AS secondLevelPercentStr
+        ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
+        sum( c.`level` = '合格' ) AS firstLevelNum,
+        sum( c.`level` = '不合格' ) AS secondLevelNum,
+        ROUND( sum( c.`level` = '合格' ) / count( * ), 4 ) AS firstLevelPercent,
+        ROUND( sum( c.`level` = '不合格' )/ count( * ), 4 ) AS secondLevelPercent,
+        concat( ROUND( sum( c.`level` = '合格' ) / count( * )* 100, 2 ), '%' ) AS firstLevelPercentStr,
+        concat( ROUND( sum( c.`level` = '不合格' )/ count( * )* 100, 2 ), '%' ) AS secondLevelPercentStr
         FROM
         med_behospital_info a,
         med_qcresult_cases c,
@@ -2907,7 +2861,7 @@
             AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND a.beh_dept_name = #{qcResultShortPageVO.doctorName}
+            AND a.doctor_name = #{qcResultShortPageVO.doctorName}
         </if>
         <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
             AND b.`level` = #{qcResultShortPageVO.level}

File diff suppressed because it is too large
+ 413 - 330
src/main/resources/mapper/QcresultInfoMapper.xml