|
@@ -1,6 +1,5 @@
|
|
|
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.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -9,9 +8,7 @@ import com.diagbot.dto.CheckJobDTO;
|
|
|
import com.diagbot.dto.CheckUserDTO;
|
|
|
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;
|
|
@@ -27,26 +24,22 @@ import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.CheckJobPageVO;
|
|
|
-import com.diagbot.vo.CheckJobVO;
|
|
|
import com.diagbot.vo.CheckUserVO;
|
|
|
import com.diagbot.vo.DistributionJobVO;
|
|
|
import com.diagbot.vo.MedCheckInfoAddVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import org.apache.commons.collections4.ListUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
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.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import static java.sql.JDBCType.NULL;
|
|
|
-
|
|
|
/**
|
|
|
* @author wangfeng
|
|
|
* @Description:
|
|
@@ -404,23 +397,6 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
|
|
|
List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
|
|
|
//2.用户科室整合
|
|
|
margeDept(checkRoleMap,checkUserDTOS,CheckerRoleEnum.HOSP_SUPERVISOR.getKey()+"");
|
|
|
-// //2.1获取科室详情
|
|
|
-// //2.1.1获取院区核查的人员id
|
|
|
-// List<Long> userIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
|
|
|
-// .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
-// .eq("role_id",CheckerRoleEnum.HOSP_GENERAL.getKey())).stream()
|
|
|
-// .map(SysUserRole::getUserId).collect(Collectors.toList());
|
|
|
-// 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());
|
|
|
-// Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
|
|
|
-// .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
-// .eq("hospital_id",hospitalId)
|
|
|
-// .eq("station","住院")
|
|
|
-// .in("dept_id",deptIds)).stream()
|
|
|
-// .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
|
|
|
if(!ListUtil.isEmpty(checkRoleMap.get(CheckerRoleEnum.HOSP_SUPERVISOR.getKey()+""))){
|
|
|
//2.3获取所有医生信息的核查数
|
|
|
CheckUserVO checkUserVO = new CheckUserVO();
|
|
@@ -447,6 +423,10 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
|
|
|
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();
|
|
@@ -457,37 +437,48 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
|
|
|
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);
|
|
|
- if(tempDepts.stream().map(CheckDeptDTO::getDeptId).collect(Collectors.toList())
|
|
|
- .contains(deptId)){
|
|
|
- tempDepts.stream().filter(checkDeptDTO -> checkDeptDTO.getDeptId().equals(deptId)).forEach(checkDeptDTO -> {
|
|
|
- if(!ListUtil.isEmpty(checkDeptDTO.getDeptcheckUsers())){
|
|
|
- checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
- }else {
|
|
|
- List<DeptCheckUserDTO> deptcheckUsers = new ArrayList();
|
|
|
- deptcheckUsers.add(deptCheckUserDTO);
|
|
|
- checkDeptDTO.setDeptcheckUsers(deptcheckUsers);
|
|
|
- }
|
|
|
- });
|
|
|
+ AtomicBoolean hasFlag = new AtomicBoolean(false);
|
|
|
+ //全部处理
|
|
|
+ if(ListUtil.isEmpty(allCheckDept.getDeptcheckUsers())){
|
|
|
+ allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
|
|
|
}
|
|
|
- else {
|
|
|
- CheckDeptDTO checkDeptDTO = new CheckDeptDTO();
|
|
|
- checkDeptDTO.setDeptId(deptId);
|
|
|
- checkDeptDTO.setDeptName(deptName);
|
|
|
- List<DeptCheckUserDTO> deptcheckUsers = new ArrayList();
|
|
|
- deptcheckUsers.add(deptCheckUserDTO);
|
|
|
- checkDeptDTO.setDeptcheckUsers(deptcheckUsers);
|
|
|
- tempDepts.add(checkDeptDTO);
|
|
|
+ allCheckDept.getDeptcheckUsers().forEach(oneDeptCheckUser -> {
|
|
|
+ if(!deptId.equals(oneDeptCheckUser.getDeptId())&&!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(allCheckDept);
|
|
|
checkRoleMap.put(roleId+"",tempDepts);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
@@ -661,11 +652,11 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
|
|
|
if(deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
|
|
|
{
|
|
|
if(jobNumDto.getStatus()==0){
|
|
|
- deptCheckUserDTO.setJobNum(deptCheckUserDTO.getJobNum()+jobNumDto.getJobNum());
|
|
|
+ deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
|
|
|
}
|
|
|
if(jobNumDto.getStatus()==1){
|
|
|
|
|
|
- deptCheckUserDTO.setCheckNum(deptCheckUserDTO.getCheckNum()+jobNumDto.getJobNum());
|
|
|
+ deptCheckUserDTO.setCheckNum(jobNumDto.getJobNum());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -684,10 +675,10 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
|
|
|
userJobs.stream().forEach(userJob -> {
|
|
|
if(deptCheckUser.getDoctorId().equals(userJob.getDoctorId())){
|
|
|
if(userJob.getStatus()==0){
|
|
|
- deptCheckUser.setJobNum(deptCheckUser.getJobNum()+userJob.getJobNum());
|
|
|
+ deptCheckUser.setJobNum(userJob.getJobNum());
|
|
|
}
|
|
|
if(userJob.getStatus()==1){
|
|
|
- deptCheckUser.setCheckNum(deptCheckUser.getCheckNum()+userJob.getJobNum());
|
|
|
+ deptCheckUser.setCheckNum(userJob.getJobNum());
|
|
|
}
|
|
|
}
|
|
|
});
|