增加 注册医生接口
parent
c0e3e3e365
commit
79f0466bcf
|
@ -5,6 +5,7 @@
|
|||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
logs/
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
|
@ -43,4 +44,4 @@ nbdist/
|
|||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
!*/build/*.xml
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.6</version>
|
||||
<!--重构登录注册模块后 重构系统公共实体类-->
|
||||
<version>3.6.7</version>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.health.system.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description: 医生实体类
|
||||
* @date 2023/10/26 10:57
|
||||
*/
|
||||
@Data
|
||||
public class Doctor extends User{
|
||||
|
||||
/*
|
||||
就职医院名称
|
||||
*/
|
||||
private String inauguralHospital;
|
||||
|
||||
/*
|
||||
科室id
|
||||
*/
|
||||
private Integer departmentId;
|
||||
|
||||
/*
|
||||
职位id
|
||||
*/
|
||||
private Integer titleId;
|
||||
|
||||
/*
|
||||
个人简介
|
||||
*/
|
||||
private String personalFile;
|
||||
|
||||
/*
|
||||
擅长领域
|
||||
*/
|
||||
private String goodFiled;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.health.system.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description: 患者实体类
|
||||
* @date 2023/10/26 10:57
|
||||
*/
|
||||
@Data
|
||||
public class Patient extends User{
|
||||
/*
|
||||
体重
|
||||
*/
|
||||
private Integer weight;
|
||||
|
||||
/*
|
||||
身高
|
||||
*/
|
||||
private Integer height;
|
||||
|
||||
/*
|
||||
性别
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/*
|
||||
年龄
|
||||
*/
|
||||
private Integer age;
|
||||
|
||||
/*
|
||||
绑定微信号
|
||||
*/
|
||||
private String weChat;
|
||||
|
||||
/*
|
||||
邀请码
|
||||
*/
|
||||
private String inviteCode;
|
||||
}
|
|
@ -11,77 +11,41 @@ import lombok.Data;
|
|||
@Data
|
||||
public class User {
|
||||
|
||||
/*
|
||||
邮箱验证码
|
||||
*/
|
||||
private String code;
|
||||
/*
|
||||
用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/*
|
||||
用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/*
|
||||
用户密码
|
||||
*/
|
||||
private String password;
|
||||
private String name;
|
||||
|
||||
/*
|
||||
用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/*
|
||||
用户邀请码
|
||||
第一次输入密码
|
||||
*/
|
||||
private String inviteCode;
|
||||
private String pwd1;
|
||||
|
||||
/*
|
||||
用户头像
|
||||
第二次密码
|
||||
*/
|
||||
private String pwd2;
|
||||
|
||||
/*
|
||||
用户形象照
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/*
|
||||
用户性别 1代表男性 2代表女性
|
||||
*/
|
||||
private Integer gender;
|
||||
/*
|
||||
用户身高
|
||||
*/
|
||||
private Integer height;
|
||||
/*
|
||||
用户体重
|
||||
*/
|
||||
private Integer weight;
|
||||
/*
|
||||
用户年龄
|
||||
*/
|
||||
private Integer age;
|
||||
/*
|
||||
患者微信号
|
||||
*/
|
||||
private String wechatNumber;
|
||||
/*
|
||||
医生所属医院
|
||||
*/
|
||||
private String hospital;
|
||||
/*
|
||||
医生所属科室id
|
||||
*/
|
||||
private Integer deptId;
|
||||
/*
|
||||
医生职位id
|
||||
*/
|
||||
private Integer titleId;
|
||||
/*
|
||||
医生简介
|
||||
*/
|
||||
private String introduce;
|
||||
/*
|
||||
医生擅长领域
|
||||
*/
|
||||
private String skilled;
|
||||
/*
|
||||
用户状态
|
||||
用户注册状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.11</version>
|
||||
<!--新增注册医师远程调用接口-->
|
||||
<version>3.6.12</version>
|
||||
<artifactId>base-system-remote</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -33,7 +34,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
<version>3.6.6</version>
|
||||
<version>3.6.7</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.health.common.core.constant.SecurityConstants;
|
|||
import com.health.common.core.constant.ServiceNameConstants;
|
||||
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;
|
||||
|
@ -20,6 +21,16 @@ import org.springframework.web.bind.annotation.*;
|
|||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteUserService {
|
||||
|
||||
/**
|
||||
* @description: 医生注册
|
||||
* @param: * @param doctor
|
||||
* @return: Result<?>
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/26 12:01
|
||||
*/
|
||||
@PostMapping("/user/register/doctor")
|
||||
public Result<?> registerDoctor(@RequestBody Doctor doctor,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 通过用户名查询用户信息
|
||||
*
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.health.system.remote.factory;
|
|||
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;
|
||||
|
@ -27,6 +28,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public RemoteUserService create(Throwable throwable) {
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService() {
|
||||
@Override
|
||||
public Result<?> registerDoctor(Doctor doctor, String source) {
|
||||
return Result.error("医生注册失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<LoginUser> getUserInfo(String username, String source) {
|
||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
<version>3.6.6</version>
|
||||
<version>3.6.7</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.health.common.log.annotation.Log;
|
|||
import com.health.common.log.enums.BusinessType;
|
||||
import com.health.common.security.annotation.RequiresPermissions;
|
||||
import com.health.common.security.utils.SecurityUtils;
|
||||
|
||||
import com.health.system.common.domain.SysConfig;
|
||||
import com.health.system.server.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -161,6 +161,12 @@ public class SysUserController extends BaseController
|
|||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//--------------邮箱注册医生--------------------------------------
|
||||
@PostMapping("/register/doctor")
|
||||
public Result<?> registerDoctor(@RequestBody Doctor doctor){
|
||||
return Result.success(userService.registerDoctor(doctor));
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
//------------------------邮箱注册----------------
|
||||
//注册
|
||||
@PostMapping("/register/user")
|
||||
|
|
|
@ -1,6 +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;
|
||||
|
@ -156,4 +157,13 @@ public interface SysUserMapper {
|
|||
|
||||
|
||||
int updPasswordByEmail(User user);
|
||||
|
||||
//添加用户表
|
||||
int registerDoctor(Doctor doctor);
|
||||
|
||||
//添加医生表
|
||||
void insertDoctor(Doctor doctor1);
|
||||
|
||||
//添加用户角色
|
||||
int insertUseRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
|
||||
}
|
||||
|
|
|
@ -4,6 +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;
|
||||
|
@ -220,4 +221,7 @@ public interface ISysUserService
|
|||
User selectUserByUserId(Long userId);
|
||||
|
||||
int updPasswordByEmail(User user);
|
||||
|
||||
//---------------注册医生---------------------------
|
||||
Boolean registerDoctor(Doctor doctor);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.print.Doc;
|
||||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -561,24 +562,24 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Override
|
||||
@Transactional
|
||||
public int registerNewUser(User user) {
|
||||
//默认是患者角色
|
||||
System.out.println("对象是:"+user);
|
||||
System.out.println(user.getGender()+",");
|
||||
System.out.println(user.getAge()+",");
|
||||
System.out.println(user.getHeight()+",");
|
||||
System.out.println(user.getWeight());
|
||||
int role=101;
|
||||
//添加用户不管是患者还是医生
|
||||
int userId=userMapper.insertNewUser(user);
|
||||
Integer userId1 = user.getUserId();
|
||||
System.out.println("获取的自增userId是"+userId1);
|
||||
//如果角色标识roleId==2的时候再赋值为102
|
||||
if (user.getDeptId()!=null){
|
||||
role=100;
|
||||
}
|
||||
// //默认是患者角色
|
||||
// System.out.println("对象是:"+user);
|
||||
// System.out.println(user.getGender()+",");
|
||||
// System.out.println(user.getAge()+",");
|
||||
// System.out.println(user.getHeight()+",");
|
||||
// System.out.println(user.getWeight());
|
||||
// int role=101;
|
||||
// //添加用户不管是患者还是医生
|
||||
// int userId=userMapper.insertNewUser(user);
|
||||
// Integer userId1 = user.getUserId();
|
||||
// System.out.println("获取的自增userId是"+userId1);
|
||||
// //如果角色标识roleId==2的时候再赋值为102
|
||||
// if (user.getDeptId()!=null){
|
||||
// role=100;
|
||||
// }
|
||||
//为用户添加角色
|
||||
userMapper.addUserRole(userId1,role);
|
||||
return userId;
|
||||
// userMapper.addUserRole(userId1,role);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -602,4 +603,25 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
}
|
||||
|
||||
//---------------注册医生---------------------------
|
||||
@Override
|
||||
public Boolean registerDoctor(Doctor doctor) {
|
||||
Integer roleId=100;
|
||||
//添加用户表
|
||||
int count=userMapper.registerDoctor(doctor);
|
||||
Integer userId = doctor.getUserId();
|
||||
Doctor doctor1 = new Doctor();
|
||||
doctor1.setUserId(userId);
|
||||
doctor1.setDepartmentId(doctor.getDepartmentId());
|
||||
doctor1.setTitleId(doctor.getTitleId());
|
||||
doctor1.setPersonalFile(doctor.getPersonalFile());
|
||||
doctor1.setInauguralHospital(doctor.getInauguralHospital());
|
||||
userMapper.insertDoctor(doctor1);
|
||||
|
||||
int i=userMapper.insertUseRole(userId,roleId);
|
||||
return i>0;
|
||||
//成功之后添加医生表
|
||||
//添加用户角色中间表
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -234,6 +234,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
|
||||
</insert>
|
||||
<insert id="registerDoctor" 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="insertDoctor">
|
||||
insert into tb_doctor
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null">doctor_id,</if>
|
||||
<if test="inauguralHospital!=null and inauguralHospital!=''">inaugural_hospital,</if>
|
||||
<if test="departmentId!=null">department_id,</if>
|
||||
<if test="titleId!=null">title_id,</if>
|
||||
<if test="professionProfile!=null and professionProfile!=''">profession_profile,</if>
|
||||
<if test="goodField!=null and goodField!=''">good_field,</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null">#{userId},</if>
|
||||
<if test="inauguralHospital!=null and inauguralHospital!=''">#{inauguralHospital},</if>
|
||||
<if test="departmentId!=null">#{departmentId},</if>
|
||||
<if test="titleId!=null">#{titleId},</if>
|
||||
<if test="professionProfile!=null and professionProfile!=''">#{personalFile},</if>
|
||||
<if test="goodField!=null and goodField!=''">#{goodFiled},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertUseRole">
|
||||
insert into tb_user_role values(#{userId},#{roleId})
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
|
|
Loading…
Reference in New Issue