|
@@ -1,13 +1,22 @@
|
|
|
package com.lantone.report.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.lantone.common.dto.report.BasDeptInfoDTO;
|
|
|
import com.lantone.common.dto.report.BehospitalInfoAgeDTO;
|
|
|
+import com.lantone.common.dto.report.CheckDeptDTO;
|
|
|
import com.lantone.common.dto.report.CheckJobDTO;
|
|
|
+import com.lantone.common.dto.report.CheckUserDTO;
|
|
|
import com.lantone.common.dto.report.CheckWorkDTO;
|
|
|
+import com.lantone.common.dto.report.CheckedRecordListDTO;
|
|
|
+import com.lantone.common.dto.report.DeptCheckUserDTO;
|
|
|
+import com.lantone.common.dto.report.SysUserDeptDTO;
|
|
|
import com.lantone.common.enums.CheckJobTypeEnum;
|
|
|
+import com.lantone.common.enums.CheckStatusEnum;
|
|
|
+import com.lantone.common.enums.CheckTypeEnum;
|
|
|
import com.lantone.common.enums.CheckerRoleEnum;
|
|
|
import com.lantone.common.enums.IsDeleteEnum;
|
|
|
import com.lantone.common.exception.ApiException;
|
|
@@ -16,15 +25,21 @@ import com.lantone.common.util.ListUtil;
|
|
|
import com.lantone.common.util.StringUtil;
|
|
|
import com.lantone.common.util.SysUserUtils;
|
|
|
import com.lantone.common.vo.report.CheckJobPageVO;
|
|
|
+import com.lantone.common.vo.report.CheckUserVO;
|
|
|
import com.lantone.common.vo.report.CheckWorkPageVO;
|
|
|
+import com.lantone.common.vo.report.CheckedRecordListVO;
|
|
|
+import com.lantone.common.vo.report.DistributionJobVO;
|
|
|
import com.lantone.common.vo.report.MedCheckWorkAddVO;
|
|
|
+import com.lantone.common.vo.report.RecordCheckVO;
|
|
|
import com.lantone.common.vo.report.SysUserBaseVO;
|
|
|
+import com.lantone.dblayermbg.entity.report.BehospitalType;
|
|
|
import com.lantone.dblayermbg.entity.report.UserRole;
|
|
|
import com.lantone.dblayermbg.entity.report.CheckInfo;
|
|
|
import com.lantone.dblayermbg.entity.report.DeptInfo;
|
|
|
import com.lantone.dblayermbg.entity.report.Role;
|
|
|
import com.lantone.dblayermbg.entity.report.User;
|
|
|
import com.lantone.dblayermbg.entity.report.UserDept;
|
|
|
+import com.lantone.dblayermbg.facade.report.BehospitalTypeFacade;
|
|
|
import com.lantone.dblayermbg.facade.report.RoleFacade;
|
|
|
import com.lantone.dblayermbg.facade.report.DeptInfoFacade;
|
|
|
import com.lantone.dblayermbg.facade.report.UserDeptFacade;
|
|
@@ -38,9 +53,11 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -63,6 +80,10 @@ public class QcCheckFacade {
|
|
|
private UserDeptFacade sysUserDeptFacade;
|
|
|
@Autowired
|
|
|
private UserRoleFacade userRoleFacade;
|
|
|
+ @Autowired
|
|
|
+ private BehospitalTypeFacade behospitalTypeFacade;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 分页
|
|
|
*
|
|
@@ -324,6 +345,391 @@ public class QcCheckFacade {
|
|
|
throw new ApiException("该用户的角色和任务类型不对应!");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @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 Map<String, List<CheckDeptDTO>> getCheckUserMap() {
|
|
|
+
|
|
|
+ //1.获取当前用户对应的管理员角色
|
|
|
+ //获取人员id 和 该人员的医院id
|
|
|
+ Long hospitalId = SysUserUtils.getCurrentHospitalId();
|
|
|
+ Long principleId = SysUserUtils.getCurrentPrincipleId();
|
|
|
+ //获取核查监管相关角色id
|
|
|
+ List<Long> checkRoleIds = roleFacade.list(new QueryWrapper<Role>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .like("name", "监管人员")
|
|
|
+ ).stream().map(Role::getId).collect(Collectors.toList());
|
|
|
+ //查询该角色的所有角色id
|
|
|
+ List<Long> roleIds = userRoleFacade.list(new QueryWrapper<UserRole>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("user_id", principleId)
|
|
|
+ ).stream().distinct().map(UserRole::getRoleId).collect(Collectors.toList());
|
|
|
+ List<Long> searchRoleIds = new ArrayList<>();
|
|
|
+ //当前用户是监管人员或者是超级管理员
|
|
|
+ if (roleIds.contains(-1L)) {
|
|
|
+ searchRoleIds.addAll(checkRoleIds);
|
|
|
+ } else {
|
|
|
+ searchRoleIds.addAll(containsRole(checkRoleIds, roleIds));
|
|
|
+ }
|
|
|
+ if (searchRoleIds.isEmpty()) {
|
|
|
+ throw new ApiException("该用户不是核查监管人员!");
|
|
|
+ }
|
|
|
+ //2.获取相应角色对应的科室以及核查人员
|
|
|
+ Map<String, List<CheckDeptDTO>> checkUserMap = getCheckRoleMap(searchRoleIds, hospitalId, principleId);
|
|
|
+ return checkUserMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 获取相应角色对应的科室以及核查人员
|
|
|
+ * @Date 2021/5/14
|
|
|
+ * @Param [searchRoleIds]
|
|
|
+ * @Return java.util.Map<java.lang.String, java.util.List < java.util.Map < java.lang.String, java.lang.Object>>>
|
|
|
+ * @MethodName getCheckRoleMap
|
|
|
+ */
|
|
|
+
|
|
|
+ private Map<String, List<CheckDeptDTO>> getCheckRoleMap(List<Long> searchRoleIds, Long hospitalId, Long principleId) {
|
|
|
+ Map<String, List<CheckDeptDTO>> checkRoleMap = new HashMap<>();
|
|
|
+ for (Long id : searchRoleIds) {
|
|
|
+ try {
|
|
|
+ //不同角色不同查询方式
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 院区管理员获取管理的科室以及科室包涵质控人员
|
|
|
+ * @Date 2021/5/17
|
|
|
+ * @Param [checkRoleMap, hospitalId, principleId]
|
|
|
+ * @Return void
|
|
|
+ * @MethodName getYQCheckInfo
|
|
|
+ */
|
|
|
+ private void getYQCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
|
|
|
+ //1.获取院级质控人员有哪些
|
|
|
+ //1.1获取院级质控人员角色id
|
|
|
+ CheckUserVO checkUserVOS = new CheckUserVO();
|
|
|
+ checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.HOSP_GENERAL.getKey() * 1l));
|
|
|
+ checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
|
|
|
+ checkUserVOS.setHospitalId(hospitalId);
|
|
|
+ List<CheckUserDTO> checkUserDTOS = medCheckInfoFacade.getBaseMapper().getCheckUser(checkUserVOS);
|
|
|
+ //2.用户科室整合
|
|
|
+ margeDept(checkRoleMap, checkUserDTOS, CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + "");
|
|
|
+ if (!ListUtil.isEmpty(checkRoleMap.get(CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + ""))) {
|
|
|
+ //2.3获取所有医生信息的核查数
|
|
|
+ CheckUserVO checkUserVO = new CheckUserVO();
|
|
|
+ checkUserVO.setJobType(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey());
|
|
|
+ //通过核查人员id获取核查人员的核查任务数
|
|
|
+ List<DeptCheckUserDTO> userJobs = medCheckInfoFacade.getBaseMapper().getDeptJobNumByUserId(checkUserVO);
|
|
|
+ addCheckInfoMaps(checkRoleMap, null, userJobs, checkUserDTOS, CheckerRoleEnum.HOSP_SUPERVISOR.getKey(), CheckJobTypeEnum.HOSP_SUPERVISOR.getKey());
|
|
|
+ } else {
|
|
|
+ checkRoleMap.put(CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + "", new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 质控科管理员获取管理的科室以及科室包涵质控人员
|
|
|
+ * @Date 2021/5/17
|
|
|
+ * @Param [checkRoleMap, hospitalId, principleId]
|
|
|
+ * @Return void
|
|
|
+ * @MethodName getZKKCheckInfo
|
|
|
+ */
|
|
|
+ private void getZKKCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
|
|
|
+ //1.获取质控科id
|
|
|
+ DeptInfo deptInfo = deptInfoFacade.getOne(new QueryWrapper<DeptInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("station", "质管"));
|
|
|
+ if (deptInfo == null || deptInfo.getDeptId() == null) {
|
|
|
+ throw new ApiException( "科室质管科不存在,请联系管理员!");
|
|
|
+ }
|
|
|
+// //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))
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+ CheckUserVO checkUserVOS = new CheckUserVO();
|
|
|
+ //质管科人员角色
|
|
|
+ checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.QUAT_GENERAL.getKey() * 1l));
|
|
|
+ //质管科
|
|
|
+ checkUserVOS.setDeptStations(Lists.newArrayList("质管"));
|
|
|
+ checkUserVOS.setDeptIds(Lists.newArrayList(deptInfo.getDeptId()));
|
|
|
+ checkUserVOS.setHospitalId(hospitalId);
|
|
|
+ List<CheckUserDTO> checkUserDTOS = medCheckInfoFacade.getBaseMapper().getCheckUser(checkUserVOS);
|
|
|
+ //2.1获取科室详情
|
|
|
+ Map<String, String> deptMap = deptInfoFacade.list(new QueryWrapper<DeptInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .in("dept_id", Lists.newArrayList(deptInfo.getDeptId()))).stream()
|
|
|
+ .collect(Collectors.toMap(DeptInfo::getDeptId, DeptInfo::getDeptName, (v1, v2) -> v2));
|
|
|
+ if (deptMap != null && !deptMap.isEmpty()) {
|
|
|
+ //2.3获取质控科核查人员的核查数
|
|
|
+ List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
|
|
|
+ CheckUserVO checkUserVO = new CheckUserVO();
|
|
|
+ checkUserVO.setJobType(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey());
|
|
|
+ checkUserVO.setUserList(doctorIds);
|
|
|
+ //通过核查人员id获取核查人员的核查任务数
|
|
|
+ List<DeptCheckUserDTO> userJobs = medCheckInfoFacade.getBaseMapper().getDeptJobNumByUserId(checkUserVO);
|
|
|
+ userJobs.stream().forEach(deptCheckUserDTO -> {
|
|
|
+ deptCheckUserDTO.setDeptId(deptInfo.getDeptId());
|
|
|
+ });
|
|
|
+ addCheckInfoMaps(checkRoleMap, deptMap, userJobs, checkUserDTOS, CheckerRoleEnum.QUAT_SUPERVISOR.getKey(), CheckJobTypeEnum.QUAT_SUPERVISOR.getKey());
|
|
|
+ } else {
|
|
|
+ checkRoleMap.put(CheckerRoleEnum.QUAT_SUPERVISOR.getKey() + "", new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 院区人员用户科室合并
|
|
|
+ * @Date 2021/6/1
|
|
|
+ * @Param [checkRoleMap, checkUserDTOS, s]
|
|
|
+ * @Return void
|
|
|
+ * @MethodName margeDept
|
|
|
+ */
|
|
|
+ private void margeDept(Map<String, List<CheckDeptDTO>> checkRoleMap, List<CheckUserDTO> checkUserDTOS, String roleId) {
|
|
|
+ if (ListUtil.isEmpty(checkUserDTOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Set<String> userIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toSet());
|
|
|
+ try {
|
|
|
+ List<CheckDeptDTO> tempDepts = new ArrayList<>();
|
|
|
+ //全部
|
|
|
+ CheckDeptDTO allCheckDept = new CheckDeptDTO();
|
|
|
+ allCheckDept.setDeptId("-1");
|
|
|
+ allCheckDept.setDeptName("全部");
|
|
|
+ userIds.stream().forEach(userId -> {
|
|
|
+ //获取该用户的科室拼接
|
|
|
+ StringBuilder deptIdBuilder = new StringBuilder();
|
|
|
+ StringBuilder deptNameBuilder = new StringBuilder();
|
|
|
+ StringBuilder userName = new StringBuilder();
|
|
|
+ checkUserDTOS.stream().forEach(checkUserDTO -> {
|
|
|
+ if (userId.equals(checkUserDTO.getDoctorId())) {
|
|
|
+ deptIdBuilder.append(checkUserDTO.getDeptId()).append(",");
|
|
|
+ deptNameBuilder.append(checkUserDTO.getDeptName()).append(",");
|
|
|
+ if (userName.length() == 0) {
|
|
|
+ userName.append(checkUserDTO.getDoctorName());
|
|
|
+ }
|
|
|
+ //除了全部以外添加科室信息
|
|
|
+ if (!tempDepts.stream().map(CheckDeptDTO::getDeptId).collect(Collectors.toList())
|
|
|
+ .contains(checkUserDTO.getDeptId())) {
|
|
|
+ CheckDeptDTO oneCheckUser = new CheckDeptDTO();
|
|
|
+ oneCheckUser.setDeptId(checkUserDTO.getDeptId());
|
|
|
+ oneCheckUser.setDeptName(checkUserDTO.getDeptName());
|
|
|
+ tempDepts.add(oneCheckUser);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //合并科室
|
|
|
+ String deptId = deptIdBuilder.substring(0, deptIdBuilder.length() - 1);
|
|
|
+ String deptName = deptNameBuilder.substring(0, deptNameBuilder.length() - 1);
|
|
|
+ //科室用户
|
|
|
+ DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
|
|
|
+ deptCheckUserDTO.setDoctorId(userId);
|
|
|
+ deptCheckUserDTO.setDoctorName(userName.toString());
|
|
|
+ deptCheckUserDTO.setDeptId(deptId);
|
|
|
+ deptCheckUserDTO.setDeptName(deptName);
|
|
|
+ AtomicBoolean hasFlag = new AtomicBoolean(false);
|
|
|
+ //全部处理
|
|
|
+ if (ListUtil.isEmpty(allCheckDept.getDeptcheckUsers())) {
|
|
|
+ allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
+ }
|
|
|
+ allCheckDept.getDeptcheckUsers().forEach(oneDeptCheckUser -> {
|
|
|
+ if (!userId.equals(oneDeptCheckUser.getDoctorId())) {
|
|
|
+ hasFlag.set(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (hasFlag.get()) {
|
|
|
+ allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ tempDepts.stream().forEach(checkDeptDTO -> {
|
|
|
+ if (deptId.contains(checkDeptDTO.getDeptId())) {
|
|
|
+ checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ tempDepts.add(0, allCheckDept);
|
|
|
+ checkRoleMap.put(roleId + "", tempDepts);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 临床科室管理员获取管理的科室以及科室包涵质控人员
|
|
|
+ * @Date 2021/5/17
|
|
|
+ * @Param [checkRoleMap, hospitalId, principleId]
|
|
|
+ * @Return void
|
|
|
+ * @MethodName getDeptCheckInfo
|
|
|
+ */
|
|
|
+ private void getDeptCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
|
|
|
+
|
|
|
+ //1.获取监管人员所在科室集合
|
|
|
+ List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<UserDept>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("user_id", principleId)
|
|
|
+ ).stream().map(UserDept::getDeptId).collect(Collectors.toList());
|
|
|
+ if (deptIds.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //1.2去除质管科
|
|
|
+ DeptInfo deptInfo = deptInfoFacade.getOne(new QueryWrapper<DeptInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("station", "质管"));
|
|
|
+ if (deptInfo == null || deptInfo.getDeptId() == null) {
|
|
|
+ throw new ApiException( "科室质管科不存在,请联系管理员!");
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(deptInfo.getDeptId())) {
|
|
|
+ deptIds.remove(deptInfo.getDeptId());
|
|
|
+ }
|
|
|
+ CheckUserVO checkUserVOS = new CheckUserVO();
|
|
|
+ //科室普通核查人员角色筛选
|
|
|
+ checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.DEPT_GENERAL.getKey() * 1l));
|
|
|
+ checkUserVOS.setDeptIds(deptIds);
|
|
|
+ checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
|
|
|
+ checkUserVOS.setHospitalId(hospitalId);
|
|
|
+ List<CheckUserDTO> checkUserDTOS = medCheckInfoFacade.getBaseMapper().getCheckUser(checkUserVOS);
|
|
|
+ //2.1获取科室详情
|
|
|
+ Map<String, String> deptMap = deptInfoFacade.list(new QueryWrapper<DeptInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .in("dept_id", deptIds)).stream()
|
|
|
+ .collect(Collectors.toMap(DeptInfo::getDeptId, DeptInfo::getDeptName, (v1, v2) -> v2));
|
|
|
+ if (deptMap != null && !deptMap.isEmpty()) {
|
|
|
+ //2.3获取所有医生信息的核查数
|
|
|
+ List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
|
|
|
+ CheckUserVO checkUserVO = new CheckUserVO();
|
|
|
+ checkUserVO.setJobType(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey());
|
|
|
+ checkUserVO.setUserList(doctorIds);
|
|
|
+ checkUserVO.setDeptIds(deptIds);
|
|
|
+ //通过核查人员id获取核查人员的核查任务数
|
|
|
+ List<DeptCheckUserDTO> userJobs = medCheckInfoFacade.getBaseMapper().getDeptJobNumByUserId(checkUserVO);
|
|
|
+ addCheckInfoMaps(checkRoleMap, deptMap, userJobs, checkUserDTOS, CheckerRoleEnum.DEPT_SUPERVISOR.getKey(), CheckJobTypeEnum.DEPT_SUPERVISOR.getKey());
|
|
|
+ } else {
|
|
|
+ checkRoleMap.put(CheckerRoleEnum.DEPT_SUPERVISOR.getKey() + "", new ArrayList<>());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 拼装科室、核查人员、任务数对象
|
|
|
+ * @Date 2021/5/17
|
|
|
+ * @Param [checkRoleMap, doctorInfos, userJobs, deptInfos, roleId]
|
|
|
+ * @Return void
|
|
|
+ * @MethodName addCheckInfoMap
|
|
|
+ */
|
|
|
+ private void addCheckInfoMaps(Map<String, List<CheckDeptDTO>> checkRoleMap, Map<String, String> deptMap,
|
|
|
+ List<DeptCheckUserDTO> userJobs, List<CheckUserDTO> checkUserDTOS, int roleId, int jobType) {
|
|
|
+ //非院区任务
|
|
|
+ if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() != jobType) {
|
|
|
+ if (deptMap.isEmpty() || checkUserDTOS.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ checkRoleMap.put(roleId + "", new ArrayList<>());
|
|
|
+ //遍历科室
|
|
|
+ for (String deptId : deptMap.keySet()) {
|
|
|
+ //科室对象
|
|
|
+ CheckDeptDTO checkDeptDTO = new CheckDeptDTO();
|
|
|
+ checkDeptDTO.setDeptId(deptId);
|
|
|
+ checkDeptDTO.setDeptName(deptMap.get(deptId));
|
|
|
+ checkDeptDTO.setDeptcheckUsers(new ArrayList<DeptCheckUserDTO>());
|
|
|
+ //遍历医生
|
|
|
+ for (CheckUserDTO checkUserDTO : checkUserDTOS) {
|
|
|
+ //同一科室
|
|
|
+ if (checkDeptDTO.getDeptId().equals(checkUserDTO.getDeptId())) {
|
|
|
+ DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
|
|
|
+ deptCheckUserDTO.setDeptId(checkUserDTO.getDeptId());
|
|
|
+ deptCheckUserDTO.setDeptName(checkUserDTO.getDeptName());
|
|
|
+ deptCheckUserDTO.setDoctorId(checkUserDTO.getDoctorId());
|
|
|
+ deptCheckUserDTO.setDoctorName(checkUserDTO.getDoctorName());
|
|
|
+ checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (DeptCheckUserDTO deptCheckUserDTO : checkDeptDTO.getDeptcheckUsers()) {
|
|
|
+ //遍历数量
|
|
|
+ for (DeptCheckUserDTO jobNumDto : userJobs) {
|
|
|
+ //这个科室有这个人
|
|
|
+ if (deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId())) {
|
|
|
+ if (deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId())) {
|
|
|
+ if (jobNumDto.getStatus() == 0) {
|
|
|
+ deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
|
|
|
+ }
|
|
|
+ if (jobNumDto.getStatus() == 1) {
|
|
|
+
|
|
|
+ deptCheckUserDTO.setCheckNum(jobNumDto.getJobNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ checkRoleMap.get(roleId + "").add(checkDeptDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //院区任务不是同一科室的人员数量增加
|
|
|
+ else if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == jobType) {
|
|
|
+ checkRoleMap.get(roleId + "").stream().forEach(checkDeptDTO -> {
|
|
|
+ if (!ListUtil.isEmpty(checkDeptDTO.getDeptcheckUsers())) {
|
|
|
+ checkDeptDTO.getDeptcheckUsers().stream().forEach(deptCheckUser -> {
|
|
|
+ userJobs.stream().forEach(userJob -> {
|
|
|
+ if (deptCheckUser.getDoctorId().equals(userJob.getDoctorId())) {
|
|
|
+ if (userJob.getStatus() == 0) {
|
|
|
+ deptCheckUser.setJobNum(userJob.getJobNum());
|
|
|
+ }
|
|
|
+ if (userJob.getStatus() == 1) {
|
|
|
+ deptCheckUser.setCheckNum(userJob.getJobNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Author songxl
|
|
|
* @Description list求交集
|
|
@@ -371,7 +777,297 @@ public class QcCheckFacade {
|
|
|
throw new ApiException("任务生成的开始时间必须小于结束时间!");
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 获取指定核查人员的核查任务
|
|
|
+ * @Date 2021/5/17
|
|
|
+ * @Param [checkJobVO]
|
|
|
+ * @Return java.util.List<com.diagbot.dto.CheckJobDTO>
|
|
|
+ * @MethodName getCheckListByUserId
|
|
|
+ */
|
|
|
+ public IPage<CheckJobDTO> getCheckListByUserId(CheckJobPageVO checkJobVO) {
|
|
|
+ //非空校验
|
|
|
+ if (StringUtil.isBlank(checkJobVO.getCheckId())) {
|
|
|
+ throw new ApiException( "没有传核查用户id!");
|
|
|
+ }
|
|
|
+ IPage<CheckJobDTO> checkJobDTOS = medCheckInfoFacade.getBaseMapper().getCheckListByUserId(checkJobVO);
|
|
|
+ //获取当前登录人员
|
|
|
+ Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleId());
|
|
|
+ List<CheckJobDTO> outCheckJobDTOS = new ArrayList<>();
|
|
|
+ //判断分配人员是否是当前人员
|
|
|
+ for (CheckJobDTO checkJobDTO : checkJobDTOS.getRecords()) {
|
|
|
+ if (principleId.equals(checkJobDTO.getJobDistributor())) {
|
|
|
+ checkJobDTO.setDelFlag(true);
|
|
|
+ } else {
|
|
|
+ checkJobDTO.setDelFlag(false);
|
|
|
+ }
|
|
|
+ outCheckJobDTOS.add(checkJobDTO);
|
|
|
+ }
|
|
|
+ checkJobDTOS.setRecords(outCheckJobDTOS);
|
|
|
+ return checkJobDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @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 ApiException( "入参为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(distributionJobVO.getCheckDept())) {
|
|
|
+ throw new ApiException( "核查人科室(checkDept)为空");
|
|
|
+ }
|
|
|
+ if (distributionJobVO.getBehospitalDepts() == null
|
|
|
+ || distributionJobVO.getBehospitalDepts().isEmpty()) {
|
|
|
+ throw new ApiException( "核查任务科室集合(behospitalDepts)为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isEmpty(distributionJobVO.getJobType())) {
|
|
|
+ throw new ApiException( "核查任务类型(jobType)为空");
|
|
|
+ }
|
|
|
+ //全院的话要判断院级核查人员和核查病历不是同一科室
|
|
|
+ if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == Integer.parseInt(distributionJobVO.getJobType())) {
|
|
|
+ for (String deptId : distributionJobVO.getCheckDept().split(",")) {
|
|
|
+ if (distributionJobVO.getBehospitalDepts().contains(deptId)) {
|
|
|
+ throw new ApiException("院级核查人员和核查病历是同一科室");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //获取人员id 和 该人员的医院id
|
|
|
+ Long hospitalId = SysUserUtils.getCurrentHospitalId();
|
|
|
+ Long principleId = SysUserUtils.getCurrentPrincipleId();
|
|
|
+ //2.获取任务类型 0分配 1取消
|
|
|
+ String distributionType = distributionJobVO.getDistributionType();
|
|
|
+ //3 分配
|
|
|
+ if (StringUtil.isNotBlank(distributionType) && "0".equals(distributionType)) {
|
|
|
+ //3.1 任务未分配校验
|
|
|
+ List<String> distributionNames = medCheckInfoFacade.list(new QueryWrapper<CheckInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .in("behospital_code", distributionJobVO.getBehospitalCodes())
|
|
|
+ ).stream().filter(s -> s.getJobDistributionName() != null).map(CheckInfo::getJobDistributionName)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (distributionNames != null && distributionNames.size() > 0) {
|
|
|
+ throw new ApiException( "待分配任务列表存在已分配任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取分配用户信息
|
|
|
+ QueryWrapper<User> userQuer = new QueryWrapper<>();
|
|
|
+ userQuer.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", principleId)
|
|
|
+ .eq("status", 1);
|
|
|
+ User user = sysUserFacade.getOne(userQuer);
|
|
|
+ String principleName = user.getLinkman();
|
|
|
+ //用户名称如果是null(目的:分配用户名为null表示用户未分配)
|
|
|
+ if (principleName == null) {
|
|
|
+ principleName = "";
|
|
|
+ }
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ //3.2分配核查任务
|
|
|
+ return medCheckInfoFacade.update(new UpdateWrapper<CheckInfo>()
|
|
|
+ .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 = medCheckInfoFacade.list(new QueryWrapper<CheckInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .in("behospital_code", distributionJobVO.getBehospitalCodes())
|
|
|
+ ).stream().map(CheckInfo::getCheckId).collect(Collectors.toSet());
|
|
|
+ //4.2获取出来的核查用户存在但不是一个
|
|
|
+ if (checkIds == null || checkIds.isEmpty() ||
|
|
|
+ (checkIds.size() != 1 && checkIds.contains(distributionJobVO.getCheckId()))) {
|
|
|
+ throw new ApiException("待取消分配任务列表不存在或存在不是该用户的任务!");
|
|
|
+ } else {
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ //4.3取消分配
|
|
|
+ Long a = null;
|
|
|
+ return medCheckInfoFacade.update(new UpdateWrapper<CheckInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("check_id", distributionJobVO.getCheckId())
|
|
|
+ .in("behospital_code", distributionJobVO.getBehospitalCodes())
|
|
|
+ .set("job_distributor", a)
|
|
|
+ .set("job_distribution_name", a)
|
|
|
+ .set("check_id", a)
|
|
|
+ .set("check_name", a)
|
|
|
+ .set("job_distribution_time", now));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IPage<CheckedRecordListDTO> checkedRecordList(CheckedRecordListVO checkedRecordListVO) {
|
|
|
+ Long hospitalId = SysUserUtils.getCurrentHospitalId();
|
|
|
+ Long userId = SysUserUtils.getCurrentPrincipleId();
|
|
|
+ SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
|
|
|
+ sysUserBaseVO.setUserId(userId);
|
|
|
+ List<Long> roleIds = sysUserFacade.getUserRoles(sysUserBaseVO).getSelRoles().stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+ List<String> deptIds = Lists.newArrayList();
|
|
|
+ SysUserDeptDTO sysUserDeptDTO = sysUserFacade.getUserDepts(sysUserBaseVO);
|
|
|
+ if (ListUtil.isNotEmpty(sysUserDeptDTO.getSelDepts())) {
|
|
|
+ deptIds.addAll(sysUserDeptDTO.getSelDepts().stream().map(i -> i.getDeptId()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ //1.2去除质管科
|
|
|
+ DeptInfo deptInfo = deptInfoFacade.getOne(new QueryWrapper<DeptInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("station", "质管"));
|
|
|
+ if (deptInfo == null || deptInfo.getDeptId() == null) {
|
|
|
+ throw new ApiException("科室质管科不存在,请联系管理员!");
|
|
|
+ }
|
|
|
+ List<Long> userIds = Lists.newArrayList();
|
|
|
+ List<String> JobTypes = Lists.newArrayList();
|
|
|
+ roleIds.forEach(roleId -> {
|
|
|
+ if (roleId.intValue() == CheckerRoleEnum.HOSP_SUPERVISOR.getKey()
|
|
|
+ && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() + ""))) {
|
|
|
+ userIds.addAll(getUserIdsOfRoleId(hospitalId, null, CheckerRoleEnum.HOSP_GENERAL.getKey()));
|
|
|
+ JobTypes.add(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() + "");
|
|
|
+ } else if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey()
|
|
|
+ && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + ""))) {
|
|
|
+ //添加质管科人员
|
|
|
+ deptIds.add(deptInfo.getDeptId());
|
|
|
+ userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.QUAT_GENERAL.getKey()));
|
|
|
+ JobTypes.add(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + "");
|
|
|
+ } else if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey() && ListUtil.isNotEmpty(deptIds)
|
|
|
+ && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + ""))) {
|
|
|
+ //移除质管科人员
|
|
|
+ deptIds.remove(deptInfo.getDeptId());
|
|
|
+ JobTypes.add(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + "");
|
|
|
+ userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.DEPT_GENERAL.getKey()));
|
|
|
+ } else if ((roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey() && ListUtil.isNotEmpty(deptIds))
|
|
|
+ || roleId.intValue() == CheckerRoleEnum.QUAT_GENERAL.getKey() || roleId.intValue() == CheckerRoleEnum.HOSP_GENERAL.getKey()) {
|
|
|
+ userIds.add(userId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //如果用户是质控科核查人员,在不传入任务类型的时候要添加质控科任务类型进行筛选
|
|
|
+ if (roleIds.contains(CheckerRoleEnum.QUAT_GENERAL.getKey() * 1l)) {
|
|
|
+ JobTypes.add(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + "");
|
|
|
+ }
|
|
|
+ if (roleIds.contains(CheckerRoleEnum.DEPT_GENERAL.getKey() * 1l)) {
|
|
|
+ JobTypes.add(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + "");
|
|
|
+ }
|
|
|
+ if (roleIds.contains(CheckerRoleEnum.HOSP_GENERAL.getKey() * 1l)) {
|
|
|
+ JobTypes.add(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() + "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes())) {
|
|
|
+ checkedRecordListVO.setCheckJobTypes(JobTypes);
|
|
|
+ }
|
|
|
+ if (ListUtil.isEmpty(userIds)) {
|
|
|
+ userIds.add(999999999999999999l);
|
|
|
+ }
|
|
|
+ checkedRecordListVO.setCurrentDeptIds(String.join(",", deptIds));
|
|
|
+ checkedRecordListVO.setCurrentGeneralUserIds(userIds);
|
|
|
+ checkedRecordListVO.setHospitalId(hospitalId);
|
|
|
+ IPage<CheckedRecordListDTO> iPage = medCheckInfoFacade.getBaseMapper().checkedRecordList(checkedRecordListVO);
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(iPage.getRecords())) {
|
|
|
+ List<String> behospitalCodes = iPage.getRecords().stream().map(i -> i.getBehospitalCode()).collect(Collectors.toList());
|
|
|
+ Map<String, BehospitalInfoAgeDTO> ageMap = behospitalInfoFacade.getBehospitalInfoAge(hospitalId, behospitalCodes).stream().collect(Collectors.toMap(i -> i.getBehospitalCode(), i -> i));
|
|
|
+ iPage.getRecords().forEach(i -> {
|
|
|
+ i.setMonth(i.getJobDistributionTime());
|
|
|
+ i.setStatus(CheckStatusEnum.getName(Integer.parseInt(i.getStatus())));
|
|
|
+ i.setAge(ageMap.get(i.getBehospitalCode()) == null ? "" : ageMap.get(i.getBehospitalCode()).getAge());
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
+ return iPage;
|
|
|
}
|
|
|
|
|
|
+ private List<Long> getUserIdsOfRoleId(Long hospitalId, List<String> deptIds, long roleId) {
|
|
|
+ QueryWrapper<UserDept> sysUserDeptQueryWrapper = new QueryWrapper<>();
|
|
|
+ sysUserDeptQueryWrapper.eq("hospital_id", hospitalId);
|
|
|
+ sysUserDeptQueryWrapper.in(ListUtil.isNotEmpty(deptIds), "dept_id", deptIds);
|
|
|
+ List<Long> userIds = sysUserDeptFacade.list(sysUserDeptQueryWrapper).stream().map(i -> i.getUserId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(userIds)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ QueryWrapper<UserRole> sysUserRoleQueryWrapper = new QueryWrapper<>();
|
|
|
+ sysUserRoleQueryWrapper.in("user_id", userIds);
|
|
|
+ sysUserRoleQueryWrapper.eq("role_id", roleId);
|
|
|
+ return userRoleFacade.list(sysUserRoleQueryWrapper).stream().map(i -> i.getUserId()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description获取当前用户的任务来源 和筛选分值
|
|
|
+ * @Date 2021/5/28
|
|
|
+ * @Param []
|
|
|
+ * @Return java.util.Map<java.lang.String, java.lang.String>
|
|
|
+ * @MethodName getCheckType
|
|
|
+ */
|
|
|
+ public Map<String, Object> getCheckType() {
|
|
|
+ Map<String, Object> out = Maps.newLinkedHashMap();
|
|
|
+ Map<Integer, String> checkTypes = Maps.newLinkedHashMap();
|
|
|
+ Long userId = SysUserUtils.getCurrentPrincipleId();
|
|
|
+ SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
|
|
|
+ sysUserBaseVO.setUserId(userId);
|
|
|
+ List<Long> roleIds = sysUserFacade.getUserRoles(sysUserBaseVO).getSelRoles().stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+ roleIds.stream().forEach(roleId -> {
|
|
|
+ if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey()) {
|
|
|
+ checkTypes.put(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey(), CheckJobTypeEnum.DEPT_SUPERVISOR.getName());
|
|
|
+ }
|
|
|
+ if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.QUAT_GENERAL.getKey()) {
|
|
|
+ checkTypes.put(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey(), CheckJobTypeEnum.QUAT_SUPERVISOR.getName());
|
|
|
+ }
|
|
|
+ if (roleId.intValue() == CheckerRoleEnum.HOSP_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.HOSP_GENERAL.getKey()) {
|
|
|
+ checkTypes.put(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey(), CheckJobTypeEnum.HOSP_SUPERVISOR.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Long hospitalId = SysUserUtils.getCurrentHospitalId();
|
|
|
+ List<Integer> valus = behospitalTypeFacade.list(new QueryWrapper<BehospitalType>()
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .isNotNull("value")
|
|
|
+ .groupBy("value")).stream().map(BehospitalType::getValue).collect(Collectors.toList());
|
|
|
+ out.put("source", checkTypes);
|
|
|
+ out.put("value", valus);
|
|
|
+ return out;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean recordCheck(RecordCheckVO recordCheckVO) {
|
|
|
+ Long hospitalId = SysUserUtils.getCurrentHospitalId();
|
|
|
+ Long userId = SysUserUtils.getCurrentPrincipleId();
|
|
|
+ QueryWrapper<CheckInfo> medCheckInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ medCheckInfoQueryWrapper.eq("behospital_code", recordCheckVO.getBehospitalCode());
|
|
|
+ medCheckInfoQueryWrapper.eq("hospital_id", hospitalId);
|
|
|
+ medCheckInfoQueryWrapper.eq("check_id", userId);
|
|
|
+ medCheckInfoQueryWrapper.eq("check_type", CheckTypeEnum.ALL.getKey());
|
|
|
+ CheckInfo medCheckInfo = medCheckInfoFacade.getOne(medCheckInfoQueryWrapper);
|
|
|
+ if (medCheckInfo == null) {
|
|
|
+ throw new ApiException("该数据您暂无核查权限!");
|
|
|
+ }
|
|
|
+
|
|
|
+ medCheckInfo.setStatus(1);
|
|
|
+ medCheckInfo.setCheckTime(DateUtil.now());
|
|
|
+ medCheckInfoFacade.updateById(medCheckInfo);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|