Browse Source

湘雅全院病案首页缺陷列表、病历列表跳转查/导出

chengyao 3 years ago
parent
commit
d1d7d2f2f8

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

@@ -86,6 +86,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/entryCountGroupByCasePage").permitAll()
                 .antMatchers("/console/entryCountGroupByEntry").permitAll()
                 .antMatchers("/console/entryCountGroupByEntryPage").permitAll()
+                .antMatchers("/console/entryCountGroupXYByEntryPage").permitAll()
                 .antMatchers("/console/entryGroupByEntryInnerPage").permitAll()
                 .antMatchers("/console/getAverageDayNum").permitAll()
                 .antMatchers("/console/getAverageDayNumPage").permitAll()
@@ -110,6 +111,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/mrCount").permitAll()
                 .antMatchers("/console/mrStatistics").permitAll()
                 .antMatchers("/console/qcResultShortPage").permitAll()
+                .antMatchers("/console/qcResultShortXYPage").permitAll()
                 .antMatchers("/console/resultStatistics").permitAll()
                 .antMatchers("/console/resultStatisticsByDeptPage").permitAll()
                 .antMatchers("/console/homePageMRCount").permitAll()
@@ -142,9 +144,11 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/getAverageFeeExport").permitAll()
                 .antMatchers("/console/export/levelPercentGroupByDeptExport").permitAll()
                 .antMatchers("/console/export/entryCountGroupByEntryExport").permitAll()
+                .antMatchers("/console/export/entryCountGroupXYByEntryExport").permitAll()
                 .antMatchers("/console/export/entryCountGroupByCaseExport").permitAll()
                 .antMatchers("/console/export/entryStatisticsExport").permitAll()
                 .antMatchers("/console/export/qcResultShortPageExport").permitAll()
+                .antMatchers("/console/export/qcResultShortXYPageExport").permitAll()
                 .antMatchers("/console/export/leaveHosMrPageExport").permitAll()
                 .antMatchers("/console/export/qcCheckStatisticsExport").permitAll()
                 .antMatchers("/console/export/unModifyMRPageExport").permitAll()

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

@@ -130,6 +130,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/entryCountGroupByCasePage", request)
                 || matchers("/console/entryCountGroupByEntry", request)
                 || matchers("/console/entryCountGroupByEntryPage", request)
+                || matchers("/console/entryCountGroupXYByEntryPage", request)
                 || matchers("/console/entryGroupByEntryInnerPage", request)
                 || matchers("/console/getAverageDayNum", request)
                 || matchers("/console/getAverageDayNumPage", request)
@@ -154,6 +155,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/medicalRecordIndicator", request)
                 || matchers("/console/codingMonthly", request)
                 || matchers("/console/qcResultShortPage", request)
+                || matchers("/console/qcResultShortXYPage", request)
                 || matchers("/console/resultStatistics", request)
                 || matchers("/console/resultStatisticsByDeptPage", request)
                 || matchers("/console/homePageMRCount", request)
@@ -186,9 +188,11 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/getAverageFeeExport", request)
                 || matchers("/console/export/levelPercentGroupByDeptExport", request)
                 || matchers("/console/export/entryCountGroupByEntryExport", request)
+                || matchers("/console/export/entryCountGroupXYByEntryExport", request)
                 || matchers("/console/export/entryCountGroupByCaseExport", request)
                 || matchers("/console/export/entryStatisticsExport", request)
                 || matchers("/console/export/qcResultShortPageExport", request)
+                || matchers("/console/export/qcResultShortXYPageExport", request)
                 || matchers("/console/export/leaveHosMrPageExport", request)
                 || matchers("/console/export/qcCheckStatisticsExport", request)
                 || matchers("/console/export/unModifyMRPageExport", request)

+ 48 - 0
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -196,6 +196,22 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", EntryNumGroupDTO.class, fileName, response, 12.8f);
     }
 
+    /**
+     * 缺陷详情导出-湘雅
+     *
+     * @param filterPageVO
+     * @return
+     */
+    public void entryCountGroupXYByEntryExport(HttpServletResponse response, FilterPageXYVO filterPageVO) {
+        filterPageVO.setCurrent(1L);
+        filterPageVO.setSize(Long.MAX_VALUE);
+        filterPageVO.setSearchCount(false);
+        IPage<EntryNumGroupDTO> page = consoleFacade.entryCountGroupXYByEntryPage(filterPageVO);
+        String fileName = "缺陷详情.xls";
+        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", EntryNumGroupDTO.class, fileName, response, 12.8f);
+    }
+
+
 
     /**
      * 各模块缺陷占比导出
@@ -256,6 +272,38 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
 
+    /**
+     * 缺陷详情质控评分页导出-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public void qcResultShortXYPageExport(HttpServletResponse response, QcResultShortXYPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
+                && qcResultShortPageVO.getDeptName().equals("全部")) {
+            qcResultShortPageVO.setDeptName("");
+        }
+        Date startDate = qcResultShortPageVO.getStartDate();
+        Date endDate = qcResultShortPageVO.getEndDate();
+        //时间间隔90天
+        long interval = 90 * 24l * 60l * 60l * 1000l;
+        if (endDate.getTime() < startDate.getTime()) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        }
+        if (endDate.getTime() - startDate.getTime() > interval) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+        }
+
+        qcResultShortPageVO.setCurrent(1L);
+        qcResultShortPageVO.setSize(Long.MAX_VALUE);
+        qcResultShortPageVO.setSearchCount(false);
+        List<ExportExcelDTO> record = behospitalInfoFacade.getBaseMapper().qcResultShortXYPageExport(qcResultShortPageVO);
+        String fileName = "缺陷详情质控评分页.xls";
+        ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
+    }
+
     /**
      * 出院人数统计导出
      *

+ 20 - 5
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -1412,15 +1412,15 @@ public class ConsoleFacade {
     /**
      * 缺陷详情(分页)-湘雅
      *
-     * @param filterPageXYVO
+     * @param filterPageVO
      * @return
      */
-    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(FilterPageXYVO filterPageXYVO) {
+    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(FilterPageXYVO filterPageVO) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         String userId = SysUserUtils.getCurrentPrincipleID();
-        filterPageXYVO.setHospitalId(hospitalId);
-        filterPageXYVO.setUserId(Long.valueOf(userId));
-        IPage<EntryNumGroupDTO> page = qcresultInfoFacade.getBaseMapper().entryCountGroupXYByEntryPage(filterPageXYVO);
+        filterPageVO.setHospitalId(hospitalId);
+        filterPageVO.setUserId(Long.valueOf(userId));
+        IPage<EntryNumGroupDTO> page = qcresultInfoFacade.getBaseMapper().entryCountGroupXYByEntryPage(filterPageVO);
         return page;
     }
 
@@ -2455,6 +2455,21 @@ public class ConsoleFacade {
         return page;
     }
 
+    /**
+     * 条目缺陷质控评分页(内页)-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> qcResultShortXYPage(QcResultShortXYPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        qcResultShortPageVO.setUserId(Long.valueOf(userId));
+        IPage<QcResultShortDTO> page = behospitalInfoFacade.getBaseMapper().qcResultShortXYPage(qcResultShortPageVO);
+        return page;
+    }
+
     /**
      * 关键条目缺陷占比统计
      *

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

@@ -304,6 +304,15 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<QcResultShortDTO> qcResultShortPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+
+    /**
+     * 条目缺陷质控评分页(内页)-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> qcResultShortXYPage(@Param("qcResultShortPageVO") QcResultShortXYPageVO qcResultShortPageVO);
+
     /**
      * 条目缺陷质控评分页-科室(内页)
      *
@@ -442,6 +451,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+    /**
+     * 条目缺陷质控评分详情页导出到excel-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> qcResultShortXYPageExport(@Param("qcResultShortPageVO") QcResultShortXYPageVO qcResultShortPageVO);
+
     /**
      * 未整改病历统计
      *

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

@@ -125,10 +125,10 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
     /**
      * 缺陷详情(分页)-湘雅
      *
-     * @param filterPageXYVO
+     * @param filterPageVO
      * @return
      */
-    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(@Param("filterPageXYVO") FilterPageXYVO filterPageXYVO);
+    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(@Param("filterPageVO") FilterPageXYVO filterPageVO);
 
     /**
      * 各科室质控平均分(分页)

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

@@ -588,6 +588,17 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.qcResultShortPageExport(qcResultShortPageVO);
     }
 
+    /**
+     * 条目缺陷质控评分详情页导出到excel-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+
+    public List<ExportExcelDTO> qcResultShortXYPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
+        return baseMapper.qcResultShortPageExport(qcResultShortPageVO);
+    }
+
     /**
      * 缺陷详情质控评分页导出-科室
      *

+ 155 - 0
src/main/java/com/diagbot/vo/QcResultShortXYPageVO.java

@@ -0,0 +1,155 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/6/16 17:00
+ */
+@Getter
+@Setter
+public class QcResultShortXYPageVO extends Page {
+    @ApiModelProperty(hidden = true)
+    private Long userId;
+    @ApiModelProperty(hidden = true)
+    private String hospitalId;
+    /**
+     * 病历号
+     */
+    private String behospitalCode;
+    /**
+     * 病人姓名
+     */
+    private String patName;
+    /**
+     * 条目名称
+     */
+    private String casesEntryName;
+    /**
+     * (1-导出7天[含缺陷明细项]  2-导出90天[不含缺陷明细项] )
+     */
+    @NotNull(message = "导出天数选择不能为空")
+    private String radioCheck = "1";
+
+    /**
+     * 主诊断
+     */
+    private String diagnose;
+
+    /**
+     * title名称
+     */
+    private String titleName;
+
+    /**
+     * 条目id
+     */
+    private Long casesEntryId;
+    /**
+     * 模块名称
+     */
+    private String casesName;
+    /**
+     * 模块id
+     */
+    private Long casesId;
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 科室ID
+     */
+    private String deptId;
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 医师类别
+     */
+    private String professor;
+    /**
+     * 医生编号
+     */
+    private String doctorId;
+    /**
+     * 病历等级
+     */
+    private String level;
+    @NotNull(message = "请输入起始时间")
+    private Date startDate;
+    @NotNull(message = "请输入截止时间")
+    private Date endDate;
+
+    /**
+     * 单项否决
+     */
+    private Integer isReject;
+
+    /**
+     * 规则类型(0:无,1:空项,2:错误)
+     */
+    private Integer ruleType;
+
+    /**
+     * 离院人员类型(0/null:总人数,1:死亡人数,2:新生儿,3:手术病人数,4:非医嘱离院病人,5:31日再入院病人)
+     */
+    private Integer leaveHosType;
+
+    /**
+     * 核查状态(1:已核查,0:未核查)
+     */
+    private Integer checkStatus;
+    /**
+     * 首页核查状态(1:已核查,0:未核查)
+     */
+    private Integer mrStatus;
+    /**
+     * 病历核查人员
+     */
+    private String chName;
+    /**
+     * 首页核查人员
+     */
+    private String mrName;
+    /**
+     * 病历核查起始时间
+     */
+    private Date chTimeStart;
+    /**
+     * 病历核查截止时间
+     */
+    private Date chTimeEnd;
+    /**
+     * 首页核查起始时间
+     */
+    private Date mrTimeStart;
+    /**
+     * 首页核查截止时间
+     */
+    private Date mrTimeEnd;
+    /**
+     * 是否归档(0:未归档,1:已归档)
+     */
+    private String isPlacefile = "1";
+
+    /**
+     * 住院超过31日标志
+     */
+    private Integer beHosGT31Days;
+
+    /**
+     * 改善标志(1:病案首页改善病历,2:病案首页改善至合格病历,3:病案首页改善至满分病历)
+     */
+    private Integer improveType;
+}

+ 14 - 1
src/main/java/com/diagbot/web/ConsoleController.java

@@ -323,7 +323,7 @@ public class ConsoleController {
     }
 
     /**
-     * 条目缺陷占比(分页)-湘雅
+     * 条目缺陷占比导出(分页)-湘雅
      *
      * @param filterPageXYVO
      * @return
@@ -620,6 +620,19 @@ public class ConsoleController {
         return RespDTO.onSuc(consoleFacade.qcResultShortPage(qcResultShortPageVO));
     }
 
+    /**
+     * 条目缺陷质控评分页(内页)-湘雅
+     *
+     * @param qcResultShortXYPageVO
+     * @return
+     */
+    @ApiOperation(value = "条目缺陷质控评分页(内页)[by:zhaops]")
+    @PostMapping("/qcResultShortXYPage")
+    @SysLogger("qcResultShortXYPage")
+    public RespDTO<IPage<QcResultShortDTO>> qcResultShortXYPage(@RequestBody @Valid QcResultShortXYPageVO qcResultShortXYPageVO) {
+        return RespDTO.onSuc(consoleFacade.qcResultShortXYPage(qcResultShortXYPageVO));
+    }
+
     /**
      * 关键条目缺陷占比统计
      *

+ 26 - 0
src/main/java/com/diagbot/web/ConsoleExportController.java

@@ -203,6 +203,19 @@ public class ConsoleExportController {
         consoleExportFacade.entryCountGroupByEntryExport(response, filterPageVO);
     }
 
+    /**
+     * 条目缺陷占比导出-湘雅
+     *
+     * @param filterPageVO
+     * @return
+     */
+    @ApiOperation(value = "缺陷详情导出[by:gaodm]")
+    @PostMapping("/entryCountGroupXYByEntryExport")
+    @SysLogger("entryCountGroupXYByEntryExport")
+    public void entryCountGroupXYByEntryExport(HttpServletResponse response, @RequestBody @Valid FilterPageXYVO filterPageVO) {
+        consoleExportFacade.entryCountGroupXYByEntryExport(response, filterPageVO);
+    }
+
     /**
      * 各模块缺陷占比导出
      *
@@ -274,6 +287,19 @@ public class ConsoleExportController {
         consoleExportFacade.qcResultShortPageExport(response, qcResultShortPageVO);
     }
 
+    /**
+     * 缺陷详情质控评分页导出-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @ApiOperation(value = "缺陷详情质控评分页导出[by:zhaops]")
+    @PostMapping("/qcResultShortXYPageExport")
+    @SysLogger("qcResultShortXYPageExport")
+    public void qcResultShortXYPageExport(HttpServletResponse response, @RequestBody @Valid QcResultShortXYPageVO qcResultShortPageVO) {
+        consoleExportFacade.qcResultShortXYPageExport(response, qcResultShortPageVO);
+    }
+
     /**
      * 出院人数统计导出
      *

+ 818 - 1
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -5345,7 +5345,271 @@
         </if>
     </select>
 
-    <!-- 条目缺陷质控评分页(内页)-->
+    <!-- 条目缺陷质控评分页(内页)湘雅-->
+    <select id="qcResultShortXYPage" 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_name AS doctorName,
+        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 DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        ifnull(mci.status,0) AS checkStatus,
+        ifnull(hm_mci.status,0) AS mrStatus,
+        mci.check_name as chName,
+        e.score_res as scoreBn,
+        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,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        case
+        when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        e.director_doctor != '' and e.director_doctor is not null
+        then e.director_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        (e.director_doctor = '' or e.director_doctor is null) and
+        e.behospital_doctor != '' and e.behospital_doctor is not null
+        then e.behospital_doctor end as doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        b.gmt_create
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        med_home_page 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 = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = e.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
+            and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
+        </if>
+        <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
+            AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
+            AND a.beh_dept_name = #{qcResultShortPageVO.deptName}
+        </if>
+        <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
+            AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
+        </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultShortPageVO.level}
+        </if>
+        <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null ">
+            AND d.id = #{qcResultShortPageVO.casesEntryId}
+        </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND d.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND d.cases_id = #{qcResultShortPageVO.casesId}
+        </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then e.director_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then e.behospital_doctor end ) = #{qcResultShortPageVO.doctorName}
+        </if>
+        <if test="qcResultShortPageVO.professor != null and qcResultShortPageVO.professor != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then '主治医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then '主任医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then '住院医师' end) = #{qcResultShortPageVO.professor}
+        </if>
+        <if test="qcResultShortPageVO.isReject != null">
+            AND c.is_reject = #{qcResultShortPageVO.isReject}
+        </if>
+        <if test="qcResultShortPageVO.ruleType != null">
+            AND d.rule_type = #{qcResultShortPageVO.ruleType}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 31
+        </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_cases e
+        on  be.behospital_code = e.behospital_code
+        and be.hospital_id = e.hospital_id
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        )tt1
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
+            ,med_medical_record tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = 30
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
+            ,med_crisis_info tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+        </if>
+        ) t1
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
+            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'
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
+            , med_home_page t2
+            , med_home_operation_info t3
+            WHERE t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.home_page_id = t3.home_page_id
+            AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
+        </if>
+        ) t
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.mrStatus != null">
+            AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
+        </if>
+        <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
+            AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
+            AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
+        </if>
+    </select>
+
+    <!-- 条目缺陷质控评分页(内页)-->
     <select id="qcResultShortPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT t.*
         FROM
@@ -10736,6 +11000,559 @@
         )m
     </select>
 
+    <!-- 条目缺陷评分详情页导出湘雅-->
+    <select id="qcResultShortXYPageExport" resultMap="ExportExcelMap">
+        SELECT * from(
+        SELECT
+        f1.*,
+        f2.avgScore
+        FROM
+        (SELECT
+        t.*,
+        qi.score_res AS score,
+        qd.msg AS msg,
+        qc.NAME AS caseName
+        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 AS scoreBn,
+        t1.NAME AS patName,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_name AS doctorName,
+        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 AS diagnose,
+        t1.ward_name AS wardName,
+        t1.file_code AS fileCode,
+        t1.checkStatus AS checkStatus,
+        t1.mrStatus AS mrStatus,
+        t1.chName AS chName,
+        t1.mrName AS mrName,
+        t1.chTime AS chTime,
+        t1.mrTime AS mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        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,
+        e.score_res as scoreBn,
+        hm_mci.gmt_create as mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        a.behospital_code,
+        a.bed_code,
+        a.file_code,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        case
+        when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        e.director_doctor != '' and e.director_doctor is not null
+        then e.director_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        (e.director_doctor = '' or e.director_doctor is null) and
+        e.behospital_doctor != '' and e.behospital_doctor is not null
+        then e.behospital_doctor end as doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        b.gmt_create
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        med_home_page 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 = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = e.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
+            and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
+        </if>
+        <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
+            AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
+            AND a.beh_dept_name  = #{qcResultShortPageVO.deptName}
+        </if>
+        <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
+            AND a.beh_dept_id  = #{qcResultShortPageVO.deptId}
+        </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultShortPageVO.level}
+        </if>
+        <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null ">
+            AND d.id = #{qcResultShortPageVO.casesEntryId}
+        </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND d.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND d.cases_id = #{qcResultShortPageVO.casesId}
+        </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then e.director_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then e.behospital_doctor end ) = #{qcResultShortPageVO.doctorName}
+        </if>
+        <if test="qcResultShortPageVO.professor != null and qcResultShortPageVO.professor != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then '主治医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then '主任医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then '住院医师' end) = #{qcResultShortPageVO.professor}
+        </if>
+        <if test="qcResultShortPageVO.isReject != null">
+            AND c.is_reject = #{qcResultShortPageVO.isReject}
+        </if>
+        <if test="qcResultShortPageVO.ruleType != null">
+            AND d.rule_type = #{qcResultShortPageVO.ruleType}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 31
+        </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_cases e
+        on  be.behospital_code = e.behospital_code
+        and be.hospital_id = e.hospital_id
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        )tt1
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
+            ,med_medical_record tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = 30
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
+            ,med_crisis_info tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+        </if>
+        ) t1
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
+            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'
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
+            , med_home_page t2
+            , med_home_operation_info t3
+            WHERE t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.home_page_id = t3.home_page_id
+            AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
+        </if>
+        ) t
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        LEFT JOIN med_qcresult_detail qd ON qd.is_deleted = 'N'
+        AND t.hospitalId = qd.hospital_id
+        AND t.behospitalCode = qd.behospital_code
+        LEFT JOIN qc_cases qc ON qc.is_deleted = 'N'
+        AND qd.cases_id = qc.id
+        LEFT JOIN qc_cases_entry qce ON qce.is_deleted = 'N'
+        AND qd.cases_id = qce.cases_id
+        AND qd.cases_entry_id = qce.id
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.mrStatus != null">
+            AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
+        </if>
+        <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
+            AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
+            AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            AND qce.NAME = #{qcResultShortPageVO.casesEntryName}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null ">
+            AND qce.id = #{qcResultShortPageVO.casesEntryId}
+        </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND qce.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND qce.cases_id = #{qcResultShortPageVO.casesId}
+        </if>
+        )f1,
+        (SELECT
+        ROUND( AVG( qi.score_res ), 2 ) AS avgScore,
+        t.behDeptId,
+        t.behDeptName
+        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.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        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,
+        t2.age,
+        t1.file_code AS fileCode,
+        t1.checkStatus,
+        t1.mrStatus,
+        t1.chName,
+        t1.mrName,
+        t1.chTime,
+        t1.mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        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,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        b.gmt_create
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        med_home_page 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 = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = e.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
+            and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
+        </if>
+        <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
+            AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
+            <if test="qcResultShortPageVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
+            </if>
+            <if test="qcResultShortPageVO.endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
+            AND a.beh_dept_name  = #{qcResultShortPageVO.deptName}
+        </if>
+        <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
+            AND a.beh_dept_id  = #{qcResultShortPageVO.deptId}
+        </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultShortPageVO.level}
+        </if>
+        <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null ">
+            AND d.id = #{qcResultShortPageVO.casesEntryId}
+        </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND d.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND d.cases_id = #{qcResultShortPageVO.casesId}
+        </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then e.director_doctor
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then e.behospital_doctor end ) = #{qcResultShortPageVO.doctorName}
+        </if>
+        <if test="qcResultShortPageVO.professor != null and qcResultShortPageVO.professor != ''">
+            AND(case
+            when e.attending_doctor != '' and e.attending_doctor is not null then '主治医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            e.director_doctor != '' and e.director_doctor is not null
+            then '主任医师'
+            when (e.attending_doctor = '' or e.attending_doctor is null) and
+            (e.director_doctor = '' or e.director_doctor is null) and
+            e.behospital_doctor != '' and e.behospital_doctor is not null
+            then '住院医师' end) = #{qcResultShortPageVO.professor}
+        </if>
+        <if test="qcResultShortPageVO.isReject != null">
+            AND c.is_reject = #{qcResultShortPageVO.isReject}
+        </if>
+        <if test="qcResultShortPageVO.ruleType != null">
+            AND d.rule_type = #{qcResultShortPageVO.ruleType}
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 31
+        </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
+        )tt1
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
+            ,med_medical_record tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = 30
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
+            ,med_crisis_info tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+        </if>
+        ) t1
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
+            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'
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
+            , med_home_page t2
+            , med_home_operation_info t3
+            WHERE t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.home_page_id = t3.home_page_id
+            AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
+        </if>
+        ) t
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.mrStatus != null">
+            AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
+        </if>
+        <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
+            AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
+            AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
+        </if>
+        GROUP BY
+        t.behDeptId,
+        t.behDeptName
+        )f2
+        WHERE
+        f1.behDeptId = f2.behDeptId
+        AND f1.behDeptName = f2.behDeptName
+        )m
+    </select>
+
     <resultMap id="MedicalCheckMap" type="com.diagbot.dto.MedicalCheckDTO">
         <result column="deptName" property="deptName"/>
         <result column="deptId" property="deptId"/>

+ 47 - 37
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -1687,15 +1687,7 @@
             AND a.beh_dept_id = #{filterPageVO.deptId}
         </if>
         <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
-            AND (case
-            when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            a.director_doctor_id != '' and a.director_doctor_id is not null
-            then a.director_doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            (a.director_doctor_id = '' or a.director_doctor_id is null) and
-            a.beh_doctor_id != '' and a.beh_doctor_id is not null
-            then a.beh_doctor_id end)= #{filterPageVO.doctorName}
+            AND a.doctor_name = #{filterPageVO.doctorName}
         </if>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -1760,15 +1752,7 @@
             </if>
         </if>
         <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
-            AND (case
-            when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            a.director_doctor_id != '' and a.director_doctor_id is not null
-            then a.director_doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            (a.director_doctor_id = '' or a.director_doctor_id is null) and
-            a.beh_doctor_id != '' and a.beh_doctor_id is not null
-            then a.beh_doctor_id end)= #{filterPageVO.doctorName}
+            AND a.doctor_name = #{filterPageVO.doctorName}
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name  =  #{filterPageVO.deptName}
@@ -1826,8 +1810,8 @@
         med_qcresult_detail d
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND d.is_deleted = 'N'
+        AND b.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.behospital_code = b.behospital_code
@@ -1862,15 +1846,26 @@
             AND a.beh_dept_id = #{filterPageVO.deptId}
         </if>
         <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
-            AND (case
-            when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            a.director_doctor_id != '' and a.director_doctor_id is not null
-            then a.director_doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            (a.director_doctor_id = '' or a.director_doctor_id is null) and
-            a.beh_doctor_id != '' and a.beh_doctor_id is not null
-            then a.beh_doctor_id end)= #{filterPageVO.doctorName}
+            AND(case
+            when b.attending_doctor != '' and b.attending_doctor is not null then b.attending_doctor
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            b.director_doctor != '' and b.director_doctor is not null
+            then b.director_doctor
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            (b.director_doctor = '' or b.director_doctor is null) and
+            b.behospital_doctor != '' and b.behospital_doctor is not null
+            then b.behospital_doctor end ) = #{filterPageVO.doctorName}
+        </if>
+        <if test="filterPageVO.professor != null and filterPageVO.professor != ''">
+            AND(case
+            when b.attending_doctor != '' and b.attending_doctor is not null then '主治医师'
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            b.director_doctor != '' and b.director_doctor is not null
+            then '主任医师'
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            (b.director_doctor = '' or b.director_doctor is null) and
+            b.behospital_doctor != '' and b.behospital_doctor is not null
+            then '住院医师' end) = #{filterPageVO.professor}
         </if>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -1901,13 +1896,17 @@
         count(*) AS totleNum
         FROM
         med_behospital_info a,
+        med_home_page b,
         med_qcresult_detail d,
         qc_cases_entry e
         WHERE
         a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = d.behospital_code
         <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile != ''">
             and a.is_placefile = #{filterPageVO.isPlacefile}
@@ -1935,15 +1934,26 @@
             </if>
         </if>
         <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
-            AND (case
-            when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            a.director_doctor_id != '' and a.director_doctor_id is not null
-            then a.director_doctor_id
-            when (a.doctor_id = '' or a.doctor_id is null) and
-            (a.director_doctor_id = '' or a.director_doctor_id is null) and
-            a.beh_doctor_id != '' and a.beh_doctor_id is not null
-            then a.beh_doctor_id end)= #{filterPageVO.doctorName}
+            AND(case
+            when b.attending_doctor != '' and b.attending_doctor is not null then b.attending_doctor
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            b.director_doctor != '' and b.director_doctor is not null
+            then b.director_doctor
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            (b.director_doctor = '' or b.director_doctor is null) and
+            b.behospital_doctor != '' and b.behospital_doctor is not null
+            then b.behospital_doctor end ) = #{filterPageVO.doctorName}
+        </if>
+        <if test="filterPageVO.professor != null and filterPageVO.professor != ''">
+            AND(case
+            when b.attending_doctor != '' and b.attending_doctor is not null then '主治医师'
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            b.director_doctor != '' and b.director_doctor is not null
+            then '主任医师'
+            when (b.attending_doctor = '' or b.attending_doctor is null) and
+            (b.director_doctor = '' or b.director_doctor is null) and
+            b.behospital_doctor != '' and b.behospital_doctor is not null
+            then '住院医师' end) = #{filterPageVO.professor}
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name  =  #{filterPageVO.deptName}