Commit 72de4466 authored by mlchun's avatar mlchun

1.用户个人信息接口

parent 12d6437e
......@@ -5,9 +5,13 @@ import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.Result;
import io.hmit.dto.OrgUserInfoDTO;
import io.hmit.dto.ServiceUserInfoDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import io.hmit.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -19,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
* @Description :
* @Author : Shen Yuanfeng
......@@ -34,11 +40,39 @@ public class UserController {
@Autowired
private UserService userService;
@Autowired
private PensionOldFamilyService pensionOldFamilyService;
@Login
@GetMapping("myinfo")
@ApiOperation("信息")
public Result<UserInfoDTO> get(@ApiIgnore @LoginUser UserEntity user){
@GetMapping("oldinfo")
@ApiOperation("老人个人信息")
public Result<UserInfoDTO> getOldInfo(@ApiIgnore @LoginUser UserEntity user){
UserInfoDTO userDetails = userService.getUserDetails(user.getId());
return new Result<UserInfoDTO>().ok(userDetails);
}
@Login
@GetMapping("oldfamilyinfo")
@ApiOperation("老人家属信息")
public Result<List<PensionOldFamilyDTO>> getOldFamilyInfo(@ApiIgnore @LoginUser UserEntity user){
List<PensionOldFamilyDTO> familyDTOS = pensionOldFamilyService.findByOldId(user.getId());
return new Result<List<PensionOldFamilyDTO>>().ok(familyDTOS);
}
@Login
@GetMapping("orginfo")
@ApiOperation("机构信息")
public Result<OrgUserInfoDTO> getOrgUserInfo(@ApiIgnore @LoginUser UserEntity user){
OrgUserInfoDTO orgUserInfo = userService.getOrgUserByUserId(user.getId());
return new Result<OrgUserInfoDTO>().ok(orgUserInfo);
}
@Login
@GetMapping("serviceinfo")
@ApiOperation("服务人员信息")
public Result<ServiceUserInfoDTO> serviceinfo(@ApiIgnore @LoginUser UserEntity user){
ServiceUserInfoDTO serviceUser = userService.getServiceUserByUserId(user.getId());
return new Result<ServiceUserInfoDTO>().ok(serviceUser);
}
}
package io.hmit.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.dto.OrgUserInfoDTO;
import io.hmit.dto.ServiceUserInfoDTO;
import io.hmit.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
......@@ -22,4 +24,8 @@ public interface UserDao extends BaseDao<UserEntity> {
List<Long> getAllOrganizationStaff(Long userId);
OrgUserInfoDTO getOrgUserByUserId(Long userId);
ServiceUserInfoDTO getServiceUserByUserId(Long userId);
}
package io.hmit.dto;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Description :
* @Author : Shen Yuanfeng
* @Date: 2021/3/18 16:01
*/
@Data
@ApiModel(value = "老人信息")
public class OldUserInfoDTO { @ApiModelProperty(value = "用户id")
private Long id;
/**
* 用户名
*/
@ApiModelProperty(value = "用户名")
private String username;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号")
private String mobile;
/**
* 性别
*/
@ApiModelProperty(value = "性别")
private String gender;
/**
* 生日
*/
@ApiModelProperty(value = "生日")
private Date birthday;
/**
* 地址_地区
*/
@ApiModelProperty(value = "地址_地区")
private String addressArea;
/**
* 详细地址
*/
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "所属社区名称")
private String communityName;
@ApiModelProperty(value = "身体状态")
private String healthStatus;
@ApiModelProperty(value = "家属信息")
private List<PensionOldFamilyDTO> pensionOldFamilyDTOList;
}
package io.hmit.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel(value = "机构信息")
public class OrgUserInfoDTO {
@ApiModelProperty(value = "用户id")
private Long id;
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "机构名称")
private String name;
@ApiModelProperty(value = "机构图标")
private String icon;
@ApiModelProperty(value = "机构描述")
private String description;
@ApiModelProperty(value = "服务区域")
private String serviceArea;
}
package io.hmit.dto;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel(value = "用户信息")
public class ServiceUserInfoDTO {
@ApiModelProperty(value = "用户id")
private Long id;
/**
* 用户名
*/
@ApiModelProperty(value = "用户名")
private String username;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号")
private String mobile;
/**
* 性别
*/
@ApiModelProperty(value = "性别")
private String gender;
/**
* 生日
*/
@ApiModelProperty(value = "生日")
private Date birthday;
/**
* 地址_地区
*/
@ApiModelProperty(value = "地址_地区")
private String addressArea;
/**
* 详细地址
*/
@ApiModelProperty(value = "详细地址")
private String address;
/**
* 机构ID
*/
@ApiModelProperty(value = "机构ID")
private String orgId;
/**
* 机构名称
*/
@ApiModelProperty(value = "机构ID")
private String orgName;
/**
* 服务区域
*/
@ApiModelProperty(value = "服务区域")
private String serviceArea;
}
......@@ -34,20 +34,13 @@ public class PensionOldFamilyDTO implements Serializable {
@ApiModelProperty(value = "家属与老人的关系")
private String familyMemberRole;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "更新者")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "身份证号")
private String idCardNo;
@ApiModelProperty(value = "备注")
private String remark;
}
\ No newline at end of file
......@@ -31,6 +31,9 @@ public class PensionOrganizationDTO implements Serializable {
@ApiModelProperty(value = "机构描述")
private String description;
@ApiModelProperty(value = "服务区域")
private String serviceArea;
@ApiModelProperty(value = "创建者")
private Long creator;
......
......@@ -31,4 +31,9 @@ public class PensionOrganizationEntity extends BaseEntity {
* 机构描述
*/
private String description;
/**
* 服务区域
*/
private String serviceArea;
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package io.hmit.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.BaseService;
import io.hmit.dto.LoginDTO;
import io.hmit.dto.OrgUserInfoDTO;
import io.hmit.dto.ServiceUserInfoDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
......@@ -42,4 +44,8 @@ public interface UserService extends BaseService<UserEntity> {
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
OrgUserInfoDTO getOrgUserByUserId(Long userId);
ServiceUserInfoDTO getServiceUserByUserId(Long userId);
}
......@@ -10,6 +10,8 @@ import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.validator.AssertUtils;
import io.hmit.dao.UserDao;
import io.hmit.dto.LoginDTO;
import io.hmit.dto.OrgUserInfoDTO;
import io.hmit.dto.ServiceUserInfoDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.TokenEntity;
import io.hmit.entity.UserEntity;
......@@ -114,4 +116,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return getPageData(list, page.getTotal(), UserEntity.class);
}
@Override
public OrgUserInfoDTO getOrgUserByUserId(Long userId) {
return userDao.getOrgUserByUserId(userId);
}
@Override
public ServiceUserInfoDTO getServiceUserByUserId(Long userId) {
return userDao.getServiceUserByUserId(userId);
}
}
\ No newline at end of file
......@@ -20,4 +20,18 @@
WHERE organization_id = (SELECT organization_id FROM pension_organization_user
WHERE user_id = #{userId});
</select>
<select id="getOrgUserByUserId" resultType="io.hmit.dto.OrgUserInfoDTO">
SELECT tu.id, tu.username, tu.mobile, po.name, po.icon, po.description, po.service_area
FROM tb_user tu, pension_organization_user pou, pension_organization po
WHERE tu.id = pou.user_id AND po.id = pou.organization_id AND tu.id = #{userId};
</select>
<select id="getServiceUserByUserId" resultType="io.hmit.dto.ServiceUserInfoDTO">
SELECT tu.id, tu.username, tu.mobile, tu.gender, tu.address_area, tu.address, tu.birthday,
po.id AS orgId, po.name AS orgName, po.service_area
FROM tb_user tu, pension_organization_user pou, pension_organization po
WHERE tu.id = pou.user_id AND po.id = pou.organization_id AND tu.id = #{userId};
</select>
</mapper>
\ No newline at end of file
......@@ -17,8 +17,8 @@
</resultMap>
<select id="findByOldId" resultType="io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO">
select * from pension_old_family
where old_id = #{oldId}
SELECT * FROM pension_old_family pof, tb_user tu
WHERE pof.family_member_id = tu.id and pof.old_id = #{oldId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment