评论新增了标题1111

This commit is contained in:
wucongxing8150 2025-06-09 14:44:05 +08:00
parent 566be0b3fe
commit a9120604c6
6 changed files with 278 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import com.example.caseData.common.Response;
import com.example.caseData.dao.*; import com.example.caseData.dao.*;
import com.example.caseData.dto.T; import com.example.caseData.dto.T;
import com.example.caseData.dto.caseExchange.CaseExchangeDto; import com.example.caseData.dto.caseExchange.CaseExchangeDto;
import com.example.caseData.dto.caseExchangeLabel.CaseExchangeLabelDto;
import com.example.caseData.dto.caseExchangeVote.CaseExchangeVoteDto; import com.example.caseData.dto.caseExchangeVote.CaseExchangeVoteDto;
import com.example.caseData.dto.caseExchangeVoteOption.CaseExchangeVoteOptionDto; import com.example.caseData.dto.caseExchangeVoteOption.CaseExchangeVoteOptionDto;
import com.example.caseData.dto.userCommentCaseExchange.GetUserCaseExchangeCommentPageDto; import com.example.caseData.dto.userCommentCaseExchange.GetUserCaseExchangeCommentPageDto;
@ -141,6 +142,15 @@ public class CaseExchangeController {
dto.setCollect(true); dto.setCollect(true);
} }
} }
// 查找标签
LambdaQueryWrapper<CaseExchangeLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
labelQueryWrapper.eq(CaseExchangeLabelModel::getExchangeId, dto.getExchangeId());
List<CaseExchangeLabelModel> caseExchangeLabels = caseExchangeLabelDao.selectList(labelQueryWrapper);
if (caseExchangeLabels != null && !caseExchangeLabels.isEmpty()) {
List<CaseExchangeLabelDto> caseExchangeLabelDto = CaseExchangeLabelDto.GetListDto(caseExchangeLabels);
dto.setLabel(caseExchangeLabelDto);
}
} }
resultMap.put("page", resultPage.getCurrent()); resultMap.put("page", resultPage.getCurrent());
@ -257,6 +267,104 @@ public class CaseExchangeController {
return Response.success(g); return Response.success(g);
} }
/**
* 临床病例库-病例交流-列表
*/
// @PostMapping("/exchange/list")
// public Response<Map<String, Object>> getCaseExchangeSearchPage(
// @Validated()
// @RequestBody getCaseExchangeSearchPage request
// ) {
// UserModel user = new UserModel();
// BasicHospitalModel basicHospital = new BasicHospitalModel();
//
// String userId = (String) httpServletRequest.getAttribute("userId");
// if (userId != null) {
// user = userDao.selectById(Long.valueOf(userId));
// if (user == null) {
// return Response.error();
// }
//
// // 获取当前用户所属医院
// basicHospital = basicHospitalDao.selectById(user.getHospitalId());
// if (basicHospital == null) {
// return Response.error();
// }
// }
//
// request.validateForPage();
//
// Map<String, Object> resultMap = new HashMap<>();
//
// Page<CaseExchangeDto> page = new Page<>(request.getPage(), request.getPageSize());
//
// // 获取文章数据
// IPage<CaseExchangeDto> resultPage = caseExchangeDao.getCaseExchangeSearchPage(
// page,
// request.getKeyword(),
// request.getUserId(),
// request.getIsSelected(),
// request.handleOrder()
// );
//
// for (CaseExchangeDto dto : resultPage.getRecords()) {
// // 查找用户所属医院
// if (userId != null){
// if (!userId.equals(dto.getUserId())){
// user = userDao.selectById(dto.getUserId());
// if (user == null) {
// return Response.error();
// }
//
// // 获取当前用户所属医院
// basicHospital = basicHospitalDao.selectById(user.getHospitalId());
// if (basicHospital == null) {
// return Response.error();
// }
// }
// }else{
// user = userDao.selectById(dto.getUserId());
// if (user == null) {
// return Response.error();
// }
//
// // 获取当前用户所属医院
// basicHospital = basicHospitalDao.selectById(user.getHospitalId());
// if (basicHospital == null) {
// return Response.error();
// }
// }
//
// dto.setAvatar(Replace.addOssDomain(user.getAvatar()));
// dto.setUserName(user.getUserName());
// dto.setHospitalName(basicHospital.getHospitalName());
//
// // 获取用户收藏状态
// if (userId != null) {
// // 检测用户是否已收藏过
// UserCollectExchangeModel userCollectExchangeModel = caseExchangeService.getUserCollectExchangeStatus(dto.getExchangeId(),userId);
// if (userCollectExchangeModel != null) {
// dto.setCollect(true);
// }
// }
//
// // 查找标签
// LambdaQueryWrapper<CaseExchangeLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
// labelQueryWrapper.eq(CaseExchangeLabelModel::getExchangeId, dto.getExchangeId());
// List<CaseExchangeLabelModel> caseExchangeLabels = caseExchangeLabelDao.selectList(labelQueryWrapper);
// if (caseExchangeLabels != null && !caseExchangeLabels.isEmpty()) {
// List<CaseExchangeLabelDto> caseExchangeLabelDto = CaseExchangeLabelDto.GetListDto(caseExchangeLabels);
// dto.setLabel(caseExchangeLabelDto);
// }
// }
//
// resultMap.put("page", resultPage.getCurrent());
// resultMap.put("pageSize", resultPage.getSize());
// resultMap.put("total", resultPage.getTotal());
// resultMap.put("data", resultPage.getRecords());
// return Response.success(resultMap);
// }
/** /**
* 病例交流-详情-投票数据 * 病例交流-详情-投票数据
*/ */

View File

@ -2,6 +2,7 @@ package com.example.caseData.controller;
import com.example.caseData.common.Response; import com.example.caseData.common.Response;
import com.example.caseData.dto.index.GetIndexClinicalDto; import com.example.caseData.dto.index.GetIndexClinicalDto;
import com.example.caseData.dto.index.GetIndexExchangeDto;
import com.example.caseData.service.IndexService; import com.example.caseData.service.IndexService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -20,4 +21,10 @@ public class IndexController extends BaseController {
return Response.success(indexService.GetIndexClinical()); return Response.success(indexService.GetIndexClinical());
} }
// 首页-病例交流
// @GetMapping("/index/exchange")
// public Response<GetIndexExchangeDto> getIndexExchange() {
// return Response.success(indexService.GetIndexExchange());
// }
} }

View File

@ -121,8 +121,8 @@ public class CaseExchangeDto {
/** /**
* 标签数据 * 标签数据
*/ */
@JsonProperty("case_exchange_label") @JsonProperty("label")
private List<CaseExchangeLabelDto> caseExchangeLabel; private List<CaseExchangeLabelDto> label;
/** /**
* 列表 * 列表
@ -152,7 +152,7 @@ public class CaseExchangeDto {
if (model.getCaseExchangeLabel() != null) { if (model.getCaseExchangeLabel() != null) {
List<CaseExchangeLabelDto> listDto = CaseExchangeLabelDto.GetListDto(model.getCaseExchangeLabel()); List<CaseExchangeLabelDto> listDto = CaseExchangeLabelDto.GetListDto(model.getCaseExchangeLabel());
dto.setCaseExchangeLabel(listDto); dto.setLabel(listDto);
} }
return dto; return dto;
@ -184,7 +184,7 @@ public class CaseExchangeDto {
// 标签 // 标签
if (model.getCaseExchangeLabel() != null) { if (model.getCaseExchangeLabel() != null) {
List<CaseExchangeLabelDto> listDto = CaseExchangeLabelDto.GetListDto(model.getCaseExchangeLabel()); List<CaseExchangeLabelDto> listDto = CaseExchangeLabelDto.GetListDto(model.getCaseExchangeLabel());
dto.setCaseExchangeLabel(listDto); dto.setLabel(listDto);
} }
return dto; return dto;

View File

@ -0,0 +1,26 @@
package com.example.caseData.dto.index;
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GetIndexExchangeDto {
@JsonProperty("new_articles")
private List<CaseClinicalArticleDto> newArticles; // 最新上线
@JsonProperty("most_read_articles")
private List<CaseClinicalArticleDto> mostReadArticles; // 最多阅读
@JsonProperty("recommend_hospital")
private List<RecommendHospitalDto> recommendHospital; // 医院病例库推荐
@JsonProperty("recommend_doctor")
private List<RecommendDoctorDto> recommendDoctor; // 医生病例库推荐
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.caseData.dao.*; import com.example.caseData.dao.*;
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto; import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
import com.example.caseData.dto.index.GetIndexClinicalDto; import com.example.caseData.dto.index.GetIndexClinicalDto;
import com.example.caseData.dto.index.GetIndexExchangeDto;
import com.example.caseData.dto.index.RecommendDoctorDto; import com.example.caseData.dto.index.RecommendDoctorDto;
import com.example.caseData.dto.index.RecommendHospitalDto; import com.example.caseData.dto.index.RecommendHospitalDto;
import com.example.caseData.model.*; import com.example.caseData.model.*;
@ -17,6 +18,9 @@ public class IndexService {
@Resource @Resource
private CaseClinicalArticleDao caseClinicalArticleDao; private CaseClinicalArticleDao caseClinicalArticleDao;
@Resource
private CaseExchangeDao caseExchangeDao;
@Resource @Resource
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao; private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
@ -154,4 +158,130 @@ public class IndexService {
g.setRecommendDoctor(RecommendDoctorDto.GetListDto(statsCaseClinicalDoctors)); g.setRecommendDoctor(RecommendDoctorDto.GetListDto(statsCaseClinicalDoctors));
return g; return g;
} }
// /**
// * 获取首页数据-病例交流
// */
// public GetIndexExchangeDto GetIndexExchange(){
// // 精选-3条
// LambdaQueryWrapper<CaseExchangeModel> selectedQueryWrapper = new LambdaQueryWrapper<>();
// selectedQueryWrapper.eq(CaseExchangeModel::getExchangeStatus, 1) // 上线状态
// .eq(CaseExchangeModel::getIsSelected, 1)
// .orderByDesc(CaseExchangeModel::getCreatedAt) // 按发布时间倒序
// .last("LIMIT 3"); // 只取2条记录
// List<CaseExchangeModel> selectedExchanges = caseExchangeDao.selectList(selectedQueryWrapper);
//
// // 最新收录-分页
//
//
//
// // 最新上线-2条
// LambdaQueryWrapper<CaseClinicalArticleModel> caseClinicalArticleQueryWrapper = new LambdaQueryWrapper<>();
// caseClinicalArticleQueryWrapper.eq(CaseClinicalArticleModel::getArticleStatus, 1) // 上线状态
// .orderByDesc(CaseClinicalArticleModel::getCreatedAt) // 按发布时间倒序
// .last("LIMIT 2"); // 只取2条记录
// List<CaseClinicalArticleModel> latestArticles = caseClinicalArticleDao.selectList(caseClinicalArticleQueryWrapper);
// for (CaseClinicalArticleModel article : latestArticles) {
// // 查找作者
// LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
// authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, article.getArticleId());
// List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
// for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
// // 查询医生
// CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
//
// // 查询医生所属医院
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
// caseClinicalDoctor.setBasicHospital(basicHospital);
//
// author.setCaseClinicalDoctor(caseClinicalDoctor);
// }
//
// article.setAuthor(caseClinicalArticleAuthors);
//
// // 查找标签
// LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
// labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, article.getArticleId());
// List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
// article.setLabel(caseClinicalArticleLabels);
// }
//
//
// // 最多阅读-2条
// caseClinicalArticleQueryWrapper = new LambdaQueryWrapper<>();
// caseClinicalArticleQueryWrapper.eq(CaseClinicalArticleModel::getArticleStatus, 1) // 上线状态
// .orderByDesc(CaseClinicalArticleModel::getReadNum) // 按阅读量倒序
// .last("LIMIT 2"); // 只取2条记录
// List<CaseClinicalArticleModel> mostReadArticles = caseClinicalArticleDao.selectList(caseClinicalArticleQueryWrapper);
// for (CaseClinicalArticleModel article : mostReadArticles) {
// // 根据文章ID查找作者
// LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
// authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, article.getArticleId());
// List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
// for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
// // 查询医生
// CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
//
// // 查询医生所属医院
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
// caseClinicalDoctor.setBasicHospital(basicHospital);
//
// author.setCaseClinicalDoctor(caseClinicalDoctor);
// }
//
// article.setAuthor(caseClinicalArticleAuthors);
//
// // 查找标签
// LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
// labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, article.getArticleId());
// List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
// article.setLabel(caseClinicalArticleLabels);
//
// // 删除内容字段
// article.setArticleContent("");
// }
//
// // 医院病例库推荐-2条
// LambdaQueryWrapper<StatsCaseClinicalHospitalModel> statsCaseClinicalHospitalModelQueryWrapper = new LambdaQueryWrapper<>();
// statsCaseClinicalHospitalModelQueryWrapper.orderByDesc(StatsCaseClinicalHospitalModel::getArticleNum) // 按文章数量倒序
// .last("LIMIT 2"); // 只取2条记录
// List<StatsCaseClinicalHospitalModel> statsCaseClinicalHospitals = statsCaseClinicalHospitalDao.selectList(statsCaseClinicalHospitalModelQueryWrapper);
// for (StatsCaseClinicalHospitalModel hospital : statsCaseClinicalHospitals) {
// // 查询医院基础数据
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(hospital.getHospitalId());
// hospital.setBasicHospital(basicHospital);
// }
//
// // 医生病例库推荐-2条
// LambdaQueryWrapper<StatsCaseClinicalDoctorModel> statsCaseClinicalDoctorModelQueryWrapper = new LambdaQueryWrapper<>();
// statsCaseClinicalDoctorModelQueryWrapper.orderByDesc(StatsCaseClinicalDoctorModel::getArticleNum) // 按文章数量倒序
// .last("LIMIT 2"); // 只取2条记录
// List<StatsCaseClinicalDoctorModel> statsCaseClinicalDoctors = statsCaseClinicalDoctorDao.selectList(statsCaseClinicalDoctorModelQueryWrapper);
// for (StatsCaseClinicalDoctorModel doctor : statsCaseClinicalDoctors) {
// // 查询医生数据
// CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(doctor.getDoctorId());
//
// // 查询医生所属医院
// BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
// caseClinicalDoctor.setBasicHospital(basicHospital);
//
// doctor.setCaseClinicalDoctor(caseClinicalDoctor);
// }
//
// // 处理返回值
// GetIndexClinicalDto g = new GetIndexClinicalDto();
//
// // 最新上线-2条
// g.setNewArticles(CaseClinicalArticleDto.GetListDto(latestArticles));
//
// // 最多阅读-2条
// g.setMostReadArticles(CaseClinicalArticleDto.GetListDto(mostReadArticles));
//
// // 医院病例库推荐-2条
// g.setRecommendHospital(RecommendHospitalDto.GetListDto(statsCaseClinicalHospitals));
//
// // 医生病例库推荐-2条
// g.setRecommendDoctor(RecommendDoctorDto.GetListDto(statsCaseClinicalDoctors));
// return g;
// }
} }

View File

@ -57,7 +57,9 @@
LEFT JOIN basic_hospital c ON b.hospital_id = c.hospital_id LEFT JOIN basic_hospital c ON b.hospital_id = c.hospital_id
LEFT JOIN case_exchange d ON a.exchange_id = d.exchange_id LEFT JOIN case_exchange d ON a.exchange_id = d.exchange_id
WHERE a.status = 1 WHERE a.status = 1
AND a.user_id = #{userId} <if test="userId != null and userId != ''">
AND a.user_id = #{userId}
</if>
AND d.exchange_status = 1 AND d.exchange_status = 1
ORDER BY a.created_at DESC ORDER BY a.created_at DESC
</select> </select>