# Conflicts:
#	doctor-auth/src/main/resources/bootstrap.yml
#	doctor-common/doctor-common-core/src/main/java/doctor/common/core/constant/Constants.java
#	doctor-gateway/src/main/resources/bootstrap.yml
#	doctor-modules/doctor-file/src/main/resources/bootstrap.yml
#	doctor-modules/doctor-gen/src/main/resources/bootstrap.yml
#	doctor-modules/doctor-health/src/main/resources/bootstrap.yml
#	doctor-modules/doctor-job/src/main/resources/bootstrap.yml
#	doctor-modules/doctor-system/src/main/resources/bootstrap.yml
#	doctor-visual/doctor-monitor/src/main/resources/bootstrap.yml
cbx
zmyYYDS 2024-01-14 16:29:49 +08:00
commit b6f482f009
69 changed files with 1669 additions and 1139 deletions

View File

@ -1,6 +1,7 @@
package doctor.system.api;
import doctor.common.core.constant.ServiceNameConstants;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
import doctor.system.api.model.LoginUser;
@ -8,7 +9,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallback = RemoteDoctorFallbackFactory.class)
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallbackFactory = RemoteDoctorFallbackFactory.class)
public interface RemoteDoctorService {
@PostMapping("/doctor/getDoctor")

View File

@ -1,10 +1,11 @@
package doctor.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class Doctor {
private Integer id;
private Integer departmentId;
@ -12,7 +13,7 @@ public class Doctor {
private String userName;
private Integer reviewStatus;
private String phone;
private String password;
private String pwd;
private String name;
private String imagePic;
private String jobTitle;
@ -34,115 +35,4 @@ public class Doctor {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
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 getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
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;
}
}

View File

@ -1,15 +1,11 @@
package doctor.system.api.domain;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : User
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 20:46
*/
@Data
public class User {
private Integer id;
private String phone;
@ -20,121 +16,10 @@ public class User {
private String headPic;
private Integer sex;
private Integer age;
private String height;
private String weight;
private Integer height;
private Integer weight;
private String invitationCode;
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 String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getWeight() {
return weight;
}
public void setWeight(String 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;
}
}

View File

@ -1,45 +1,34 @@
package doctor.system.api.factory;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class RemoteDoctorFallbackFactory implements RemoteDoctorService {
public class RemoteDoctorFallbackFactory implements FallbackFactory<RemoteDoctorService> {
private static final Logger log = LoggerFactory.getLogger(RemoteDoctorFallbackFactory.class);
@Override
public RemoteDoctorService create(Throwable throwable)
{
log.error("文件服务调用失败:{}", throwable.getMessage());
return new RemoteDoctorService() {
@Override
public R<LoginUser> getDoctorInfo(String email) {
log.error("文件服务调用失败");
return R.fail("登录超时");
return R.fail("登录失败");
}
@Override
public R<LoginUser> getUser(String email) {
log.error("文件服务调用失败");
return R.fail("登录超时");
return R.fail("登录失败");
}
// @Override
// public RemoteDoctorService create(Throwable throwable)
// {
// log.error("文件服务调用失败:{}", throwable.getMessage());
// return new RemoteDoctorService() {
// @Override
// public R<LoginUser> getDoctorInfo(String email) {
// return R.fail("登录超时");
// }
//
// @Override
// public R<LoginUser> getUser(String email) {
// return R.fail("登录失败");
// }
//
//
// };
// }
};
}
}

View File

@ -3,7 +3,7 @@ package doctor.auth.service;
import doctor.auth.util.RSAUtils;
import doctor.auth.util.RsaKey;
import doctor.auth.vo.DoctorVo;
import doctor.auth.vo.UserVo;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.UUID;
@Component
public class HealthDoctorService {
@ -31,7 +30,10 @@ public class HealthDoctorService {
} catch (Exception e) {
throw new RuntimeException(e);
}
if (s.equals(data.getSysUser().getPassword())){
if (data==null){
return null;
}
if (s.equals(data.getDoctor().getPwd())){
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
doctorVo.setSessionId(accessToken);

View File

@ -6,8 +6,6 @@ import doctor.auth.vo.UserVo;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.RemoteUserService;
import doctor.system.api.factory.RemoteUserFallbackFactory;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -32,6 +30,9 @@ public class HealthUserService {
} catch (Exception e) {
throw new RuntimeException(e);
}
if (data==null){
return null;
}
if (s.equals(data.getUser().getPwd())){
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
@ -44,8 +45,8 @@ public class HealthUserService {
doctorUserVo.setJiGuangPwd(s);
doctorUserVo.setHeadPic(data.getUser().getHeadPic());
doctorUserVo.setSex(data.getUser().getSex());
doctorUserVo.setHeight(Integer.valueOf(data.getUser().getHeight()));
doctorUserVo.setWeight(Integer.valueOf(data.getUser().getWeight()));
doctorUserVo.setHeight(data.getUser().getHeight());
doctorUserVo.setWeight(data.getUser().getWeight());
doctorUserVo.setFaceFlag(1);
UUID uuid = UUID.randomUUID();
String inviteCode = uuid.toString().replaceAll("-", "").substring(0, 8);
@ -55,5 +56,4 @@ public class HealthUserService {
}
return null;
}
}

View File

@ -113,6 +113,15 @@
<artifactId>swagger-annotations</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</dependency>
</dependencies>

View File

@ -16,5 +16,4 @@ import doctor.common.swagger.config.SwaggerAutoConfiguration;
@Import({ SwaggerAutoConfiguration.class })
public @interface EnableCustomSwagger2
{
}

View File

@ -14,6 +14,13 @@
<dependencies>
<!-- Oss上传 -->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
@ -84,6 +91,11 @@
<artifactId>doctor-api-system</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>

View File

@ -1,31 +0,0 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.domain.entity.Banners;
import doctor.service.BannersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @BelongsProject: Medical_Treatment
* @BelongsPackage: doctor.controller
* @Author: jpz
* @CreateTime: 2024/1/10 15:54
*/
@RestController
@RequestMapping("/share/v1")
public class BannersController {
@Autowired
private BannersService bannersService;
@GetMapping("/bannersShow")
public HealthR<List<Banners>> bannersShow(){
List<Banners> banners = bannersService.bannersShow();
return HealthR.ok(banners);
}
}

View File

@ -1,30 +0,0 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.domain.entity.Department;
import doctor.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @BelongsProject: Medical_Treatment
* @BelongsPackage: doctor.controller
* @Author: jpz
* @CreateTime: 2024/1/10 16:49
*/
@RestController
@RequestMapping("/share/knowledgeBase/v1")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
@GetMapping("/findDepartment")
public HealthR<List<Department>> findDepartment(){
List<Department> list=departmentService.findDepartment();
return HealthR.ok(list);
}
}

View File

@ -1,33 +0,0 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.domain.entity.DiseaseCategory;
import doctor.service.DiseaseCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.xml.transform.Result;
import java.util.List;
/**
* @BelongsProject: Medical_Treatment
* @BelongsPackage: doctor.controller
* @Author: jpz
* @CreateTime: 2024/1/10 17:16
*/
@RestController
@RequestMapping("/share/knowledgeBase/v1")
public class DiseaseCategoryController {
@Autowired
private DiseaseCategoryService diseaseCategoryService;
@GetMapping("/findDiseaseCategory")
public HealthR<List<DiseaseCategory>> findDiseaseCategory(@RequestParam Integer departmentId){
List<DiseaseCategory> list=diseaseCategoryService.findDiseaseCategory(departmentId);
return HealthR.ok(list);
}
}

View File

@ -1,10 +1,11 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.entity.DiseaseKnowledge;
import doctor.domain.entity.DrugsCategory;
import doctor.domain.entity.*;
import doctor.service.DepartmentService;
import doctor.service.DiseaseCategoryService;
import doctor.service.DiseaseKnowledgeService;
import doctor.service.HealthDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -13,17 +14,17 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static doctor.common.core.utils.PageUtils.startPage;
import static com.github.pagehelper.page.PageMethod.startPage;
/**
* @BelongsProject: Medical_Treatment
* @BelongsPackage: doctor.controller
* @Author: jpz
* @CreateTime: 2024/1/10 20:56
*/
@RestController
@RequestMapping("/share/knowledgeBase/v1")
public class DiseaseKnowledgeController {
@RequestMapping("/knowledgeBase/v1")
public class HealthDepartmentController {
@Autowired
private HealthDepartmentService healthV1Service;
@Autowired
private DiseaseCategoryService diseaseCategoryService;
@Autowired
private DiseaseKnowledgeService diseaseKnowledgeService;
//罕见病症详情
@ -47,9 +48,15 @@ public class DiseaseKnowledgeController {
}
@GetMapping("/findDiseaseCategory")
public HealthR<List<DiseaseCategory>> findDiseaseCategory(@RequestParam Integer departmentId){
List<DiseaseCategory> list=diseaseCategoryService.findDiseaseCategory(departmentId);
return HealthR.ok(list);
}
@GetMapping("/findDepartment")
public HealthR<List<DepartmentEntity>> findDepartment(){
List<DepartmentEntity> departmentEntities=healthV1Service.findDepartment();
return HealthR.ok(departmentEntities);
}
}

View File

@ -0,0 +1,66 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.dto.ApplyJoinDto;
import doctor.domain.entity.Banners;
import doctor.domain.entity.DoctorJobTitleEntity;
import doctor.domain.vo.DoctorVo;
import doctor.domain.vo.FindImagePicVo;
import doctor.service.BannersService;
import doctor.service.HealthJobTitleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@RestController
@RequestMapping("/v1")
public class HealthJobTitleController {
@Autowired
private HealthJobTitleService healthJobTitleService;
@Autowired
private BannersService bannersService;
@GetMapping("/bannersShow")
public HealthR<List<Banners>> bannersShow(){
List<Banners> banners = bannersService.bannersShow();
return HealthR.ok(banners);
}
@GetMapping("/findJobTitleList")
public HealthR<List<DoctorJobTitleEntity>> findJobTitleList() {
List<DoctorJobTitleEntity> doctorJobTitleEntities=healthJobTitleService.findJobTitleList();
return HealthR.ok(doctorJobTitleEntities);
}
@PostMapping("/sendEmailCode")
public HealthR sendEmailCode(@RequestParam("email") String email) {
HealthR healthR= healthJobTitleService.sendEmailCode(email);
return HealthR.ok(healthR);
}
@PostMapping("/applyJoin")
public HealthR applyJoin(@RequestBody ApplyJoinDto applyJoinDto) {
HealthR healthR= healthJobTitleService.applyJoin(applyJoinDto);
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));
}
}

View File

@ -1,6 +1,7 @@
package doctor.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.system.api.domain.Doctor;
import doctor.service.DoctorUserService;
@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/doctor")
@DS("master")
public class HealthLoginController {
@Autowired

View File

@ -21,7 +21,7 @@ import static com.github.pagehelper.page.PageMethod.startPage;
* @CreateTime: 2024/1/11 16:19
*/
@RestController
@RequestMapping("/share/information/v1")
@RequestMapping("/information/v1")
public class InformationController {
@Autowired
private InformationService informationService;

View File

@ -0,0 +1,35 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.vo.InquiryDetailsRecordVo;
import doctor.service.InquiryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.github.pagehelper.page.PageMethod.startPage;
/**
* @ClassName : InquiryController
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:09
*/
@RestController
@RequestMapping("/user/inquiry/verify/v1")
public class InquiryController {
@Autowired
private InquiryService inquiryService;
//历史问诊记录列表
@GetMapping("/findHistoryInquiryRecord")
public HealthR<List<InquiryDetailsRecordVo>> findHistoryInquiryRecord(@RequestParam Integer page,@RequestParam Integer count){
startPage(page,count);
List<InquiryDetailsRecordVo> inquiryDetailsRecordVoList = inquiryService.findHistoryInquiryRecord();
return HealthR.ok(inquiryDetailsRecordVoList);
}
}

View File

@ -1,15 +1,19 @@
package doctor.controller;
import doctor.common.core.domain.R;
import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.common.core.domain.HealthR;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.service.UserVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static com.github.pagehelper.page.PageMethod.startPage;
/**
* @ClassName : UserVideoController
* @Description :
@ -24,34 +28,43 @@ public class UserVideoController {
//用户视频收藏列表
@GetMapping("/findVideoCollectionList")
public R<List<UserVideoCollection>>findVideoCollectionList(){
List<UserVideoCollection> userVideoCollectionList =userVideoService.findVideoCollectionList();
return R.ok(userVideoCollectionList);
public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count){
startPage(page,count);
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList();
return HealthR.ok(userVideoCollectionVos);
}
//用户取消视频收藏
@GetMapping("/cancelVideoCollection/{id}")
public R cancelVideoCollection(@PathVariable Integer id){
userVideoService.cancelVideoCollection(id);
return R.ok();
@DeleteMapping("/cancelVideoCollection")
public HealthR cancelVideoCollection(@RequestHeader Integer userId,@RequestHeader String sessionId,@RequestParam Integer videoId ){
userVideoService.cancelVideoCollection(userId,sessionId,videoId);
return HealthR.ok();
}
//用户购买视频列表
@GetMapping("/findUserVideoBuyList")
public R<List<UserVideoBuy>>findUserVideoBuyList(){
List<UserVideoBuy> userVideoBuys =userVideoService.findUserVideoBuyList();
return R.ok(userVideoBuys);
public HealthR<List<UserVideoBuyVo>>findUserVideoBuyList(@RequestParam Integer page, @RequestParam Integer count){
startPage(page,count);
List<UserVideoBuyVo> userVideoCollectionVos =userVideoService.findUserVideoBuyList();
return HealthR.ok(userVideoCollectionVos);
}
//用户删除购买的视频
@DeleteMapping("/deleteVideoBuy/{id}")
public R deleteVideoBuy(@PathVariable Integer id){
userVideoService.deleteVideoBuy(id);
return R.ok();
@DeleteMapping("/deleteVideoBuy/{videoId}")
public HealthR deleteVideoBuy(@PathVariable Integer videoId){
userVideoService.deleteVideoBuy(videoId);
return HealthR.ok();
}
//我的钱包
@GetMapping("/findUserWallet")
public R<List<UserWallet>> findUserWallet(){
List<UserWallet> userWallets = userVideoService.findUserWallet();
return R.ok(userWallets);
public HealthR<List<UserWalletEntity>> findUserWallet(){
List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
return HealthR.ok(userWallets);
}
//用户消费记录
@GetMapping("/findUserConsumptionRecordList")
public HealthR<List<UserConsumptionRecordVo>> findUserConsumptionRecordList(@RequestParam Integer page,@RequestParam Integer count){
startPage(page,count);
List<UserConsumptionRecordVo> userConsumptionRecordVos = userVideoService.findUserConsumptionRecordList();
return HealthR.ok(userConsumptionRecordVos);
}

View File

@ -1,5 +1,6 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.domain.entity.*;
import doctor.service.VideoService;
@ -20,22 +21,22 @@ public class VideoController {
@Autowired
private VideoService videoService;
//收藏健康讲堂视频列表
@PostMapping("/verify/v1/addUserVideoCollection")
public R addUserVideoCollection(@RequestBody UserVideoCollection userVideoCollection){
videoService.addUserVideoCollection(userVideoCollection);
return R.ok();
@PostMapping("/verify/v1/addUserVideoCollection/{videoId}")
public HealthR addUserVideoCollection(@RequestParam Integer videoId){
videoService.addUserVideoCollection(videoId);
return HealthR.ok();
}
//购买健康讲堂视频
@PostMapping("/verify/v1/videoBuy")
public R videoBuy(@RequestBody UserVideoBuy userVideoBuy){
videoService.videoBuy(userVideoBuy);
return R.ok();
}
//视频评论列表
@GetMapping("/v1/findVideoCommentList")
public R<List<VideoComment>> findVideoCommentList(){
List<VideoComment> videoCommentList = videoService.findVideoCommentList();
return R.ok(videoCommentList);
public HealthR videoBuy(@RequestParam Integer videoId, @RequestParam Integer price){
videoService.videoBuy(videoId,price);
return HealthR.ok();
}
// //视频评论列表
// @GetMapping("/v1/findVideoCommentList")
// public R<List<VideoCommentEntity>> findVideoCommentList(){
// List<VideoCommentEntity> videoCommentList = videoService.findVideoCommentList();
// return R.ok(videoCommentList);
// }
}

View File

@ -0,0 +1,17 @@
package doctor.domain.dto;
import lombok.Data;
@Data
public class ApplyJoinDto {
private String email;
private String code;
private String pwd1;
private String pwd2;
private String name;
private String inauguralHospital;
private Integer departmentId;
private Integer jobTitleId;
private String personalProfile;
private String goodFieId;
}

View File

@ -0,0 +1,20 @@
package doctor.domain.entity;
import lombok.Data;
import java.util.Date;
@Data
public class DepartmentEntity {
private Integer id;
private String departmentName;
private String pic;
private Integer rank;
private Date createTime;
}

View File

@ -0,0 +1,18 @@
package doctor.domain.entity;
import lombok.Data;
import java.util.Date;
@Data
public class DoctorJobTitleEntity {
private Integer id;
private String jobTitle;
private Date createTime;
}

View File

@ -1,9 +1,8 @@
package doctor.domain.entity;
import java.security.Timestamp;
import java.util.Date;
public class DoctorUser {
public class DoctorUserEntity {
private int id;
private String phone;

View File

@ -0,0 +1,106 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : InquiryDetailsRecordEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 17:26
*/
public class InquiryDetailsRecordEntity {
private Integer id;
private Integer inquiryId;
private Integer userId;
private Integer friendId;
private String askContent;
private String askImage;
private String voiceChat;
private Integer direction;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date askTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getInquiryId() {
return inquiryId;
}
public void setInquiryId(Integer inquiryId) {
this.inquiryId = inquiryId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getFriendId() {
return friendId;
}
public void setFriendId(Integer friendId) {
this.friendId = friendId;
}
public String getAskContent() {
return askContent;
}
public void setAskContent(String askContent) {
this.askContent = askContent;
}
public String getAskImage() {
return askImage;
}
public void setAskImage(String askImage) {
this.askImage = askImage;
}
public String getVoiceChat() {
return voiceChat;
}
public void setVoiceChat(String voiceChat) {
this.voiceChat = voiceChat;
}
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
public Date getAskTime() {
return askTime;
}
public void setAskTime(Date askTime) {
this.askTime = askTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,75 @@
package doctor.domain.entity;
import java.util.Date;
/**
* @ClassName : SickCircleCommentEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:57
*/
public class SickCircleCommentEntity {
private Integer id;
private Integer sickCircleId;
private Integer userId;
private String content;
private Date commentTime;
private Integer whetherDoctor;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSickCircleId() {
return sickCircleId;
}
public void setSickCircleId(Integer sickCircleId) {
this.sickCircleId = sickCircleId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCommentTime() {
return commentTime;
}
public void setCommentTime(Date commentTime) {
this.commentTime = commentTime;
}
public Integer getWhetherDoctor() {
return whetherDoctor;
}
public void setWhetherDoctor(Integer whetherDoctor) {
this.whetherDoctor = whetherDoctor;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}

View File

@ -1,140 +0,0 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : User
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 20:46
*/
public class User {
private Integer id;
private String phone;
private String pwd;
private String email;
private String nickName;
private String userName;
private String headPic;
private Integer sex;
private Integer age;
private String height;
private String weight;
private String invitationCode;
private Date updateTime;
private Long 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 String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getWeight() {
return weight;
}
public void setWeight(String 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;
}
}

View File

@ -1,16 +1,20 @@
package doctor.domain.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @BelongsProject: Medical_Treatment
* @BelongsPackage: doctor.entity
* @Author: jpz
* @CreateTime: 2024/1/8 20:59
* @ClassName : UserEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 20:46
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserEntity {
private Integer id;
private String phone;
@ -21,121 +25,11 @@ public class UserEntity {
private String headPic;
private Integer sex;
private Integer age;
private Integer height;
private Integer weight;
private String height;
private String weight;
private String invitationCode;
private Date updateTime;
private Date createTime;
private Long 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 Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -1,56 +0,0 @@
package doctor.domain.entity;
/**
* @ClassName : UserVideoBuy
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 15:20
*/
public class UserVideoBuy {
private Integer id;
private Integer userId;
private Integer videoId;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public UserVideoBuy(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id;
this.userId = userId;
this.videoId = videoId;
this.createTime = createTime;
}
public UserVideoBuy() {
}
}

View File

@ -1,62 +0,0 @@
package doctor.domain.entity;
import io.swagger.models.auth.In;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : UserVideoCollection
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 14:28
*/
public class UserVideoCollection {
private Integer id;
private Integer userId;
private Integer videoId;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public UserVideoCollection(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id;
this.userId = userId;
this.videoId = videoId;
this.createTime = createTime;
}
public UserVideoCollection() {
}
}

View File

@ -1,16 +1,12 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : UserWallet
* @ClassName : UserWalletEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 20:30
*/
public class UserWallet {
public class UserWalletEntity {
private Integer id;
private Integer userId;
private Integer balance;

View File

@ -1,110 +0,0 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : Video
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 15:59
*/
public class Video {
private Integer id;
private String title;
private Integer categoryId;
private String shearUrl;
private String abstracts;
private String originalUrl;
private Integer duration;
private Integer price;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getShearUrl() {
return shearUrl;
}
public void setShearUrl(String shearUrl) {
this.shearUrl = shearUrl;
}
public String getAbstracts() {
return abstracts;
}
public void setAbstracts(String abstracts) {
this.abstracts = abstracts;
}
public String getOriginalUrl() {
return originalUrl;
}
public void setOriginalUrl(String originalUrl) {
this.originalUrl = originalUrl;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Long createTime) {
this.id = id;
this.title = title;
this.categoryId = categoryId;
this.shearUrl = shearUrl;
this.abstracts = abstracts;
this.originalUrl = originalUrl;
this.duration = duration;
this.price = price;
this.createTime = createTime;
}
public Video() {
}
}

View File

@ -1,60 +0,0 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : VideoComment
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 21:54
*/
public class VideoComment {
private Integer id;
private Integer userId;
private Integer videoId;
private String content;
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -1,22 +1,58 @@
package doctor.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
/**
* @ClassName : VideoCommentEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 21:54
*/
public class VideoCommentEntity {
private Integer id;
private Integer userId;
private Integer videoId;
private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -1,70 +0,0 @@
package doctor.domain.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : VideoCount
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 16:24
*/
public class VideoCount {
private Integer id;
private Integer videoId;
private Integer buyNum;
private Integer collectionNum;
private Integer commentNum;
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public Integer getBuyNum() {
return buyNum;
}
public void setBuyNum(Integer buyNum) {
this.buyNum = buyNum;
}
public Integer getCollectionNum() {
return collectionNum;
}
public void setCollectionNum(Integer collectionNum) {
this.collectionNum = collectionNum;
}
public Integer getCommentNum() {
return commentNum;
}
public void setCommentNum(Integer commentNum) {
this.commentNum = commentNum;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -1,5 +1,11 @@
package doctor.domain.entity;
/**
* @ClassName : VideoEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 15:59
*/
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -20,7 +26,5 @@ public class VideoEntity {
private String originalUrl;
private Integer duration;
private Integer price;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
private Long createTime;
}

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
package doctor.domain.vo;
import lombok.Data;
@Data
public class FindImagePicVo {
private String imagePic;
}

View File

@ -0,0 +1,100 @@
package doctor.domain.vo;
/**
* @ClassName : InquiryDetailsRecordVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:02
*/
public class InquiryDetailsRecordVo {
private Integer recordId;
private Integer doctorId;
private String imagePic;
private String doctorName;
private String department;
private String jobTitle;
private Integer evaluateStatus;
private String userName;
private String jiGuangPwd;
private Long inquiryTime;
public Integer getRecordId() {
return recordId;
}
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
public Integer getDoctorId() {
return doctorId;
}
public void setDoctorId(Integer doctorId) {
this.doctorId = doctorId;
}
public String getImagePic() {
return imagePic;
}
public void setImagePic(String imagePic) {
this.imagePic = imagePic;
}
public String getDoctorName() {
return doctorName;
}
public void setDoctorName(String doctorName) {
this.doctorName = doctorName;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getJobTitle() {
return jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public Integer getEvaluateStatus() {
return evaluateStatus;
}
public void setEvaluateStatus(Integer evaluateStatus) {
this.evaluateStatus = evaluateStatus;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getJiGuangPwd() {
return jiGuangPwd;
}
public void setJiGuangPwd(String jiGuangPwd) {
this.jiGuangPwd = jiGuangPwd;
}
public Long getInquiryTime() {
return inquiryTime;
}
public void setInquiryTime(Long inquiryTime) {
this.inquiryTime = inquiryTime;
}
}

View File

@ -0,0 +1,11 @@
package doctor.domain.vo;
/**
* @ClassName : UserArchivesVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 18:52
*/
public class UserArchivesVo {
private Integer recordId;
}

View File

@ -0,0 +1,55 @@
package doctor.domain.vo;
/**
* @ClassName : UserConsumptionRecordVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-14 15:30
*/
public class UserConsumptionRecordVo {
private Integer direction;
private Integer type;
private Integer changeNum;
private String remark;
private long createTime;
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getChangeNum() {
return changeNum;
}
public void setChangeNum(Integer changeNum) {
this.changeNum = changeNum;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,64 @@
package doctor.domain.vo;
/**
* @ClassName : UserVideoBuyVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 16:37
*/
public class UserVideoBuyVo {
private Integer id;
private Integer videoId;
private String title;
private String original;
private Integer duration;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getOriginal() {
return original;
}
public void setOriginal(String original) {
this.original = original;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,91 @@
package doctor.domain.vo;
/**
* @ClassName : UserVideoCollectionVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 16:11
*/
public class UserVideoCollectionVo {
private Integer id;
private String title;
private String shearUrl;
private String original;
private Integer price;
private Integer duration;
private Integer whetherBuy;
private Integer buyNum;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getShearUrl() {
return shearUrl;
}
public void setShearUrl(String shearUrl) {
this.shearUrl = shearUrl;
}
public String getOriginal() {
return original;
}
public void setOriginal(String original) {
this.original = original;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getWhetherBuy() {
return whetherBuy;
}
public void setWhetherBuy(Integer whetherBuy) {
this.whetherBuy = whetherBuy;
}
public Integer getBuyNum() {
return buyNum;
}
public void setBuyNum(Integer buyNum) {
this.buyNum = buyNum;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}

View File

@ -3,10 +3,10 @@ package doctor.mapper;
import doctor.system.api.domain.Department;
import doctor.system.api.domain.Doctor;
import doctor.system.api.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.mybatis.spring.annotation.MapperScan;
@MapperScan
@Mapper
public interface DoctorUserMapper {
User selectUserByEmail(@Param("email") String email);

View File

@ -0,0 +1,12 @@
package doctor.mapper;
import doctor.domain.entity.DepartmentEntity;
import org.mybatis.spring.annotation.MapperScan;
import java.util.List;
@MapperScan
public interface HealthDepartmentMapper {
List<DepartmentEntity> findDepartments();
}

View File

@ -0,0 +1,26 @@
package doctor.mapper;
import doctor.domain.entity.DoctorJobTitleEntity;
import doctor.system.api.domain.Department;
import doctor.system.api.domain.Doctor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface HealthJobTitleMapper {
List<DoctorJobTitleEntity> findJobTitleList();
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);
}

View File

@ -0,0 +1,17 @@
package doctor.mapper;
import doctor.domain.entity.InquiryDetailsRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ClassName : InquiryMapper
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:18
*/
@Mapper
public interface InquiryMapper {
List<InquiryDetailsRecordEntity> findHistoryInquiryRecord();
}

View File

@ -1,8 +1,9 @@
package doctor.mapper;
import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.domain.entity.UserConsumptionRecordEntity;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -16,13 +17,15 @@ import java.util.List;
*/
@Mapper
public interface UserVideoMapper {
List<UserVideoCollection> findVideoCollectionList();
List<UserVideoCollectionEntity> findVideoCollectionList();
void cancelVideoCollection(@Param("id") Integer id);
void cancelVideoCollection(@Param("videoId") Integer videoId);
List<UserVideoBuy> findUserVideoBuyList();
List<UserVideoBuyEntity> findUserVideoBuyList();
void deleteVideoBuy(@Param("id") Integer id);
void deleteVideoBuy(@Param("videoId") Integer videoId);
List<UserWallet> findUserWallet();
List<UserWalletEntity> findUserWallet();
List<UserConsumptionRecordEntity> findUserConsumptionRecordList();
}

View File

@ -16,24 +16,23 @@ import java.util.List;
public interface VideoMapper {
void addUserVideoCollection(UserVideoCollection userVideoCollection);
void addUserVideoCollection(@Param("userId") Integer userId, @Param("videoId") Integer videoId);
Video findById(@Param("videoId") Integer videoId);
VideoEntity findById(@Param("videoId") Integer videoId);
VideoCount FindVideoId(@Param("id") Integer id);
VideoCountEntity FindVideoId(@Param("id") Integer id);
void updateVideoCount(VideoCount videoCount);
void updateVideoCount(VideoCountEntity videoCount);
User FindById(@Param("userId") Integer userId);
UserEntity FindById(@Param("userId") Integer userId);
UserWallet FindUserWallet(@Param("id") Integer id);
UserWalletEntity FindUserWallet(@Param("id") Integer id);
Video findByVideoId(@Param("videoId") Integer videoId);
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
List<VideoComment> findVideoCommentList();
// UserWallet FindById(@Param("userId") Integer userId);
// UserWalletEntity FindById(@Param("userId") Integer userId);
}

View File

@ -0,0 +1,10 @@
package doctor.service;
import doctor.domain.entity.DepartmentEntity;
import java.util.List;
public interface HealthDepartmentService {
List<DepartmentEntity> findDepartment();
}

View File

@ -0,0 +1,25 @@
package doctor.service;
import doctor.common.core.domain.HealthR;
import doctor.domain.dto.ApplyJoinDto;
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;
public interface HealthJobTitleService {
List<DoctorJobTitleEntity> findJobTitleList();
HealthR sendEmailCode(String email);
HealthR applyJoin(ApplyJoinDto applyJoinDto);
DoctorVo findDoctorById(Integer doctorId);
List<FindImagePicVo> findSystemImagePic();
HealthR uploadImagePic(MultipartFile imagePic, Integer doctorId, String sessionId);
}

View File

@ -0,0 +1,15 @@
package doctor.service;
import doctor.domain.vo.InquiryDetailsRecordVo;
import java.util.List;
/**
* @ClassName : InquiryService
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:18
*/
public interface InquiryService {
List<InquiryDetailsRecordVo> findHistoryInquiryRecord();
}

View File

@ -1,8 +1,11 @@
package doctor.service;
import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import java.util.List;
@ -13,13 +16,19 @@ import java.util.List;
* @Date: 2024-01-10 14:33
*/
public interface UserVideoService {
List<UserVideoCollection> findVideoCollectionList();
void cancelVideoCollection(Integer id);
List<UserVideoBuy> findUserVideoBuyList();
void deleteVideoBuy(Integer id);
List<UserWallet> findUserWallet();
List<UserVideoBuyVo> findUserVideoBuyList();
void deleteVideoBuy(Integer videoId);
List<UserWalletEntity> findUserWallet();
List<UserVideoCollectionVo> findVideoCollectionList();
void cancelVideoCollection(Integer userId, String sessionId, Integer videoId);
List<UserConsumptionRecordVo> findUserConsumptionRecordList();
}

View File

@ -12,10 +12,10 @@ import java.util.List;
*/
public interface VideoService {
void addUserVideoCollection(UserVideoCollection userVideoCollection);
void addUserVideoCollection(Integer videoId);
void videoBuy(UserVideoBuy userVideoBuy);
void videoBuy(Integer videoId,Integer price);
List<VideoComment> findVideoCommentList();
}

View File

@ -26,4 +26,5 @@ public class DoctorUserServiceImpl implements DoctorUserService {
doctor.setDepartment(department);
return doctor;
}
}

View File

@ -0,0 +1,20 @@
package doctor.service.impl;
import doctor.domain.entity.DepartmentEntity;
import doctor.mapper.HealthDepartmentMapper;
import doctor.service.HealthDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class HealthDepartmentServiceImpl implements HealthDepartmentService {
@Autowired
private HealthDepartmentMapper healthV1Mapper;
@Override
public List<DepartmentEntity> findDepartment() {
return healthV1Mapper.findDepartments();
}
}

View File

@ -0,0 +1,133 @@
package doctor.service.impl;
import doctor.common.core.domain.HealthR;
import doctor.common.security.service.TokenService;
import doctor.domain.dto.ApplyJoinDto;
import doctor.domain.entity.DoctorJobTitleEntity;
import doctor.domain.vo.DoctorVo;
import doctor.domain.vo.FindImagePicVo;
import doctor.mapper.HealthJobTitleMapper;
import doctor.service.HealthJobTitleService;
import doctor.system.api.domain.Department;
import doctor.system.api.domain.Doctor;
import doctor.system.api.model.LoginUser;
import doctor.util.OssUtil;
import doctor.util.RSAUtils;
import doctor.util.RsaKey;
import doctor.util.SendEmail;
import org.bouncycastle.jcajce.provider.asymmetric.rsa.RSAUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
@Service
public class HealthJobTitleServiceImpl implements HealthJobTitleService {
@Autowired
private HealthJobTitleMapper healthJobTitleMapper;
@Autowired
private SendEmail sendEmail;
@Autowired
private TokenService tokenService;
@Resource
private RedisTemplate<String,Integer> redisTemplate;
@Override
public List<DoctorJobTitleEntity> findJobTitleList() {
return healthJobTitleMapper.findJobTitleList();
}
@Override
public HealthR sendEmailCode(String email) {
if (!redisTemplate.hasKey(email)){
Integer integer = redisTemplate.opsForValue().get(email);
sendEmail.sendEmail(email,integer);
}
if (email==null){
return HealthR.fail();
}
Integer code=0;
Random random = new Random();
for (int i = 0; i < 4; i++) {
int i1 = random.nextInt();
code=i+=i1;
}
sendEmail.sendEmail(email,code);
redisTemplate.opsForValue().set(email,code,2, TimeUnit.MINUTES);
return HealthR.ok();
}
@Override
public HealthR applyJoin(ApplyJoinDto applyJoinDto) {
if (applyJoinDto==null){
return HealthR.fail("参数为空");
}
String s="";
try {
s= RSAUtils.rsaDecrypt(applyJoinDto.getPwd1(), RsaKey.PRIVATE_KEY);
String s2 = RSAUtils.rsaDecrypt(applyJoinDto.getPwd2(), RsaKey.PRIVATE_KEY);
if (!s.equals(s2)){
return HealthR.fail("请输入相同的密码");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
if (!redisTemplate.hasKey(applyJoinDto.getEmail())){
return HealthR.fail("验证码过去请重新发送");
}
Integer integer = redisTemplate.opsForValue().get(applyJoinDto.getEmail());
if (!String.valueOf(integer).equals(applyJoinDto.getCode())){
return HealthR.fail("验车码错误");
}
Doctor doctor = new Doctor();
BeanUtils.copyProperties(applyJoinDto,doctor);
doctor.setCreateTime(new Date());
Integer jobTitleId = applyJoinDto.getJobTitleId();
DoctorJobTitleEntity doctorJobTitleEntity=healthJobTitleMapper.findDoctorJobTitleById(jobTitleId);
doctor.setJobTitle(doctorJobTitleEntity.getJobTitle());
healthJobTitleMapper.insertDoctor(doctor);
redisTemplate.delete(applyJoinDto.getEmail());
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);
}
}

View File

@ -0,0 +1,29 @@
package doctor.service.impl;
import doctor.domain.entity.InquiryDetailsRecordEntity;
import doctor.domain.vo.InquiryDetailsRecordVo;
import doctor.mapper.InquiryMapper;
import doctor.service.InquiryService;
import doctor.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName : InquiryServiceImpl
* @Description :
* @Author : FJJ
* @Date: 2024-01-12 19:19
*/
@Service
public class InquiryServiceImpl implements InquiryService {
@Autowired
private InquiryMapper inquiryMapper;
@Override
public List<InquiryDetailsRecordVo> findHistoryInquiryRecord() {
List<InquiryDetailsRecordEntity> inquiryDetailsRecordEntity = inquiryMapper.findHistoryInquiryRecord();
List<InquiryDetailsRecordVo> inquiryDetailsRecordVos = ConvertUtil.entityToVoList(inquiryDetailsRecordEntity, InquiryDetailsRecordVo.class);
return inquiryDetailsRecordVos;
}
}

View File

@ -1,10 +1,15 @@
package doctor.service.impl;
import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.domain.entity.UserConsumptionRecordEntity;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.mapper.UserVideoMapper;
import doctor.service.UserVideoService;
import doctor.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,28 +25,44 @@ import java.util.List;
public class UserVideoServiceImpl implements UserVideoService {
@Autowired
private UserVideoMapper userVideoMapper;
@Override
public List<UserVideoCollection> findVideoCollectionList() {
return userVideoMapper.findVideoCollectionList();
public List<UserVideoCollectionVo> findVideoCollectionList() {
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList();
List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class);
return userVideoCollectionVoList;
}
@Override
public void cancelVideoCollection(Integer id) {
userVideoMapper.cancelVideoCollection(id);
public void cancelVideoCollection(Integer userId, String sessionId, Integer videoId) {
userVideoMapper.cancelVideoCollection(videoId);
}
@Override
public List<UserVideoBuy> findUserVideoBuyList() {
return userVideoMapper.findUserVideoBuyList();
public List<UserConsumptionRecordVo> findUserConsumptionRecordList() {
List<UserConsumptionRecordEntity> userConsumptionRecordEntityList=userVideoMapper.findUserConsumptionRecordList();
List<UserConsumptionRecordVo> userConsumptionRecordVoList = ConvertUtil.entityToVoList(userConsumptionRecordEntityList, UserConsumptionRecordVo.class);
return userConsumptionRecordVoList;
}
@Override
public List<UserVideoBuyVo> findUserVideoBuyList() {
List<UserVideoBuyEntity> userVideoCollectionEntityList=userVideoMapper.findUserVideoBuyList();
List<UserVideoBuyVo> userVideoBuyList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoBuyVo.class);
return userVideoBuyList;
}
@Override
public void deleteVideoBuy(Integer id) {
userVideoMapper.deleteVideoBuy(id);
public void deleteVideoBuy(Integer videoId) {
userVideoMapper.deleteVideoBuy(videoId);
}
@Override
public List<UserWallet> findUserWallet() {
public List<UserWalletEntity> findUserWallet() {
return userVideoMapper.findUserWallet();
}
}

View File

@ -1,11 +1,13 @@
package doctor.service.impl;
import doctor.common.core.utils.JwtUtils;
import doctor.domain.entity.*;
import doctor.mapper.VideoMapper;
import doctor.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@ -18,39 +20,38 @@ import java.util.List;
public class VideoServiceImpl implements VideoService {
@Autowired
private VideoMapper videoMapper;
@Autowired
private HttpServletRequest request;
@Override
public void addUserVideoCollection(UserVideoCollection userVideoCollection) {
public void addUserVideoCollection(Integer videoId) {
//获取用户id
String token = request.getHeader("token");
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
// 添加收藏
videoMapper.addUserVideoCollection(userVideoCollection);
videoMapper.addUserVideoCollection(userId,videoId);
// 更新视频收藏数
Video video = videoMapper.findById(userVideoCollection.getVideoId());
VideoCount videoCount = videoMapper.FindVideoId(video.getId());
VideoEntity video = videoMapper.findById(videoId);
VideoCountEntity videoCount = videoMapper.FindVideoId(video.getId());
videoMapper.updateVideoCount(videoCount);
}
@Override
public void videoBuy(UserVideoBuy userVideoBuy) {
public void videoBuy(Integer videoId,Integer price) {
//获取用户id
String token = request.getHeader("token");
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
//查询用户信息
User user = videoMapper.FindById(userVideoBuy.getUserId());
//查询视频信息
Video video = videoMapper.findByVideoId(userVideoBuy.getVideoId());
UserEntity user = videoMapper.FindById(userId);
//查询用户钱包
UserWallet userWallet = videoMapper.FindUserWallet(user.getId());
UserWalletEntity userWallet = videoMapper.FindUserWallet(user.getId());
//判断用户钱包是否足够
if (userWallet.getBalance() >= video.getPrice()) {
if (userWallet.getBalance() >= price) {
//更新用户钱包
int newblance=userWallet.getBalance() - video.getPrice();
int newblance = userWallet.getBalance() -price;
//更新用户钱包
videoMapper.updateUserWallet(newblance,userWallet.getId());
videoMapper.updateUserWallet(newblance, userWallet.getId());
}
}
}
@Override
public List<VideoComment> findVideoCommentList() {
return videoMapper.findVideoCommentList();
}
}

View File

@ -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 AccessKeyaccessKeySecretAPI访 访
*/
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;
}
/**
* 使FilePutObject ** 使
* @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;
}
}

View File

@ -0,0 +1,133 @@
package doctor.util;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;
/**
* RSA
* @author : WangZhanpeng
* @date : 2024/1/9 15:13
*/
public class RSAUtils {
private static Map<Integer, String> keyMap = new HashMap<Integer, String>();
public static void getKey() throws NoSuchAlgorithmException {
genKeyPair();
System.out.println("公钥===:"+keyMap.get(0));
System.out.println("私钥===:"+keyMap.get(1));
}
/**
*
*
* @throws NoSuchAlgorithmException
*/
public static void genKeyPair() throws NoSuchAlgorithmException {
// KeyPairGenerator类用于生成公钥和私钥对基于RSA算法生成对象
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
// 初始化密钥对生成器密钥大小为96-1024位
keyPairGen.initialize(1024, new SecureRandom());
// 生成一个密钥对保存在keyPair中
KeyPair keyPair = keyPairGen.generateKeyPair();
// 得到私钥
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
// 得到公钥
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded()));
// 得到私钥字符串
String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded())));
// 将公钥和私钥保存到Map
//0表示公钥
keyMap.put(0, publicKeyString);
//1表示私钥
keyMap.put(1, privateKeyString);
}
/**
* RSA
* @param str
* @param privateKey
* @return
*/
public static String rsaDecrypt(String str, String privateKey) throws Exception {
//base64编码的私钥
byte[] decoded = Base64.decodeBase64(privateKey);
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
//RSA解密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, priKey);
byte[] inputArray = Base64.decodeBase64(str.getBytes("UTF-8"));
int inputLength = inputArray.length;
// 最大加密字节数,超出最大字节数需要分组加密
int MAX_ENCRYPT_BLOCK = 128;
// 标识
int offSet = 0;
byte[] resultBytes = {};
byte[] cache;
while (inputLength - offSet > 0) {
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
offSet += MAX_ENCRYPT_BLOCK;
} else {
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
offSet = inputLength;
}
resultBytes = Arrays.copyOf(resultBytes, resultBytes.length + cache.length);
System.arraycopy(cache, 0, resultBytes, resultBytes.length - cache.length, cache.length);
}
String outStr = new String(resultBytes);
return outStr;
}
/**
* RSA
* @param input
* @param rsaPublicKey
* @return
* @throws Exception
*/
public static List<String> rsaEncrypt(String input, String rsaPublicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
String result = "";
// 将Base64编码后的公钥转换成PublicKey对象
byte[] buffer = Base64.decodeBase64(rsaPublicKey);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
PublicKey publicKey = keyFactory.generatePublic(keySpec);
// 加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] inputArray = input.getBytes();
int inputLength = inputArray.length;
System.out.println("加密字节数:" + inputLength);
// 最大加密字节数,超出最大字节数需要分组加密
int MAX_ENCRYPT_BLOCK = 117;
// 标识
int offSet = 0;
List<String> results=new ArrayList<>();
byte[] cache;
while (inputLength - offSet > 0) {
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
offSet += MAX_ENCRYPT_BLOCK;
} else {
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
offSet = inputLength;
}
results.add(Base64.encodeBase64String(cache));
}
return results;
}
}

View File

@ -0,0 +1,20 @@
package doctor.util;
/**
* RSA
* @author : WangZhanpeng
* @date : 2024/1/9 15:49
*/
public class RsaKey {
/**
*
*/
public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7xkwklONlHn8TGmTH6yyvv7Bv9AcxXgpkAhuPxpOCVHgkpGGJUJVc8JCMOAhmqI4zdJRqTJa1aOk1glcOaOWja28o6lqNzxn3X3fqdkcWoF/L9Znw1MSDK7oFeSsHqubc9wA2GKb4EFt2TWuaFB+dWfPUhFeJ1GoZhpjjgZLO9QIDAQAB";
/**
*
*/
public static final String PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALvGTCSU42UefxMaZMfrLK+/sG/0BzFeCmQCG4/Gk4JUeCSkYYlQlVzwkIw4CGaojjN0lGpMlrVo6TWCVw5o5aNrbyjqWo3PGfdfd+p2RxagX8v1mfDUxIMrugV5Kweq5tz3ADYYpvgQW3ZNa5oUH51Z89SEV4nUahmGmOOBks71AgMBAAECgYAQNJTts0vMtk0RQP3hoxJAOLLpdo4IXK1Y5DWsut6QKOoVf3pLd4DsfHZ9I3jWI0XievU0F1gKX/uAerc4ryTiR6dxHRyKQxhAamLCFqAgTd6GQf6nl7LlKJkHOKZ1/Un0l245zSLoUzNYxzLZhXfOX8lMNfnXpznfZV43nJJMIQJBAPEeKpEzK8/lEJCszBCXgAH75Qcwu+J/LjZFXChsEqx0ubbhg9orgwg+z5Z2uLXVbeScTkBIi+yY6Jd5RUbyhTsCQQDHXUUcylpo0vo9z/xMPTcd5m5UqTm6ZVacdnrkOQtGJJCKOLYTLhWGUPmE0s+cgn9/24H0H8FjOM/ta8tdTPmPAkEAyV5lNICk7WojzH/TqWOtb3q8yqWDtGR85qxEjCm96rNNSpPKt1ExjJhQbBvYpVuK/KshmwQ7f6wwTBjmp5rxcwJAVbJPAggtgr+l16ourmrl5VFm/bdcXDYxW8JGIxIuOXGAPBoSkf4OPJVUHHctzP3/Zmtp2hFIZKlIH6tlWG69GwJAUcnD0XMH8+h9mYUFdwgD0JtaEbeY3ofkO+RymFdcYO//ZjwnVWyGRIhi/lJ5URPiiDzt2MmX5G2a0NJPwP60Lg==";
}

View File

@ -0,0 +1,26 @@
package doctor.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import javax.mail.internet.MimeMessage;
@Component
public class SendEmail {
@Autowired
private JavaMailSender javaMailSender;
public void sendEmail(String email,Integer code){
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
mimeMessageHelper.setTo(email);
mimeMessageHelper.setFrom("3581044601@qq.com");
mimeMessageHelper.setSubject("发送验证码");
mimeMessageHelper.setText("验证码为:"+code);
javaMailSender.send(mimeMessage);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.HealthDepartmentMapper">
<select id="findDepartments" resultType="doctor.domain.entity.DepartmentEntity">
select * from department
</select>
</mapper>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.HealthJobTitleMapper">
<insert id="insertDoctor">
INSERT INTO doctor (id, department_id, email, user_name, review_status, phone, pwd, name, image_pic, job_title, inaugural_hospital, personal_profile, good_field, create_time)
VALUES (0,#{departmentId},#{email},#{userName},#{reviewStatus},#{phone},#{pwd},#{name},#{imagePic},#{jobTitle},#{inauguralHospital},#{personalProfile},#{goodField},#{createTime});
</insert>
<update id="updDoctorImgPicBuyId">
update doctor set image_pic=#{s} where id=#{doctorId}
</update>
<select id="findJobTitleList" resultType="doctor.domain.entity.DoctorJobTitleEntity">
select * from doctor_job_title
</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>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.InquiryMapper">
<select id="findHistoryInquiryRecord" resultType="doctor.domain.entity.InquiryDetailsRecordEntity">
select *
from inquiry_details_record
</select>
</mapper>

View File

@ -6,23 +6,27 @@
<delete id="cancelVideoCollection">
delete
from user_video_collection
where id = #{id}
where video_id = #{videoId}
</delete>
<delete id="deleteVideoBuy">
delete
from user_video_buy
where id = #{id}
where video_id = #{videoId}
</delete>
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection">
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
select *
from user_video_collection
</select>
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuy">
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
select *
from user_video_buy
</select>
<select id="findUserWallet" resultType="doctor.domain.entity.UserWallet">
<select id="findUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
select *
from user_wallet
</select>
<select id="findUserConsumptionRecordList" resultType="doctor.domain.entity.UserConsumptionRecordEntity">
select *
from user_consumption_record
</select>
</mapper>

View File

@ -24,38 +24,29 @@
where id=#{id}
</update>
<select id="findById" resultType="doctor.domain.entity.Video">
<select id="findById" resultType="doctor.domain.entity.VideoEntity">
SELECT user_video_collection.*
FROM user_video_collection
LEFT JOIN video ON user_video_collection.video_id = video.id
WHERE video.id = #{videoId}
</select>
<select id="FindVideoId" resultType="doctor.domain.entity.VideoCount">
<select id="FindVideoId" resultType="doctor.domain.entity.VideoCountEntity">
select *
from video_count
where id = #{id}
</select>
<select id="FindById" resultType="doctor.domain.entity.User">
<select id="FindById" resultType="doctor.domain.entity.UserEntity">
SELECT user.*
FROM user_video_buy
LEFT JOIN user ON user.id = user_video_buy.user_id
WHERE user_video_buy.user_id = #{userId}
</select>
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWallet">
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
SELECT user.*
FROM user_wallet
LEFT JOIN user ON user.id = user_wallet.user_id
WHERE user_wallet.user_id==#{id}
</select>
<select id="findByVideoId" resultType="doctor.domain.entity.Video">
SELECT user_video_buy.*
FROM user_video_buy
LEFT JOIN video ON video.id = user_video_buy.video_id
WHERE video.video.id = #{videoId}
</select>
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoComment">
select *
from video_comment
</select>
</mapper>