|
@@ -21,6 +21,7 @@ import com.lantone.common.exception.Asserts;
|
|
|
import com.lantone.common.util.DateUtil;
|
|
|
import com.lantone.common.util.EntityUtil;
|
|
|
import com.lantone.common.util.ListUtil;
|
|
|
+import com.lantone.common.util.StringUtil;
|
|
|
import com.lantone.common.util.SysUserUtils;
|
|
|
import com.lantone.common.vo.AddHospitalTreeVO;
|
|
|
import com.lantone.common.vo.AddUserVO;
|
|
@@ -28,6 +29,7 @@ import com.lantone.common.vo.GetUserPageVO;
|
|
|
import com.lantone.common.vo.LoginVO;
|
|
|
import com.lantone.common.vo.UpdateUserVO;
|
|
|
import com.lantone.dblayermbg.entity.DeptUser;
|
|
|
+import com.lantone.dblayermbg.entity.Doctor;
|
|
|
import com.lantone.dblayermbg.entity.Hospital;
|
|
|
import com.lantone.dblayermbg.entity.HospitalUser;
|
|
|
import com.lantone.dblayermbg.entity.MedoupDoctor;
|
|
@@ -36,6 +38,7 @@ import com.lantone.dblayermbg.entity.User;
|
|
|
import com.lantone.dblayermbg.entity.UserRole;
|
|
|
import com.lantone.dblayermbg.facade.DeptFacade;
|
|
|
import com.lantone.dblayermbg.facade.DeptUserFacade;
|
|
|
+import com.lantone.dblayermbg.facade.DoctorFacade;
|
|
|
import com.lantone.dblayermbg.facade.HospitalFacade;
|
|
|
import com.lantone.dblayermbg.facade.HospitalUserFacade;
|
|
|
import com.lantone.dblayermbg.facade.MedoupDoctorFacade;
|
|
@@ -88,6 +91,8 @@ public class UserManagementFacade {
|
|
|
private RoleFacade roleFacade;
|
|
|
@Autowired
|
|
|
private MedoupDoctorFacade medoupDoctorFacade;
|
|
|
+ @Autowired
|
|
|
+ private DoctorFacade doctorfacade;
|
|
|
|
|
|
public CommonResult login(LoginVO loginVO) {
|
|
|
Map<String, String> params = new HashMap<>();
|
|
@@ -146,9 +151,6 @@ public class UserManagementFacade {
|
|
|
user.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
|
|
|
user.setGmtCreate(DateUtil.now());
|
|
|
user.setPassword(BCrypt.hashpw(user.getPassword()));
|
|
|
- if (addUserVO.getJobNo() != null) {
|
|
|
- addUserVO.setDoctorId(addUserVO.getJobNo());
|
|
|
- }
|
|
|
//1.1校验用户
|
|
|
boolean deptFlag = false;
|
|
|
if (ListUtil.isNotEmpty(addUserVO.getAddHospitalTreeVO().getDepts())) {
|
|
@@ -210,14 +212,19 @@ public class UserManagementFacade {
|
|
|
}
|
|
|
//医疗组(无医生信息,就不会有医疗组;有医生信息无医疗组)
|
|
|
boolean groupFlag = false;
|
|
|
- if (user.getDoctorId() == null) {
|
|
|
+ if (StringUtil.isEmpty(user.getJobNo())) {
|
|
|
groupFlag = true;
|
|
|
} else {
|
|
|
- List<MedoupDoctor> medoupDoctors = medoupDoctorFacade.list(new QueryWrapper<MedoupDoctor>()
|
|
|
- .eq("dcotor_id", user.getDoctorId())
|
|
|
+ List<Doctor> doctors = doctorfacade.list(new QueryWrapper<Doctor>()
|
|
|
+ .eq("code", user.getJobNo())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()));
|
|
|
- if (ListUtil.isEmpty(medoupDoctors)) {
|
|
|
- groupFlag = true;
|
|
|
+ if(ListUtil.isNotEmpty(doctors)){
|
|
|
+ List<MedoupDoctor> medoupDoctors = medoupDoctorFacade.list(new QueryWrapper<MedoupDoctor>()
|
|
|
+ .in("dcotor_id", doctors.stream().map(Doctor::getId).collect(Collectors.toList()))
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey()));
|
|
|
+ if (ListUtil.isEmpty(medoupDoctors)) {
|
|
|
+ groupFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (!groupFlag) {
|
|
@@ -404,10 +411,6 @@ public class UserManagementFacade {
|
|
|
public boolean updateUser(UpdateUserVO updateUserVO) {
|
|
|
//1.删除该用户关联的科室、医院
|
|
|
if (delUserHospitalORDept(updateUserVO.getId())) {
|
|
|
- //工号为医生号
|
|
|
- if (updateUserVO.getJobNo() != null) {
|
|
|
- updateUserVO.setDoctorId(updateUserVO.getJobNo());
|
|
|
- }
|
|
|
User user = new User();
|
|
|
BeanUtils.copyProperties(updateUserVO, user);
|
|
|
user.setPassword(BCrypt.hashpw(user.getPassword()));
|