参与者与系统用户整合
This commit is contained in:
@@ -3,13 +3,14 @@ package com.core.common.core.domain.model;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.core.common.core.domain.entity.SysUser;
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录用户身份权限
|
* 登录用户身份权限
|
||||||
*
|
*
|
||||||
@@ -72,6 +73,16 @@ public class LoginUser implements UserDetails {
|
|||||||
/** 租户ID */
|
/** 租户ID */
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构/科室id
|
||||||
|
*/
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参与者id
|
||||||
|
*/
|
||||||
|
private Long practitionerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.core.common.core.domain.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录用户扩展
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LoginUserExtend {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构/科室id
|
||||||
|
*/
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参与者id
|
||||||
|
*/
|
||||||
|
private Long practitionerId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import com.core.common.constant.Constants;
|
|||||||
import com.core.common.constant.UserConstants;
|
import com.core.common.constant.UserConstants;
|
||||||
import com.core.common.core.domain.entity.SysUser;
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
import com.core.common.core.domain.model.LoginUser;
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.core.domain.model.LoginUserExtend;
|
||||||
import com.core.common.core.redis.RedisCache;
|
import com.core.common.core.redis.RedisCache;
|
||||||
import com.core.common.exception.ServiceException;
|
import com.core.common.exception.ServiceException;
|
||||||
import com.core.common.exception.user.*;
|
import com.core.common.exception.user.*;
|
||||||
@@ -63,7 +64,7 @@ public class SysLoginService {
|
|||||||
*/
|
*/
|
||||||
public String login(String username, String password, String code, String uuid) {
|
public String login(String username, String password, String code, String uuid) {
|
||||||
// 验证码校验
|
// 验证码校验
|
||||||
// validateCaptcha(username, code, uuid);
|
validateCaptcha(username, code, uuid);
|
||||||
// 登录前置校验
|
// 登录前置校验
|
||||||
loginPreCheck(username, password);
|
loginPreCheck(username, password);
|
||||||
// 用户验证
|
// 用户验证
|
||||||
@@ -91,7 +92,7 @@ public class SysLoginService {
|
|||||||
MessageUtils.message("user.login.success")));
|
MessageUtils.message("user.login.success")));
|
||||||
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
|
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
|
||||||
|
|
||||||
// -----start-----登录时set租户id,正常应该从请求头获取,这行代码只是测试使用
|
// -----start-----登录时set租户id
|
||||||
Integer tenantId = 0;
|
Integer tenantId = 0;
|
||||||
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
@@ -103,8 +104,12 @@ public class SysLoginService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
loginUser.setTenantId(tenantId);
|
loginUser.setTenantId(tenantId);
|
||||||
// -----end-----登录时set租户id,正常应该从请求头获取,这行代码只是测试使用
|
// -----end-----登录时set租户id
|
||||||
recordLoginInfo(loginUser.getUserId());
|
recordLoginInfo(loginUser.getUserId());
|
||||||
|
// 设置 机构id和参与者id
|
||||||
|
LoginUserExtend loginUserExtend = userService.getLoginUserExtend(loginUser.getUserId());
|
||||||
|
loginUser.setOrgId(loginUserExtend.getOrgId());
|
||||||
|
loginUser.setPractitionerId(loginUserExtend.getPractitionerId());
|
||||||
// 生成token
|
// 生成token
|
||||||
return tokenService.createToken(loginUser);
|
return tokenService.createToken(loginUser);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.core.system.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.model.LoginUserExtend;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import com.core.common.core.domain.entity.SysUser;
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
@@ -125,4 +126,12 @@ public interface SysUserMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysUser checkEmailUnique(String email);
|
public SysUser checkEmailUnique(String email);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展属性
|
||||||
|
*
|
||||||
|
* @param userId 系统用户id
|
||||||
|
* @return 扩展属性
|
||||||
|
*/
|
||||||
|
LoginUserExtend getLoginUserExtend(@Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.core.system.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.core.common.core.domain.entity.SysUser;
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.common.core.domain.model.LoginUserExtend;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层
|
* 用户 业务层
|
||||||
@@ -203,4 +204,12 @@ public interface ISysUserService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展属性
|
||||||
|
*
|
||||||
|
* @param userId 系统用户id
|
||||||
|
* @return 扩展属性
|
||||||
|
*/
|
||||||
|
LoginUserExtend getLoginUserExtend(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.model.LoginUserExtend;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -484,4 +485,16 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||||||
}
|
}
|
||||||
return successMsg.toString();
|
return successMsg.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展属性
|
||||||
|
*
|
||||||
|
* @param userId 系统用户id
|
||||||
|
* @return 扩展属性
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LoginUserExtend getLoginUserExtend(Long userId) {
|
||||||
|
return userMapper.getLoginUserExtend(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,4 +265,12 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getLoginUserExtend" resultType="com.core.common.core.domain.model.LoginUserExtend">
|
||||||
|
SELECT T1.ID AS practitioner_id,
|
||||||
|
T1.org_id AS org_id
|
||||||
|
FROM adm_practitioner AS T1
|
||||||
|
WHERE T1.delete_flag = '0'
|
||||||
|
AND T1.user_id = #{userId} LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -224,6 +224,9 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> delUserPractitioner(Long userId) {
|
public R<?> delUserPractitioner(Long userId) {
|
||||||
|
if (1L == userId) {
|
||||||
|
return R.fail(null, "admin不允许删除");
|
||||||
|
}
|
||||||
iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||||
practitionerAppAppMapper.delUserRole(userId);
|
practitionerAppAppMapper.delUserRole(userId);
|
||||||
Practitioner one =
|
Practitioner one =
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ public class ChargeItemFormData {
|
|||||||
this.statusEnum = ChargeItemStatus.BILLED.getValue();
|
this.statusEnum = ChargeItemStatus.BILLED.getValue();
|
||||||
this.contextEnum = EncounterClass.AMB.getValue();
|
this.contextEnum = EncounterClass.AMB.getValue();
|
||||||
this.occurrenceTime = new Date();
|
this.occurrenceTime = new Date();
|
||||||
this.performerId = SecurityUtils.getLoginUser().getUserId();
|
this.performerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
this.entererId = SecurityUtils.getLoginUser().getUserId();
|
this.entererId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
this.enteredDate = new Date();
|
this.enteredDate = new Date();
|
||||||
this.serviceTable = CommonConstants.TableName.ADM_HEALTHCARE_SERVICE;
|
this.serviceTable = CommonConstants.TableName.ADM_HEALTHCARE_SERVICE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.openhis.web.doctorstation.dto;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.openhis.common.enums.EncounterClass;
|
import com.openhis.common.enums.EncounterClass;
|
||||||
@@ -126,8 +127,7 @@ public class AdviceSaveDto {
|
|||||||
this.statusEnum = RequestStatus.DRAFT.getValue();
|
this.statusEnum = RequestStatus.DRAFT.getValue();
|
||||||
this.categoryEnum = EncounterClass.AMB.getValue();
|
this.categoryEnum = EncounterClass.AMB.getValue();
|
||||||
this.therapyEnum = TherapyTimeType.TEMPORARY.getValue();
|
this.therapyEnum = TherapyTimeType.TEMPORARY.getValue();
|
||||||
// TODO: 应该从当前登录账号获取参与者id,现在没有
|
this.practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
// this.practitionerId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user