新增了标签统计数据
This commit is contained in:
parent
4ebdb2c862
commit
d226b4e4f0
@ -5,11 +5,16 @@ import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.StatsCaseClinicalDao;
|
||||
import com.example.caseData.dao.StatsCaseClinicalDoctorDao;
|
||||
import com.example.caseData.dao.StatsCaseClinicalHospitalDao;
|
||||
import com.example.caseData.dao.StatsCaseClinicalLabelDao;
|
||||
import com.example.caseData.dto.statsCaseClinical.StatsCaseClinicalDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalLabel.StatsCaseClinicalLabelDto;
|
||||
import com.example.caseData.model.*;
|
||||
import com.example.caseData.request.StatsCaseClinicalRequest.getClinicalStatsLabel;
|
||||
import com.example.caseData.request.caseLabelRequest.getCaseLabel;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@ -24,6 +29,9 @@ public class StatsCaseClinicalController extends BaseController {
|
||||
@Resource
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
|
||||
|
||||
/**
|
||||
* 临床病例库-统计
|
||||
*/
|
||||
@ -84,4 +92,25 @@ public class StatsCaseClinicalController extends BaseController {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalLabel.StatsCaseClinicalLabelDto;
|
||||
import com.example.caseData.model.StatsCaseClinicalLabelModel;
|
||||
import com.example.caseData.model.StatsCaseExchangeUserModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -13,7 +14,7 @@ import org.apache.ibatis.annotations.Update;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseExchangeUserModel> {
|
||||
public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseClinicalLabelModel> {
|
||||
|
||||
/**
|
||||
* 医院病例库推荐-搜索
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -55,6 +55,9 @@ public class CaseExchangeService {
|
||||
@Resource
|
||||
private RegularUtil regularUtil;
|
||||
|
||||
@Resource
|
||||
private UserVoteExchangeDao userVoteExchangeDao;
|
||||
|
||||
/**
|
||||
* 新增-病例交流
|
||||
* @param userId 用户id
|
||||
@ -510,29 +513,41 @@ public class CaseExchangeService {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检测用户是否已收藏过
|
||||
UserCollectExchangeModel userCollectExchange = getUserCollectExchangeStatus(exchangeId,userId);
|
||||
if (userCollectExchange != null) {
|
||||
// 检测用户是否已投票
|
||||
LambdaQueryWrapper<UserVoteExchangeModel> userVoteExchangeQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userVoteExchangeQueryWrapper.eq(UserVoteExchangeModel::getUserId, userId);
|
||||
userVoteExchangeQueryWrapper.eq(UserVoteExchangeModel::getExchangeId, exchangeId);
|
||||
UserVoteExchangeModel userVoteExchange = userVoteExchangeDao.selectOne(userVoteExchangeQueryWrapper);
|
||||
if (userVoteExchange != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 新增收藏
|
||||
UserCollectExchangeModel userCollectExchangeData = new UserCollectExchangeModel();
|
||||
userCollectExchangeData.setUserId(Long.valueOf(userId));
|
||||
userCollectExchangeData.setExchangeId(Long.valueOf(exchangeId));
|
||||
int res = userCollectExchangeDao.insert(userCollectExchangeData);
|
||||
if (res <= 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 增加病例交流收藏数
|
||||
caseExchangeDao.inc(Long.valueOf(exchangeId),"collect_num",1);
|
||||
|
||||
// 增加病例交流总收藏数
|
||||
statsCaseExchangeDao.inc(1L,"exchange_collect_num",1);
|
||||
|
||||
// 增加用户交流收藏数
|
||||
statsCaseExchangeUserDao.inc(Long.valueOf(userId),"exchange_collect_num",1);
|
||||
//
|
||||
// // 获取病例交流对应偷票数据
|
||||
// LambdaQueryWrapper<UserVoteExchangeModel> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// mapQueryWrapper.eq(UserVoteExchangeModel::getUserId, userId);
|
||||
// mapQueryWrapper.eq(UserVoteExchangeModel::getExchangeId, exchangeId);
|
||||
// UserVoteExchangeModel userVoteExchange = userVoteExchangeDao.selectOne(mapQueryWrapper);
|
||||
// if (userVoteExchange != null) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // 新增投票
|
||||
// UserVoteExchangeModel userVoteExchangedata = new UserVoteExchangeModel();
|
||||
// userVoteExchangedata.setUserId(Long.valueOf(userId));
|
||||
// userVoteExchangedata.setExchangeId(Long.valueOf(exchangeId));
|
||||
// int res = userCollectExchangeDao.insert(userCollectExchangeData);
|
||||
// if (res <= 0){
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // 增加病例交流收藏数
|
||||
// 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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user