| | |
| | | sysUser.setUserName(externalUserInfo.getYongHuDLM()); |
| | | sysUser.setOrgid(externalUserInfo.getZuZhiJGID()); |
| | | //根据userName判断一下,是不是之前有新增 |
| | | SysUser sysUser1 = sysUserMapper.selectUserByUserName(externalUserInfo.getYongHuDLM()); |
| | | |
| | | SysUser sysUser1 = null; |
| | | List<SysUser> sysUserList = sysUserMapper.selectUserList(sysUser); |
| | | if (CollectionUtils.isNotEmpty(sysUserList)) { |
| | | sysUser1 = sysUserList.get(0); |
| | | if (sysUserList.size() > 1) sysUser1 = getUser(sysUserList); |
| | | } |
| | | sysUser.setGuid(externalUserInfo.getZuZhiJGID()); |
| | | sysUser.setNickName(externalUserInfo.getYongHuXM()); |
| | | sysUser.setUserType(""); |
| | |
| | | } |
| | | |
| | | |
| | | private SysUser getUser(List<SysUser> sysUserList) { |
| | | SysUser sysUser = null; |
| | | if (CollectionUtils.isNotEmpty(sysUserList) && sysUserList.size() > 1) { |
| | | // 按create_time降序排序,获取最新的记录 |
| | | List<SysUser> sortedList = sysUserList.stream().sorted(Comparator.comparing(SysUser::getCreateTime).reversed()).collect(Collectors.toList()); |
| | | |
| | | // 第一条(最新的)赋值给sysUser1 |
| | | sysUser = sortedList.get(0); |
| | | |
| | | // 获取需要删除的ID(从第二条开始) |
| | | List<Long> idsToDelete = sortedList.stream().skip(1).map(SysUser::getUserId).collect(Collectors.toList()); |
| | | Long[] idArray = idsToDelete.toArray(new Long[0]); |
| | | // 批量删除其他记录 |
| | | if (!idsToDelete.isEmpty()) { |
| | | sysUserMapper.deleteUserByIds(idArray); |
| | | } |
| | | } |
| | | return sysUser; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addOrganInfo(Map dataMap) { |
| | | log.info("ServiceExternalServiceImpl---addOrganInfo的新增的值为:{}", dataMap); |
| | |
| | | <id property="orgid" column="orgid"/> |
| | | <id property="hisUserId" column="his_user_id"/> |
| | | <result property="deptId" column="dept_id"/> |
| | | <result property="userCode" column="user_code"/> |
| | | <result property="hospInfo" column="hosp_info"/> |
| | | <result property="deptInfo" column="dept_info"/> |
| | | <result property="userName" column="user_name"/> |
| | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, |
| | | u.dept_id, |
| | | u.user_code, |
| | | u.id_card, |
| | | u.hosp_info, |
| | | u.dept_info, |
| | |
| | | </sql> |
| | | |
| | | <select id="selectUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult"> |
| | | select u.user_id,u.title,u.his_user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_type, |
| | | select u.user_code,u.user_id,u.title,u.his_user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, |
| | | u.user_type, |
| | | u.nick_name, u.user_name, |
| | | u.email,u.id_card, |
| | | u.avatar, |
| | |
| | | <select id="selectAllocatedList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" |
| | | resultMap="SysUserResult"> |
| | | select distinct u.user_id,u.his_user_id,u.title,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_name, |
| | | u.user_type, |
| | | u.user_type,u.user_code, |
| | | u.nick_name, |
| | | u.email, |
| | | u.birthday, |
| | |
| | | resultMap="SysUserResult"> |
| | | select distinct u.user_id, u.dept_id, u.hosp_info, u.dept_info,u.searchscope, u.user_name, u.user_type, |
| | | u.nick_name, |
| | | u.user_code, |
| | | u.email, |
| | | u.his_user_id, |
| | | u.title, |
| | |
| | | <if test="orgid != null and orgid != ''">orgid,</if> |
| | | <if test="deptCode != null and deptCode != ''">dept_code,</if> |
| | | <if test="deptName != null and deptName != ''">dept_name,</if> |
| | | <if test="userCode != null and userCode != ''">user_code,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="orgid != null and orgid != ''">#{orgid},</if> |
| | | <if test="deptCode != null and deptCode != ''">#{deptCode},</if> |
| | | <if test="deptName != null and deptName != ''">#{deptName},</if> |
| | | <if test="userCode != null and userCode != ''">#{userCode},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <insert id="batchUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | user_id, dept_id, user_name, nick_name, email, avatar, phonenumber, sex, password, status, create_by, remark, |
| | | user_type, dept_info, hosp_info, searchscope, id_card, title, job_phone, birthday, his_user_id, guid, orgid, |
| | | user_type, dept_info, hosp_info, searchscope, id_card, title, job_phone, birthday, his_user_id, guid, orgid,user_code, |
| | | create_time |
| | | ) values |
| | | <foreach collection="list" item="item" separator=","> |
| | |
| | | #{item.hisUserId}, |
| | | #{item.guid}, |
| | | #{item.orgid}, |
| | | #{item.userCode}, |
| | | now() |
| | | ) |
| | | </foreach> |
| | |
| | | <if test="jobPhone != null and jobPhone != ''">job_phone=#{jobPhone},</if> |
| | | <if test="birthday != null ">birthday=#{birthday},</if> |
| | | <if test="orgid != null ">orgid=#{orgid},</if> |
| | | <if test="userCode != null ">user_code=#{userCode},</if> |
| | | <if test="title != null and title != ''"> |
| | | title = #{title}, |
| | | </if> |
| | |
| | | |
| | | <delete id="deleteUserById" parameterType="Long"> |
| | | update sys_user |
| | | set del_flag = '2' |
| | | set del_flag = '1' |
| | | where user_id = #{userId} |
| | | </delete> |
| | | |
| | | <delete id="deleteUserByIds" parameterType="Long"> |
| | | update sys_user set del_flag = '2' where user_id in |
| | | update sys_user set del_flag = '1' where user_id in |
| | | <foreach collection="array" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |