master
parent
201d5efd13
commit
6e0c6608f2
|
@ -1,5 +1,6 @@
|
||||||
package com.health.system.server.controller;
|
package com.health.system.server.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.health.common.core.domain.Result;
|
import com.health.common.core.domain.Result;
|
||||||
import com.health.common.core.user.CommonBody;
|
import com.health.common.core.user.CommonBody;
|
||||||
import com.health.common.core.utils.StringUtils;
|
import com.health.common.core.utils.StringUtils;
|
||||||
|
|
|
@ -171,4 +171,13 @@ public interface SysUserMapper {
|
||||||
Patient selectPatient(@Param("userId") Integer userId);
|
Patient selectPatient(@Param("userId") Integer userId);
|
||||||
|
|
||||||
Doctor selectDoctor(@Param("userId") Integer userId);
|
Doctor selectDoctor(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 核对邮箱是否已经注册过
|
||||||
|
* @param: * @param email
|
||||||
|
* @return: void
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/10/27 10:01
|
||||||
|
*/
|
||||||
|
User checkEmail(@Param("email") String email);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.health.system.server.service.impl;
|
package com.health.system.server.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.health.common.core.constant.UserConstants;
|
import com.health.common.core.constant.UserConstants;
|
||||||
import com.health.common.core.domain.Result;
|
import com.health.common.core.domain.Result;
|
||||||
|
@ -607,8 +608,10 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Boolean registerDoctor(Doctor doctor) {
|
public Boolean registerDoctor(Doctor doctor) {
|
||||||
|
|
||||||
|
checkEmail(doctor.getEmail());
|
||||||
Integer roleId=100;
|
Integer roleId=100;
|
||||||
//添加用户表
|
//添加用户表
|
||||||
int count=userMapper.registerDoctor(doctor);
|
int count=userMapper.registerDoctor(doctor);
|
||||||
Integer userId = doctor.getUserId();
|
Integer userId = doctor.getUserId();
|
||||||
Doctor doctor1 = new Doctor();
|
Doctor doctor1 = new Doctor();
|
||||||
|
@ -618,14 +621,27 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
doctor1.setPersonalFile(doctor.getPersonalFile());
|
doctor1.setPersonalFile(doctor.getPersonalFile());
|
||||||
doctor1.setInauguralHospital(doctor.getInauguralHospital());
|
doctor1.setInauguralHospital(doctor.getInauguralHospital());
|
||||||
doctor1.setGoodFiled(doctor.getGoodFiled());
|
doctor1.setGoodFiled(doctor.getGoodFiled());
|
||||||
|
//添加医生表
|
||||||
userMapper.insertDoctor(doctor1);
|
userMapper.insertDoctor(doctor1);
|
||||||
|
//添加用户和角色中间表
|
||||||
int i=userMapper.insertUseRole(userId,roleId);
|
int i=userMapper.insertUseRole(userId,roleId);
|
||||||
return i>0;
|
return i>0;
|
||||||
//成功之后添加医生表
|
//成功之后添加医生表
|
||||||
//添加用户角色中间表
|
//添加用户角色中间表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 核对邮箱是否已经注册过
|
||||||
|
* @param: * @param email
|
||||||
|
* @return: void
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/10/27 10:01
|
||||||
|
*/
|
||||||
|
private void checkEmail(String email) {
|
||||||
|
User user=userMapper.checkEmail(email);
|
||||||
|
Assert.isNull(user,"邮箱{}已经注册,请重新输入邮箱"+email);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------注册医生---------------------------
|
//---------------注册医生---------------------------
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -45,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="dataScope" column="data_scope" />
|
<result property="dataScope" column="data_scope" />
|
||||||
<result property="status" column="role_status" />
|
<result property="status" column="role_status" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<sql id="selectUser">
|
||||||
|
select user_id,name,email,avatar,status from tb_user
|
||||||
|
</sql>
|
||||||
<sql id="selectUserVo">
|
<sql id="selectUserVo">
|
||||||
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,
|
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,
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||||
|
@ -155,8 +157,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectDoctor" resultType="com.health.system.common.domain.Doctor">
|
<select id="selectDoctor" resultType="com.health.system.common.domain.Doctor">
|
||||||
select * from tb_doctor where doctor_id=#{userId}
|
select * from tb_doctor where doctor_id=#{userId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="checkEmail" resultType="com.health.system.common.domain.User">
|
||||||
|
<include refid="selectUser">
|
||||||
|
where email=#{email}
|
||||||
|
</include>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
|
Loading…
Reference in New Issue