新增了标签统计数据

This commit is contained in:
wucongxing8150 2025-06-13 13:56:23 +08:00
parent 4ebdb2c862
commit d226b4e4f0
4 changed files with 83 additions and 22 deletions

View File

@ -5,11 +5,16 @@ import com.example.caseData.common.Response;
import com.example.caseData.dao.StatsCaseClinicalDao; import com.example.caseData.dao.StatsCaseClinicalDao;
import com.example.caseData.dao.StatsCaseClinicalDoctorDao; import com.example.caseData.dao.StatsCaseClinicalDoctorDao;
import com.example.caseData.dao.StatsCaseClinicalHospitalDao; import com.example.caseData.dao.StatsCaseClinicalHospitalDao;
import com.example.caseData.dao.StatsCaseClinicalLabelDao;
import com.example.caseData.dto.statsCaseClinical.StatsCaseClinicalDto; import com.example.caseData.dto.statsCaseClinical.StatsCaseClinicalDto;
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto; import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto; import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
import com.example.caseData.dto.statsCaseClinicalLabel.StatsCaseClinicalLabelDto;
import com.example.caseData.model.*; import com.example.caseData.model.*;
import com.example.caseData.request.StatsCaseClinicalRequest.getClinicalStatsLabel;
import com.example.caseData.request.caseLabelRequest.getCaseLabel;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController
@ -24,6 +29,9 @@ public class StatsCaseClinicalController extends BaseController {
@Resource @Resource
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao; private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
@Resource
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
/** /**
* 临床病例库-统计 * 临床病例库-统计
*/ */
@ -84,4 +92,25 @@ public class StatsCaseClinicalController extends BaseController {
return Response.success(g); return Response.success(g);
} }
/**
* 临床病例库-统计-疾病标签
*/
@GetMapping("/clinical/stats/label")
public Response<StatsCaseClinicalLabelDto> getClinicalStatsLabel(
@Validated() @ModelAttribute getClinicalStatsLabel request
){
// 统计表-病例库-临床
LambdaQueryWrapper<StatsCaseClinicalLabelModel> statsCaseClinicalLabelQueryWrapper = new LambdaQueryWrapper<>();
statsCaseClinicalLabelQueryWrapper.eq(StatsCaseClinicalLabelModel::getLabelIden, request.getLabelIden());
StatsCaseClinicalLabelModel statsCaseClinicalLabel = statsCaseClinicalLabelDao.selectOne(statsCaseClinicalLabelQueryWrapper);
StatsCaseClinicalLabelDto g = StatsCaseClinicalLabelDto.GetDto(statsCaseClinicalLabel);
if (g == null){
return Response.success(new StatsCaseClinicalLabelDto());
}
return Response.success(g);
}
} }

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto; import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
import com.example.caseData.dto.statsCaseClinicalLabel.StatsCaseClinicalLabelDto; import com.example.caseData.dto.statsCaseClinicalLabel.StatsCaseClinicalLabelDto;
import com.example.caseData.model.StatsCaseClinicalLabelModel;
import com.example.caseData.model.StatsCaseExchangeUserModel; import com.example.caseData.model.StatsCaseExchangeUserModel;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -13,7 +14,7 @@ import org.apache.ibatis.annotations.Update;
import java.util.Map; import java.util.Map;
@Mapper @Mapper
public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseExchangeUserModel> { public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseClinicalLabelModel> {
/** /**
* 医院病例库推荐-搜索 * 医院病例库推荐-搜索

View File

@ -0,0 +1,16 @@
package com.example.caseData.request.StatsCaseClinicalRequest;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class getClinicalStatsLabel {
/**
* 疾病标签唯一标识
*/
@JsonProperty("label_iden")
@NotNull(message = "参数错误")
private Integer labelIden;
}

View File

@ -55,6 +55,9 @@ public class CaseExchangeService {
@Resource @Resource
private RegularUtil regularUtil; private RegularUtil regularUtil;
@Resource
private UserVoteExchangeDao userVoteExchangeDao;
/** /**
* 新增-病例交流 * 新增-病例交流
* @param userId 用户id * @param userId 用户id
@ -510,29 +513,41 @@ public class CaseExchangeService {
return false; return false;
} }
// 检测用户是否已收藏过 // 检测用户是否已投票
UserCollectExchangeModel userCollectExchange = getUserCollectExchangeStatus(exchangeId,userId); LambdaQueryWrapper<UserVoteExchangeModel> userVoteExchangeQueryWrapper = new LambdaQueryWrapper<>();
if (userCollectExchange != null) { userVoteExchangeQueryWrapper.eq(UserVoteExchangeModel::getUserId, userId);
userVoteExchangeQueryWrapper.eq(UserVoteExchangeModel::getExchangeId, exchangeId);
UserVoteExchangeModel userVoteExchange = userVoteExchangeDao.selectOne(userVoteExchangeQueryWrapper);
if (userVoteExchange != null) {
return true; return true;
} }
//
// 新增收藏 // // 获取病例交流对应偷票数据
UserCollectExchangeModel userCollectExchangeData = new UserCollectExchangeModel(); // LambdaQueryWrapper<UserVoteExchangeModel> mapQueryWrapper = new LambdaQueryWrapper<>();
userCollectExchangeData.setUserId(Long.valueOf(userId)); // mapQueryWrapper.eq(UserVoteExchangeModel::getUserId, userId);
userCollectExchangeData.setExchangeId(Long.valueOf(exchangeId)); // mapQueryWrapper.eq(UserVoteExchangeModel::getExchangeId, exchangeId);
int res = userCollectExchangeDao.insert(userCollectExchangeData); // UserVoteExchangeModel userVoteExchange = userVoteExchangeDao.selectOne(mapQueryWrapper);
if (res <= 0){ // if (userVoteExchange != null) {
return false; // return true;
} // }
//
// 增加病例交流收藏数 // // 新增投票
caseExchangeDao.inc(Long.valueOf(exchangeId),"collect_num",1); // UserVoteExchangeModel userVoteExchangedata = new UserVoteExchangeModel();
// userVoteExchangedata.setUserId(Long.valueOf(userId));
// 增加病例交流总收藏数 // userVoteExchangedata.setExchangeId(Long.valueOf(exchangeId));
statsCaseExchangeDao.inc(1L,"exchange_collect_num",1); // int res = userCollectExchangeDao.insert(userCollectExchangeData);
// if (res <= 0){
// 增加用户交流收藏数 // return false;
statsCaseExchangeUserDao.inc(Long.valueOf(userId),"exchange_collect_num",1); // }
//
// // 增加病例交流收藏数
// caseExchangeDao.inc(Long.valueOf(exchangeId),"collect_num",1);
//
// // 增加病例交流总收藏数
// statsCaseExchangeDao.inc(1L,"exchange_collect_num",1);
//
// // 增加用户交流收藏数
// statsCaseExchangeUserDao.inc(Long.valueOf(userId),"exchange_collect_num",1);
return true; return true;
} }