用户相关问题修改

master
gongzhenkun 2 years ago
parent 92449be992
commit 7c78363d73

@ -1,8 +1,11 @@
package com.ruoyi.web.controller.pc;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.system.domain.req.AppRegisterReq;
import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq;
import com.ruoyi.system.domain.req.PcTDoctorUpdateReq;
import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp;
@ -42,6 +45,9 @@ public class TDoctorController extends BaseController
@Autowired
private ITDoctorService tDoctorService;
@Resource
private SysLoginService loginService;
/**
*
*/
@ -94,6 +100,13 @@ public class TDoctorController extends BaseController
return toAjax(tDoctorService.updateTDoctor(tDoctor));
}
@ApiOperation("注册医生信息")
@PostMapping("/register")
@Log(title = "注册医生信息", businessType = BusinessType.INSERT)
public AjaxResult fillInfoForDoctor(@RequestBody @Validated AppRegisterReq req) {
return loginService.loginForAppFillInfo(req);
}
/**
*
*/

@ -3,6 +3,8 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUserEX;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -57,7 +59,7 @@ public class SysUserController extends BaseController
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
List<SysUserEX> list = userService.selectUserExList(user);
return getDataTable(list);
}
@ -66,8 +68,9 @@ public class SysUserController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
startPage();
List<SysUserEX> list = userService.selectUserExList(user);
ExcelUtil<SysUserEX> util = new ExcelUtil<SysUserEX>(SysUserEX.class);
util.exportExcel(response, list, "用户数据");
}
@ -145,8 +148,11 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user)
public AjaxResult edit(@Validated @RequestBody SysUserEX user)
{
if (user.getPhonenumber() != null) {
user.setUserName(user.getPhonenumber());
}
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (StringUtils.isNotEmpty(user.getPhonenumber())

@ -28,7 +28,6 @@ public class SysUser extends BaseEntity
private Long userId;
/** 部门ID */
@Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId;
/** 用户账号 */
@ -40,7 +39,6 @@ public class SysUser extends BaseEntity
private String nickName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@ -76,10 +74,6 @@ public class SysUser extends BaseEntity
private Date loginDate;
/** 部门对象 */
@Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
})
private SysDept dept;
/** 角色对象 */

@ -0,0 +1,70 @@
package com.ruoyi.common.core.domain.entity;
import com.ruoyi.common.annotation.Excel;
/**
* PC
*
* @author gongzhenkun
* @date 2022/11/15 15:31
*/
public class SysUserEX extends SysUser{
/** 所属医院 */
@Excel(name = "所属医院")
private String hospitalName;
/** 职称 */
@Excel(name = "职称")
private String title;
/** 专长 */
@Excel(name = "专长")
private String speciality;
/** 职业医师照片路径 */
@Excel(name = "职业医师照片路径")
private String medicalLicense;
@Excel(name = "职业医师照片路径2")
private String medicalLicense2;
public String getHospitalName() {
return hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSpeciality() {
return speciality;
}
public void setSpeciality(String speciality) {
this.speciality = speciality;
}
public String getMedicalLicense() {
return medicalLicense;
}
public void setMedicalLicense(String medicalLicense) {
this.medicalLicense = medicalLicense;
}
public String getMedicalLicense2() {
return medicalLicense2;
}
public void setMedicalLicense2(String medicalLicense2) {
this.medicalLicense2 = medicalLicense2;
}
}

@ -1,6 +1,8 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUserEX;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysUser;
@ -19,6 +21,14 @@ public interface SysUserMapper
*/
public List<SysUser> selectUserList(SysUser sysUser);
/**
*
*
* @param user
* @return
*/
public List<SysUserEX> selectUserExList(SysUser user);
/**
*
*

@ -51,6 +51,14 @@ public interface TDoctorMapper
*/
public int updateTDoctor(TDoctor tDoctor);
/**
*
*
* @param tDoctor
* @return
*/
public int updateTDoctorByUserId(TDoctor tDoctor);
/**
*
*

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserEX;
/**
*
@ -18,6 +19,14 @@ public interface ISysUserService
*/
public List<SysUser> selectUserList(SysUser user);
/**
*
*
* @param user
* @return
*/
public List<SysUserEX> selectUserExList(SysUser user);
/**
*
*

@ -3,7 +3,13 @@ package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.validation.Validator;
import com.ruoyi.common.core.domain.entity.SysUserEX;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.domain.TDoctor;
import com.ruoyi.system.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,11 +28,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
@ -61,6 +62,9 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
protected Validator validator;
@Resource
private TDoctorMapper doctorMapper;
/**
*
*
@ -74,6 +78,17 @@ public class SysUserServiceImpl implements ISysUserService
return userMapper.selectUserList(user);
}
/**
*
*
* @param user
* @return
*/
@Override
public List<SysUserEX> selectUserExList(SysUser user) {
return userMapper.selectUserExList(user);
}
/**
*
*
@ -300,6 +315,7 @@ public class SysUserServiceImpl implements ISysUserService
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
updateDoctorInfo((SysUserEX) user);
return userMapper.updateUser(user);
}
@ -564,4 +580,10 @@ public class SysUserServiceImpl implements ISysUserService
}
return successMsg.toString();
}
private void updateDoctorInfo(SysUserEX userEX) {
TDoctor tDoctor = new TDoctor();
BeanUtils.copyProperties(userEX, tDoctor);
doctorMapper.updateTDoctorByUserId(tDoctor);
}
}

@ -27,6 +27,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="UserExResult" type="sysUserEX" extends="SysUserResult">
<result property="hospitalId" column="hospital_id"/>
<result property="hospitalName" column="hospital_name"/>
<result property="title" column="title"/>
<result property="speciality" column="speciality"/>
<result property="medicalLicense" column="medicalLicense"/>
<result property="medicalLicense2" column="medicalLicense2"/>
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
@ -130,8 +139,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.phonenumber = #{phonenumber}
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
<select id="selectUserById" parameterType="Long" resultMap="UserExResult">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,td.hospital_id,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
LEFT JOIN t_doctor td ON u.user_id = td.user_id
where u.user_id = #{userId}
</select>
@ -231,4 +247,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE c.role_key = #{common}
</select>
<select id="selectUserExList" resultMap="UserExResult">
SELECT
u.user_id,
u.nick_name,
u.user_name,
u.avatar,
u.phonenumber,
u.PASSWORD,
u.sex,
u.STATUS,
u.del_flag,
u.login_ip,
u.login_date,
u.create_by,
u.create_time,
u.remark,
td.hospital_id,
th.`name` AS hospital_name,
td.title,
td.speciality,
td.medical_license,
td.medical_license2
FROM
sys_user u
LEFT JOIN t_doctor td ON u.user_id = td.user_id
LEFT JOIN t_hospital th ON td.hospital_id = th.id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
ORDER BY u.user_id
</select>
</mapper>

@ -135,6 +135,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateTDoctorByUserId" parameterType="TDoctor">
update t_doctor
<trim prefix="SET" suffixOverrides=",">
<if test="openId != null">open_id = #{openId},</if>
<if test="identifier != null">identifier = #{identifier},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="marriage != null">marriage = #{marriage},</if>
<if test="title != null">title = #{title},</if>
<if test="speciality != null">speciality = #{speciality},</if>
<if test="introduction != null">introduction = #{introduction},</if>
<if test="medicalLicense != null">medical_license = #{medicalLicense},</if>
<if test="medicalLicense2 != null">medical_license2 = #{medicalLicense2},</if>
<if test="qrCode != null">qr_code = #{qrCode},</if>
<if test="hospitalId != null">hospital_id = #{hospitalId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteTDoctorById" parameterType="Long">
update t_doctor set del_flag = '2',update_time = sysdate() where id = #{id}
</delete>

Loading…
Cancel
Save