修改了搜索、修改了dockerfile
This commit is contained in:
parent
0acfe1a06e
commit
1a8c64757d
16
Dockerfile
16
Dockerfile
@ -3,6 +3,22 @@ FROM maven:3.9.2-eclipse-temurin-17-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 添加国内 Maven 镜像源
|
||||
RUN mkdir -p /root/.m2 && \
|
||||
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" \
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 \
|
||||
https://maven.apache.org/xsd/settings-1.0.0.xsd"> \
|
||||
<mirrors> \
|
||||
<mirror> \
|
||||
<id>aliyun</id> \
|
||||
<mirrorOf>*</mirrorOf> \
|
||||
<name>aliyun maven</name> \
|
||||
<url>https://maven.aliyun.com/repository/public</url> \
|
||||
</mirror> \
|
||||
</mirrors> \
|
||||
</settings>' > /root/.m2/settings.xml
|
||||
|
||||
# 将 pom.xml 和 src 目录复制到容器
|
||||
COPY pom.xml .
|
||||
COPY src ./src
|
||||
|
||||
@ -14,9 +14,10 @@ import com.example.caseData.dto.caseClinicalVideoAuthor.CaseClinicalVideoAuthorD
|
||||
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.*;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalArticleSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalDoctorSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalHospitalSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalVideoSearchPage;
|
||||
import com.example.caseData.service.CaseClinicalArticleService;
|
||||
import com.example.caseData.service.CaseClinicalVideoService;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -71,12 +72,12 @@ public class ClinicalController extends BaseController {
|
||||
private CaseClinicalVideoService caseClinicalVideoService;
|
||||
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* 临床病例库-搜索-文章
|
||||
*/
|
||||
@PostMapping("/clinical/search")
|
||||
public Response<Map<String, Object>> getClinicalSearchPage(
|
||||
@PostMapping("/clinical/article/search")
|
||||
public Response<Map<String, Object>> getClinicalArticleSearchPage(
|
||||
@Validated()
|
||||
@RequestBody getClinicalSearchPage request
|
||||
@RequestBody getClinicalArticleSearchPage request
|
||||
) {
|
||||
String userId = (String) httpServletRequest.getAttribute("userId");
|
||||
|
||||
@ -84,88 +85,101 @@ public class ClinicalController extends BaseController {
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
if (request.getType() == 1){
|
||||
Page<CaseClinicalArticleDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
Page<CaseClinicalArticleDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取文章数据
|
||||
IPage<CaseClinicalArticleDto> resultPage = caseClinicalArticleDao.getCaseClinicalArticleSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
request.handleOrder()
|
||||
);
|
||||
// 获取文章数据
|
||||
IPage<CaseClinicalArticleDto> resultPage = caseClinicalArticleDao.getCaseClinicalArticleSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (CaseClinicalArticleDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, dto.getArticleId());
|
||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
List<CaseClinicalArticleAuthorDto> caseClinicalArticleAuthorListDto = CaseClinicalArticleAuthorDto.GetListDto(caseClinicalArticleAuthors);
|
||||
dto.setAuthor(caseClinicalArticleAuthorListDto);
|
||||
|
||||
// 获取用户收藏状态
|
||||
if (userId != null) {
|
||||
// 检测用户是否已收藏过
|
||||
UserCollectClinicalArticleModel userCollectClinicalArticle = caseClinicalArticleService.getUserCollectClinicalArticleStatus(dto.getArticleId(),userId);
|
||||
if (userCollectClinicalArticle != null) {
|
||||
dto.setCollect(true);
|
||||
}
|
||||
}
|
||||
for (CaseClinicalArticleDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, dto.getArticleId());
|
||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
} else if (request.getType() == 2) {
|
||||
Page<CaseClinicalVideoDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
List<CaseClinicalArticleAuthorDto> caseClinicalArticleAuthorListDto = CaseClinicalArticleAuthorDto.GetListDto(caseClinicalArticleAuthors);
|
||||
dto.setAuthor(caseClinicalArticleAuthorListDto);
|
||||
|
||||
// 获取视频数据
|
||||
IPage<CaseClinicalVideoDto> resultPage = caseClinicalVideoDao.getCaseClinicalVideoSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (CaseClinicalVideoDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, dto.getVideoId());
|
||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
List<CaseClinicalVideoAuthorDto> caseClinicalVideoAuthorListDto = CaseClinicalVideoAuthorDto.GetListDto(caseClinicalVideoAuthors);
|
||||
dto.setAuthor(caseClinicalVideoAuthorListDto);
|
||||
|
||||
// 获取用户收藏状态
|
||||
if (userId != null) {
|
||||
// 检测用户是否已收藏过
|
||||
UserCollectClinicalVideoModel userCollectClinicalVideo = caseClinicalVideoService.getUserCollectClinicalVideoStatus(dto.getVideoId(),userId);
|
||||
if (userCollectClinicalVideo != null) {
|
||||
dto.setCollect(true);
|
||||
}
|
||||
// 获取用户收藏状态
|
||||
if (userId != null) {
|
||||
// 检测用户是否已收藏过
|
||||
UserCollectClinicalArticleModel userCollectClinicalArticle = caseClinicalArticleService.getUserCollectClinicalArticleStatus(dto.getArticleId(),userId);
|
||||
if (userCollectClinicalArticle != null) {
|
||||
dto.setCollect(true);
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临床病例库-搜索-视频
|
||||
*/
|
||||
@PostMapping("/clinical/video/search")
|
||||
public Response<Map<String, Object>> getClinicalVideoSearchPage(
|
||||
@Validated()
|
||||
@RequestBody getClinicalVideoSearchPage request
|
||||
) {
|
||||
String userId = (String) httpServletRequest.getAttribute("userId");
|
||||
|
||||
request.validateForPage();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
Page<CaseClinicalVideoDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取视频数据
|
||||
IPage<CaseClinicalVideoDto> resultPage = caseClinicalVideoDao.getCaseClinicalVideoSearchPage(
|
||||
page,
|
||||
request.getKeyword(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (CaseClinicalVideoDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, dto.getVideoId());
|
||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
List<CaseClinicalVideoAuthorDto> caseClinicalVideoAuthorListDto = CaseClinicalVideoAuthorDto.GetListDto(caseClinicalVideoAuthors);
|
||||
dto.setAuthor(caseClinicalVideoAuthorListDto);
|
||||
|
||||
// 获取用户收藏状态
|
||||
if (userId != null) {
|
||||
// 检测用户是否已收藏过
|
||||
UserCollectClinicalVideoModel userCollectClinicalVideo = caseClinicalVideoService.getUserCollectClinicalVideoStatus(dto.getVideoId(),userId);
|
||||
if (userCollectClinicalVideo != null) {
|
||||
dto.setCollect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class getClinicalSearchPage {
|
||||
public class getClinicalArticleSearchPage {
|
||||
// ✅ 分页参数
|
||||
@Min(value = 1,message = "页码最小为 1")
|
||||
private Integer page = 1;
|
||||
@ -33,12 +33,6 @@ public class getClinicalSearchPage {
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
// 类型(1:文章 2:视频)
|
||||
@NotNull(message = "类型不能为空")
|
||||
@Min(value = 1, message = "入参错误")
|
||||
@Max(value = 2, message = "入参错误")
|
||||
private Integer type;
|
||||
|
||||
// 排序字段
|
||||
private OrderRequest order;
|
||||
|
||||
@ -30,8 +30,13 @@ public class getClinicalDoctorSearchPage {
|
||||
*/
|
||||
@Data
|
||||
public static class OrderRequest {
|
||||
@JsonProperty("updated_at")
|
||||
private String updatedAt; // 更新时间排序
|
||||
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName; // 医生名称
|
||||
|
||||
@JsonProperty("article_num")
|
||||
private String articleNum; // 数量-文章
|
||||
|
||||
|
||||
|
||||
@ -31,8 +31,13 @@ public class getClinicalHospitalSearchPage {
|
||||
*/
|
||||
@Data
|
||||
public static class OrderRequest {
|
||||
@JsonProperty("updated_at")
|
||||
private String updatedAt; // 更新时间排序
|
||||
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName; // 医院名称
|
||||
|
||||
@JsonProperty("article_num")
|
||||
private String articleNum; // 数量-文章
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,89 @@
|
||||
package com.example.caseData.request.clinicalRequest;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class getClinicalVideoSearchPage {
|
||||
// ✅ 分页参数
|
||||
@Min(value = 1,message = "页码最小为 1")
|
||||
private Integer page = 1;
|
||||
|
||||
@JsonProperty("page_size")
|
||||
@Min(value = 1, message = "每页个数最小为 1")
|
||||
private Integer pageSize = 20;
|
||||
|
||||
// 标题/作者名称/疾病名称
|
||||
@JsonProperty("keyword")
|
||||
private String keyword;
|
||||
|
||||
// 医院id
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId;
|
||||
|
||||
// 医生id
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
// 排序字段
|
||||
private OrderRequest order;
|
||||
|
||||
/**
|
||||
* 排序字段嵌套结构体
|
||||
*/
|
||||
@Data
|
||||
public static class OrderRequest {
|
||||
private String createdAt; // 创建时间
|
||||
private String readNum; // 阅读量
|
||||
private String pushDate; // 发表时间
|
||||
|
||||
public Map<String, String> toMap() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (StringUtils.hasText(createdAt)) {
|
||||
map.put("a.created_at", createdAt);
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(readNum)) {
|
||||
map.put("a.read_num", readNum);
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(pushDate)) {
|
||||
map.put("a.push_date", pushDate);
|
||||
}
|
||||
|
||||
// 默认排序(如果用户未传递任何排序字段)
|
||||
if (map.isEmpty()) {
|
||||
map.put("a.updated_at", "desc");
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排序字段,若无用户输入则使用默认排序
|
||||
*/
|
||||
public Map<String, String> handleOrder() {
|
||||
return order != null ? order.toMap() : new OrderRequest().toMap();
|
||||
}
|
||||
|
||||
// ✅ 校验分页参数
|
||||
public void validateForPage() {
|
||||
// 如果 page 为空,设为默认值 1
|
||||
if (page == null) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
if (pageSize == null) {
|
||||
pageSize = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
WHERE a.video_status = 1
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
a.article_title LIKE CONCAT('%', #{keyword}, '%')
|
||||
a.video_title LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR d.doctor_name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR l.label_name LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user