|
@@ -2,17 +2,22 @@ package com.lantone.security.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
|
|
|
import com.lantone.common.dto.ViewRegionDTO;
|
|
|
import com.lantone.common.exception.ApiException;
|
|
|
import com.lantone.common.util.ListUtil;
|
|
|
import com.lantone.common.util.StringUtil;
|
|
|
import com.lantone.common.vo.CheckSolveRegionVO;
|
|
|
+import com.lantone.common.vo.GetDeptListVO;
|
|
|
import com.lantone.common.vo.SaveRegionVO;
|
|
|
import com.lantone.common.vo.GetRegionVO;
|
|
|
+import com.lantone.dblayermbg.entity.Dept;
|
|
|
import com.lantone.dblayermbg.entity.Region;
|
|
|
import com.lantone.dblayermbg.entity.RegionDept;
|
|
|
+import com.lantone.dblayermbg.facade.DeptFacade;
|
|
|
import com.lantone.dblayermbg.facade.RegionFacade;
|
|
|
import com.lantone.dblayermbg.service.RegionDeptService;
|
|
|
+import com.lantone.security.enums.IsDeleteEnum;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
@@ -35,6 +40,8 @@ public class RegionManagementFacade {
|
|
|
private RegionDeptService regionDeptService;
|
|
|
@Autowired
|
|
|
private RegionFacade regionFacade;
|
|
|
+ @Autowired
|
|
|
+ private DeptFacade deptFacade;
|
|
|
|
|
|
/**
|
|
|
* @Description: 新增/修改病区
|
|
@@ -197,8 +204,8 @@ public class RegionManagementFacade {
|
|
|
//禁用校验
|
|
|
if (null != checkSolveRegionVO.getId() && 0 == checkSolveRegionVO.getMark()) {
|
|
|
List<Long> collectList = regionDeptService.lambdaQuery()
|
|
|
- .eq(RegionDept::getRegionId, checkSolveRegionVO.getId())
|
|
|
- .eq(RegionDept::getHospitalId, checkSolveRegionVO.getHospitalId())
|
|
|
+ .eq(RegionDept::getRegionId,checkSolveRegionVO.getId())
|
|
|
+ .eq(RegionDept::getHospitalId,checkSolveRegionVO.getHospitalId())
|
|
|
.list().stream().map(obj -> obj.getDeptId()).collect(Collectors.toList());
|
|
|
if (ListUtil.isNotEmpty(collectList) && collectList.size() > 0) {
|
|
|
//当前病区存在与之关联的科室
|
|
@@ -210,10 +217,59 @@ public class RegionManagementFacade {
|
|
|
//禁用病区处理
|
|
|
if (null != checkSolveRegionVO.getId() && 1 == checkSolveRegionVO.getMark()) {
|
|
|
regionFacade.lambdaUpdate()
|
|
|
- .eq(Region::getId, checkSolveRegionVO.getId())
|
|
|
- .eq(Region::getHospitalId, checkSolveRegionVO.getHospitalId())
|
|
|
- .set(Region::getStatus, 0).update();
|
|
|
+ .eq(Region::getId,checkSolveRegionVO.getId())
|
|
|
+ .eq(Region::getHospitalId,checkSolveRegionVO.getHospitalId())
|
|
|
+ .set(Region::getStatus,0).update();
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:科室id,name返回
|
|
|
+ * @Param: [hospitalId]
|
|
|
+ * @return: java.util.List<com.lantone.dblayermbg.entity.Dept>
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2021/8/2
|
|
|
+ */
|
|
|
+ public List<Dept> getDept(GetDeptListVO getDeptListVO){
|
|
|
+ List<Dept> list = new ArrayList<>();
|
|
|
+ if(0 == getDeptListVO.getMark()){
|
|
|
+ list = queryMethod(getDeptListVO,null);
|
|
|
+ }
|
|
|
+
|
|
|
+ //互斥
|
|
|
+ if(1 == getDeptListVO.getMark()) {
|
|
|
+ //关联或被禁止的科室id
|
|
|
+ List<Long> regionDeptIds = regionDeptService.lambdaQuery()
|
|
|
+ .eq(RegionDept::getHospitalId,getDeptListVO.getHospitalId())
|
|
|
+ .eq(RegionDept::getIsDeleted,IsDeleteEnum.N.getKey())
|
|
|
+ .list().stream().map(obj -> obj.getDeptId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(ListUtil.isNotEmpty(regionDeptIds)){
|
|
|
+ list = queryMethod(getDeptListVO,regionDeptIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 科室lambdaQueryChainWrapper
|
|
|
+ * @Param: [getDeptListVO, regionDeptIds]
|
|
|
+ * @return: java.util.List<com.lantone.dblayermbg.entity.Dept>
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2021/8/2
|
|
|
+ */
|
|
|
+ public List<Dept> queryMethod(GetDeptListVO getDeptListVO, List<Long> regionDeptIds){
|
|
|
+ LambdaQueryChainWrapper<Dept> lambdaQueryChainWrapper = deptFacade.lambdaQuery();
|
|
|
+ lambdaQueryChainWrapper.eq(Dept::getHospitalId,getDeptListVO.getHospitalId());
|
|
|
+ lambdaQueryChainWrapper.eq(Dept::getIsDeleted,IsDeleteEnum.N.getKey());
|
|
|
+ if(ListUtil.isNotEmpty(regionDeptIds)){
|
|
|
+ lambdaQueryChainWrapper.notIn(Dept::getId,regionDeptIds);
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(getDeptListVO.getDeptName())){
|
|
|
+ lambdaQueryChainWrapper.like(Dept::getName,getDeptListVO.getDeptName());
|
|
|
+ }
|
|
|
+ return lambdaQueryChainWrapper.select(Dept::getId,Dept::getName).list();
|
|
|
+ }
|
|
|
}
|