Browse Source

获取主治医生

chengyao 4 years ago
parent
commit
8e8f7f4639

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

@@ -190,6 +190,8 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/print/export/levelExportByDept").permitAll()
                 .antMatchers("/consoleByDept/entryStatisticsByDept").permitAll()
                 .antMatchers("/print/export/entryStatisticsExportByDept").permitAll()
+                .antMatchers("/consoleByDept/leaveHosMRPageByDept").permitAll()
+                .antMatchers("/print/export/leaveHosMrPageExportByDept").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -234,6 +234,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/print/export/levelExportByDept", request)
                 || matchers("/consoleByDept/entryStatisticsByDept", request)
                 || matchers("/print/export/entryStatisticsExportByDept", request)
+                || matchers("/consoleByDept/leaveHosMRPageByDept", request)
+                || matchers("/print/export/leaveHosMrPageExportByDept", request)
                 || matchers("/", request)) {
             return true;
         }

+ 39 - 8
src/main/java/com/diagbot/facade/BasDoctorInfoFacade.java

@@ -2,15 +2,22 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.BasDeptInfoDTO;
+import com.diagbot.entity.BasDeptInfo;
 import com.diagbot.entity.BasDoctorInfo;
+import com.diagbot.entity.SysUserDept;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.BasDoctorInfoServiceImpl;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.BasDeptInfoVO;
 import com.diagbot.vo.data.BasDoctorInfoVO;
+import io.swagger.models.auth.In;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 
 /**
@@ -20,6 +27,10 @@ import java.util.List;
  */
 @Component
 public class BasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
+    @Autowired
+    SysUserDeptFacade sysUserDeptFacade;
+    @Autowired
+    BasDeptInfoFacade basDeptInfoFacade;
 
     /**
      * 获取医院医生下拉列表信息
@@ -29,15 +40,35 @@ public class BasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
      */
     public List<BasDoctorInfo> getDoctorByDept(BasDoctorInfoVO basDoctorInfoVO) {
         basDoctorInfoVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
-        QueryWrapper<BasDoctorInfo> QueryWrapper = new QueryWrapper<>();
-        QueryWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
-        QueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
-        QueryWrapper.eq("dept_id",basDoctorInfoVO.getDeptId());
-        if(StringUtils.isNotEmpty(basDoctorInfoVO.getInputStr())){
-            QueryWrapper.like("name",basDoctorInfoVO.getInputStr());
+        basDoctorInfoVO.setUserId(Long.valueOf( SysUserUtils.getCurrentPrincipleID()));
+        QueryWrapper<SysUserDept> userDeptWrapper = new QueryWrapper<>();
+        List<BasDoctorInfo> list = new ArrayList<>();
+                userDeptWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
+        userDeptWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        userDeptWrapper.eq("user_id",basDoctorInfoVO.getUserId());
+        List<SysUserDept> UserDeptlist = sysUserDeptFacade.list(userDeptWrapper);
+        HashSet<String> deptSet = new HashSet<String>();
+        if(ListUtil.isNotEmpty(UserDeptlist)){
+            UserDeptlist.forEach(sysUserDept->{
+                deptSet.add(sysUserDept.getDeptId());
+            });
+            QueryWrapper<BasDeptInfo> deptInfo = new QueryWrapper<>();
+            deptInfo.eq("hospital_id",basDoctorInfoVO.getHospitalId());
+            deptInfo.eq("is_deleted", IsDeleteEnum.N.getKey());
+            deptInfo.eq("dept_name",basDoctorInfoVO.getDeptName());
+            deptInfo.in("dept_id",deptSet);
+            BasDeptInfo deptOne = basDeptInfoFacade.getOne(deptInfo);
+            QueryWrapper<BasDoctorInfo> QueryWrapper = new QueryWrapper<>();
+            QueryWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
+            QueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+            QueryWrapper.eq("dept_id",deptOne.getDeptId());
+            if(StringUtils.isNotEmpty(basDoctorInfoVO.getInputStr())){
+                QueryWrapper.like("name",basDoctorInfoVO.getInputStr());
+            }
+            QueryWrapper.orderByAsc("name");
+            list = this.list(QueryWrapper);
         }
-        QueryWrapper.orderByAsc("name");
-        List<BasDoctorInfo> list = this.list(QueryWrapper);
+
         return list;
     }
 

+ 31 - 0
src/main/java/com/diagbot/facade/ConsoleByDeptExportFacade.java

@@ -201,7 +201,38 @@ public class ConsoleByDeptExportFacade {
         String fileName = "关键条目缺陷占比统计导出.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", EntryStasByDeptDTO.class, fileName, response, 12.8f);
     }
+    /**
+     * 出院人数统计导出-科室
+     *
+     * @param  qcResultShortPageVO
+     * @return
+     */
+    public void leaveHosMrPageExportByDept(HttpServletResponse response,QcResultShortPageVO qcResultShortPageVO) {
+        solveParam(qcResultShortPageVO);
+        qcResultShortPageVO.setCurrent(1L);
+        qcResultShortPageVO.setSize(Long.MAX_VALUE);
+        qcResultShortPageVO.setSearchCount(false);
+        List<ExportExcelByDeptDTO> records = behospitalInfoFacade.qcResultShortByDeptPageExport(qcResultShortPageVO);
+        List<ExportSevenByDeptDTO> resDTO = new ArrayList<ExportSevenByDeptDTO>();
+        if(ListUtil.isNotEmpty(records)){
+            ExportSevenByDeptDTO exportByDeptDTO = new ExportSevenByDeptDTO();
+            exportByDeptDTO.setBehDeptName(records.get(0).getBehDeptName());
+            exportByDeptDTO.setExportExcelByDeptDTOS(records);
+            resDTO.add(exportByDeptDTO);
+        }
 
+        List<ExportNinetyByDeptDTO> resWide = new ArrayList<ExportNinetyByDeptDTO>();
+        if("2".equals(qcResultShortPageVO.getRadioCheck())){
+            resWide = transList(records, resWide);
+        }
+        String fileName = "出院人数统计.xls";
+        if("1".equals(qcResultShortPageVO.getRadioCheck())){
+            ExcelUtils.exportExcelUser(resDTO, null, "sheet1", ExportSevenByDeptDTO.class, fileName, response);
+        }
+        if("2".equals(qcResultShortPageVO.getRadioCheck())){
+            ExcelUtils.exportExcelUser(resWide, null, "sheet1", ExportNinetyByDeptDTO.class, fileName, response);
+        }
+    }
 
 
 

+ 12 - 0
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -728,4 +728,16 @@ public class ConsoleByDeptFacade {
         List<EntryStasByDeptDTO> records = behospitalInfoFacade.entryStatisticsByDept(entryStatisticsVO);
         return records;
     }
+
+    /**
+     * 离院病人质控评分详情页-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> leaveHosMRPageByDept(QcResultShortPageVO qcResultShortPageVO) {
+        filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
+        IPage<QcResultShortDTO> page = behospitalInfoFacade.leaveHosMRPageByDept(qcResultShortPageVO);
+        return page;
+    }
 }

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

@@ -230,7 +230,7 @@ public class ConsoleExportFacade {
         Date startDate = qcResultShortPageVO.getStartDate();
         Date endDate = qcResultShortPageVO.getEndDate();
         //时间间隔90天
-        long interval = 90 * 24l * 60l * 60l * 1000l;
+        long interval = 90 * 24l * 60l * 60l * 100l;
         if (endDate.getTime() < startDate.getTime()) {
             throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
         }

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

@@ -318,6 +318,15 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<QcResultShortDTO> leaveHosMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+    /**
+     * 离院病人质控评分详情页-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> leaveHosMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
+
+
     /**
  * 离院病人质控评分年龄单独查询详情页
  *

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

@@ -305,6 +305,14 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public IPage<QcResultShortDTO> leaveHosMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+    /**
+     * 离院病人质控评分详情页-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> leaveHosMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
+
     /**
      * 改善率统计-全院(首页)
      *

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

@@ -426,6 +426,18 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         IPage<QcResultShortDTO> qcResultShortDTOIPage = baseMapper.leaveHosMRPage(qcResultShortPageVO);
         return qcResultShortDTOIPage;
     }
+    /**
+     * 离院病人质控评分详情页-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @Override
+    public IPage<QcResultShortDTO> leaveHosMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
+        IPage<QcResultShortDTO> qcResultShortDTOIPage = baseMapper.leaveHosMRPageByDept(qcResultShortPageVO);
+        return qcResultShortDTOIPage;
+    }
+
 
     /**
      * 改善率统计-全院(首页)

+ 2 - 1
src/main/java/com/diagbot/vo/data/BasDoctorInfoVO.java

@@ -16,7 +16,8 @@ public class BasDoctorInfoVO {
      * 搜索参数
      */
     private String inputStr;
-   // private String deptName;
+    private String deptName;
+    @ApiModelProperty(hidden = true)
     private String deptId;
     @ApiModelProperty(hidden = true)
     private Long hospitalId;

+ 31 - 0
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -300,5 +300,36 @@ public class ConsoleByDeptController {
     public RespDTO<List<EntryStasByDeptDTO>> entryStatisticsByDept(@RequestBody @Valid EntryStatisticsVO entryStatisticsVO) {
         return RespDTO.onSuc(consoleByDeptFacade.entryStatisticsByDept(entryStatisticsVO));
     }
+
+    /**
+     * 出院人数统计-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @ApiOperation(value = "出院人数统计-科室[by:cy]",
+            notes = "behospitalCode: 病历号<br>" +
+                    "patName: 病人姓名 <br>" +
+                    "behDeptName:科室名称 <br>" +
+                    "doctorId:医生工号 <br>" +
+                    "doctorName:医生姓名 <br>" +
+                    "level: 病历等级 <br>" +
+                    "checkStatus: 核查状态(1:已核查,0:未核查) <br>" +
+                    "mrStatus: 首页核查状态(1:已核查,0:未核查) <br>" +
+                    "chName: 病历核查人员 <br>" +
+                    "mrName: 首页核查人员 <br>" +
+                    "chTimeStart: 病历核查起始时间 <br>" +
+                    "chTimeEnd: 病历核查截止时间 <br>" +
+                    "mrTimeStart: 首页核查起始时间 <br>" +
+                    "mrTimeEnd: 首页核查截止时间 <br>" +
+                    "leaveHosType: 离院人员类型(0/null:总人数,1:死亡人数,2:新生儿,3:手术病人数,4:非医嘱离院病人,5:31日再入院病人) <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>" +
+                    "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+    @PostMapping("/leaveHosMRPageByDept")
+    @SysLogger("leaveHosMRPageByDept")
+    public RespDTO<IPage<QcResultShortDTO>> leaveHosMRPageByDept(@RequestBody @Valid QcResultShortPageVO qcResultShortPageVO) {
+        return RespDTO.onSuc(consoleByDeptFacade.leaveHosMRPageByDept(qcResultShortPageVO));
+    }
     //endregion -----------------------内页接口结束------------------------------
 }

+ 31 - 0
src/main/java/com/diagbot/web/ConsoleByDeptExportController.java

@@ -201,6 +201,37 @@ public class ConsoleByDeptExportController {
          consoleByDeptExportFacade.entryStatisticsByDeptExport(response,entryStatisticsVO);
     }
 
+    /**
+     * 出院人数统计导出-科室
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @ApiOperation(value = "出院人数统计导出-科室[by:cy]",
+            notes = "behospitalCode: 病历号<br>" +
+                    "patName: 病人姓名 <br>" +
+                    "behDeptName:科室名称 <br>" +
+                    "doctorId:医生工号 <br>" +
+                    "doctorName:医生姓名 <br>" +
+                    "level: 病历等级 <br>" +
+                    "leaveHosType: 离院人员类型(0/null:总人数,1:死亡人数,2:新生儿,3:手术病人数,4:非医嘱离院病人,5:31日再入院病人) <br>" +
+                    "checkStatus: 核查状态(1:已核查,0:未核查) <br>" +
+                    "mrStatus: 首页核查状态(1:已核查,0:未核查) <br>" +
+                    "chName: 病历核查人员 <br>" +
+                    "mrName: 首页核查人员 <br>" +
+                    "chTimeStart: 病历核查起始时间 <br>" +
+                    "chTimeEnd: 病历核查截止时间 <br>" +
+                    "mrTimeStart: 首页核查起始时间 <br>" +
+                    "mrTimeEnd: 首页核查截止时间 <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>" +
+                    "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+    @PostMapping("/leaveHosMrPageExportByDept")
+    @SysLogger("leaveHosMrPageExportByDept")
+    public void leaveHosMrPageExportByDept(HttpServletResponse response, @RequestBody @Valid QcResultShortPageVO qcResultShortPageVO) {
+        consoleByDeptExportFacade.leaveHosMrPageExportByDept(response, qcResultShortPageVO);
+    }
+
 /**
      * 病历稽查统计(首页)
      * @param filterVO

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

@@ -1,6 +1,9 @@
 package com.diagbot.web;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.QcResultShortDTO;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConsoleExportFacade;
 import com.diagbot.vo.*;
 import io.swagger.annotations.Api;

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

@@ -6493,6 +6493,249 @@
         </if>
     </select>
 
+    <!-- 离院病人评分详情页-科室-->
+    <select id="leaveHosMRPageByDept" 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,
+        t1.checkStatus,
+        t1.mrStatus,
+        t1.chName,
+        t1.mrName,
+        t1.chTime,
+        t1.mrTime,
+        CONCAT( ifnull(t2.age,'') ,ifnull(t2.age_unit,'') )as age,
+        t1.file_code AS fileCode
+        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
+        tt1.*
+        FROM
+        (
+        SELECT
+        b.*,
+        ifnull(c.LEVEL,'未评分') as LEVEL ,
+        c.grade_type,
+        c.score_res,
+        c.gmt_create
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        a.behospital_code,
+        a.bed_code,
+        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,
+        a.file_code
+        FROM
+        med_behospital_info a,
+        sys_user_dept b
+        WHERE
+        a.is_deleted = 'N'
+        b.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.beh_dept_id = b.dept_id
+        AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.userId!=null">
+            AND b.user_id = #{qcResultShortPageVO.userId}
+        </if>
+        <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 LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
+        </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.doctorId != null and qcResultShortPageVO.doctorId != ''">
+            AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
+            OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
+            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
+        </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
+            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
+            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+        </if>
+        ) b
+        LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N'
+        AND b.hospital_id = c.hospital_id
+        AND b.behospital_code = c.behospital_code
+        ) tt1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
+            ,med_medical_record tt2,
+            qc_mode tt3
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt3.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = tt3.id
+            AND tt3.`name` = '手术记录'
+        </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
+        )t1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND (
+            ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
+            OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
+            )
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
+            , med_medical_record b,
+            med_medical_record_content c,
+            med_home_page t2
+            WHERE
+            b.is_deleted = 'N'
+            and c.is_deleted = 'N'
+            and t2.is_deleted = 'N'
+            and t1.hospital_id = b.hospital_id
+            and t1.hospital_id = c.hospital_id
+            and t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = b.behospital_code
+            AND t1.behospital_code = t2.behospital_code
+            AND b.rec_id = c.rec_id
+            and b.mode_id = '24'
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==4">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.leave_hospital_type = '非医嘱离院'
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType == null or qcResultShortPageVO.leaveHosType == 0 or qcResultShortPageVO.leaveHosType == 3">
+            LEFT JOIN med_home_page t2 ON t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+        </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>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND t.`level` = #{qcResultShortPageVO.level}
+        </if>
+    </select>
+
     <!-- 病案首页改善率统计(首页)-->
     <select id="homePageImproveCount" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.HomePageImproveDTO">
         SELECT