Merge branch 'cbx' of https://gitea.qinmian.online/cbx/Medical_Treatment into fjj
# Conflicts: # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/User.javacbx
commit
16bc23b2a2
|
@ -1,10 +1,11 @@
|
||||||
package doctor.system.api.domain;
|
package doctor.system.api.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@Data
|
||||||
public class Doctor {
|
public class Doctor {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer departmentId;
|
private Integer departmentId;
|
||||||
|
@ -34,115 +35,4 @@ public class Doctor {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDepartmentId() {
|
|
||||||
return departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartmentId(Integer departmentId) {
|
|
||||||
this.departmentId = departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getReviewStatus() {
|
|
||||||
return reviewStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviewStatus(Integer reviewStatus) {
|
|
||||||
this.reviewStatus = reviewStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPwd() {
|
|
||||||
return pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwd(String pwd) {
|
|
||||||
this.pwd = pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImagePic() {
|
|
||||||
return imagePic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImagePic(String imagePic) {
|
|
||||||
this.imagePic = imagePic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJobTitle() {
|
|
||||||
return jobTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobTitle(String jobTitle) {
|
|
||||||
this.jobTitle = jobTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInauguralHospital() {
|
|
||||||
return inauguralHospital;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInauguralHospital(String inauguralHospital) {
|
|
||||||
this.inauguralHospital = inauguralHospital;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPersonalProfile() {
|
|
||||||
return personalProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonalProfile(String personalProfile) {
|
|
||||||
this.personalProfile = personalProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGoodField() {
|
|
||||||
return goodField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGoodField(String goodField) {
|
|
||||||
this.goodField = goodField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package doctor.system.api.domain;
|
package doctor.system.api.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
@Data
|
||||||
* @ClassName : User
|
|
||||||
* @Description : 用户表
|
|
||||||
* @Author : FJJ
|
|
||||||
* @Date: 2024-01-10 20:46
|
|
||||||
*/
|
|
||||||
public class User {
|
public class User {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String phone;
|
private String phone;
|
||||||
|
@ -24,117 +20,6 @@ public class User {
|
||||||
private Integer weight;
|
private Integer weight;
|
||||||
private String invitationCode;
|
private String invitationCode;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
private long createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPwd() {
|
|
||||||
return pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwd(String pwd) {
|
|
||||||
this.pwd = pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNickName() {
|
|
||||||
return nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNickName(String nickName) {
|
|
||||||
this.nickName = nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeadPic() {
|
|
||||||
return headPic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeadPic(String headPic) {
|
|
||||||
this.headPic = headPic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSex() {
|
|
||||||
return sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(Integer sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getAge() {
|
|
||||||
return age;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAge(Integer age) {
|
|
||||||
this.age = age;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(Integer height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getWeight() {
|
|
||||||
return weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWeight(Integer weight) {
|
|
||||||
this.weight = weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInvitationCode() {
|
|
||||||
return invitationCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInvitationCode(String invitationCode) {
|
|
||||||
this.invitationCode = invitationCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ public class HealthDoctorService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
if (data==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (s.equals(data.getDoctor().getPwd())){
|
if (s.equals(data.getDoctor().getPwd())){
|
||||||
Map<String, Object> token = tokenService.createToken(data);
|
Map<String, Object> token = tokenService.createToken(data);
|
||||||
String accessToken = (String) token.get("access_token");
|
String accessToken = (String) token.get("access_token");
|
||||||
|
|
|
@ -30,6 +30,9 @@ public class HealthUserService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
if (data==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (s.equals(data.getUser().getPwd())){
|
if (s.equals(data.getUser().getPwd())){
|
||||||
Map<String, Object> token = tokenService.createToken(data);
|
Map<String, Object> token = tokenService.createToken(data);
|
||||||
String accessToken = (String) token.get("access_token");
|
String accessToken = (String) token.get("access_token");
|
||||||
|
|
|
@ -14,6 +14,13 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- Oss上传 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.10.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|
|
@ -4,10 +4,13 @@ import doctor.common.core.domain.HealthR;
|
||||||
import doctor.domain.dto.ApplyJoinDto;
|
import doctor.domain.dto.ApplyJoinDto;
|
||||||
import doctor.domain.entity.Banners;
|
import doctor.domain.entity.Banners;
|
||||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||||
|
import doctor.domain.vo.DoctorVo;
|
||||||
|
import doctor.domain.vo.FindImagePicVo;
|
||||||
import doctor.service.BannersService;
|
import doctor.service.BannersService;
|
||||||
import doctor.service.HealthJobTitleService;
|
import doctor.service.HealthJobTitleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -42,4 +45,22 @@ public class HealthJobTitleController {
|
||||||
HealthR healthR= healthJobTitleService.applyJoin(applyJoinDto);
|
HealthR healthR= healthJobTitleService.applyJoin(applyJoinDto);
|
||||||
return HealthR.ok(healthR);
|
return HealthR.ok(healthR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findDoctorById")
|
||||||
|
public HealthR<DoctorVo> findDoctorById(@RequestHeader Integer doctorId,
|
||||||
|
@RequestHeader String sessionId) {
|
||||||
|
return HealthR.ok(healthJobTitleService.findDoctorById(doctorId));
|
||||||
|
}
|
||||||
|
@GetMapping("/findSystemImagePic")
|
||||||
|
public HealthR<List<FindImagePicVo>> findSystemImagePic() {
|
||||||
|
return HealthR.ok(healthJobTitleService.findSystemImagePic());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/uploadImagePic")
|
||||||
|
public HealthR uploadImagePic(@RequestParam("imagePic") MultipartFile imagePic,
|
||||||
|
@RequestHeader String sessionId,
|
||||||
|
@RequestHeader Integer doctorId) {
|
||||||
|
return HealthR.ok(healthJobTitleService.uploadImagePic(imagePic,doctorId,sessionId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package doctor.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DoctorVo {
|
||||||
|
private Integer departmentId;
|
||||||
|
private String departmentName;
|
||||||
|
private String goodField;
|
||||||
|
private Integer id;
|
||||||
|
private String imagePic;
|
||||||
|
private String inauguralHospital;
|
||||||
|
private String jobTitle;
|
||||||
|
private String name;
|
||||||
|
private String personalProfile;
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package doctor.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FindImagePicVo {
|
||||||
|
private String imagePic;
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
package doctor.mapper;
|
package doctor.mapper;
|
||||||
|
|
||||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||||
|
import doctor.system.api.domain.Department;
|
||||||
import doctor.system.api.domain.Doctor;
|
import doctor.system.api.domain.Doctor;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,4 +13,14 @@ public interface HealthJobTitleMapper {
|
||||||
List<DoctorJobTitleEntity> findJobTitleList();
|
List<DoctorJobTitleEntity> findJobTitleList();
|
||||||
|
|
||||||
void insertDoctor(Doctor doctor);
|
void insertDoctor(Doctor doctor);
|
||||||
|
|
||||||
|
Doctor findDoctorById(Integer id);
|
||||||
|
|
||||||
|
Department findDepartmentById(Integer departmentId);
|
||||||
|
|
||||||
|
DoctorJobTitleEntity findDoctorJobTitleById(Integer id);
|
||||||
|
|
||||||
|
List<String> findDoctorImgPic();
|
||||||
|
|
||||||
|
void updDoctorImgPicBuyId(@Param("doctorId") Integer doctorId, @Param("s") String s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@ package doctor.service;
|
||||||
import doctor.common.core.domain.HealthR;
|
import doctor.common.core.domain.HealthR;
|
||||||
import doctor.domain.dto.ApplyJoinDto;
|
import doctor.domain.dto.ApplyJoinDto;
|
||||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||||
|
import doctor.domain.vo.DoctorVo;
|
||||||
|
import doctor.domain.vo.FindImagePicVo;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,4 +16,10 @@ public interface HealthJobTitleService {
|
||||||
HealthR sendEmailCode(String email);
|
HealthR sendEmailCode(String email);
|
||||||
|
|
||||||
HealthR applyJoin(ApplyJoinDto applyJoinDto);
|
HealthR applyJoin(ApplyJoinDto applyJoinDto);
|
||||||
|
|
||||||
|
DoctorVo findDoctorById(Integer doctorId);
|
||||||
|
|
||||||
|
List<FindImagePicVo> findSystemImagePic();
|
||||||
|
|
||||||
|
HealthR uploadImagePic(MultipartFile imagePic, Integer doctorId, String sessionId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package doctor.service.impl;
|
package doctor.service.impl;
|
||||||
|
|
||||||
import doctor.common.core.domain.HealthR;
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.common.security.service.TokenService;
|
||||||
import doctor.domain.dto.ApplyJoinDto;
|
import doctor.domain.dto.ApplyJoinDto;
|
||||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||||
|
import doctor.domain.vo.DoctorVo;
|
||||||
|
import doctor.domain.vo.FindImagePicVo;
|
||||||
import doctor.mapper.HealthJobTitleMapper;
|
import doctor.mapper.HealthJobTitleMapper;
|
||||||
import doctor.service.HealthJobTitleService;
|
import doctor.service.HealthJobTitleService;
|
||||||
|
import doctor.system.api.domain.Department;
|
||||||
import doctor.system.api.domain.Doctor;
|
import doctor.system.api.domain.Doctor;
|
||||||
|
import doctor.system.api.model.LoginUser;
|
||||||
|
import doctor.util.OssUtil;
|
||||||
import doctor.util.RSAUtils;
|
import doctor.util.RSAUtils;
|
||||||
import doctor.util.RsaKey;
|
import doctor.util.RsaKey;
|
||||||
import doctor.util.SendEmail;
|
import doctor.util.SendEmail;
|
||||||
|
@ -14,8 +20,10 @@ import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -27,6 +35,8 @@ public class HealthJobTitleServiceImpl implements HealthJobTitleService {
|
||||||
private HealthJobTitleMapper healthJobTitleMapper;
|
private HealthJobTitleMapper healthJobTitleMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SendEmail sendEmail;
|
private SendEmail sendEmail;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisTemplate<String,Integer> redisTemplate;
|
private RedisTemplate<String,Integer> redisTemplate;
|
||||||
|
|
||||||
|
@ -80,8 +90,44 @@ public class HealthJobTitleServiceImpl implements HealthJobTitleService {
|
||||||
Doctor doctor = new Doctor();
|
Doctor doctor = new Doctor();
|
||||||
BeanUtils.copyProperties(applyJoinDto,doctor);
|
BeanUtils.copyProperties(applyJoinDto,doctor);
|
||||||
doctor.setCreateTime(new Date());
|
doctor.setCreateTime(new Date());
|
||||||
|
Integer jobTitleId = applyJoinDto.getJobTitleId();
|
||||||
|
DoctorJobTitleEntity doctorJobTitleEntity=healthJobTitleMapper.findDoctorJobTitleById(jobTitleId);
|
||||||
|
doctor.setJobTitle(doctorJobTitleEntity.getJobTitle());
|
||||||
healthJobTitleMapper.insertDoctor(doctor);
|
healthJobTitleMapper.insertDoctor(doctor);
|
||||||
redisTemplate.delete(applyJoinDto.getEmail());
|
redisTemplate.delete(applyJoinDto.getEmail());
|
||||||
return HealthR.ok();
|
return HealthR.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DoctorVo findDoctorById(Integer doctorId) {
|
||||||
|
DoctorVo doctorVo = new DoctorVo();
|
||||||
|
Doctor doctor=healthJobTitleMapper.findDoctorById(doctorId);
|
||||||
|
Department department=healthJobTitleMapper.findDepartmentById(doctor.getDepartmentId());
|
||||||
|
BeanUtils.copyProperties(doctor,doctorVo);
|
||||||
|
BeanUtils.copyProperties(department,doctorVo);
|
||||||
|
return doctorVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FindImagePicVo> findSystemImagePic() {
|
||||||
|
ArrayList<FindImagePicVo> findImagePicVos = new ArrayList<>();
|
||||||
|
FindImagePicVo findImagePicVo = new FindImagePicVo();
|
||||||
|
List<String> imgPics= healthJobTitleMapper.findDoctorImgPic();
|
||||||
|
for (String imgPic : imgPics) {
|
||||||
|
findImagePicVo.setImagePic(imgPic);
|
||||||
|
findImagePicVos.add(findImagePicVo);
|
||||||
|
}
|
||||||
|
return findImagePicVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR uploadImagePic(MultipartFile imagePic,Integer doctorId,String sessionId) {
|
||||||
|
String s = OssUtil.uploadMultipartFile(imagePic);
|
||||||
|
healthJobTitleMapper.updDoctorImgPicBuyId(doctorId,s);
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(sessionId);
|
||||||
|
Doctor doctor = loginUser.getDoctor();
|
||||||
|
doctor.setImagePic(s);
|
||||||
|
tokenService.createToken(loginUser);
|
||||||
|
return HealthR.ok(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
package doctor.util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
|
import com.aliyun.oss.model.GetObjectRequest;
|
||||||
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import java.io.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Oss服务调用
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class OssUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Endpoint 存储对象概述 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限 访问路径前缀 存储对象概述
|
||||||
|
*/
|
||||||
|
private static String endPoint = "oss-cn-shanghai.aliyuncs.com";
|
||||||
|
private static String accessKeyId = "LTAI5tLE4XbyvvbuT7D2stCk";
|
||||||
|
private static String accessKeySecret = "W7ZeT4dMrMPP0c8BBwcyIPnhe3P4E8";
|
||||||
|
private static String accessPre = "https://lyb1314.oss-cn-shanghai.aliyuncs.com/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bucket名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String bucketName = "lyb1314";
|
||||||
|
|
||||||
|
private static OSS ossClient ;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ossClient = new OSSClientBuilder().build(
|
||||||
|
endPoint,
|
||||||
|
accessKeyId,
|
||||||
|
accessKeySecret);
|
||||||
|
log.info("oss服务连接成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认路径上传本地文件
|
||||||
|
* @param filePath
|
||||||
|
*/
|
||||||
|
public static String uploadFile(String filePath){
|
||||||
|
return uploadFileForBucket(bucketName,getOssFilePath(filePath) ,filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认路径上传multipartFile文件
|
||||||
|
* @param multipartFile
|
||||||
|
*/
|
||||||
|
public static String uploadMultipartFile(MultipartFile multipartFile) {
|
||||||
|
return uploadMultipartFile(bucketName,getOssFilePath(multipartFile.getOriginalFilename()),multipartFile);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 上传 multipartFile 类型文件
|
||||||
|
* @param bucketName
|
||||||
|
* @param ossPath
|
||||||
|
* @param multipartFile
|
||||||
|
*/
|
||||||
|
public static String uploadMultipartFile(String bucketName , String ossPath , MultipartFile multipartFile){
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
inputStream = multipartFile.getInputStream();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
||||||
|
return accessPre+ossPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用File上传PutObject上传文件 ** 程序默认使用次方法上传
|
||||||
|
* @param bucketName 实例名称
|
||||||
|
* @param ossPath oss存储路径
|
||||||
|
* @param filePath 本地文件路径
|
||||||
|
*/
|
||||||
|
public static String uploadFileForBucket(String bucketName , String ossPath , String filePath) {
|
||||||
|
// 创建PutObjectRequest对象。
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, ossPath, new File(filePath));
|
||||||
|
|
||||||
|
// 上传
|
||||||
|
ossClient.putObject(putObjectRequest);
|
||||||
|
return accessPre+ossPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用文件流上传到指定的bucket实例
|
||||||
|
* @param bucketName 实例名称
|
||||||
|
* @param ossPath oss存储路径
|
||||||
|
* @param filePath 本地文件路径
|
||||||
|
*/
|
||||||
|
public static String uploadFileInputStreamForBucket(String bucketName , String ossPath , String filePath){
|
||||||
|
|
||||||
|
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
inputStream = new FileInputStream(filePath);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
|
||||||
|
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
||||||
|
return accessPre+ossPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void uploadFileInputStreamForBucket(String bucketName , String ossPath , InputStream inputStream ){
|
||||||
|
ossClient.putObject(bucketName, ossPath, inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载
|
||||||
|
* @param ossFilePath
|
||||||
|
* @param filePath
|
||||||
|
*/
|
||||||
|
public static void downloadFile(String ossFilePath , String filePath ){
|
||||||
|
downloadFileForBucket(bucketName , ossFilePath , filePath);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 下载
|
||||||
|
* @param bucketName 实例名称
|
||||||
|
* @param ossFilePath oss存储路径
|
||||||
|
* @param filePath 本地文件路径
|
||||||
|
*/
|
||||||
|
public static void downloadFileForBucket(String bucketName , String ossFilePath , String filePath ){
|
||||||
|
ossClient.getObject(new GetObjectRequest(bucketName, ossFilePath), new File(filePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getOssDefaultPath(){
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
String url =
|
||||||
|
now.getYear()+"/"+
|
||||||
|
now.getMonth()+"/"+
|
||||||
|
now.getDayOfMonth()+"/"+
|
||||||
|
now.getHour()+"/"+
|
||||||
|
now.getMinute()+"/";
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getOssFilePath(String filePath){
|
||||||
|
String fileSuf = filePath.substring(filePath.indexOf(".") + 1);
|
||||||
|
return getOssDefaultPath() + UUID.randomUUID().toString() + "." + fileSuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,9 +8,24 @@
|
||||||
VALUES (0,#{departmentId},#{email},#{userName},#{reviewStatus},#{phone},#{pwd},#{name},#{imagePic},#{jobTitle},#{inauguralHospital},#{personalProfile},#{goodField},#{createTime});
|
VALUES (0,#{departmentId},#{email},#{userName},#{reviewStatus},#{phone},#{pwd},#{name},#{imagePic},#{jobTitle},#{inauguralHospital},#{personalProfile},#{goodField},#{createTime});
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
<update id="updDoctorImgPicBuyId">
|
||||||
|
update doctor set image_pic=#{s} where id=#{doctorId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="findJobTitleList" resultType="doctor.domain.entity.DoctorJobTitleEntity">
|
<select id="findJobTitleList" resultType="doctor.domain.entity.DoctorJobTitleEntity">
|
||||||
select * from doctor_job_title
|
select * from doctor_job_title
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findDoctorById" resultType="doctor.system.api.domain.Doctor">
|
||||||
|
select * from doctor where id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findDepartmentById" resultType="doctor.system.api.domain.Department">
|
||||||
|
select * from department where id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findDoctorJobTitleById" resultType="doctor.domain.entity.DoctorJobTitleEntity">
|
||||||
|
select * from doctor_job_title where id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findDoctorImgPic" resultType="java.lang.String">
|
||||||
|
select image_pic from doctor
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue