增加 患者登录接口1.0
parent
bf2d44366f
commit
30dd351159
|
@ -1,6 +1,8 @@
|
|||
package com.health.system.common.domain.model;
|
||||
|
||||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.Doctor;
|
||||
import com.health.system.common.domain.Patient;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import lombok.Data;
|
||||
|
@ -53,6 +55,14 @@ public class LoginUser implements Serializable {
|
|||
*/
|
||||
private String ipaddr;
|
||||
|
||||
/*
|
||||
医生对象
|
||||
*/
|
||||
private Doctor doctor;
|
||||
/*
|
||||
患者对象
|
||||
*/
|
||||
private Patient patient;
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<!--新增注册医师远程调用接口-->
|
||||
<version>3.6.12</version>
|
||||
<!--新增注册患者远程调用接口-->
|
||||
<version>3.6.13</version>
|
||||
<artifactId>base-system-remote</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
|
@ -4,10 +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;
|
||||
import com.health.system.common.domain.*;
|
||||
import com.health.system.common.domain.model.LoginUser;
|
||||
import com.health.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
@ -22,6 +19,16 @@ import org.springframework.web.bind.annotation.*;
|
|||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteUserService {
|
||||
|
||||
/**
|
||||
* @description: 患者注册
|
||||
* @param: * @param patient
|
||||
* @param source
|
||||
* @return: Result<?>
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/26 13:21
|
||||
*/
|
||||
@PostMapping("/register/patient")
|
||||
public Result<?> registerPatient(@RequestBody Patient patient,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* @description: 医生注册
|
||||
* @param: * @param doctor
|
||||
|
|
|
@ -3,10 +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;
|
||||
import com.health.system.common.domain.*;
|
||||
import com.health.system.common.domain.model.LoginUser;
|
||||
import com.health.system.remote.RemoteUserService;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -28,6 +25,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public RemoteUserService create(Throwable throwable) {
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService() {
|
||||
@Override
|
||||
public Result<?> registerPatient(Patient patient, String source) {
|
||||
return Result.error("医生注册失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> registerDoctor(Doctor doctor, String source) {
|
||||
return Result.error("医生注册失败:" + throwable.getMessage());
|
||||
|
|
|
@ -132,10 +132,20 @@ public class SysUserController extends BaseController
|
|||
}
|
||||
//查询该用户下的所有角色
|
||||
Set<String> roles=permissionService.getEmailRolePermission(user);
|
||||
System.out.println("所有角色是"+roles);
|
||||
LoginUser loginUserVo = new LoginUser();
|
||||
loginUserVo.setUser(user);
|
||||
loginUserVo.setRoles(roles);
|
||||
if (roles.contains("患者")){
|
||||
Patient patient=userService.selectPatient(user.getUserId());
|
||||
System.out.println(patient);
|
||||
loginUserVo.setPatient(patient);
|
||||
}else{
|
||||
Doctor doctor=userService.selectDoctor(user.getUserId());
|
||||
System.out.println(doctor);
|
||||
loginUserVo.setDoctor(doctor);
|
||||
}
|
||||
System.out.println("所有角色是"+roles);
|
||||
|
||||
System.out.println("最后的返回对象是:"+loginUserVo);
|
||||
return Result.success(loginUserVo);
|
||||
}
|
||||
|
|
|
@ -167,4 +167,8 @@ public interface SysUserMapper {
|
|||
int registerPatient(Patient patient);
|
||||
|
||||
void insertPatient(Patient patient1);
|
||||
|
||||
Patient selectPatient(@Param("userId") Integer userId);
|
||||
|
||||
Doctor selectDoctor(@Param("userId") Integer userId);
|
||||
}
|
||||
|
|
|
@ -224,4 +224,9 @@ public interface ISysUserService
|
|||
|
||||
//---------------注册患者---------------------------
|
||||
Boolean registerPatient(Patient patient);
|
||||
|
||||
//------------------查询患者信息
|
||||
Patient selectPatient(Integer userId);
|
||||
//------------------------------查询医生信息
|
||||
Doctor selectDoctor(Integer userId);
|
||||
}
|
||||
|
|
|
@ -628,6 +628,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
//---------------注册医生---------------------------
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean registerPatient(Patient patient) {
|
||||
Integer roleId=101;
|
||||
//
|
||||
|
@ -643,4 +644,17 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.insertUseRole(userId,roleId)>0;
|
||||
}
|
||||
|
||||
//-------------查询患者-------------------------
|
||||
@Override
|
||||
public Patient selectPatient(Integer userId) {
|
||||
|
||||
return userMapper.selectPatient(userId);
|
||||
}
|
||||
|
||||
//------------查询医生---------------------------
|
||||
@Override
|
||||
public Doctor selectDoctor(Integer userId) {
|
||||
return userMapper.selectDoctor(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -149,6 +149,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectUserByUserId" resultType="com.health.system.common.domain.User">
|
||||
select * from tb_user where user_id=#{userId1}
|
||||
</select>
|
||||
<select id="selectPatient" resultType="com.health.system.common.domain.Patient">
|
||||
select * from tb_patient where patient_id=#{userId}
|
||||
</select>
|
||||
<select id="selectDoctor" resultType="com.health.system.common.domain.Doctor">
|
||||
select * from tb_doctor where doctor_id=#{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
|
|
Loading…
Reference in New Issue