增加 注册患者接口1.0
parent
fafef40ff4
commit
08900227fe
|
@ -164,9 +164,23 @@ public class SysUserController extends BaseController
|
|||
//--------------邮箱注册医生--------------------------------------
|
||||
@PostMapping("/register/doctor")
|
||||
public Result<?> registerDoctor(@RequestBody Doctor doctor){
|
||||
return Result.success(userService.registerDoctor(doctor));
|
||||
Boolean flag = userService.registerDoctor(doctor);
|
||||
if (flag==true){
|
||||
return Result.success("","注册成功");
|
||||
}
|
||||
return Result.success("","注册失败");
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
@PostMapping("/register/patient")
|
||||
public Result<?> registerPatient(@RequestBody Patient patient){
|
||||
Boolean flag = userService.registerPatient(patient);
|
||||
if (flag==true){
|
||||
return Result.success("","注册成功");
|
||||
}
|
||||
return Result.success("","注册失败");
|
||||
}
|
||||
|
||||
//------------------------邮箱注册----------------
|
||||
//注册
|
||||
@PostMapping("/register/user")
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.health.system.server.mapper;
|
||||
|
||||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.Doctor;
|
||||
import com.health.system.common.domain.EmailLoginUser;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import com.health.system.common.domain.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -166,4 +163,8 @@ public interface SysUserMapper {
|
|||
|
||||
//添加用户角色
|
||||
int insertUseRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
|
||||
|
||||
int registerPatient(Patient patient);
|
||||
|
||||
void insertPatient(Patient patient1);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.health.common.core.domain.Result;
|
||||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.Doctor;
|
||||
import com.health.system.common.domain.EmailLoginUser;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import com.health.system.common.domain.*;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
|
@ -224,4 +221,7 @@ public interface ISysUserService
|
|||
|
||||
//---------------注册医生---------------------------
|
||||
Boolean registerDoctor(Doctor doctor);
|
||||
|
||||
//---------------注册患者---------------------------
|
||||
Boolean registerPatient(Patient patient);
|
||||
}
|
||||
|
|
|
@ -626,4 +626,21 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
//添加用户角色中间表
|
||||
}
|
||||
|
||||
//---------------注册医生---------------------------
|
||||
@Override
|
||||
public Boolean registerPatient(Patient patient) {
|
||||
Integer roleId=101;
|
||||
//
|
||||
patient.setStatus(1);
|
||||
int count=userMapper.registerPatient(patient);
|
||||
Integer userId = patient.getUserId();
|
||||
Patient patient1 = new Patient();
|
||||
patient1.setUserId(userId);
|
||||
String inviteCode = RandomUtil.randomString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 10);
|
||||
patient1.setInviteCode(inviteCode);
|
||||
userMapper.insertPatient(patient1);
|
||||
|
||||
return userMapper.insertUseRole(userId,roleId)>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -275,6 +275,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertUseRole">
|
||||
insert into tb_user_role values(#{userId},#{roleId})
|
||||
</insert>
|
||||
<insert id="registerPatient" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into tb_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name!=null and name!=''">name,</if>
|
||||
<if test="pwd1!=null and pwd1!=''">pwd1,</if>
|
||||
<if test="email!=null and email!=''">email,</if>
|
||||
<if test="avatar!=null and avatar!=''">avatar,</if>
|
||||
<if test="status!=null">status,</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name!=null and name!=''">#{name},</if>
|
||||
<if test="pwd1!=null and pwd1!=''">#{pwd1},</if>
|
||||
<if test="email!=null and email!=''">#{email},</if>
|
||||
<if test="avatar!=null and avatar!=''">#{avatar},</if>
|
||||
<if test="status!=null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertPatient">
|
||||
insert into tb_patient
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="user_id!=null">patient_id,</if>
|
||||
<if test="invite_code!=null and invite_code!=''">invite_code,</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="user_id!=null">#{userId},</if>
|
||||
<if test="invite_code!=null and invite_code!=''">#{inviteCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
|
|
Loading…
Reference in New Issue