Преглед на файлове

Merge remote-tracking branch 'origin/dev/20200716_1.3.8' into debug

# Conflicts:
#	src/main/java/com/diagbot/vo/ExportQcresultVO.java
zhaops преди 5 години
родител
ревизия
bc1269062e

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

@@ -136,6 +136,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/qcCheckStatisticsExport").permitAll()
                 .antMatchers("/console/export/unModifyMRPageExport").permitAll()
                 .antMatchers("/console/export/unModifyMRStatisticsExport").permitAll()
+                .antMatchers("/console/export/reHos31DaysPageExport").permitAll()
                 .antMatchers("/qc/data/sendDoctorInfos").permitAll()
                 .antMatchers("/qc/data/sendDeptInfos").permitAll()
                 .antMatchers("/qc/data/sendRecordTypes").permitAll()

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

@@ -180,6 +180,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/qcCheckStatisticsExport", request)
                 || matchers("/console/export/unModifyMRPageExport", request)
                 || matchers("/console/export/unModifyMRStatisticsExport", request)
+                || matchers("/console/export/reHos31DaysPageExport", request)
                 || matchers("/qc/data/sendDoctorInfos", request)
                 || matchers("/qc/data/sendDeptInfos", request)
                 || matchers("/qc/data/sendRecordTypes", request)

+ 7 - 0
src/main/java/com/diagbot/dto/BehospitalInfoDTO.java

@@ -119,4 +119,11 @@ public class BehospitalInfoDTO implements Serializable {
     private Date placefileDate;
 
     private Integer checkStatus;
+    private Integer mrStatus;
+    private String chName;
+    private String mrName;
+    private Date chTimeStart;
+    private Date chTimeEnd;
+    private Date mrTimeStart;
+    private Date mrTimeEnd;
 }

+ 7 - 0
src/main/java/com/diagbot/dto/ReBeHosDTO.java

@@ -1,5 +1,7 @@
 package com.diagbot.dto;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -16,21 +18,26 @@ public class ReBeHosDTO {
     /**
      * 病案号
      */
+    @Excel(name = "病案号", width = 20, needMerge = true, orderNum = "1")
     private String fileCode;
     /**
      * 性别
      */
+    @Excel(name = "性别", width = 10, needMerge = true, orderNum = "2")
     private String sex;
     /**
      * 主诊断
      */
+    @Excel(name = "主诊断", width = 50, needMerge = true, orderNum = "3")
     private String diagnose;
     /**
      * 间隔天数
      */
+    @Excel(name = "间隔天数", width = 10, needMerge = true, orderNum = "4")
     private Integer diffDays;
     /**
      * 比较病历组
      */
+    @ExcelCollection(name = "", orderNum = "5")
     private List<ReBeHosDetailDTO> details;
 }

+ 8 - 1
src/main/java/com/diagbot/dto/ReBeHosDetailDTO.java

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
@@ -17,18 +18,22 @@ public class ReBeHosDetailDTO {
     /**
      * 病人住院号
      */
+    @Excel(name = "病人住院号", width = 20, orderNum = "1")
     private String behospitalCode;
     /**
      * 病人姓名
      */
+    @Excel(name = "病人姓名", width = 20, orderNum = "2")
     private String name;
     /**
      * 病历等级
      */
+    @Excel(name = "病历等级", width = 10, orderNum = "3")
     private String level;
     /**
      * 病历得分
      */
+    @Excel(name = "病历得分", width = 10, orderNum = "4")
     private Double scoreRes;
     /**
      * 科室编码
@@ -37,16 +42,18 @@ public class ReBeHosDetailDTO {
     /**
      * 科室
      */
+    @Excel(name = "科室", width = 50, orderNum = "5")
     private String behDeptName;
-
     /**
      * 出院日期
      */
+    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "6")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date leaveHospitalDate;
     /**
      * 入院日期
      */
+    @Excel(name = "入院日期", format = "yyyy-MM-dd", width = 30, orderNum = "7")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date behospitalDate;
 }

+ 10 - 0
src/main/java/com/diagbot/entity/MedCheckInfo.java

@@ -79,6 +79,16 @@ public class MedCheckInfo implements Serializable {
      */
     private Integer status;
 
+    private Integer checkType;
+
+    public Integer getCheckType() {
+        return checkType;
+    }
+
+    public void setCheckType(Integer checkType) {
+        this.checkType = checkType;
+    }
+
     public Long getId() {
         return id;
     }

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

@@ -17,6 +17,7 @@ import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.LevelStatisticsTZDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
+import com.diagbot.dto.ReBeHosDTO;
 import com.diagbot.dto.UnModifyMRDTO;
 import com.diagbot.entity.SysHospitalSet;
 import com.diagbot.exception.CommonErrorCode;
@@ -32,6 +33,7 @@ import com.diagbot.vo.FilterPageByAverageVO;
 import com.diagbot.vo.FilterPageVO;
 import com.diagbot.vo.FilterUnModifyMRVO;
 import com.diagbot.vo.QcResultShortPageVO;
+import com.diagbot.vo.ReBeHosPageVO;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -333,7 +335,7 @@ public class ConsoleExportFacade {
 
         List<String> columnSet = Arrays.asList(hospitalSet.getValue().split(","));
         for (String valueStr : columnSet) {
-            if(StringUtil.isBlank(valueStr)){
+            if (StringUtil.isBlank(valueStr)) {
                 continue;
             }
             String[] keyValue = valueStr.split("--");
@@ -351,4 +353,20 @@ public class ConsoleExportFacade {
         String fileName = "未整改病历统计.xls";
         ExcelUtils.exportExcelDynamicCol(colList, data, null, "sheet1", fileName, response);
     }
+
+    /**
+     * 31天再入院统计导出
+     *
+     * @param reBeHosPageVO
+     * @return
+     */
+    public void reHos31DaysPageExport(HttpServletResponse response, ReBeHosPageVO reBeHosPageVO) {
+        reBeHosPageVO.setCurrent(1L);
+        reBeHosPageVO.setSize(Long.MAX_VALUE);
+        reBeHosPageVO.setSearchCount(false);
+        IPage<ReBeHosDTO> page = consoleFacade.reHos31DaysPage(reBeHosPageVO);
+        List<ReBeHosDTO> records = page.getRecords();
+        String fileName = "31天再入院统计详情.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", ReBeHosDTO.class, fileName, response);
+    }
 }

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

@@ -1251,6 +1251,7 @@ public class ConsoleFacade {
                 BeanUtil.copyProperties(record, detailRecord);
                 details.add(detailRecord);
                 ReBeHosDetailDTO lastDetailRecord = new ReBeHosDetailDTO();
+                lastDetailRecord.setName(record.getName());
                 lastDetailRecord.setBehDeptId(record.getLastBehDeptId());
                 lastDetailRecord.setBehDeptName(record.getBehDeptName());
                 lastDetailRecord.setBehospitalCode(record.getLastBehospitalCode());

+ 14 - 1
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.entity.MedCheckInfo;
+import com.diagbot.entity.SysUser;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -10,6 +11,7 @@ import com.diagbot.service.impl.MedCheckInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.MedCheckInfoAddVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
@@ -24,6 +26,9 @@ import java.util.Map;
 @Component
 public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
 
+    @Autowired
+    SysUserFacade sysUserFacade;
+
     /**
      * @param medCheckInfoAddVO
      * @return
@@ -33,12 +38,18 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         Date now = DateUtil.now();
         //获取人员id 和 该人员的医院id
         Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
-        String principleName = SysUserUtils.getCurrentPrinciple();
         Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        QueryWrapper<SysUser> userQuer = new QueryWrapper<>();
+        userQuer.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id",principleId)
+                .eq("status",1);
+        SysUser user = sysUserFacade.getOne(userQuer);
+        String principleName = user.getLinkman();
         Map<String, Object> mapAll = new HashMap<String, Object>();
         mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
         mapAll.put("behospital_code", medCheckInfoAddVO.getBehospitalCode());
         mapAll.put("hospital_id", hospitalId);
+        mapAll.put("check_type", medCheckInfoAddVO.getCheckType());
         QueryWrapper<MedCheckInfo> medCheckInfoQuerys = new QueryWrapper<>();
         medCheckInfoQuerys.allEq(mapAll);
         MedCheckInfo data = this.getOne(medCheckInfoQuerys, false);
@@ -58,6 +69,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             medCheckInfo.setCheckId(principleId);
             medCheckInfo.setCheckName(principleName);
             medCheckInfo.setCheckTime(now);
+            medCheckInfo.setCheckType(medCheckInfoAddVO.getCheckType());
             medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
             medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
             res = this.save(medCheckInfo);
@@ -89,6 +101,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             medCheckInfo.setCheckId(principleId);
             medCheckInfo.setCheckName(principleName);
             medCheckInfo.setCheckTime(now);
+            medCheckInfo.setCheckType(medCheckInfoAddVO.getCheckType());
             medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
             medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
             res = this.save(medCheckInfo);

+ 8 - 0
src/main/java/com/diagbot/vo/BehospitalPageVO.java

@@ -96,4 +96,12 @@ public class BehospitalPageVO extends Page implements Serializable {
     private String isPlacefile = "1";
 
     private Integer checkStatus;
+    private Integer mrStatus;
+    private String chName;
+    private String mrName;
+    private Date chTimeStart;
+    private Date chTimeEnd;
+    private Date mrTimeStart;
+    private Date mrTimeEnd;
+
 }

+ 7 - 0
src/main/java/com/diagbot/vo/ExportQcresultVO.java

@@ -28,6 +28,13 @@ public class ExportQcresultVO {
     private String deptId;
     private String name;
     private Integer checkStatus;
+    private Integer mrStatus;
+    private String chName;
+    private String mrName;
+    private Date chTimeStart;
+    private Date chTimeEnd;
+    private Date mrTimeStart;
+    private Date mrTimeEnd;
 
     /**
      * 是否归档(0:未归档,1:已归档)

+ 2 - 0
src/main/java/com/diagbot/vo/MedCheckInfoAddVO.java

@@ -16,4 +16,6 @@ public class MedCheckInfoAddVO {
     private String behospitalCode; // 病历id
     @ApiModelProperty(hidden = true)
     private Integer checkStatus = 1;//核查状态(0未核查,1已核查)
+    private Integer checkType;
+
 }

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

@@ -8,6 +8,7 @@ import com.diagbot.vo.FilterPageByAverageVO;
 import com.diagbot.vo.FilterPageVO;
 import com.diagbot.vo.FilterUnModifyMRVO;
 import com.diagbot.vo.QcResultShortPageVO;
+import com.diagbot.vo.ReBeHosPageVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -300,4 +301,22 @@ public class ConsoleExportController {
     public void unModifyMRStatisticsExport(HttpServletResponse response, @RequestBody @Valid FilterUnModifyMRVO filterUnModifyMRVO) {
         consoleExportFacade.unModifyMRStatisticsExport(response, filterUnModifyMRVO);
     }
+
+    /**
+     * 未整改病历统计导出
+     * 31天再入院统计导出
+     *
+     * @param reBeHosPageVO
+     * @return
+     */
+    @ApiOperation(value = "31天再入院统计导出[by:zhaops]",
+            notes = "name: 病人姓名 <br>" +
+                    "fileCode: 病案号 <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>")
+    @PostMapping("/reHos31DaysPageExport")
+    @SysLogger("reHos31DaysPageExport")
+    public void reHos31DaysPageExport(HttpServletResponse response, @RequestBody @Valid ReBeHosPageVO reBeHosPageVO) {
+        consoleExportFacade.reHos31DaysPageExport(response, reBeHosPageVO);
+    }
 }

+ 249 - 35
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -42,7 +42,14 @@
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
         SELECT * FROM (
         select   t.*,
-        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
          from (
         select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
         grade_time, c.age from med_behospital_info a
@@ -51,9 +58,12 @@
         left join med_home_page c
         on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
         ) t
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
         where t.is_deleted = 'N'
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
@@ -103,6 +113,27 @@
         <if test="checkStatus != null ">
         and p.check_status = #{checkStatus}
         </if>
+        <if test="mrStatus != null ">
+        AND p.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  p.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND p.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        </if>
     </select>
 
     <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
@@ -269,7 +300,14 @@
         SELECT * from (
         SELECT
         t.*,
-        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type as ch_type,
+        h.check_type AS mr_type,
+        g.check_name as ch_name,
+        h.check_name as mr_name,
+        g.check_time as ch_time,
+        h.check_time AS mr_time
         FROM
         ( SELECT
         a.*,
@@ -292,9 +330,12 @@
         WHERE d.is_deleted = 'N'
         AND d.user_id = #{userId}
         ) t
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
         where t.is_deleted = 'N'
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
@@ -344,13 +385,41 @@
         <if test="checkStatus != null ">
             and p.check_status = #{checkStatus}
         </if>
+        <if test="mrStatus != null ">
+        AND p.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  p.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND p.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        </if>
     </select>
 
     <!--质控评分(个人)分页-->
     <select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
         Select * from (
         select t.*,
-        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type as ch_type,
+        h.check_type AS mr_type,
+        g.check_name as ch_name,
+        h.check_name as mr_name,
+        g.check_time as ch_time,
+        h.check_time AS mr_time
          from (SELECT
         a.*,
         IFNULL(b.level, '未评分') AS `level`,
@@ -385,9 +454,12 @@
         IFNULL(a.director_doctor_name, '')
         ) LIKE CONCAT('%', u1.linkman, '%')
         ) t
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
         WHERE t.is_deleted = 'N'
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
@@ -424,13 +496,41 @@
         <if test="checkStatus != null ">
             and p.check_status = #{checkStatus}
         </if>
+        <if test="mrStatus != null ">
+            AND p.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  p.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND p.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        </if>
     </select>
 
     <!--质控评分(医疗组)分页-->
     <select id="getPageByGroup" resultType="com.diagbot.dto.BehospitalInfoDTO">
         select * from (
         select t.*,
-        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type as ch_type,
+        h.check_type AS mr_type,
+        g.check_name as ch_name,
+        h.check_name as mr_name,
+        g.check_time as ch_time,
+        h.check_time AS mr_time
          from (
         select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
         grade_time, c.age from med_behospital_info a
@@ -439,9 +539,12 @@
         left join med_home_page c
         on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
         ) t
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
         WHERE t.is_deleted = 'N'
         and
             t.doctor_id in (
@@ -503,6 +606,27 @@
         <if test="checkStatus != null ">
             and p.check_status = #{checkStatus}
         </if>
+        <if test="mrStatus != null ">
+            AND p.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  p.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND p.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        </if>
     </select>
 
     <!-- 出院总人数统计-全院-首页 -->
@@ -2319,7 +2443,15 @@
     <!-- 质控评分导出到excel-->
     <select id="exportQcresult" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
         SELECT * FROM (
-        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
+        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
+         FROM (
         SELECT
         t1.behDeptId,
         t1.behDeptName,
@@ -2461,23 +2593,53 @@
         t1.behDoctorName,
         t1.patName,
         t1.behospitalCode,
-        t1.caseName)tp LEFT JOIN
-        (SELECT
-        *
-        FROM
-        med_check_info
-        WHERE is_deleted = 'N') g
+        t1.caseName)tp
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON tp.behospitalCode = g.behospital_code
-        AND tp.hospitalId = g.hospital_id ) tu
+        AND tp.hospitalId = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON tp.behospitalCode = h.behospital_code
+        AND tp.hospitalId = h.hospital_id
+        ) tu
+        WHERE tu.behospitalCode IS NOT NULL
         <if test="checkStatus != null ">
-            where tu.check_status = #{checkStatus}
+            and tu.check_status = #{checkStatus}
+        </if>
+        <if test="mrStatus != null ">
+            AND tu.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  tu.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND tu.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
         </if>
     </select>
 
     <!-- 科室质控评分导出到excel-->
     <select  id="exportQcresultByDept" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
         SELECT * FROM (
-        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
+        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
+         FROM (
         SELECT
         t1.behDeptId,
         t1.behDeptName,
@@ -2633,23 +2795,53 @@
         t1.behDoctorName,
         t1.patName,
         t1.behospitalCode,
-        t1.caseName)tp LEFT JOIN
-        (SELECT
-        *
-        FROM
-        med_check_info
-        WHERE is_deleted = 'N') g
+        t1.caseName)tp
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON tp.behospitalCode = g.behospital_code
-        AND tp.hospitalId = g.hospital_id ) tu
+        AND tp.hospitalId = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON tp.behospitalCode = h.behospital_code
+        AND tp.hospitalId = h.hospital_id
+        ) tu
+        WHERE tu.behospitalCode IS NOT NULL
         <if test="checkStatus != null ">
-            where tu.check_status = #{checkStatus}
+            and tu.check_status = #{checkStatus}
+        </if>
+        <if test="mrStatus != null ">
+            AND tu.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  tu.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND tu.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
         </if>
     </select>
 
     <!-- 医疗组质控评分导出到excel-->
     <select  id="exportQcresultByGroup" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
         SELECT * FROM (
-        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
+        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
+         FROM (
         SELECT
         t1.behDeptId,
         t1.behDeptName,
@@ -2811,16 +3003,38 @@
         t1.behDoctorName,
         t1.patName,
         t1.behospitalCode,
-        t1.caseName)tp LEFT JOIN
-        (SELECT
-        *
-        FROM
-        med_check_info
-        WHERE is_deleted = 'N') g
+        t1.caseName)tp
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON tp.behospitalCode = g.behospital_code
-        AND tp.hospitalId = g.hospital_id ) tu
+        AND tp.hospitalId = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON tp.behospitalCode = h.behospital_code
+        AND tp.hospitalId = h.hospital_id
+        ) tu
+        WHERE tu.behospitalCode IS NOT NULL
         <if test="checkStatus != null ">
-            where tu.check_status = #{checkStatus}
+            and tu.check_status = #{checkStatus}
+        </if>
+        <if test="mrStatus != null ">
+            AND tu.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND  tu.ch_name  like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND tu.mr_name  like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
         </if>
     </select>
 

+ 1 - 0
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -16,6 +16,7 @@
         <result column="check_name" property="checkName" />
         <result column="check_time" property="checkTime" />
         <result column="status" property="status" />
+        <result column="check_type" property="checkType" />
     </resultMap>
 
 </mapper>