Parcourir la source

1、各科室缺陷占比(组合)-全院-根据内外科系统统计
2、各科室质控平均分(首页)-根据内外科系统统计

zhaops il y a 5 ans
Parent
commit
520dafefbd

+ 1 - 1
src/main/java/com/diagbot/aggregate/AverageStatisticsAggregate.java

@@ -253,7 +253,7 @@ public class AverageStatisticsAggregate {
     @DataProvider("getAverageScore")
     public List<AverageStatisticsDTO> getAverageScore(@InvokeParameter("filterVO") FilterVO filterVO) {
         List<AverageStatisticsDTO> retAverageScoreList = Lists.newLinkedList();
-        List<AverageStatisticsDTO> averageScoreList = qcresultInfoFacade.getAverageScoreByDept(filterVO);
+        List<AverageStatisticsDTO> averageScoreList = qcresultInfoFacade.getAverageScore(filterVO);
         Integer limitCount = filterVO.getLimitCount();
         //质控平均分
         if (ListUtil.isNotEmpty(averageScoreList)) {

+ 6 - 4
src/main/java/com/diagbot/dto/AverageStatisticsDTO.java

@@ -14,10 +14,12 @@ public class AverageStatisticsDTO {
     private String id;
     private String name;
     private Integer num;
-    private Double averageValue=0d;
-    private Double totleValue=0d;
+    private Double averageValue = 0d;
+    private Double totleValue = 0d;
     //环比平均值
-    private Double lastAverageValue=0d;
+    private Double lastAverageValue = 0d;
     //同比平均值
-    private Double lastYearAverageValue=0d;
+    private Double lastYearAverageValue = 0d;
+    //科室分类
+    private String deptClass;
 }

+ 3 - 0
src/main/java/com/diagbot/dto/LevelStatisticsDTO.java

@@ -28,4 +28,7 @@ public class LevelStatisticsDTO {
     private String firstLevelPercentStr;
     private String secondLevelPercentStr;
     private String thirdLevelPercentStr;
+
+    private String deptClassId;
+    private String deptClass;
 }

+ 35 - 0
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -196,6 +196,24 @@ public class ConsoleFacade {
         return retMap;
     }
 
+    /**
+     * 各科室质控平均分(首页)-根据内外科系统统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO) {
+        filterVOSet(filterVO);
+        List<AverageStatisticsDTO> retAverageScoreList = Lists.newLinkedList();
+        List<AverageStatisticsDTO> averageScoreList = qcresultInfoFacade.getAverageScoreByDeptClass(filterVO);
+        Integer limitCount = filterVO.getLimitCount();
+        //质控平均分
+        if (ListUtil.isNotEmpty(averageScoreList)) {
+            retAverageScoreList = averageStatisticsAggregate.getLimitAverageList(averageScoreList, limitCount);
+        }
+        return retAverageScoreList;
+    }
+
     /**
      * 各科室甲级病历占比
      *
@@ -507,6 +525,23 @@ public class ConsoleFacade {
         return records;
     }
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO) {
+        String hosptialId = SysUserUtils.getCurrentHospitalID();
+        String startDate = filterFacade.getStartDateStr(filterOrderVO.getType(), null);
+        String endDate = filterFacade.getEndDateStr(filterOrderVO.getType(), null);
+        filterOrderVO.setStartDate(startDate);
+        filterOrderVO.setEndDate(endDate);
+        filterOrderVO.setHospitalId(hosptialId);
+        List<LevelStatisticsDTO> records = behospitalInfoFacade.levelStatisticsByDeptClass(filterOrderVO);
+        return records;
+    }
+
     /**
      * 病案首页合格率占比
      *

+ 8 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -163,4 +163,12 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @return
      */
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 }

+ 9 - 1
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -74,7 +74,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterVO
      * @return
      */
-    public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO);
+    public List<AverageStatisticsDTO> getAverageScore(FilterVO filterVO);
 
     /**
      * 按科室统计质控病历数
@@ -162,4 +162,12 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @return
      */
     public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+
+    /**
+     * 各科室质控平均分(首页)-根据内外科系统统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO);
 }

+ 8 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -164,4 +164,12 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @return
      */
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 }

+ 12 - 2
src/main/java/com/diagbot/service/QcresultInfoService.java

@@ -75,7 +75,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterVO
      * @return
      */
-    public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO);
+    public List<AverageStatisticsDTO> getAverageScore(FilterVO filterVO);
 
     /**
      * 按科室统计质控病历数
@@ -135,6 +135,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
 
     /**
      * 各模块缺陷占比-科室(分页)
+     *
      * @param filterPageByDeptVO
      * @return
      */
@@ -142,10 +143,11 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
 
     /**
      * 缺陷详情-科室(分页)
+     *
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO")FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 条目缺陷占比(内页)
@@ -161,4 +163,12 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @return
      */
     public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+
+    /**
+     * 各科室质控平均分(首页)-根据内外科系统统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO);
 }

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

@@ -19,8 +19,8 @@ import com.diagbot.vo.FilterPageByDeptVO;
 import com.diagbot.vo.FilterPageVO;
 import com.diagbot.vo.FilterVO;
 import com.diagbot.vo.HomePageFilterVO;
-import org.apache.ibatis.annotations.Param;
 import com.diagbot.vo.TaskVO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -229,4 +229,15 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
         return baseMapper.resultStatisticsByDeptAndDoctorPage(filterPageByDeptVO);
     }
+
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    @Override
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO) {
+        return baseMapper.levelStatisticsByDeptClass(filterOrderVO);
+    }
 }

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

@@ -95,8 +95,8 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO) {
-        return baseMapper.getAverageScoreByDept(filterVO);
+    public List<AverageStatisticsDTO> getAverageScore(FilterVO filterVO) {
+        return baseMapper.getAverageScore(filterVO);
     }
 
     /**
@@ -218,4 +218,15 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
     public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
         return baseMapper.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
     }
+
+    /**
+     * 各科室质控平均分(首页)-根据内外科系统统计
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO) {
+        return baseMapper.getAverageScoreByDeptClass(filterVO);
+    }
 }

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

@@ -42,4 +42,9 @@ public class FilterVO {
 
     @ApiModelProperty(hidden = true)
     private Long userId;
+
+    /**
+     * 科室分类
+     */
+    private String className;
 }

+ 34 - 0
src/main/java/com/diagbot/web/ConsoleController.java

@@ -115,6 +115,21 @@ public class ConsoleController {
         return RespDTO.onSuc(consoleFacade.getAverageScore(filterVO));
     }
 
+    /**
+     * 各科室质控平均分(首页)-根据内外科系统统计
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "各科室质控平均分(首页)-根据内外科系统统计[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
+                    "className: 科室分类:内科/外科,全部不传 <br>" )
+    @PostMapping("/getAverageScoreByDeptClass")
+    @SysLogger("getAverageScoreByDeptClass")
+    public RespDTO<Map<String, Object>> getAverageScoreByDeptClass(@RequestBody @Valid FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.getAverageScoreByDeptClass(filterVO));
+    }
+
     /**
      * 各科室甲级病历占比
      *
@@ -338,6 +353,25 @@ public class ConsoleController {
         return RespDTO.onSuc(consoleFacade.levelStatistics(filterOrderVO));
     }
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    @ApiOperation(value = "各科室缺陷占比(组合)-全院-根据内外科系统统计[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
+                    "level: 病历等级 <br>" +
+                    "name: 科室名称 <br>" +
+                    "className: 科室分类:内科/外科,全部不传 <br>" +
+                    "asc: 排序(升序) <br>" +
+                    "desc: 排序(降序) <br>")
+    @PostMapping("/levelStatisticsByDeptClass")
+    @SysLogger("levelStatisticsByDeptClass")
+    public RespDTO<List<LevelStatisticsDTO>> levelStatisticsByDeptClass(@RequestBody @Valid FilterOrderVO filterOrderVO) {
+        return RespDTO.onSuc(consoleFacade.levelStatisticsByDeptClass(filterOrderVO));
+    }
+
     /**
      * 病案首页合格率占比
      *

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

@@ -1068,6 +1068,208 @@
         </if>
     </select>
 
+    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计 -->
+    <select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
+        SELECT
+        t1.deptId,
+        t1.deptName,
+        t1.deptClassId,
+        t1.deptClass,
+        t2.entryNum,
+        t1.mrNum,
+        t1.totleValue,
+        t1.averageValue,
+        t1.firstLevelNum,
+        t1.secondLevelNum,
+        t1.thirdLevelNum,
+        t1.firstLevelPercent,
+        t1.secondLevelPercent,
+        t1.thirdLevelPercent,
+        t1.firstLevelPercentStr,
+        t1.secondLevelPercentStr,
+        t1.thirdLevelPercentStr
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        e.dept_id AS deptClassId,
+        e.dept_name AS deptClass,
+        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
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        med_qcresult_info c,
+        bas_dept_info d,
+        bas_dept_info e
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        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.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = d.dept_id
+        AND d.parent_dept_id = e.dept_id
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="className != null and className != ''">
+            and e.dept_name = #{className}
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name,
+        e.dept_id,
+        e.dept_name
+        ) t1,
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        g.dept_id AS deptClassId,
+        g.dept_name AS deptClass,
+        count( * ) AS entryNum
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        med_qcresult_info c,
+        med_qcresult_detail d,
+        qc_cases_entry e,
+        bas_dept_info f,
+        bas_dept_info g
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND g.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.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND a.beh_dept_id = f.dept_id
+        AND f.parent_dept_id = g.dept_id
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="className != null and className != ''">
+            and g.dept_name = #{className}
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name,
+        g.dept_id,
+        g.dept_name
+        ) t2
+        WHERE
+        t1.deptId = t2.deptId
+        AND t1.deptName = t2.deptName
+        AND t1.deptClassId = t2.deptClassId
+        AND t1.deptClass = t2.deptClass
+        <if test="asc != null and asc !=''">
+            order by
+            <choose>
+                <when test='asc=="deptId"'>deptId asc</when>
+                <when test='asc=="deptName"'>deptName asc</when>
+                <when test='asc=="entryNum"'>entryNum asc</when>
+                <when test='asc=="mrNum"'>mrNum asc</when>
+                <when test='asc=="totleValue"'>totleValue asc</when>
+                <when test='asc=="averageValue"'>averageValue asc</when>
+                <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
+                <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
+                <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
+                <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
+                <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
+                <otherwise> deptName asc </otherwise>
+            </choose>
+        </if>
+        <if test="desc != null and desc!=''">
+            order by
+            <choose>
+                <when test='desc=="deptId"'>deptId desc</when>
+                <when test='desc=="deptName"'>deptName desc</when>
+                <when test='desc=="entryNum"'>entryNum desc</when>
+                <when test='desc=="mrNum"'>mrNum desc</when>
+                <when test='desc=="totleValue"'>totleValue desc</when>
+                <when test='desc=="averageValue"'>averageValue desc</when>
+                <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
+                <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
+                <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
+                <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
+                <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
+                <otherwise> deptName desc </otherwise>
+            </choose>
+        </if>
+    </select>
+
     <!-- 病案首页合格率占比 -全院-->
     <select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
         SELECT

+ 49 - 2
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -326,8 +326,8 @@
         )t
     </select>
 
-    <!-- 质控平均分按科室统计 -->
-    <select id="getAverageScoreByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AverageStatisticsDTO">
+    <!-- 各科室质控平均分(首页) -->
+    <select id="getAverageScore" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AverageStatisticsDTO">
         SELECT
         a.beh_dept_id AS id,
         a.beh_dept_name AS name,
@@ -361,6 +361,53 @@
         a.beh_dept_name
     </select>
 
+    <!-- 各科室质控平均分(首页)-根据内外科系统统计 -->
+    <select id="getAverageScoreByDeptClass" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AverageStatisticsDTO">
+        SELECT
+        a.beh_dept_id AS id,
+        a.beh_dept_name AS NAME,
+        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(*) AS num ,
+        e.dept_name as deptClass
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        med_qcresult_info c,
+        bas_dept_info d,
+        bas_dept_info e
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        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.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = d.dept_id
+        AND d.parent_dept_id = e.dept_id
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ AND a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="className != null and className != ''">
+            AND e.dept_name = #{className}
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
+
     <!-- 按科室统计质控病历数 -->
     <select id="resultCountByDept" parameterType="com.diagbot.vo.QcresultFilterVO" resultType="com.diagbot.dto.NumDTO">
         SELECT