Browse Source

医生查询下拉模糊/病案首页合格~不合格字段补充

chengyao 4 years ago
parent
commit
a54d72101d

+ 4 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -179,9 +179,13 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/behospitalInfo/exportQcresultByPerson").permitAll()
                 .antMatchers("/consoleByDept/beHosCountByDept").permitAll()
                 .antMatchers("/consoleByDept/casesEntryStatisticsByDept").permitAll()
+                .antMatchers("/bas/doctor/getList").permitAll()
+                .antMatchers("/consoleByDept/homePageOrGoodLevelByDept").permitAll()
+                .antMatchers("/print/export/homePageLevelExportByDept").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }
+
     @Override
     public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
         log.info("Configuring ResourceServerSecurityConfigurer");

+ 3 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -223,6 +223,9 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/behospitalInfo/exportQcresultByPerson", request)
                 || matchers("/consoleByDept/beHosCountByDept", request)
                 || matchers("/consoleByDept/casesEntryStatisticsByDept", request)
+                || matchers("/bas/doctor/getList", request)
+                || matchers("/consoleByDept/homePageOrGoodLevelByDept", request)
+                || matchers("/print/export/homePageLevelExportByDept", request)
                 || matchers("/", request)) {
             return true;
         }

+ 29 - 20
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -7,11 +7,7 @@ import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
-import com.diagbot.vo.FilterOrderByDeptVO;
-import com.diagbot.vo.FilterPageByDeptVO;
-import com.diagbot.vo.FilterVO;
-import com.diagbot.vo.QcResultShortPageVO;
-import com.diagbot.vo.QcresultFilterVO;
+import com.diagbot.vo.*;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -492,7 +488,7 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageByDeptDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
             return null;
@@ -501,11 +497,11 @@ public class ConsoleByDeptFacade {
             filterOrderByDeptVO.setDeptName(deptList.get(0).getDeptName());
         }
         filterFacade.filterOrderByDeptVOSet(filterOrderByDeptVO);
-        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        List<HomePageByDeptDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
         //没有医生过滤时增加全科室数据
         if (StringUtil.isBlank(filterOrderByDeptVO.getDeptName())
                 || filterOrderByDeptVO.getDeptName().equals(filterOrderByDeptVO.getDeptName())) {
-            HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+            HomePageByDeptDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
             if (item != null) {
                 records.add(0, item);
             }
@@ -555,6 +551,18 @@ public class ConsoleByDeptFacade {
             }
             return returnSource;
         }
+    /**
+     * 不合格/合格数病历号-科室(内页)
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> homePageOrGoodLevelByDept(QcResultPageVO qcResultPageVO) {
+        filterFacade.OrGoodLevelPageVOSet(qcResultPageVO);
+        return behospitalInfoFacade.getOrGoodLevelByDept(qcResultPageVO);
+    }
+
+
 
 
     /**
@@ -563,7 +571,7 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<HomePageNumDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageByDeptDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
 
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
@@ -576,8 +584,8 @@ public class ConsoleByDeptFacade {
         if (filterOrderByDeptVO.getLimitCount() == null || filterOrderByDeptVO.getLimitCount().equals(0)) {
             filterOrderByDeptVO.setLimitCount(10);
         }
-        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
-        HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+        List<HomePageByDeptDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        HomePageByDeptDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
         if (item != null) {
             records.add(0, item);
         }
@@ -597,13 +605,13 @@ public class ConsoleByDeptFacade {
      * @param deptName
      * @return
      */
-    public HomePageNumDTO getGlobleRecord(List<HomePageNumDTO> records, String deptName) {
+    public HomePageByDeptDTO getGlobleRecord(List<HomePageByDeptDTO> records, String deptName) {
         DecimalFormat df = new DecimalFormat("#0.00");
-        HomePageNumDTO item = new HomePageNumDTO();
+        HomePageByDeptDTO item = new HomePageByDeptDTO();
         //总病历数
         Integer mrNum = records
                 .stream()
-                .map(HomePageNumDTO::getMrNum)
+                .map(HomePageByDeptDTO::getMrNum)
                 .reduce(0, Integer::sum);
         if (mrNum == null || mrNum == 0) {
             return null;
@@ -611,7 +619,7 @@ public class ConsoleByDeptFacade {
         //总缺陷数
         Integer entryNum = records
                 .stream()
-                .map(HomePageNumDTO::getEntryNum)
+                .map(HomePageByDeptDTO::getEntryNum)
                 .reduce(0, Integer::sum);
         //总分
         Double totleValue = records
@@ -626,7 +634,7 @@ public class ConsoleByDeptFacade {
         //合格病历总数
         Integer firstLevelNum = records
                 .stream()
-                .map(HomePageNumDTO::getFirstLevelNum)
+                .map(HomePageByDeptDTO::getFirstLevelNum)
                 .reduce(0, Integer::sum);
         //合格病历占比
         Double firstLevelPercent = BigDecimal.valueOf(firstLevelNum)
@@ -637,7 +645,7 @@ public class ConsoleByDeptFacade {
         //不合格病历数
         Integer secondLevelNum = records
                 .stream()
-                .map(HomePageNumDTO::getSecondLevelNum)
+                .map(HomePageByDeptDTO::getSecondLevelNum)
                 .reduce(0, Integer::sum);
         //不合格病历占比
         Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
@@ -648,12 +656,12 @@ public class ConsoleByDeptFacade {
         //条目缺陷总数(模块下条目*病历数)
         Integer entryTotleNum = records
                 .stream()
-                .map(HomePageNumDTO::getEntryTotleNum)
+                .map(HomePageByDeptDTO::getEntryTotleNum)
                 .reduce(0, Integer::sum);
         //空项总数
         Integer emptyNum = records
                 .stream()
-                .map(HomePageNumDTO::getEmptyNum)
+                .map(HomePageByDeptDTO::getEmptyNum)
                 .reduce(0, Integer::sum);
         Double emptyPercent = BigDecimal.valueOf(entryTotleNum - emptyNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
@@ -663,7 +671,7 @@ public class ConsoleByDeptFacade {
         //错误项总数
         Integer errorNum = records
                 .stream()
-                .map(HomePageNumDTO::getErrorNum)
+                .map(HomePageByDeptDTO::getErrorNum)
                 .reduce(0, Integer::sum);
         Double errorPercent = BigDecimal.valueOf(entryTotleNum - errorNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
@@ -672,6 +680,7 @@ public class ConsoleByDeptFacade {
                 = df.format(BigDecimal.valueOf(errorPercent).multiply(BigDecimal.valueOf(100))) + "%";
 
         item.setDoctorName(deptName);
+//        item.setDeptId(deptId);
         item.setEntryNum(entryNum);
         item.setMrNum(mrNum);
         item.setTotleValue(totleValue);

+ 10 - 1
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -161,7 +161,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageByDeptDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 单条条目缺陷统计-首页
@@ -179,6 +179,15 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
+
+    /**
+     * 病案首页合格/不合格数
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> getIsGoodLevelByDept(QcResultPageVO qcResultPageVO);
+
     /**
      * 各科室缺陷占比(组合)-全院-根据内外科系统统计-关联上级科室
      *

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

@@ -8,7 +8,6 @@ import com.diagbot.vo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -171,7 +170,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageByDeptDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 缺陷明细-科室(分页)

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

@@ -1,16 +1,12 @@
 package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.*;
 import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.mapper.BehospitalInfoMapper;
 import com.diagbot.service.BehospitalInfoService;
-import com.diagbot.util.BeanUtil;
 import com.diagbot.vo.*;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
@@ -174,6 +170,16 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.operationCountByDept(filterVO);
     }
 
+    /**
+     * 病案首页合格/不合格数-科室
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> getOrGoodLevelByDept(QcResultPageVO qcResultPageVO) {
+        return  baseMapper.getIsGoodLevelByDept(qcResultPageVO);
+    }
+
     /**
      * 各科室缺陷占比排行(分页)
      *
@@ -225,7 +231,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @return
      */
     @Override
-    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageByDeptDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         return baseMapper.homePageLevelStatisticsByDept(filterOrderByDeptVO);
     }
 

+ 28 - 6
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.*;
 import com.diagbot.facade.ConsoleByDeptFacade;
-import com.diagbot.vo.FilterOrderByDeptVO;
-import com.diagbot.vo.FilterPageByDeptVO;
-import com.diagbot.vo.FilterVO;
-import com.diagbot.vo.QcResultShortPageVO;
+import com.diagbot.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -100,7 +97,7 @@ public class ConsoleByDeptController {
                     "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
     @PostMapping("/homePageLevelByDeptLimit")
     @SysLogger("homePageLevelByDeptLimit")
-    public RespDTO<List<HomePageNumDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageByDeptDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelByDeptLimit(filterOrderByDeptVO));
     }
 
@@ -230,9 +227,34 @@ public class ConsoleByDeptController {
                     "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
     @PostMapping("/homePageLevelStatisticsByDept")
     @SysLogger("homePageLevelStatisticsByDept")
-    public RespDTO<List<HomePageNumDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageByDeptDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO));
     }
+    /**
+     * 病案首页合格/不合格数
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    @ApiOperation(value = "病案首页合格/不合格数(科室)-内页[by:cy]",
+            notes = "behospitalCode: 病历号<br>" +
+                    "patName: 病人姓名 <br>" +
+                    "casesEntryName: 条目名称 <br>" +
+                    "titleName: 标题名称 <br>" +
+                    "casesEntryId: 条目id <br>" +
+                    "behDeptName:科室名称 <br>" +
+                    "doctorId:医生工号 <br>" +
+                    "doctorName:医生姓名 <br>" +
+                    "level: 病历等级 <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>" +
+                    "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+    @PostMapping("/homePageOrGoodLevelByDept")
+    @SysLogger("homePageOrGoodLevelByDept")
+    public RespDTO<IPage<QcResultShortDTO>> homePageOrGoodLevelByDept(@RequestBody @Valid QcResultPageVO qcResultPageVO) {
+        return RespDTO.onSuc(consoleByDeptFacade.homePageOrGoodLevelByDept(qcResultPageVO));
+    }
+
 
     /**
      * 条目缺陷质控评分页-科室(内页)

+ 294 - 2
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2910,7 +2910,7 @@
 
     <!-- 病案首页合格率占比-科室 -->
     <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
-            resultType="com.diagbot.dto.HomePageNumDTO">
+            resultType="com.diagbot.dto.HomePageByDeptDTO">
         SELECT
         t1.doctorId,
         t1.doctorName,
@@ -7571,7 +7571,298 @@
         d.NAME
     </select>
 
-    <!-- 不合格/合格数病历号(内页)-->
+
+
+    <!-- 不合格/合格数病历号(内页)科室-->
+    <select id="getIsGoodLevelByDept" resultType="com.diagbot.dto.QcResultShortDTO">
+        SELECT t.*
+        FROM
+        (SELECT DISTINCT
+        t1.hospital_id AS hospitalId,
+        t1.behospital_code AS behospitalCode,
+        t1.bed_code AS bedCode,
+        t1.LEVEL AS LEVEL,
+        t1.grade_type AS gradeType,
+        t1.score_res AS scoreRes,
+        t1.scoreBn,
+        t1.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_id AS doctorId,
+        t1.doctor_name AS doctorName,
+        t1.beh_doctor_id AS behDoctorId,
+        t1.beh_doctor_name AS behDoctorName,
+        t1.director_doctor_id AS directorDoctorId,
+        t1.director_doctor_name AS directorDoctorName,
+        t1.birthday AS birthday,
+        t1.behospital_date AS behospitalDate,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t1.placefile_date AS placefileDate,
+        t1.gmt_create AS gradeTime,
+        t1.diagnose,
+        t1.ward_name AS wardName,
+        CONCAT( ifnull(t2.age,'') ,ifnull(t2.age_unit,'') )as age,
+        t1.file_code AS fileCode,
+        t1.checkStatus,
+        t1.mrStatus,
+        t1.chName,
+        t1.mrName,
+        t1.chTime,
+        t1.mrTime
+        FROM
+        (SELECT
+        be.*,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
+        ifnull(mci.status,0) AS checkStatus,
+        ifnull(hm_mci.status,0) AS mrStatus,
+        mci.check_name as chName,
+        hm_mci.check_name as mrName,
+        mci.gmt_create as chTime,
+        hm_mci.gmt_create as mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        a.behospital_code,
+        a.bed_code,
+        a.file_code,
+        e.score_res as scoreBn,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.doctor_id,
+        a.doctor_name,
+        a.beh_doctor_id,
+        a.beh_doctor_name,
+        a.director_doctor_id,
+        a.director_doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name
+        FROM
+        med_behospital_info a,
+        sys_user_dept c,
+        med_qcresult_cases e
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.beh_dept_id = c.dept_id
+        AND a.behospital_code = e.behospital_code
+        AND a.qc_type_id != 0
+        AND e.cases_id = 243
+        <if test="userId!=null">
+            AND c.user_id = #{userId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and a.beh_dept_name = #{deptName}
+        </if>
+        <if test="deptClass != null and deptClass != ''">
+            and a.beh_dept_id = #{deptClass}
+        </if>
+        <if test="titleName != null and titleName != '' ">
+            <if test="titleName == '不合格数'">
+                AND e.`level`='不合格'
+            </if>
+            <if test="titleName == '合格数'">
+                AND e.`level`='合格'
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            <if test="startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{behospitalCode}, '%' )
+        </if>
+        <if test="patName != null and patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{patName}, '%' )
+        </if>
+        <if test="doctorId != null and doctorId != ''">
+            AND (a.doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
+            OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
+            OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
+        </if>
+        )be
+        left join med_check_info mci
+        on mci.is_deleted = 'N'
+        and mci.check_type = 0
+        and be.hospital_id = mci.hospital_id
+        and be.behospital_code = mci.behospital_code
+        left join med_check_info hm_mci
+        on hm_mci.is_deleted = 'N'
+        and hm_mci.check_type = 1
+        and be.hospital_id = hm_mci.hospital_id
+        and be.behospital_code = hm_mci.behospital_code
+        left join med_qcresult_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        where
+        1=1
+        <if test="level != null and level != ''">
+            AND b.`level` = #{level}
+        </if>
+        ) t1
+        LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
+        AND t1.behospital_code = t2.behospital_code
+        AND t2.is_deleted = 'N'
+        ) t,
+        (
+        SELECT
+        a.doctor_id as doctorId,
+        a.doctor_name as doctorName
+        FROM
+        med_behospital_info a,
+        sys_user_dept b,
+        med_qcresult_cases c,
+        med_qcresult_detail d,
+        qc_cases_entry 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.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND a.beh_dept_id = b.dept_id
+        AND c.cases_id = d.cases_id
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND d.cases_id = 243
+        AND a.qc_type_id != 0
+        <!--        <if test="titleName != null ">-->
+        <!--            <if test="titleName == '不合格数'">-->
+        <!--                AND c.`level`='不合格'-->
+        <!--            </if>-->
+        <!--            <if test="titleName == '合格数'">-->
+        <!--                AND c.`level`='合格'-->
+        <!--            </if>-->
+        <!--        </if>-->
+        <if test="userId!=null">
+            AND b.user_id = #{userId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and a.beh_dept_name = #{deptName}
+        </if>
+        <if test="deptClass != null and deptClass != ''">
+            and a.beh_dept_id = #{deptClass}
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            <if test="startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{behospitalCode}, '%' )
+        </if>
+        <if test="patName != null and patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{patName}, '%' )
+        </if>
+        <if test="doctorId != null and doctorId != ''">
+            AND (a.doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
+            OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
+            OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
+        </if>
+        GROUP BY
+        a.doctor_id,
+        a.doctor_name
+        ) t2
+        where
+        t.doctorId = t2.doctorId
+        AND t.doctorName = t2.doctorName
+        <if test="checkStatus != null">
+            AND t.checkStatus = #{checkStatus}
+        </if>
+        <if test="mrStatus != null">
+            AND t.mrStatus = #{mrStatus}
+        </if>
+        <if test="chName != null and chName!=''">
+            AND t.chName like concat('%', #{chName}, '%')
+        </if>
+        <if test="mrName != null and mrName!=''">
+            AND t.mrName like concat('%', #{mrName}, '%')
+        </if>
+        <if test="chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{mrTimeEnd}]]>
+        </if>
+    </select>
+
+    <!-- 不合格/合格数病历号(内页)全院-->
     <select id="badLevelPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT t.*
         FROM
@@ -7839,6 +8130,7 @@
             <![CDATA[ AND t.mrTime <= #{qcResultPageVO.mrTimeEnd}]]>
         </if>
     </select>
+
     <!-- 未整改病历质控评分页(内页)-->
     <select id="unModifyMRPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT t.*