Explorar el Código

核查功能开发及脚本

wangfeng hace 4 años
padre
commit
d62df1fb41

+ 40 - 0
doc/013.20200706v1.3.7/qc_initv1.3.7.sql

@@ -1,3 +1,43 @@
 use `qc`;
 
 ALTER TABLE `med_qcresult_info` ADD `have_home_page` tinyint(4) DEFAULT '0' COMMENT '是否有病案首页(0:无,1:有)' AFTER `score_res`;
+
+DELETE FROM sys_user_pageset WHERE user_id = -1;
+
+INSERT INTO `sys_user_pageset` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '病历等级', 'level', '1', '1', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '病历得分', 'scoreRes', '1', '2', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '病人住院序号', 'behospitalCode', '1', '3', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '病案号', 'fileCode', '1', '5', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '病人姓名', 'name', '1', '6', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '性别', 'sex', '1', '7', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '年龄', 'age', '1', '8', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '床号', 'bedCode', '1', '9', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '入院日期', 'behospitalDate', '1', '10', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '出院日期', 'leaveHospitalDate', '1', '11', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '归档日期', 'placefileDate', '1', '12', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '主诊断', 'diagnose', '1', '13', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '住院医生', 'behDoctorName', '1', '14', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '主管医生', 'doctorName', '1', '15', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '主任医生', 'directorDoctorName', '1', '16', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '科室', 'behDeptName', '1', '17', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '评分时间', 'gradeTime', '1', '18', NULL);
+INSERT INTO `sys_user_pageset` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '核查状态', 'checkStatus', '1', '4', NULL);
+
+/* #找出没有”核查状态“的人员并给加上*/
+ INSERT INTO sys_user_pageset
+(  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`)
+ SELECT is_deleted,
+gmt_create,
+ gmt_modified,
+ creator,
+MODIFIER,
+ user_id,
+ page_type,
+ CASE WHEN ISNULL(NAME) THEN "核查状态" ELSE "核查状态" END NAME,
+ CASE WHEN ISNULL(userId) THEN "checkStatus" ELSE "checkStatus" END val,
+ STATUS,
+ CASE WHEN ISNULL(order_no) THEN 4 ELSE 4 END order_no,
+ remark
+ FROM (SELECT * FROM  sys_user_pageset  WHERE user_id <> -1) b LEFT JOIN  (SELECT c.user_id AS userId FROM  sys_user_pageset c  WHERE user_id <> -1 AND val = "checkStatus") p ON b.user_id = p.userId
+WHERE  userId IS NULL
+ GROUP BY user_id ;

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

@@ -117,4 +117,6 @@ public class BehospitalInfoDTO implements Serializable {
      */
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date placefileDate;
+
+    private Integer checkStatus;
 }

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

@@ -0,0 +1,184 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 核查表
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-07-06
+ */
+public class MedCheckInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 核查人id
+     */
+    private Long checkId;
+
+    /**
+     * 核查人
+     */
+    private String checkName;
+
+    /**
+     * 核查时间
+     */
+    private Date checkTime;
+
+    /**
+     * 核查状态(0未核查,1已核查)
+     */
+    private Integer status;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public String getBehospitalCode() {
+        return behospitalCode;
+    }
+
+    public void setBehospitalCode(String behospitalCode) {
+        this.behospitalCode = behospitalCode;
+    }
+    public Long getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Long hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+    public Long getCheckId() {
+        return checkId;
+    }
+
+    public void setCheckId(Long checkId) {
+        this.checkId = checkId;
+    }
+    public String getCheckName() {
+        return checkName;
+    }
+
+    public void setCheckName(String checkName) {
+        this.checkName = checkName;
+    }
+    public Date getCheckTime() {
+        return checkTime;
+    }
+
+    public void setCheckTime(Date checkTime) {
+        this.checkTime = checkTime;
+    }
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "MedCheckInfo{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", behospitalCode=" + behospitalCode +
+            ", hospitalId=" + hospitalId +
+            ", checkId=" + checkId +
+            ", checkName=" + checkName +
+            ", checkTime=" + checkTime +
+            ", status=" + status +
+        "}";
+    }
+}

+ 112 - 0
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -0,0 +1,112 @@
+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.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.MedCheckInfoService;
+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;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-06 13:27
+ */
+@Component
+public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
+
+    @Autowired
+    MedCheckInfoService medCheckInfoService;
+
+    /**
+     * @param medCheckInfoAddVO
+     * @return
+     */
+    public Boolean addMedCheckInfos(MedCheckInfoAddVO medCheckInfoAddVO) {
+        boolean res = false;
+        Date now = DateUtil.now();
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        String principleName = SysUserUtils.getCurrentPrinciple();
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        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);
+        QueryWrapper<MedCheckInfo> medCheckInfoQuerys = new QueryWrapper<>();
+        medCheckInfoQuerys.allEq(mapAll);
+        MedCheckInfo data = medCheckInfoService.getOne(medCheckInfoQuerys);
+        if (data != null) {
+            if (data.getStatus() == 1) {
+                //检验核查人是否是本人
+                boolean b = data.getCheckId() == principleId;
+                if (b) {
+                    //是本人且该数据已核查,不能改为未核查
+                    if (medCheckInfoAddVO.getCheckStatus() == 0) {
+                        throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据已核查,不能改成未核查!");
+                    }
+                    res = saveNew(mapAll, now, hospitalId, principleId, principleName, medCheckInfoAddVO);
+                } else {
+                    throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据已被人核查,您暂无权限!");
+                }
+            } else {
+                res = saveNew(mapAll, now, hospitalId, principleId, principleName, medCheckInfoAddVO);
+            }
+        } else {
+            //该病历没有核查的时候, 就添加核查记录
+            MedCheckInfo medCheckInfo = new MedCheckInfo();
+            medCheckInfo.setGmtCreate(now);
+            medCheckInfo.setGmtModified(now);
+            medCheckInfo.setHospitalId(hospitalId);
+            medCheckInfo.setCheckId(principleId);
+            medCheckInfo.setCheckName(principleName);
+            medCheckInfo.setCheckTime(now);
+            medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
+            medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
+            res = medCheckInfoService.save(medCheckInfo);
+        }
+
+        return res;
+    }
+
+    /**
+     * @param mapAll
+     * @param now
+     * @param hospitalId
+     * @param principleId
+     * @param principleName
+     * @param medCheckInfoAddVO
+     * @return
+     */
+    public boolean saveNew(Map<String, Object> mapAll, Date now, Long hospitalId, Long principleId, String principleName, MedCheckInfoAddVO medCheckInfoAddVO) {
+        boolean res = false;
+        UpdateWrapper<MedCheckInfo> medCheckInfoUpdate = new UpdateWrapper<>();
+        medCheckInfoUpdate.allEq(mapAll).set("is_deleted", IsDeleteEnum.Y.getKey()).set("gmt_modified", now);
+        res = medCheckInfoService.update(medCheckInfoUpdate);
+        //删除原来的成功后, 再新建一条核查数据
+        if (res) {
+            MedCheckInfo medCheckInfo = new MedCheckInfo();
+            medCheckInfo.setGmtCreate(now);
+            medCheckInfo.setGmtModified(now);
+            medCheckInfo.setHospitalId(hospitalId);
+            medCheckInfo.setCheckId(principleId);
+            medCheckInfo.setCheckName(principleName);
+            medCheckInfo.setCheckTime(now);
+            medCheckInfo.setStatus(medCheckInfoAddVO.getCheckStatus());
+            medCheckInfo.setBehospitalCode(medCheckInfoAddVO.getBehospitalCode());
+            res = medCheckInfoService.save(medCheckInfo);
+        }
+        return res;
+    }
+}

+ 16 - 0
src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedCheckInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 核查表 Mapper 接口
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-07-06
+ */
+public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/MedCheckInfoService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.MedCheckInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 核查表 服务类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-07-06
+ */
+public interface MedCheckInfoService extends IService<MedCheckInfo> {
+
+}

+ 20 - 0
src/main/java/com/diagbot/service/impl/MedCheckInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.MedCheckInfo;
+import com.diagbot.mapper.MedCheckInfoMapper;
+import com.diagbot.service.MedCheckInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 核查表 服务实现类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-07-06
+ */
+@Service
+public class MedCheckInfoServiceImpl extends ServiceImpl<MedCheckInfoMapper, MedCheckInfo> implements MedCheckInfoService {
+
+}

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

@@ -94,4 +94,6 @@ public class BehospitalPageVO extends Page implements Serializable {
      */
     @ApiModelProperty(hidden = true)
     private String isPlacefile;
+
+    private Integer checkStatus;
 }

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

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-06 13:30
+ */
+@Getter
+@Setter
+public class MedCheckInfoAddVO {
+    private Long hospitalId;//医院id
+    private String behospitalCode; // 病历id
+    @ApiModelProperty(hidden = true)
+    private Integer checkStatus = 1;//核查状态(0未核查,1已核查)
+}

+ 42 - 0
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -0,0 +1,42 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.MedCheckInfoFacade;
+import com.diagbot.vo.MedCheckInfoAddVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 核查表 前端控制器
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-07-06
+ */
+@RestController
+@RequestMapping("/qc/medCheckInfo")
+@Api(value = "核查病历数据模块相关接口API", tags = { "核查病历数据模块相关接口API" })
+@SuppressWarnings("unchecked")
+public class MedCheckInfoController {
+
+    @Autowired
+    MedCheckInfoFacade medCheckInfoFacade;
+
+    @ApiOperation(value = "核查数据接口[by:wangfeng]",
+            notes = "核查数据接口")
+    @PostMapping("/addMedCheckInfo")
+    @SysLogger("addMedCheckInfo")
+    public RespDTO<Boolean> addMedCheckInfo(@RequestBody MedCheckInfoAddVO medCheckInfoAddVO) {
+        Boolean res = medCheckInfoFacade.addMedCheckInfos(medCheckInfoAddVO);
+        return RespDTO.onSuc(res);
+    }
+
+}

+ 37 - 6
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -40,7 +40,9 @@
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        select * from (
+        select   t.*,
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
+         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
         LEFT JOIN med_qcresult_info b
@@ -48,7 +50,13 @@
         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
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
         where t.is_deleted = 'N'
+        <if test="checkStatus != null ">
+            and g.status = #{checkStatus}
+        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -249,7 +257,8 @@
     <!--质控评分(科室)分页-->
     <select id="getPageByDept" resultType="com.diagbot.dto.BehospitalInfoDTO">
         SELECT
-        *
+        t.*,
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
         FROM
         ( SELECT
         a.*,
@@ -272,7 +281,13 @@
         WHERE d.is_deleted = 'N'
         AND d.user_id = #{userId}
         ) t
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
         where t.is_deleted = 'N'
+        <if test="checkStatus != null ">
+            and g.status = #{checkStatus}
+        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -322,7 +337,9 @@
 
     <!--质控评分(个人)分页-->
     <select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        select * from (SELECT
+        select t.*,
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
+         from (SELECT
         a.*,
         IFNULL(b.level, '未评分') AS `level`,
         b.grade_type,
@@ -356,7 +373,13 @@
         IFNULL(a.director_doctor_name, '')
         ) LIKE CONCAT('%', u1.linkman, '%')
         ) t
-        where t.is_deleted = 'N'
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
+        WHERE t.is_deleted = 'N'
+        <if test="checkStatus != null ">
+            AND g.status = #{checkStatus}
+        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -393,7 +416,9 @@
 
     <!--质控评分(医疗组)分页-->
     <select id="getPageByGroup" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        select * from (
+        select t.*,
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
+         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
         LEFT JOIN med_qcresult_info b
@@ -401,7 +426,13 @@
         left join med_home_page c
         on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
         ) t
-        where t.is_deleted = 'N' and
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
+        WHERE t.is_deleted = 'N'
+        <if test="checkStatus != null ">
+            AND g.status = #{checkStatus}
+        </if> and
             t.doctor_id in (
                 SELECT doctor_id FROM `bas_doctor_info`
                 where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (

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

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.MedCheckInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.MedCheckInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="behospital_code" property="behospitalCode" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="check_id" property="checkId" />
+        <result column="check_name" property="checkName" />
+        <result column="check_time" property="checkTime" />
+        <result column="status" property="status" />
+    </resultMap>
+
+</mapper>