|
@@ -2,15 +2,22 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.BasDeptInfoDTO;
|
|
|
+import com.diagbot.entity.BasDeptInfo;
|
|
|
import com.diagbot.entity.BasDoctorInfo;
|
|
|
+import com.diagbot.entity.SysUserDept;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.service.impl.BasDoctorInfoServiceImpl;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.BasDeptInfoVO;
|
|
|
import com.diagbot.vo.data.BasDoctorInfoVO;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -20,6 +27,10 @@ import java.util.List;
|
|
|
*/
|
|
|
@Component
|
|
|
public class BasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ SysUserDeptFacade sysUserDeptFacade;
|
|
|
+ @Autowired
|
|
|
+ BasDeptInfoFacade basDeptInfoFacade;
|
|
|
|
|
|
/**
|
|
|
* 获取医院医生下拉列表信息
|
|
@@ -29,15 +40,35 @@ public class BasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
|
|
|
*/
|
|
|
public List<BasDoctorInfo> getDoctorByDept(BasDoctorInfoVO basDoctorInfoVO) {
|
|
|
basDoctorInfoVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
- QueryWrapper<BasDoctorInfo> QueryWrapper = new QueryWrapper<>();
|
|
|
- QueryWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
|
|
|
- QueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- QueryWrapper.eq("dept_id",basDoctorInfoVO.getDeptId());
|
|
|
- if(StringUtils.isNotEmpty(basDoctorInfoVO.getInputStr())){
|
|
|
- QueryWrapper.like("name",basDoctorInfoVO.getInputStr());
|
|
|
+ basDoctorInfoVO.setUserId(Long.valueOf( SysUserUtils.getCurrentPrincipleID()));
|
|
|
+ QueryWrapper<SysUserDept> userDeptWrapper = new QueryWrapper<>();
|
|
|
+ List<BasDoctorInfo> list = new ArrayList<>();
|
|
|
+ userDeptWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
|
|
|
+ userDeptWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ userDeptWrapper.eq("user_id",basDoctorInfoVO.getUserId());
|
|
|
+ List<SysUserDept> UserDeptlist = sysUserDeptFacade.list(userDeptWrapper);
|
|
|
+ HashSet<String> deptSet = new HashSet<String>();
|
|
|
+ if(ListUtil.isNotEmpty(UserDeptlist)){
|
|
|
+ UserDeptlist.forEach(sysUserDept->{
|
|
|
+ deptSet.add(sysUserDept.getDeptId());
|
|
|
+ });
|
|
|
+ QueryWrapper<BasDeptInfo> deptInfo = new QueryWrapper<>();
|
|
|
+ deptInfo.eq("hospital_id",basDoctorInfoVO.getHospitalId());
|
|
|
+ deptInfo.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ deptInfo.eq("dept_name",basDoctorInfoVO.getDeptName());
|
|
|
+ deptInfo.in("dept_id",deptSet);
|
|
|
+ BasDeptInfo deptOne = basDeptInfoFacade.getOne(deptInfo);
|
|
|
+ QueryWrapper<BasDoctorInfo> QueryWrapper = new QueryWrapper<>();
|
|
|
+ QueryWrapper.eq("hospital_id",basDoctorInfoVO.getHospitalId());
|
|
|
+ QueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ QueryWrapper.eq("dept_id",deptOne.getDeptId());
|
|
|
+ if(StringUtils.isNotEmpty(basDoctorInfoVO.getInputStr())){
|
|
|
+ QueryWrapper.like("name",basDoctorInfoVO.getInputStr());
|
|
|
+ }
|
|
|
+ QueryWrapper.orderByAsc("name");
|
|
|
+ list = this.list(QueryWrapper);
|
|
|
}
|
|
|
- QueryWrapper.orderByAsc("name");
|
|
|
- List<BasDoctorInfo> list = this.list(QueryWrapper);
|
|
|
+
|
|
|
return list;
|
|
|
}
|
|
|
|