瀏覽代碼

Merge branch '20210512_yw_check' into debug

songxinlu 4 年之前
父節點
當前提交
694caef852

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

@@ -238,6 +238,8 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/behospitalInfo/logicDelCase").permitAll()
                 .antMatchers("/qc/medCheckInfo/getCheckUserMap").permitAll()
                 .antMatchers("/qc/medCheckInfo/getCheckList").permitAll()
+                .antMatchers("/qc/medCheckInfo//updateDistributionCheck").permitAll()
+                .antMatchers("/qc/medCheckInfo//getCheckListByUserId").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -282,6 +282,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/behospitalInfo/logicDelCase", request)
                 || matchers("/qc/medCheckInfo/getCheckUserMap", request)
                 || matchers("/qc/medCheckInfo/getCheckList", request)
+                || matchers("/qc/medCheckInfo//updateDistributionCheck", request)
+                || matchers("/qc/medCheckInfo//getCheckListByUserId", request)
                 || matchers("/", request)) {
             return true;
         }

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

@@ -11,6 +11,8 @@ import lombok.Setter;
 @Getter
 @Setter
 public class CheckJobDTO {
+    //核查任务id
+    private int id;
     //病人住院序号
     private String behospitalCode;
     //病人姓名

+ 1 - 2
src/main/java/com/diagbot/entity/MedCheckInfo.java

@@ -85,8 +85,7 @@ public class MedCheckInfo implements Serializable {
     /**
      * 核查类型(0病历,1病案首页,2全部)
      */
-    private Integer checkType;
-
+    private Integer checkType = 2;
 
     /**
      * 核查任务创建人编号

+ 0 - 108
src/main/java/com/diagbot/entity/MedCheckWork.java

@@ -1,108 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.time.LocalDateTime;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author songxl
- * @since 2021-05-11
- */
-@TableName("med_check_work")
-@Data
-public class MedCheckWork implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 病历号
-     */
-    private String behospitalCode;
-
-    /**
-     * 创建者
-     */
-    private String creator;
-
-    /**
-     * 修改者
-     */
-    private String modifier;
-
-    /**
-     * 核查用户
-     */
-    private String checkUser;
-
-    /**
-     * 创建时间
-     */
-    private Date gmtCreate;
-
-    /**
-     * 修改时间
-     */
-    private Date gmtModified;
-
-    /**
-     * 核查时间
-     */
-    private Date checkTime;
-
-    /**
-     * 任务类型(0-科室任务 1-院级 2-质控科)
-     */
-    private String workType;
-
-    /**
-     * 分配状态(0-未分配 1-已分配)
-     */
-    private String distribution;
-
-    /**
-     * 核查状态(0-未核查 1-已核查)
-     */
-    private String checkStatus;
-
-    /**
-     * 是否删除
-     */
-    private String isDeleted;
-    @Override
-    public String toString() {
-        return "MedCheckWork{" +
-            "id=" + id +
-            ", hospitalId=" + hospitalId +
-            ", behospitalCode=" + behospitalCode +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", checkUser=" + checkUser +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", checkTime=" + checkTime +
-            ", workType=" + workType +
-            ", distribution=" + distribution +
-            ", checkStatus=" + checkStatus +
-            ", isDeleted=" + isDeleted +
-        "}";
-    }
-}

+ 231 - 22
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -1,12 +1,15 @@
 package com.diagbot.facade;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.dto.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.BasDeptInfo;
 import com.diagbot.entity.BasDoctorInfo;
 import com.diagbot.entity.MedCheckInfo;
+import com.diagbot.entity.QcresultInfo;
 import com.diagbot.entity.SysRole;
 import com.diagbot.entity.SysUser;
 import com.diagbot.entity.SysUserDept;
@@ -18,7 +21,9 @@ import com.diagbot.service.impl.MedCheckInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
+import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -26,8 +31,10 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -131,6 +138,86 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         }
         return res;
     }
+    /**
+     * @Author songxl
+     * @Description 获取操作用户的核查科室以及人员
+     * @Date  2021/5/14
+     * @Param []
+     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @MethodName getCheckUserMap
+     */
+    public List<CheckJobDTO> getUserCheckList(CheckJobVO checkJobVO) {
+        //非空校验
+        if(StringUtil.isBlank(checkJobVO.getStartTime())&&StringUtil.isBlank(checkJobVO.getEndTime())
+        &&StringUtil.isBlank(checkJobVO.getBehosDateStart())&&StringUtil.isBlank(checkJobVO.getBehosDateEnd()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
+        }
+        if(checkJobVO.getDeptList()==null||checkJobVO.getDeptList().isEmpty())
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传科室列表!");
+        }
+
+        //质控管理员要判断该角色是否是质控科
+        //1.获取质控科id
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        //获取核查监管相关角色id
+        List<Long> checkRoleIds = sysRoleFacade.list(new QueryWrapper<SysRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .like("name","监管人员")
+        ).stream().map(SysRole::getId).collect(Collectors.toList());
+        //查询该角色的所有角色id
+        List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("user_id", principleId)
+                .in("role_id",checkRoleIds)
+        ).stream().distinct().map(SysUserRole::getRoleId).collect(Collectors.toList());
+        List<Long> searchRoleIds = new ArrayList<>();
+        //当前用户是监管人员或者是超级管理员
+        if(roleIds.contains(-1))
+        {
+            searchRoleIds.addAll(checkRoleIds);
+        }
+        else{
+            searchRoleIds.addAll(containsRole(checkRoleIds,roleIds));
+        }
+        if(searchRoleIds.isEmpty())
+        {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户不是核查监管人员!");
+        }
+        //质控科监管人员
+        if(searchRoleIds.contains(5L)&&"2".equals(checkJobVO.getCheckType()))
+        {
+            String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .like("dept_name","质管科")).getDeptId();
+            if(StringUtil.isBlank(zkkDeptId))
+            {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在!");
+            }
+            //2.获取监管人员所在科室集合
+            List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .eq("user_id",principleId)
+            ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+            //3.判断这个人是否在质控科
+            if(deptIds.contains(zkkDeptId))
+            {
+                return baseMapper.getCheckList(checkJobVO);
+            }
+        }
+        //临床科室监管人员、院级监管人员
+        else if(searchRoleIds.contains(4L)&&"0".equals(checkJobVO.getCheckType())||
+                searchRoleIds.contains(6L)&&"1".equals(checkJobVO.getCheckType()))
+        {
+            return baseMapper.getCheckList(checkJobVO);
+        }
+       return new ArrayList<>();
+    }
     /**
      * @Author songxl
      * @Description 获取操作用户的核查科室以及人员
@@ -154,7 +241,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("user_id", principleId)
-//                .in("role_id",checkRoleIds)
+                .in("role_id",checkRoleIds)
         ).stream().distinct().map(SysUserRole::getRoleId).collect(Collectors.toList());
         List<Long> searchRoleIds = new ArrayList<>();
         //当前用户是监管人员或者是超级管理员
@@ -186,25 +273,30 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         Map<String, List<CheckDeptDTO>> checkRoleMap = new HashMap<>();
         for(Long id:searchRoleIds)
         {
-            //不同角色不同查询方式
-            switch (id.intValue())
+            try
             {
-                //临床科室监管人员
-                case 4:
-                    getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                //质控科监管人员
-                case 5:
-                    getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                //院级监管人员
-                case 6:
-                    getYQCheckInfo(checkRoleMap,hospitalId,principleId);
-                    break;
-                default:
-                    break;
-
-
+                //不同角色不同查询方式
+                switch (id.intValue())
+                {
+                    //临床科室监管人员
+                    case 4:
+                        getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //质控科监管人员
+                    case 5:
+                        getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //院级监管人员
+                    case 6:
+                        getYQCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    default:
+                        break;
+                }
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
             }
         }
         return checkRoleMap;
@@ -221,12 +313,14 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("role_id",roleId)
         ).stream().map(SysUserRole::getUserId).collect(Collectors.toList());
+        if(userIds.isEmpty()){return;}
         //1.3获取该用户id集合的科室id集合
         List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id",hospitalId)
                 .in("user_id",userIds)
         ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+        if(deptIds.isEmpty()){return;}
         //2.1获取质控人员的科室信息
         List<BasDeptInfo> deptInfos = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -243,7 +337,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         checkUserVO.setJobType(1);
         checkUserVO.setUserList(doctorIds);
         //通过核查人员id获取核查人员的核查任务数
-        List<DeptCheckUserDTO> userJobs = this.getJobNumByUserId(checkUserVO);
+        List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
         addCheckInfoMap(checkRoleMap,doctorInfos,userJobs,deptInfos,6);
     }
 
@@ -280,7 +374,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             checkUserVO.setJobType(2);
             checkUserVO.setUserList(doctorIds);
             //通过核查人员id获取核查人员的核查任务数
-            List<DeptCheckUserDTO> userJobs = this.getJobNumByUserId(checkUserVO);
+            List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
             addCheckInfoMap(checkRoleMap,doctorInfos,userJobs,deptInfos,5);
         }
 
@@ -293,6 +387,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 .eq("hospital_id",hospitalId)
                 .eq("user_id",principleId)
         ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+        if(deptIds.isEmpty()){return;}
         //2.1获取科室详情
         List<BasDeptInfo> deptInfos = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -309,7 +404,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         checkUserVO.setJobType(0);
         checkUserVO.setUserList(doctorIds);
         //通过核查人员id获取核查人员的核查任务数
-        List<DeptCheckUserDTO> userJobs = this.getJobNumByUserId(checkUserVO);
+        List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
         addCheckInfoMap(checkRoleMap,doctorInfos,userJobs,deptInfos,4);
     }
 
@@ -381,4 +476,118 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         }
         return searchRoleIds;
     }
+    /**
+     * @Author songxl
+     * @Description 分配/取消核查任务
+     * @Date  2021/5/17
+     * @Param [distributionJobVO]
+     * @Return boolean
+     * @MethodName distributionJobs
+     */
+    public boolean distributionJobs(DistributionJobVO distributionJobVO) {
+
+        //1非空校验
+        if(StringUtil.isBlank(distributionJobVO.getCheckId())||
+                StringUtil.isBlank(distributionJobVO.getCheckName())||
+                StringUtil.isBlank(distributionJobVO.getDistributionType())||
+                distributionJobVO.getBehospitalCodes()==null||
+                distributionJobVO.getBehospitalCodes().isEmpty())
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,"入参为空");
+        }
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        //2.获取任务类型 0分配 1取消
+        String distributionType = distributionJobVO.getDistributionType();
+        //3 分配
+        if(StringUtil.isNotBlank(distributionType)&&"0".equals(distributionType))
+        {
+            //3.1 任务未分配校验
+            List<String> distributionNames = this.list(new QueryWrapper<MedCheckInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .in("behospital_code",distributionJobVO.getBehospitalCodes())
+                    ).stream().filter(s-> s.getJobDistributionName() !=null).map(MedCheckInfo::getJobDistributionName)
+                    .collect(Collectors.toList());
+            if(distributionNames!=null&&distributionNames.size()>0)
+            {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "待分配任务列表存在已分配任务!");
+            }
+
+            //获取分配用户信息
+            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();
+            Date now = DateUtil.now();
+            //3.2分配核查任务
+            return  this.update(new UpdateWrapper<MedCheckInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", hospitalId)
+                    .in("behospital_code", distributionJobVO.getBehospitalCodes())
+                    .set("job_distributor", principleId)
+                    .set("job_distribution_name", principleName)
+                    .set("check_id", distributionJobVO.getCheckId())
+                    .set("check_name", distributionJobVO.getCheckName())
+                    .set("job_distribution_time", now));
+
+        }
+        //4 取消分配
+        else if(StringUtil.isNotBlank(distributionType)&&"1".equals(distributionType))
+        {
+            //4.1 任务已取消校验
+            Set<Long> checkIds = this.list(new QueryWrapper<MedCheckInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .in("behospital_code",distributionJobVO.getBehospitalCodes())
+            ).stream().map(MedCheckInfo::getCheckId).collect(Collectors.toSet());
+            //4.2获取出来的核查用户存在但不是一个
+            if(checkIds==null||checkIds.isEmpty()||
+                    (checkIds.size()!=1&&checkIds.contains(distributionJobVO.getCheckId())))
+            {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "待取消分配任务列表不存在或存在不是该用户的任务!");
+            }
+            else
+            {
+                Date now = DateUtil.now();
+                //4.3取消分配
+                return  this.update(new UpdateWrapper<MedCheckInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", hospitalId)
+                        .eq("check_id",  distributionJobVO.getCheckId())
+                        .in("behospital_code", distributionJobVO.getBehospitalCodes())
+                        .set("job_distributor",-1)
+                        .set("job_distribution_name", null)
+                        .set("check_id", -1)
+                        .set("check_name", "")
+                        .set("job_distribution_time", now));
+            }
+        }
+
+        return false;
+    }
+    /**
+     * @Author songxl
+     * @Description 获取指定核查人员的核查任务
+     * @Date  2021/5/17
+     * @Param [checkJobVO]
+     * @Return java.util.List<com.diagbot.dto.CheckJobDTO>
+     * @MethodName getCheckListByUserId
+     */
+    public List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO) {
+        //非空校验
+        if(StringUtil.isBlank(checkJobVO.getStartTime())&&StringUtil.isBlank(checkJobVO.getEndTime())
+                &&StringUtil.isBlank(checkJobVO.getBehosDateStart())&&StringUtil.isBlank(checkJobVO.getBehosDateEnd()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
+        }
+        if(StringUtil.isBlank(checkJobVO.getCheckId()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传核查用户id!");
+        }
+        return baseMapper.getCheckListByUserId(checkJobVO);
+    }
 }

+ 68 - 30
src/main/java/com/diagbot/facade/MedCheckWorkFacade.java

@@ -1,26 +1,24 @@
 package com.diagbot.facade;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.dto.MedicalRecordDTO;
-import com.diagbot.entity.MedBehospitalType;
-import com.diagbot.entity.MedCheckWork;
+import com.diagbot.entity.*;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.MedBehospitalTypeServiceImpl;
-import com.diagbot.service.impl.MedCheckWorkServiceImpl;
 import com.diagbot.service.impl.MedicalRecordServiceImpl;
 import com.diagbot.util.DateUtil;
-import com.diagbot.util.StringUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 
 /**
@@ -28,9 +26,11 @@ import java.util.List;
  * @since 2021-05-11
  */
 @Component
-public class MedCheckWorkFacade extends MedCheckWorkServiceImpl {
+public class MedCheckWorkFacade {
     @Autowired
-    private MedCheckWorkServiceImpl medCheckWorkServiceImpl;
+    SysUserFacade sysUserFacade;
+    @Autowired
+    private MedCheckInfoFacade medCheckInfoFacade;
     @Autowired
     private MedBehospitalTypeServiceImpl medBehospitalTypeServiceImpl;
     @Autowired
@@ -38,34 +38,72 @@ public class MedCheckWorkFacade extends MedCheckWorkServiceImpl {
 
     /**
      * @Author songxl
-     * @Description 批量插入任务
+     * @Description 批量操作核查任务(增加和删除)
      * @Date 2021/5/11
-     * @Param [medCheckWorkVOList]
+     * @Param [medCheckWorkVO]
      * @Return java.lang.Boolean
      * @MethodName addCheck
      */
-    public Boolean addCheck(ArrayList<MedCheckWorkAddVO> medCheckWorkVOList) {
+    public Boolean addCheckWork(MedCheckWorkAddVO medCheckWorkVO) {
 
+        Date now = DateUtil.now();
         Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
-        String create = SysUserUtils.getCurrentPrincipleID();
-        List<MedCheckWork> checkWorkList = new ArrayList<>();
-        for (MedCheckWorkAddVO medCheckWorkAddVO : medCheckWorkVOList) {
-            //入参验证
-            if (StringUtil.isBlank(medCheckWorkAddVO.getBehospitalCode())
-                    || StringUtil.isBlank(medCheckWorkAddVO.getWorkType())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "病历id或任务类型不能为空!");
+        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();
+        //操作类型(0-取消,1-添加)
+        if (medCheckWorkVO.getCheckType() == 0) {
+            QueryWrapper<MedCheckInfo> medicalRecordQe = new QueryWrapper<>();
+            medicalRecordQe.eq("hospital_id", medCheckWorkVO.getHospitalId());
+            medicalRecordQe.eq("is_deleted", IsDeleteEnum.N.getKey());
+            if (medCheckWorkVO.getBehospitalCodeList().size() > 0) {
+                medicalRecordQe.in("behospital_code", medCheckWorkVO.getBehospitalCodeList());
+            }
+//            List<MedCheckInfo> medCheckInfoList = medCheckInfoFacade.list(medicalRecordQe);
+            List<MedCheckInfo> list = medCheckInfoFacade.list(medicalRecordQe);
+            if (ListUtil.isEmpty(list)) {
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL, "存在未生成数据!");
+            }
+
+            medCheckInfoFacade.getBaseMapper().getUpdateBatch(medCheckWorkVO.getBehospitalCodeList());
+        } else {
+            //获取核查任务类型(0-科室任务 1-院级 2-质控科)
+            switch (medCheckWorkVO.getWorkType()) {
+                case 0:
+                    //该病历没有核查的时候, 就添加核查记录
+                    List<MedCheckInfo> medCheckInfoList = new ArrayList<>();
+                    for (String behospitalCode : medCheckWorkVO.getBehospitalCodeList()) {
+                        MedCheckInfo medCheckInfo = new MedCheckInfo();
+                        medCheckInfo.setBehospitalCode(behospitalCode);
+                        medCheckInfo.setGmtCreate(now);
+                        medCheckInfo.setGmtModified(now);
+                        medCheckInfo.setHospitalId(hospitalId);
+                        medCheckInfo.setCheckType(medCheckWorkVO.getCheckType());
+                        medCheckInfo.setJobCreator(principleId);
+                        medCheckInfo.setJobCreatorName(principleName);
+                        medCheckInfo.setJobCreateTime(now);
+                        medCheckInfo.setJobType(medCheckWorkVO.getWorkType());
+                        medCheckInfo.setJobDistributionTime(now);
+                        medCheckInfoList.add(medCheckInfo);
+                    }
+                    medCheckInfoFacade.saveBatch(medCheckInfoList);
+                    break;
+                case 1:
+                    break;
+                default:
+                    break;
             }
-            MedCheckWork medCheckWork = new MedCheckWork();
-            medCheckWork.setHospitalId(hospitalId);
-            medCheckWork.setCreator(create);
-            medCheckWork.setGmtCreate(DateUtil.now());
-            medCheckWork.setBehospitalCode(medCheckWorkAddVO.getBehospitalCode());
-            medCheckWork.setWorkType(medCheckWorkAddVO.getWorkType());
-
-            medCheckWork.setId(Long.valueOf(medCheckWorkAddVO.getBehospitalCode()));
-            checkWorkList.add(medCheckWork);
         }
-        return medCheckWorkServiceImpl.saveBatch(checkWorkList, 10);
+
+
+//        List<MedCheckWork> checkWorkList = new ArrayList<>();
+
+//        return medCheckWorkServiceImpl.saveBatch(checkWorkList, 10);
+        return null;
     }
 
     /**
@@ -189,7 +227,7 @@ public class MedCheckWorkFacade extends MedCheckWorkServiceImpl {
      */
     public IPage<CheckWorkDTO> pageFac(CheckWorkPageVO checkWorkPageVO) {
         checkWorkPageSet(checkWorkPageVO);
-        IPage<CheckWorkDTO> res = getCheckWorkPage(checkWorkPageVO);
+        IPage<CheckWorkDTO> res = medCheckInfoFacade.getBaseMapper().getCheckWorkPage(checkWorkPageVO);
         return res;
     }
 

+ 15 - 1
src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java

@@ -1,10 +1,14 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
+import com.diagbot.vo.CheckWorkPageVO;
 
 import java.util.List;
 
@@ -20,5 +24,15 @@ public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
     //通过核查人员id获取核查人员的核查任务数
     List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
     //获取未分配的核查任务
-    List<Object> getCheckList(CheckJobVO checkJobVO);
+    List<CheckJobDTO> getCheckList(CheckJobVO checkJobVO);
+    /**
+     * 核查任务列表
+     *
+     * @param checkWorkPageVO
+     * @return
+     */
+    IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO);
+    //获取指定核查人员的核查任务
+    List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO);
+    void getUpdateBatch(List<String> list);
 }

+ 0 - 27
src/main/java/com/diagbot/mapper/MedCheckWorkMapper.java

@@ -1,27 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.CheckWorkDTO;
-import com.diagbot.entity.MedCheckWork;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.vo.CheckWorkPageVO;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author songxl
- * @since 2021-05-11
- */
-public interface MedCheckWorkMapper extends BaseMapper<MedCheckWork> {
-
-    /**
-     * 核查任务列表
-     *
-     * @param checkWorkPageVO
-     * @return
-     */
-    public IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO);
-
-}

+ 1 - 4
src/main/java/com/diagbot/service/MedCheckInfoService.java

@@ -1,5 +1,6 @@
 package com.diagbot.service;
 
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -17,8 +18,4 @@ import java.util.List;
  * @since 2020-07-06
  */
 public interface MedCheckInfoService extends IService<MedCheckInfo> {
-    //通过核查人员id获取核查人员的核查任务数
-    List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
-
-    List<Object> getCheckList(CheckJobVO checkJobVO);
 }

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

@@ -1,16 +0,0 @@
-package com.diagbot.service;
-
-import com.diagbot.entity.MedCheckWork;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author songxl
- * @since 2021-05-11
- */
-public interface MedCheckWorkService extends IService<MedCheckWork> {
-
-}

+ 8 - 6
src/main/java/com/diagbot/service/impl/MedCheckInfoServiceImpl.java

@@ -1,5 +1,8 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.diagbot.mapper.MedCheckInfoMapper;
@@ -7,6 +10,7 @@ import com.diagbot.service.MedCheckInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.vo.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
+import com.diagbot.vo.CheckWorkPageVO;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -22,13 +26,11 @@ import java.util.List;
 @Service
 public class MedCheckInfoServiceImpl extends ServiceImpl<MedCheckInfoMapper, MedCheckInfo> implements MedCheckInfoService {
 
-    @Override
-    public List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO) {
-        return baseMapper.getJobNumByUserId(checkUserVO);
+    public IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO) {
+        return baseMapper.getCheckWorkPage(checkWorkPageVO);
     }
 
-    @Override
-    public List<Object> getCheckList(CheckJobVO checkJobVO) {
-        return baseMapper.getCheckList(checkJobVO);
+    public void getUpdateBatch(List<String> list) {
+        baseMapper.getUpdateBatch(list);
     }
 }

+ 0 - 27
src/main/java/com/diagbot/service/impl/MedCheckWorkServiceImpl.java

@@ -1,27 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.CheckWorkDTO;
-import com.diagbot.entity.MedCheckWork;
-import com.diagbot.mapper.MedCheckWorkMapper;
-import com.diagbot.service.MedCheckWorkService;
-import com.diagbot.vo.CheckWorkPageVO;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author songxl
- * @since 2021-05-11
- */
-@Service
-public class MedCheckWorkServiceImpl extends ServiceImpl<MedCheckWorkMapper, MedCheckWork> implements MedCheckWorkService {
-
-    public IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO) {
-        return baseMapper.getCheckWorkPage(checkWorkPageVO);
-    }
-
-}

+ 6 - 0
src/main/java/com/diagbot/vo/CheckJobVO.java

@@ -15,8 +15,14 @@ public class CheckJobVO {
     private String startTime;
     //生成任务结束时间
     private String endTime;
+    //出院开始时间
+    private String behosDateStart;
+    //出院结束时间
+    private String behosDateEnd;
     //任务类型
     private String checkType;
+    //核查用户id
+    private String checkId;
     //病人姓名
     private String name;
     //病人住院序号

+ 29 - 0
src/main/java/com/diagbot/vo/DistributionJobVO.java

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description: 分配核查任务入参对象
+ * @author: songxl
+ * @time: 2021/05/17
+ */
+@Data
+public class DistributionJobVO {
+    //病人住院序号集合
+    private List<String> behospitalCodes;
+    //医院id
+    private String hospitalId;
+    //分配用户id
+    private String jobDistributor;
+    //核查用户id
+    private String checkId;
+    //核查用户姓名
+    private String checkName;
+    //操作类型 分配或取消 0-分配,1-取消分配分配或取消 0-分配,1-取消分配
+    private String distributionType;
+
+
+
+}

+ 10 - 5
src/main/java/com/diagbot/vo/MedCheckWorkAddVO.java

@@ -3,7 +3,10 @@ package com.diagbot.vo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author songxl
@@ -15,10 +18,12 @@ import java.util.Date;
 @Setter
 public class MedCheckWorkAddVO {
     @ApiModelProperty(hidden = true)
-    private Long hospitalId;//医院id
-    private String behospitalCode; // 病历id
+    private Long hospitalId;            //医院id
+    private List<String> behospitalCodeList = new ArrayList<>(); // 病历id
     @ApiModelProperty(hidden = true)
-    private String creator; // 创建用户
-    private String workType; // 任务类型 0-科室任务 1-院级 1-质控科
-
+    private String workCreator;         // 创建用户编号
+    private Integer workType;           // 任务类型 0-科室任务 1-院级 1-质控科
+    private Integer checkStatus;        // 操作类型 0-取消,1-添加
+    private String createTime;          // 操作时间
+    private Integer checkType;          // 核查类型 0病历,1病案首页,2全部 默认
 }

+ 38 - 5
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -3,12 +3,15 @@ package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MedCheckInfoFacade;
 import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import jdk.nashorn.internal.ir.annotations.Ignore;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -39,6 +42,7 @@ public class MedCheckInfoController {
             notes = "核查数据接口")
     @PostMapping("/addMedCheckInfo")
     @SysLogger("addMedCheckInfo")
+    @Ignore
     public RespDTO<Boolean> addMedCheckInfo(@RequestBody MedCheckInfoAddVO medCheckInfoAddVO) {
         Boolean res = medCheckInfoFacade.addMedCheckInfos(medCheckInfoAddVO);
         return RespDTO.onSuc(res);
@@ -46,7 +50,7 @@ public class MedCheckInfoController {
 
 
 
-    @ApiOperation(value = "获取核查人员列表[by:songxl]",
+    @ApiOperation(value = "分配核查任务--获取核查人员列表[by:songxl]",
             notes = "获取核查人员列表")
     @PostMapping("/getCheckUserMap")
     @SysLogger("getCheckUserMap")
@@ -56,15 +60,44 @@ public class MedCheckInfoController {
     }
 
 
-    @ApiOperation(value = "获取待分配核查任务列表[by:songxl]",
+    @ApiOperation(value = "分配核查任务--获取待分配核查任务列表[by:songxl]",
             notes = "startTime:任务生成开始时间 必填<br>" +
                     "endTime:  任务生成结束时间 必填<br>" +
+                    "或<br>" +
+                    "behosDateStart:  出院开始时间 必填<br>" +
+                    "behosDateEnd:  出院结束时间 必填<br>" +
                     "checkType:核查类型 必填 0-科室任务 1-院级 2-质控科<br>" +
-                    "deptList:明细id,必填<br>")
+                    "deptList:科室id集合,必填<br>")
     @PostMapping("/getCheckList")
     @SysLogger("getCheckList")
-    public RespDTO<List<Object>> getCheckList(@RequestBody CheckJobVO checkJobVO) {
-        List<Object> userInfos = medCheckInfoFacade.getCheckList(checkJobVO);
+    public RespDTO<List<CheckJobDTO>> getCheckList(@RequestBody CheckJobVO checkJobVO) {
+        List<CheckJobDTO> userInfos = medCheckInfoFacade.getUserCheckList(checkJobVO);
+        return RespDTO.onSuc(userInfos);
+    }
+
+    @ApiOperation(value = "分配核查任务--分配/取消核查任务[by:songxl]",
+            notes = "behospitalCodes:病人住院序号集合 必填<br>" +
+                    "checkId:  核查用户id 必填<br>" +
+                    "checkName:  核查用户姓名 必填<br>" +
+                    "checkType:操作类型 必填 分配或取消 0-分配,1-取消分配<br>")
+    @PostMapping("/updateDistributionCheck")
+    @SysLogger("getCheckList")
+    public RespDTO<Boolean> distributionJobs(@RequestBody DistributionJobVO distributionJobVO) {
+        return RespDTO.onSuc(medCheckInfoFacade.distributionJobs(distributionJobVO));
+    }
+
+
+    @ApiOperation(value = "分配核查任务--获取指定核查人员的核查任务[by:songxl]",
+            notes = "startTime:任务生成开始时间 必填<br>" +
+                    "endTime:  任务生成结束时间 必填<br>" +
+                    "或<br>" +
+                    "behosDateStart:  出院开始时间 必填<br>" +
+                    "behosDateEnd:  出院结束时间 必填<br>" +
+                    "checkId:核查用户id")
+    @PostMapping("/getCheckListByUserId")
+    @SysLogger("getCheckListByUserId")
+    public RespDTO<List<CheckJobDTO>> getCheckListByUserId(@RequestBody CheckJobVO checkJobVO) {
+        List<CheckJobDTO> userInfos = medCheckInfoFacade.getCheckListByUserId(checkJobVO);
         return RespDTO.onSuc(userInfos);
     }
 }

+ 16 - 16
src/main/java/com/diagbot/web/MedCheckWorkController.java

@@ -17,36 +17,36 @@ import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
-
 /**
- * <p>
- *  核查前端控制器
- * </p>
  *
  * @author songxl
  * @since 2021-05-11
  */
 @RestController
 @RequestMapping("/check")
-@Api(value = "核查任务数据模块相关接口API", tags = { "核查任务数据模块相关接口API" })
+@Api(value = "生成核查任务--相关接口API", tags = { "生成核查任务--相关接口API" })
 public class MedCheckWorkController {
     @Autowired
     MedCheckWorkFacade medCheckworkFacade;
 
-    @ApiOperation(value = "生成核查任务[by:songxl]",
-            notes = "生成核查任务")
-    @PostMapping("/addCheck")
-    @SysLogger("addCheck")
-    public RespDTO<Boolean> addMedCheckInfo(@RequestBody ArrayList<MedCheckWorkAddVO> medCheckWorkVOList) {
-        Boolean res = medCheckworkFacade.addCheck(medCheckWorkVOList);
+    @ApiOperation(value = "生成/取消核查任务[by:wangsy]",
+            notes = "生成/取消核查任务 <br>" +
+            "behospitalCodeList:病历id(List) 【必填】<br>" +
+            "workType:任务类型(0-科室任务 1-院级 1-质控科) 【必填】<br>" +
+            "checkStatus:操作类型(0-取消,1-添加) 【必填】<br>" +
+            "createTime: 操作时间<br>" +
+            "checkType:核查类型(0病历,1病案首页,2全部 默认)<br>")
+    @PostMapping("/addCheckWork")
+    @SysLogger("addCheckWork")
+    public RespDTO<Boolean> addCheckTask(@RequestBody MedCheckWorkAddVO medCheckWorkVO) {
+        Boolean res = medCheckworkFacade.addCheckWork(medCheckWorkVO);
         return RespDTO.onSuc(res);
     }
 
-    @ApiOperation(value = "核查任务列表[by:wangsy]",
-            notes = "startDate:出院开始时间<br>" +
-                    "endDate:出院结束时间<br>" +
-                    "creatStatus:生成状态<br>" +
+    @ApiOperation(value = "获取患者病历列表[by:wangsy]",
+            notes = "startDate:出院开始时间 【必填】<br>" +
+                    "endDate:出院结束时间 【必填】<br>" +
+                    "creatStatus:生成状态(0-未生成 1-已生成) 【必填】<br>" +
                     "hospitalId: 医院ID<br>" +
                     "behospitalCode:病人住院序号<br>" +
                     "department:科室<br>" +

+ 1 - 1
src/main/resources/application-pre.yml

@@ -164,7 +164,7 @@ oath.self.address: http://${myhost}:${server.port}
 
 # 加解密开关
 encrypt:
-  enable: false
+  enable: true
 
 swagger:
   enable: true

+ 8 - 4
src/main/resources/application-test.yml

@@ -59,7 +59,8 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://192.168.2.241:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+#      url: jdbc:mysql://192.168.2.241:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.2.236:3306/stu?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息
@@ -109,9 +110,12 @@ spring:
   #redis
   redis:
     database:
-      cache: 8 # cache索引
-      token: 8 # Token索引
-    host: 192.168.2.241  #Redis服务器地址
+#      cache: 8 # cache索引
+#      token: 8 # Token索引
+#    host: 192.168.2.241  #Redis服务器地址
+      cache: 3 # cache索引
+      token: 3 # Token索引
+    host: 192.168.2.236  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
     password: lantone # Redis服务器连接密码(默认为空)
     lettuce:

+ 149 - 15
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -27,35 +27,169 @@
     </resultMap>
     <!--通过核查人员id获取核查人员的核查任务数-->
     <select id="getJobNumByUserId" resultType="com.diagbot.dto.DeptCheckUserDTO">
-        SELECT job_distributor doctorId, count(*) as jobNum
+        SELECT check_id doctorId, count(*) as jobNum
         from med_check_info
-        where is_deleted = 'N'
+        where is_deleted = 'N' and job_distribution_name is not null
         <if test="jobType != null">
             and job_type = #{jobType}
         </if>
         <if test="userList !=null">
-            and job_distributor in
+            and check_id in
             <foreach collection="userList" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
         </if>
-        GROUP BY job_distributor
+        GROUP BY check_id
     </select>
 
     <!--获取待分配核查任务列表-->
     <select id="getCheckList" resultType="com.diagbot.dto.CheckJobDTO">
-        SELECT job_distributor doctorId, count(*) as jobNum
-        from med_check_info
-        where is_deleted = 'N'
-        <if test="jobType != null">
-            and job_type = #{jobType}
+        SELECT a.behospital_code behospitalCode,a.beh_dept_name behospitalDept,
+        a.doctor_name attendingDoctor,a.leave_hospital_date leaveHospitalDate,
+        a.`name`,b.`value`,a.id from
+        (select a.behospital_code,a.`name`,a.beh_dept_name,a.doctor_name,a.leave_hospital_date,a.hospital_id,
+            a.beh_dept_id,b.id from med_behospital_info a ,med_check_info b
+              where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
+                and b.is_deleted = 'N' and b.job_distribution_name is NULL  and b.`status` = 0
+                <if test="checkType !=null">
+                    and b.job_type = #{checkType}
+                </if>
+                <if test="startTime !=null and endTime !=null">
+                    and b.job_create_time BETWEEN #{startTime} AND #{endTime}
+                </if>
+                <if test="behosDateStart !=null and behosDateEnd !=null">
+                    and a.leave_hospital_date BETWEEN #{behosDateStart} AND #{behosDateEnd}
+                </if>
+                <if test="name !=null">
+                    and a.doctor_name = #{name}
+                </if>
+                <if test="behospitalCode !=null">
+                    and a.behospital_code = #{behospitalCode}
+                </if>
+                <if test="name !=null">
+                    and a.`name` LIKE CONCAT('%',#{name},'%')
+                </if>
+                <if test="deptList !=null and checkType ==0">
+                    and a.beh_dept_id in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="deptList !=null and checkType ==1">
+                    and a.beh_dept_id not in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+
+        ) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
+        and a.hospital_id = b.hospital_id and b.is_deleted = 'N' ORDER BY b.`value` DESC ,a.leave_hospital_date DESC
+    </select>
+
+
+    <!--获取指定核查人员的核查任务-->
+    <select id="getCheckListByUserId" resultType="com.diagbot.dto.CheckJobDTO">
+        SELECT a.behospital_code behospitalCode,a.beh_dept_name behospitalDept,
+        a.doctor_name attendingDoctor,a.leave_hospital_date leaveHospitalDate,
+        a.`name`,b.`value`,a.id from
+        (select a.behospital_code,a.`name`,a.beh_dept_name,a.doctor_name,a.leave_hospital_date,a.hospital_id,
+        a.beh_dept_id,b.id from med_behospital_info a ,med_check_info b
+        where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
+        and b.is_deleted = 'N'
+        <if test="startTime !=null and endTime !=null">
+            and b.job_create_time BETWEEN #{startTime} AND #{endTime}
         </if>
-        <if test="userList !=null">
-            and job_distributor in
-            <foreach collection="userList" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
+        <if test="behosDateStart !=null and behosDateEnd !=null">
+            and a.leave_hospital_date BETWEEN #{behosDateStart} AND #{behosDateEnd}
+        </if>
+        <if test="checkId !=null">
+            and b.check_id = #{checkId}
+        </if>) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
+        and a.hospital_id = b.hospital_id and b.is_deleted = 'N' ORDER BY b.`value` DESC ,a.leave_hospital_date DESC
+    </select>
+    <select id="getCheckWorkPage" resultType="com.diagbot.dto.CheckWorkDTO">
+        SELECT
+        mbi.behospital_code,
+        mbi.name,
+        mbi.file_code,
+        mbi.sex,
+        mhp.age,
+        mbi.beh_dept_name,
+        mbi.leave_hospital_date,
+        mhp.behospital_day_num,
+        mbi.doctor_name,
+        mqi.level,
+        mbi.diagnose,
+        CASE WHEN mbt.behospital_type='出院病人' THEN '6'
+        WHEN mbt.behospital_type='死亡病人' THEN '6'
+        WHEN mbt.behospital_type='危重病人' THEN '4'
+        WHEN mbt.behospital_type='抢救病人' THEN '5'
+        WHEN mbt.behospital_type='手术病人' THEN '2'
+        WHEN mbt.behospital_type='疑难病人' THEN '3'
+        WHEN mbt.behospital_type='输血病人' THEN '4' ELSE '0' END AS score,
+        CASE WHEN ISNULL(mci.job_create_time) THEN '未生成' ELSE '已生成' END AS creatStatus,
+        mci.job_create_time
+        FROM
+        med_behospital_info mbi
+        LEFT JOIN med_home_page mhp
+        ON mbi.behospital_code=mhp.behospital_code
+        AND mbi.hospital_id = mhp.hospital_id
+        LEFT JOIN med_check_info mci
+        ON mbi.behospital_code = mci.behospital_code
+        AND mbi.hospital_id = mci.hospital_id AND mci.is_deleted = 'N'
+        LEFT JOIN med_qcresult_info mqi
+        ON mbi.behospital_code = mqi.behospital_code
+        AND mbi.hospital_id = mqi.hospital_id AND mqi.is_deleted = 'N'
+        LEFT JOIN med_behospital_type mbt ON mbi.behospital_code = mbt.behospital_code
+        AND mbi.hospital_id = mbt.hospital_id AND mbt.is_deleted = 'N'
+        WHERE mbi.is_deleted = 'N'
+        <if test="startDate != null">
+            <![CDATA[ AND mbi.behospital_date >= #{startDate}]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[ AND mbi.behospital_date < #{endDate}]]>
+        </if>
+        <if test="creatStatus != null and creatStatus != ''">
+            AND mci.create_status = #{creatStatus}
+        </if>
+        <if test="name != null and name != ''">
+            AND mbi.name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND mbi.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="department != null and department != ''">
+            AND mbi.beh_dept_name like CONCAT('%',#{department},'%')
+        </if>
+        <if test="sDay != null">
+            <![CDATA[ AND mhp.behospital_day_num >= #{sDay}]]>
+        </if>
+        <if test="lDay != null">
+            <![CDATA[ AND hp.behospital_day_num < #{lDay}]]>
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND mbi.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND mbi.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="level != null and level != ''">
+            AND mqi.level= #{level}
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            AND mbi.is_placefile = #{isPlacefile}
         </if>
-        GROUP BY job_distributor
     </select>
+
+    <!--通过住院号,取消核查任务-->
+    <update id="getUpdateBatch">
+        <foreach collection="list" item="item"  separator=";">
+            update med_check_info
+            <set>
+                is_deleted = 'Y'
+            </set>
+            where behospital_code = #{item.behospitalCode} and is_deleted = 'N'
+        </foreach>
+    </update>
+
 </mapper>

+ 0 - 97
src/main/resources/mapper/MedCheckWorkMapper.xml

@@ -1,97 +0,0 @@
-<?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.MedCheckWorkMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.diagbot.entity.MedCheckWork">
-        <id column="id" property="id" />
-        <result column="hospital_id" property="hospitalId" />
-        <result column="behospital_code" property="behospitalCode" />
-        <result column="creator" property="creator" />
-        <result column="modifier" property="modifier" />
-        <result column="check_user" property="checkUser" />
-        <result column="gmt_create" property="gmtCreate" />
-        <result column="gmt_modified" property="gmtModified" />
-        <result column="check_time" property="checkTime" />
-        <result column="work_type" property="workType" />
-        <result column="distribution" property="distribution" />
-        <result column="check_status" property="checkStatus" />
-        <result column="is_deleted" property="isDeleted" />
-    </resultMap>
-
-
-    <select id="getCheckWorkPage" resultType="com.diagbot.dto.CheckWorkDTO">
-        SELECT
-        mbi.behospital_code,
-        mbi.name,
-        mbi.file_code,
-        mbi.sex,
-        mhp.age,
-        mbi.beh_dept_name,
-        mbi.leave_hospital_date,
-        mhp.behospital_day_num,
-        mbi.doctor_name,
-        mqi.level,
-        mbi.diagnose,
-        CASE WHEN mbt.behospital_type='出院病人' THEN '6'
-             WHEN mbt.behospital_type='死亡病人' THEN '6'
-             WHEN mbt.behospital_type='危重病人' THEN '4'
-             WHEN mbt.behospital_type='抢救病人' THEN '5'
-             WHEN mbt.behospital_type='手术病人' THEN '2'
-             WHEN mbt.behospital_type='疑难病人' THEN '3'
-             WHEN mbt.behospital_type='输血病人' THEN '4' ELSE '0' END AS score,
-        CASE WHEN ISNULL(mci.job_create_time) THEN '0' ELSE '1' END AS creatStatus,
-        mci.job_create_time
-        FROM
-        med_behospital_info mbi
-        LEFT JOIN med_home_page mhp
-        ON mbi.behospital_code=mhp.behospital_code
-        AND mbi.hospital_id = mhp.hospital_id
-        LEFT JOIN med_check_info mci
-        ON mbi.behospital_code = mci.behospital_code
-        AND mbi.hospital_id = mci.hospital_id AND mci.is_deleted = 'N'
-        LEFT JOIN med_qcresult_info mqi
-        ON mbi.behospital_code = mqi.behospital_code
-        AND mbi.hospital_id = mqi.hospital_id AND mqi.is_deleted = 'N'
-        LEFT JOIN med_behospital_type mbt ON mbi.behospital_code = mbt.behospital_code
-        AND mbi.hospital_id = mbt.hospital_id AND mbt.is_deleted = 'N'
-        WHERE mbi.is_deleted = 'N'
-        <if test="startDate != null">
-            <![CDATA[ AND mbi.behospital_date >= #{startDate}]]>
-        </if>
-        <if test="endDate != null">
-            <![CDATA[ AND mbi.behospital_date < #{endDate}]]>
-        </if>
-        <if test="creatStatus != null and creatStatus != ''">
-            AND mci.create_status = #{creatStatus}
-        </if>
-        <if test="name != null and name != ''">
-            AND mbi.name like CONCAT('%',#{name},'%')
-        </if>
-        <if test="behospitalCode != null and behospitalCode != ''">
-            AND mbi.behospital_code like CONCAT('%',#{behospitalCode},'%')
-        </if>
-        <if test="department != null and department != ''">
-            AND mbi.beh_dept_name like CONCAT('%',#{department},'%')
-        </if>
-        <if test="sDay != null">
-            <![CDATA[ AND mhp.behospital_day_num >= #{sDay}]]>
-        </if>
-        <if test="lDay != null">
-            <![CDATA[ AND hp.behospital_day_num < #{lDay}]]>
-        </if>
-        <if test="doctorName != null and doctorName != ''">
-            AND mbi.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-        </if>
-        <if test="diagnose != null and diagnose != ''">
-            AND mbi.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
-        </if>
-        <if test="level != null and level != ''">
-            AND mqi.level= #{level}
-        </if>
-        <if test="isPlacefile != null and isPlacefile != ''">
-            AND mbi.is_placefile = #{isPlacefile}
-        </if>
-    </select>
-
-</mapper>