完善用户信息3

zmy
fjj 2024-01-19 21:33:30 +08:00
parent 2fb6724844
commit c33fc3ae52
13 changed files with 175 additions and 14 deletions

View File

@ -12,6 +12,11 @@
<artifactId>doctor-health</artifactId>
<properties>
<lombok.version>1.18.12</lombok.version>
<mapstruct.version>1.4.2.Final</mapstruct.version>
</properties>
<dependencies>
@ -97,6 +102,22 @@
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</dependency>
</dependencies>

View File

@ -1,13 +1,12 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.vo.DoctorVo;
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 org.springframework.boot.actuate.health.Health;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -20,16 +19,59 @@ import static com.github.pagehelper.page.PageMethod.startPage;
* @Date: 2024-01-12 19:09
*/
@RestController
@RequestMapping("/user/inquiry/verify/v1")
@RequestMapping("/user/inquiry")
public class InquiryController {
@Autowired
private InquiryService inquiryService;
//历史问诊记录列表
@GetMapping("/findHistoryInquiryRecord")
@GetMapping("/verify/v1/findHistoryInquiryRecord")
public HealthR<List<InquiryDetailsRecordVo>> findHistoryInquiryRecord(@RequestParam Integer page,@RequestParam Integer count){
startPage(page,count);
List<InquiryDetailsRecordVo> inquiryDetailsRecordVoList = inquiryService.findHistoryInquiryRecord();
return HealthR.ok(inquiryDetailsRecordVoList);
}
@GetMapping("/v1/findDoctorInfo")
public HealthR<DoctorVo> findDoctorInfo(@RequestHeader Integer userId,
@RequestHeader String sessionId,
@RequestParam Integer doctorId) {
DoctorVo doctorVo = inquiryService.findDoctorInfo(doctorId);
return HealthR.ok(doctorVo);
}
//咨询医生
@PutMapping("/verify/v1/consultDoctor")
public HealthR consultDoctor(@RequestHeader Integer userId,
@RequestHeader String sessionId,
@RequestParam Integer doctorId){
String doctorUserName = inquiryService.consultDoctor(userId,doctorId);
return HealthR.ok(doctorUserName);
}
//关注医生
@PostMapping("/verify/v1/followDoctor")
public HealthR followDoctor(@RequestHeader Integer userId,
@RequestHeader String sessionId,
@RequestParam Integer doctorId) {
inquiryService.followDoctor(userId,doctorId);
return HealthR.ok();
}
//取消关注医生
@DeleteMapping("/verify/v1/cancelFollow")
public HealthR cancelFollow(@RequestHeader Integer userId,
@RequestHeader String sessionId,
@RequestParam Integer doctorId){
inquiryService.cancelFollow(userId,doctorId);
return HealthR.ok();
}
//结束问诊
@PutMapping("/verify/v1/endInquiry")
public HealthR endInquiry(@RequestHeader Integer userId,
@RequestHeader String sessionId,
@RequestParam Integer recordId) {
inquiryService.endInquiry(userId,recordId);
return HealthR.ok();
}
}

View File

@ -55,8 +55,8 @@ public class UserVideoController {
//我的钱包
@GetMapping("/findUserWallet")
public HealthR<List<UserWalletEntity>> findUserWallet(){
List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
public HealthR<List<UserWalletEntity>> findUserWallet(@RequestHeader Integer userId){
List<UserWalletEntity> userWallets = userVideoService.findUserWallet(userId);
return HealthR.ok(userWallets);
}
//用户消费记录

View File

@ -0,0 +1,22 @@
package doctor.convert;
import doctor.domain.entity.VideoEntity;
import doctor.domain.vo.VideoVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.w3c.dom.stylesheets.LinkStyle;
import java.util.List;
@Mapper
public interface VideoConvert {
VideoConvert INSTANCE = Mappers.getMapper(VideoConvert.class);
VideoVo videoEntityToVideoVo(VideoEntity videoEntity);
VideoEntity videoVoToVideoEntity(VideoVo videoVo);
List<VideoEntity> videoVoListToVideoEntityList(List<VideoVo> videoVoList);
List<VideoVo> videoEntityListToVideoVoList(List<VideoEntity> videoEntityList);
}

View File

@ -2,6 +2,7 @@ package doctor.mapper;
import doctor.domain.entity.InquiryDetailsRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -14,4 +15,8 @@ import java.util.List;
@Mapper
public interface InquiryMapper {
List<InquiryDetailsRecordEntity> findHistoryInquiryRecord();
void consultDoctor(@Param("userId") Integer userId, @Param("doctorId") Integer doctorId);
String findDoctorUserNameByDoctorId(@Param("doctorId") Integer doctorId);
}

View File

@ -5,6 +5,7 @@ import doctor.domain.dto.UserTaskRecordDto;
import doctor.domain.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@ -24,7 +25,7 @@ public interface UserVideoMapper {
void deleteVideoBuy(@Param("videoId") Integer videoId);
List<UserWalletEntity> findUserWallet();
List<UserWalletEntity> findUserWallet(Integer userId);
List<UserConsumptionRecordEntity> findUserConsumptionRecordList();

View File

@ -1,5 +1,6 @@
package doctor.service;
import doctor.domain.vo.DoctorVo;
import doctor.domain.vo.InquiryDetailsRecordVo;
import java.util.List;
@ -12,4 +13,14 @@ import java.util.List;
*/
public interface InquiryService {
List<InquiryDetailsRecordVo> findHistoryInquiryRecord();
DoctorVo findDoctorInfo(Integer doctorId);
String consultDoctor(Integer userId, Integer doctorId);
void followDoctor(Integer userId, Integer doctorId);
void cancelFollow(Integer userId, Integer doctorId);
void endInquiry(Integer userId, Integer recordId);
}

View File

@ -3,6 +3,7 @@ package doctor.service;
import doctor.domain.dto.UserArchivesDto;
import doctor.domain.entity.*;
import doctor.domain.vo.*;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@ -21,7 +22,7 @@ public interface UserVideoService {
void deleteVideoBuy(Integer videoId);
List<UserWalletEntity> findUserWallet();
List<UserWalletEntity> findUserWallet(Integer userId);
List<UserVideoCollectionVo> findVideoCollectionList(Integer userId);

View File

@ -3,6 +3,7 @@ package doctor.service.impl;
import doctor.common.security.service.TokenService;
import doctor.common.security.utils.SecurityUtils;
import doctor.convert.VideoConvert;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.VideoCategoryEntity;
@ -37,7 +38,7 @@ public class HealthUserVideoServiceImpl implements HealthUserVideoService {
@Override
public List<VideoVo> findVideoVoList(Integer categoryId, Integer userId) {
List<VideoEntity> videoVoList = healthUserVideoMapper.findVideoVoList(categoryId);
List<VideoVo> videoVos = ConvertUtil.entityToVoList(videoVoList, VideoVo.class);
List<VideoVo> videoVos = VideoConvert.INSTANCE.videoEntityListToVideoVoList(videoVoList);
videoVos.forEach(video -> {
UserVideoCollectionEntity userVideoCollection = healthUserVideoMapper.selectWhetherCollectionByUserIdAndVideoId(userId,video.getId());
if(userVideoCollection!=null){

View File

@ -1,10 +1,13 @@
package doctor.service.impl;
import doctor.domain.entity.InquiryDetailsRecordEntity;
import doctor.domain.vo.DoctorVo;
import doctor.domain.vo.InquiryDetailsRecordVo;
import doctor.mapper.InquiryMapper;
import doctor.service.InquiryService;
import doctor.util.ConvertUtil;
import doctor.util.RSAUtils;
import doctor.util.RsaKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,4 +29,37 @@ public class InquiryServiceImpl implements InquiryService {
List<InquiryDetailsRecordVo> inquiryDetailsRecordVos = ConvertUtil.entityToVoList(inquiryDetailsRecordEntity, InquiryDetailsRecordVo.class);
return inquiryDetailsRecordVos;
}
@Override
public DoctorVo findDoctorInfo(Integer doctorId) {
return null;
}
@Override
public String consultDoctor(Integer userId, Integer doctorId) {
inquiryMapper.consultDoctor(userId,doctorId);
String doctorUserName = inquiryMapper.findDoctorUserNameByDoctorId(doctorId);
try {
String s = RSAUtils.rsaDecrypt(doctorUserName, RsaKey.PUBLIC_KEY);
return s;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void followDoctor(Integer userId, Integer doctorId) {
}
@Override
public void cancelFollow(Integer userId, Integer doctorId) {
}
@Override
public void endInquiry(Integer userId, Integer recordId) {
}
}

View File

@ -9,6 +9,7 @@ import doctor.service.UserVideoService;
import doctor.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@ -141,8 +142,8 @@ public class UserVideoServiceImpl implements UserVideoService {
}
@Override
public List<UserWalletEntity> findUserWallet() {
return userVideoMapper.findUserWallet();
public List<UserWalletEntity> findUserWallet(Integer userId) {
return userVideoMapper.findUserWallet(userId);
}

View File

@ -3,10 +3,30 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.InquiryMapper">
<insert id="consultDoctor">
insert into inquiry_record(
user_id,
doctor_id,
status,
show_status,
inquiry_time,
create_time
)values (
#{userId},
#{doctorId},
1,
1,
now(),
now()
)
</insert>
<select id="findHistoryInquiryRecord" resultType="doctor.domain.entity.InquiryDetailsRecordEntity">
select *
from inquiry_details_record
</select>
<select id="findDoctorUserNameByDoctorId" resultType="java.lang.String">
select user_name from doctor where doctor_id=#{doctorId}
</select>
</mapper>

View File

@ -88,7 +88,7 @@ weight = #{weight}
</select>
<select id="findUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
select *
from user_wallet
from user_wallet where user_id=#{userId}
</select>
<select id="findUserConsumptionRecordList" resultType="doctor.domain.entity.UserConsumptionRecordEntity">
select *