1234
This commit is contained in:
parent
8d659750f7
commit
ec78f1167d
@ -35,7 +35,7 @@ public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseClinicalL
|
|||||||
* @return 更新的行数
|
* @return 更新的行数
|
||||||
*/
|
*/
|
||||||
@Update("UPDATE stats_case_exchange_label SET ${field} = ${field} + #{numeral} WHERE label_iden = #{labelIden}")
|
@Update("UPDATE stats_case_exchange_label SET ${field} = ${field} + #{numeral} WHERE label_iden = #{labelIden}")
|
||||||
int inc(@Param("labelIden") Long labelIden, @Param("field") String field, @Param("numeral") int numeral);
|
int inc(@Param("labelIden") String labelIden, @Param("field") String field, @Param("numeral") int numeral);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dec 自减
|
* Dec 自减
|
||||||
@ -47,5 +47,5 @@ public interface StatsCaseClinicalLabelDao extends BaseMapper<StatsCaseClinicalL
|
|||||||
@Update("UPDATE stats_case_exchange_label " +
|
@Update("UPDATE stats_case_exchange_label " +
|
||||||
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
||||||
"WHERE label_iden = #{labelIden}")
|
"WHERE label_iden = #{labelIden}")
|
||||||
int dec(@Param("labelIden") Long labelIden, @Param("field") String field, @Param("numeral") int numeral);
|
int dec(@Param("labelIden") String labelIden, @Param("field") String field, @Param("numeral") int numeral);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,4 +111,50 @@ public class UserInfo extends Base {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据唯一标识获取信息V3
|
||||||
|
public GetUserInfoResponse getUserInfoByUuid(String uuid) throws BusinessException {
|
||||||
|
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||||
|
|
||||||
|
// 处理参数
|
||||||
|
Map<String, Object> requestData = new HashMap<>();
|
||||||
|
requestData.put("uuid", uuid);
|
||||||
|
requestData.put("platform", appConfig.getPlatform());
|
||||||
|
requestData.put("timestamp", timestamp);
|
||||||
|
|
||||||
|
// 生成签名
|
||||||
|
String sign = genSignature(requestData,appConfig.getSecretKey());
|
||||||
|
|
||||||
|
String url = appConfig.getApiUrl() + "/expert-api/getInfoByUuid";
|
||||||
|
String jsonBody = JSONUtil.toJsonStr(requestData);
|
||||||
|
log.info("获取app数据参数:{}",jsonBody);
|
||||||
|
|
||||||
|
try(HttpResponse response = HttpRequest.post(url)
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.header("sign", sign)
|
||||||
|
.body(jsonBody)
|
||||||
|
.execute()){
|
||||||
|
|
||||||
|
if (response.getStatus() != 200) {
|
||||||
|
throw new BusinessException("失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 反序列化 JSON
|
||||||
|
GetUserInfoResponse result = JSONUtil.toBean(response.body(), GetUserInfoResponse.class);
|
||||||
|
log.info("获取app数据返回:{}",result);
|
||||||
|
if (result.getCode() != 200){
|
||||||
|
if (!Objects.equals(result.getMsg(), "")){
|
||||||
|
throw new BusinessException(result.getMsg());
|
||||||
|
}else{
|
||||||
|
throw new BusinessException("失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.getData() == null){
|
||||||
|
throw new BusinessException("失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,12 @@ public class CaseClinicalArticleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserDao userDao;
|
private UserDao userDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalArticleLabelDao caseClinicalArticleLabelDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增收藏-临床病例库-文章
|
* 新增收藏-临床病例库-文章
|
||||||
* @param articleId 文章id
|
* @param articleId 文章id
|
||||||
@ -361,85 +367,16 @@ public class CaseClinicalArticleService {
|
|||||||
/**
|
/**
|
||||||
* 新增文章的统计字段
|
* 新增文章的统计字段
|
||||||
* @param articleId 文章id
|
* @param articleId 文章id
|
||||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数
|
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:文章数
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean IncClinicalArticleStats(String articleId,Integer type){
|
public boolean IncClinicalArticleStats(String articleId,Integer type){
|
||||||
try {
|
|
||||||
// 获取文章作者
|
|
||||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, articleId);
|
|
||||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
|
||||||
|
|
||||||
// 阅读量
|
|
||||||
if (type == 1){
|
|
||||||
caseClinicalArticleDao.inc(Long.valueOf(articleId),"read_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"article_read_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章收藏数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"article_read_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章收藏数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"article_read_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收藏量
|
|
||||||
if (type == 2){
|
|
||||||
caseClinicalArticleDao.inc(Long.valueOf(articleId),"collect_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"article_collect_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章收藏数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"article_collect_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章收藏数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"article_collect_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 评论数
|
|
||||||
if (type == 3){
|
|
||||||
caseClinicalArticleDao.inc(Long.valueOf(articleId),"comment_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"article_comment_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章评论数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"article_comment_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章评论数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"article_comment_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 减少文章的统计字段
|
|
||||||
* @param articleId 文章id
|
|
||||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public boolean DecClinicalArticleStats(String articleId,Integer type){
|
|
||||||
try {
|
try {
|
||||||
String caseClinicalArticleField = ""; // 具体文章
|
String caseClinicalArticleField = ""; // 具体文章
|
||||||
String statsCaseClinicalField = ""; // 全部文章
|
String statsCaseClinicalField = ""; // 全部文章
|
||||||
String statsCaseClinicalHospitalField = ""; // 医院
|
String statsCaseClinicalHospitalField = ""; // 医院
|
||||||
String statsCaseClinicalDoctorField = ""; // 医生
|
String statsCaseClinicalDoctorField = ""; // 医生
|
||||||
|
String statsCaseClinicalLabelField = ""; // 标签
|
||||||
|
|
||||||
// 阅读
|
// 阅读
|
||||||
if (type == 1){
|
if (type == 1){
|
||||||
@ -447,6 +384,7 @@ public class CaseClinicalArticleService {
|
|||||||
statsCaseClinicalField = "article_read_num"; // 全部文章
|
statsCaseClinicalField = "article_read_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "article_read_num"; // 医院
|
statsCaseClinicalHospitalField = "article_read_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "article_read_num"; // 医生
|
statsCaseClinicalDoctorField = "article_read_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_read_num"; // 标签
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -455,6 +393,7 @@ public class CaseClinicalArticleService {
|
|||||||
statsCaseClinicalField = "article_collect_num"; // 全部文章
|
statsCaseClinicalField = "article_collect_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "article_collect_num"; // 医院
|
statsCaseClinicalHospitalField = "article_collect_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "article_collect_num"; // 医生
|
statsCaseClinicalDoctorField = "article_collect_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_collect_num"; // 标签
|
||||||
}
|
}
|
||||||
|
|
||||||
// 评论
|
// 评论
|
||||||
@ -463,9 +402,104 @@ public class CaseClinicalArticleService {
|
|||||||
statsCaseClinicalField = "article_comment_num"; // 全部文章
|
statsCaseClinicalField = "article_comment_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "article_comment_num"; // 医院
|
statsCaseClinicalHospitalField = "article_comment_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "article_comment_num"; // 医生
|
statsCaseClinicalDoctorField = "article_comment_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_comment_num"; // 标签
|
||||||
}
|
}
|
||||||
|
|
||||||
caseClinicalArticleDao.dec(Long.valueOf(articleId),caseClinicalArticleField,1);
|
// 文章数
|
||||||
|
if (type == 4){
|
||||||
|
statsCaseClinicalField = "article_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caseClinicalArticleField.isEmpty()){
|
||||||
|
caseClinicalArticleDao.inc(Long.valueOf(articleId),caseClinicalArticleField,1);
|
||||||
|
}
|
||||||
|
statsCaseClinicalDao.inc(1L,statsCaseClinicalField,1);
|
||||||
|
|
||||||
|
// 获取文章作者
|
||||||
|
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, articleId);
|
||||||
|
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||||
|
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||||
|
// 查询医生
|
||||||
|
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||||
|
|
||||||
|
// 减少医生文章数
|
||||||
|
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),statsCaseClinicalHospitalField,1);
|
||||||
|
|
||||||
|
// 减少医生文章数
|
||||||
|
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文章标签数据
|
||||||
|
LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, articleId);
|
||||||
|
List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
|
||||||
|
for (CaseClinicalArticleLabelModel label : caseClinicalArticleLabels) {
|
||||||
|
statsCaseClinicalLabelDao.inc(label.getAppIden(),statsCaseClinicalLabelField,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减少文章的统计字段
|
||||||
|
* @param articleId 文章id
|
||||||
|
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:文章数
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public boolean DecClinicalArticleStats(String articleId,Integer type){
|
||||||
|
try {
|
||||||
|
String caseClinicalArticleField = ""; // 具体文章
|
||||||
|
String statsCaseClinicalField = ""; // 全部文章
|
||||||
|
String statsCaseClinicalHospitalField = ""; // 医院
|
||||||
|
String statsCaseClinicalDoctorField = ""; // 医生
|
||||||
|
String statsCaseClinicalLabelField = ""; // 标签
|
||||||
|
|
||||||
|
// 阅读
|
||||||
|
if (type == 1){
|
||||||
|
caseClinicalArticleField = "read_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "article_read_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_read_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_read_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_read_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收藏
|
||||||
|
if (type == 2){
|
||||||
|
caseClinicalArticleField = "collect_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "article_collect_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_collect_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_collect_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_collect_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 评论
|
||||||
|
if (type == 3){
|
||||||
|
caseClinicalArticleField = "comment_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "article_comment_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_comment_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_comment_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_comment_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文章数
|
||||||
|
if (type == 4){
|
||||||
|
statsCaseClinicalField = "article_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caseClinicalArticleField.isEmpty()){
|
||||||
|
caseClinicalArticleDao.dec(Long.valueOf(articleId),caseClinicalArticleField,1);
|
||||||
|
}
|
||||||
statsCaseClinicalDao.dec(1L,statsCaseClinicalField,1);
|
statsCaseClinicalDao.dec(1L,statsCaseClinicalField,1);
|
||||||
|
|
||||||
// 获取文章作者
|
// 获取文章作者
|
||||||
@ -483,6 +517,14 @@ public class CaseClinicalArticleService {
|
|||||||
statsCaseClinicalDoctorDao.dec(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
statsCaseClinicalDoctorDao.dec(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取文章标签数据
|
||||||
|
LambdaQueryWrapper<CaseClinicalArticleLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
labelQueryWrapper.eq(CaseClinicalArticleLabelModel::getArticleId, articleId);
|
||||||
|
List<CaseClinicalArticleLabelModel> caseClinicalArticleLabels = caseClinicalArticleLabelDao.selectList(labelQueryWrapper);
|
||||||
|
for (CaseClinicalArticleLabelModel label : caseClinicalArticleLabels) {
|
||||||
|
statsCaseClinicalLabelDao.dec(label.getAppIden(),statsCaseClinicalLabelField,1);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.example.caseData.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.example.caseData.dao.StatsCaseClinicalLabelDao;
|
||||||
|
import com.example.caseData.exception.BusinessException;
|
||||||
|
import com.example.caseData.model.CaseClinicalArticleAuthorModel;
|
||||||
|
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||||
|
import com.example.caseData.model.CaseClinicalVideoModel;
|
||||||
|
import com.example.caseData.model.StatsCaseClinicalLabelModel;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CaseClinicalLabelService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.example.caseData.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.example.caseData.dao.StatsCaseClinicalDoctorDao;
|
||||||
|
import com.example.caseData.dao.StatsCaseClinicalHospitalDao;
|
||||||
|
import com.example.caseData.dao.StatsCaseClinicalLabelDao;
|
||||||
|
import com.example.caseData.model.StatsCaseClinicalDoctorModel;
|
||||||
|
import com.example.caseData.model.StatsCaseClinicalHospitalModel;
|
||||||
|
import com.example.caseData.model.StatsCaseClinicalLabelModel;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CaseClinicalService {
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalHospitalDao statsCaseClinicalHospitalDao;
|
||||||
|
|
||||||
|
// 新增标签统计
|
||||||
|
@Transactional
|
||||||
|
public void AddStatsCaseClinicalLabel(String labelIden,String labelName){
|
||||||
|
LambdaQueryWrapper<StatsCaseClinicalLabelModel> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
mapQueryWrapper.eq(StatsCaseClinicalLabelModel::getLabelIden, labelIden);
|
||||||
|
StatsCaseClinicalLabelModel statsCaseClinicalLabel = statsCaseClinicalLabelDao.selectOne(mapQueryWrapper);
|
||||||
|
if (statsCaseClinicalLabel == null) {
|
||||||
|
statsCaseClinicalLabel = new StatsCaseClinicalLabelModel();
|
||||||
|
statsCaseClinicalLabel.setLabelIden(labelIden);
|
||||||
|
statsCaseClinicalLabel.setLabelName(labelName);
|
||||||
|
statsCaseClinicalLabelDao.insert(statsCaseClinicalLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增医生统计
|
||||||
|
@Transactional
|
||||||
|
public void AddStatsCaseClinicalDoctor(String doctorId){
|
||||||
|
LambdaQueryWrapper<StatsCaseClinicalDoctorModel> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
mapQueryWrapper.eq(StatsCaseClinicalDoctorModel::getDoctorId, doctorId);
|
||||||
|
StatsCaseClinicalDoctorModel statsCaseClinicalDoctor = statsCaseClinicalDoctorDao.selectOne(mapQueryWrapper);
|
||||||
|
if (statsCaseClinicalDoctor == null) {
|
||||||
|
statsCaseClinicalDoctor = new StatsCaseClinicalDoctorModel();
|
||||||
|
statsCaseClinicalDoctor.setDoctorId(Long.valueOf(doctorId));
|
||||||
|
statsCaseClinicalDoctorDao.insert(statsCaseClinicalDoctor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增医院统计
|
||||||
|
@Transactional
|
||||||
|
public void AddStatsCaseClinicalHospital(String hospitalId){
|
||||||
|
LambdaQueryWrapper<StatsCaseClinicalHospitalModel> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
mapQueryWrapper.eq(StatsCaseClinicalHospitalModel::getHospitalId, hospitalId);
|
||||||
|
StatsCaseClinicalHospitalModel statsCaseClinicalHospital = statsCaseClinicalHospitalDao.selectOne(mapQueryWrapper);
|
||||||
|
if (statsCaseClinicalHospital == null) {
|
||||||
|
statsCaseClinicalHospital = new StatsCaseClinicalHospitalModel();
|
||||||
|
statsCaseClinicalHospital.setHospitalId(Long.valueOf(hospitalId));
|
||||||
|
statsCaseClinicalHospitalDao.insert(statsCaseClinicalHospital);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.example.caseData.dao.*;
|
import com.example.caseData.dao.*;
|
||||||
import com.example.caseData.exception.BusinessException;
|
import com.example.caseData.exception.BusinessException;
|
||||||
import com.example.caseData.extend.app.Base;
|
import com.example.caseData.extend.app.Base;
|
||||||
|
import com.example.caseData.extend.app.UserInfo.GetUserInfoResponse;
|
||||||
|
import com.example.caseData.extend.app.UserInfo.UserInfo;
|
||||||
import com.example.caseData.extend.app.UserPoint.UserPoint;
|
import com.example.caseData.extend.app.UserPoint.UserPoint;
|
||||||
import com.example.caseData.extend.app.Video.Video;
|
import com.example.caseData.extend.app.Video.Video;
|
||||||
import com.example.caseData.model.*;
|
import com.example.caseData.model.*;
|
||||||
@ -24,10 +26,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
//import static com.baomidou.mybatisplus.extension.toolkit.Db.removeById;
|
//import static com.baomidou.mybatisplus.extension.toolkit.Db.removeById;
|
||||||
//import static com.baomidou.mybatisplus.extension.toolkit.Db.save;
|
//import static com.baomidou.mybatisplus.extension.toolkit.Db.save;
|
||||||
@ -40,6 +40,9 @@ public class CaseClinicalVideoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CaseClinicalVideoDao caseClinicalVideoDao;
|
private CaseClinicalVideoDao caseClinicalVideoDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalVideoLabelDao caseClinicalVideoLabelDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StatsCaseClinicalDao statsCaseClinicalDao;
|
private StatsCaseClinicalDao statsCaseClinicalDao;
|
||||||
|
|
||||||
@ -64,9 +67,24 @@ public class CaseClinicalVideoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserCommentClinicalVideoDao userCommentClinicalVideoDao;
|
private UserCommentClinicalVideoDao userCommentClinicalVideoDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalLabelService caseClinicalLabelService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private Video Video;
|
private Video Video;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserInfo userInfo;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CaseClinicalService caseClinicalService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增收藏-临床病例库-视频
|
* 新增收藏-临床病例库-视频
|
||||||
* @param videoId 视频id
|
* @param videoId 视频id
|
||||||
@ -372,85 +390,16 @@ public class CaseClinicalVideoService {
|
|||||||
/**
|
/**
|
||||||
* 新增视频的统计字段
|
* 新增视频的统计字段
|
||||||
* @param videoId 视频id
|
* @param videoId 视频id
|
||||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数
|
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:文章数
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean IncClinicalVideoStats(String videoId,Integer type){
|
public boolean IncClinicalVideoStats(String videoId,Integer type){
|
||||||
try {
|
|
||||||
// 获取文章作者
|
|
||||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, videoId);
|
|
||||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
|
||||||
|
|
||||||
// 阅读量
|
|
||||||
if (type == 1){
|
|
||||||
caseClinicalVideoDao.inc(Long.valueOf(videoId),"read_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"video_read_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章收藏数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"video_read_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章收藏数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"video_read_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收藏量
|
|
||||||
if (type == 2){
|
|
||||||
caseClinicalVideoDao.inc(Long.valueOf(videoId),"collect_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"video_collect_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章收藏数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"video_collect_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章收藏数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"video_collect_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 评论数
|
|
||||||
if (type == 3){
|
|
||||||
caseClinicalVideoDao.inc(Long.valueOf(videoId),"comment_num",1);
|
|
||||||
statsCaseClinicalDao.inc(1L,"video_comment_num",1);
|
|
||||||
|
|
||||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
|
||||||
// 查询医生
|
|
||||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
// 增加医院文章收藏数
|
|
||||||
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),"video_comment_num",1);
|
|
||||||
|
|
||||||
// 增加医生文章收藏数
|
|
||||||
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),"video_comment_num",1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 减少视频的统计字段
|
|
||||||
* @param videoId 文章id
|
|
||||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public boolean DecClinicalVideoStats(String videoId,Integer type){
|
|
||||||
try {
|
try {
|
||||||
String caseClinicalVideoField = ""; // 具体文章
|
String caseClinicalVideoField = ""; // 具体文章
|
||||||
String statsCaseClinicalField = ""; // 全部文章
|
String statsCaseClinicalField = ""; // 全部文章
|
||||||
String statsCaseClinicalHospitalField = ""; // 医院
|
String statsCaseClinicalHospitalField = ""; // 医院
|
||||||
String statsCaseClinicalDoctorField = ""; // 医生
|
String statsCaseClinicalDoctorField = ""; // 医生
|
||||||
|
String statsCaseClinicalLabelField = ""; // 标签
|
||||||
|
|
||||||
// 阅读
|
// 阅读
|
||||||
if (type == 1){
|
if (type == 1){
|
||||||
@ -458,6 +407,7 @@ public class CaseClinicalVideoService {
|
|||||||
statsCaseClinicalField = "video_read_num"; // 全部文章
|
statsCaseClinicalField = "video_read_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "video_read_num"; // 医院
|
statsCaseClinicalHospitalField = "video_read_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "video_read_num"; // 医生
|
statsCaseClinicalDoctorField = "video_read_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_read_num"; // 标签
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -466,6 +416,7 @@ public class CaseClinicalVideoService {
|
|||||||
statsCaseClinicalField = "video_collect_num"; // 全部文章
|
statsCaseClinicalField = "video_collect_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "video_collect_num"; // 医院
|
statsCaseClinicalHospitalField = "video_collect_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "video_collect_num"; // 医生
|
statsCaseClinicalDoctorField = "video_collect_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_collect_num"; // 标签
|
||||||
}
|
}
|
||||||
|
|
||||||
// 评论
|
// 评论
|
||||||
@ -474,9 +425,104 @@ public class CaseClinicalVideoService {
|
|||||||
statsCaseClinicalField = "video_comment_num"; // 全部文章
|
statsCaseClinicalField = "video_comment_num"; // 全部文章
|
||||||
statsCaseClinicalHospitalField = "video_comment_num"; // 医院
|
statsCaseClinicalHospitalField = "video_comment_num"; // 医院
|
||||||
statsCaseClinicalDoctorField = "video_comment_num"; // 医生
|
statsCaseClinicalDoctorField = "video_comment_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_comment_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文章数
|
||||||
|
if (type == 4){
|
||||||
|
statsCaseClinicalField = "article_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caseClinicalVideoField.isEmpty()){
|
||||||
|
caseClinicalVideoDao.inc(Long.valueOf(videoId),caseClinicalVideoField,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
statsCaseClinicalDao.inc(1L,statsCaseClinicalField,1);
|
||||||
|
|
||||||
|
// 获取文章作者
|
||||||
|
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, videoId);
|
||||||
|
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||||
|
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||||
|
// 查询医生
|
||||||
|
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||||
|
|
||||||
|
// 获取医院统计数据
|
||||||
|
statsCaseClinicalHospitalDao.inc(caseClinicalDoctor.getHospitalId(),statsCaseClinicalHospitalField,1);
|
||||||
|
statsCaseClinicalDoctorDao.inc(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文章标签数据
|
||||||
|
LambdaQueryWrapper<CaseClinicalVideoLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
labelQueryWrapper.eq(CaseClinicalVideoLabelModel::getVideoId, videoId);
|
||||||
|
List<CaseClinicalVideoLabelModel> caseClinicalArticleLabels = caseClinicalVideoLabelDao.selectList(labelQueryWrapper);
|
||||||
|
for (CaseClinicalVideoLabelModel label : caseClinicalArticleLabels) {
|
||||||
|
statsCaseClinicalLabelDao.inc(label.getAppIden(),statsCaseClinicalLabelField,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减少视频的统计字段
|
||||||
|
* @param videoId 文章id
|
||||||
|
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:文章数
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public boolean DecClinicalVideoStats(String videoId,Integer type){
|
||||||
|
try {
|
||||||
|
String caseClinicalVideoField = ""; // 具体文章
|
||||||
|
String statsCaseClinicalField = ""; // 全部文章
|
||||||
|
String statsCaseClinicalHospitalField = ""; // 医院
|
||||||
|
String statsCaseClinicalDoctorField = ""; // 医生
|
||||||
|
String statsCaseClinicalLabelField = ""; // 标签
|
||||||
|
|
||||||
|
// 阅读
|
||||||
|
if (type == 1){
|
||||||
|
caseClinicalVideoField = "read_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "video_read_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "video_read_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "video_read_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_read_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收藏
|
||||||
|
if (type == 2){
|
||||||
|
caseClinicalVideoField = "collect_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "video_collect_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "video_collect_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "video_collect_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_collect_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 评论
|
||||||
|
if (type == 3){
|
||||||
|
caseClinicalVideoField = "comment_num"; // 具体文章
|
||||||
|
statsCaseClinicalField = "video_comment_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "video_comment_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "video_comment_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_comment_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文章数
|
||||||
|
if (type == 4){
|
||||||
|
statsCaseClinicalField = "article_num"; // 全部文章
|
||||||
|
statsCaseClinicalHospitalField = "article_num"; // 医院
|
||||||
|
statsCaseClinicalDoctorField = "article_num"; // 医生
|
||||||
|
statsCaseClinicalLabelField = "article_num"; // 标签
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caseClinicalVideoField.isEmpty()){
|
||||||
|
caseClinicalVideoDao.dec(Long.valueOf(videoId),caseClinicalVideoField,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
caseClinicalVideoDao.dec(Long.valueOf(videoId),caseClinicalVideoField,1);
|
|
||||||
statsCaseClinicalDao.dec(1L,statsCaseClinicalField,1);
|
statsCaseClinicalDao.dec(1L,statsCaseClinicalField,1);
|
||||||
|
|
||||||
// 获取文章作者
|
// 获取文章作者
|
||||||
@ -492,6 +538,14 @@ public class CaseClinicalVideoService {
|
|||||||
statsCaseClinicalDoctorDao.dec(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
statsCaseClinicalDoctorDao.dec(caseClinicalDoctor.getDoctorId(),statsCaseClinicalDoctorField,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取文章标签数据
|
||||||
|
LambdaQueryWrapper<CaseClinicalVideoLabelModel> labelQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
labelQueryWrapper.eq(CaseClinicalVideoLabelModel::getVideoId, videoId);
|
||||||
|
List<CaseClinicalVideoLabelModel> caseClinicalArticleLabels = caseClinicalVideoLabelDao.selectList(labelQueryWrapper);
|
||||||
|
for (CaseClinicalVideoLabelModel label : caseClinicalArticleLabels) {
|
||||||
|
statsCaseClinicalLabelDao.dec(label.getAppIden(),statsCaseClinicalLabelField,1);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
@ -538,45 +592,137 @@ public class CaseClinicalVideoService {
|
|||||||
// 检测签名
|
// 检测签名
|
||||||
Video.checkSign(request,"26e8675f44565b1ed4eaaa0fcf3531d7",r,objectMapper);
|
Video.checkSign(request,"26e8675f44565b1ed4eaaa0fcf3531d7",r,objectMapper);
|
||||||
|
|
||||||
// // 处理业务逻辑
|
// 获取视频数据
|
||||||
// // 获取视频数据
|
LambdaQueryWrapper<CaseClinicalVideoModel> videoQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
// LambdaQueryWrapper<CaseClinicalVideoModel> videoQueryWrapper = new LambdaQueryWrapper<>();
|
videoQueryWrapper.eq(CaseClinicalVideoModel::getVideoNo, r.getVideoNo());
|
||||||
// videoQueryWrapper.eq(CaseClinicalVideoModel::getVideoNo, r.getVideoNo());
|
CaseClinicalVideoModel caseClinicalVideo = caseClinicalVideoDao.selectOne(videoQueryWrapper);
|
||||||
// CaseClinicalVideoModel caseClinicalVideo = caseClinicalVideoDao.selectOne(videoQueryWrapper);
|
|
||||||
//
|
// 修改
|
||||||
// // 新增
|
if (Objects.equals(r.getAction(), "update")){
|
||||||
// if (Objects.equals(r.getAction(), "add")){
|
if (caseClinicalVideo == null){
|
||||||
// if (caseClinicalVideo != null){
|
r.setAction("add");
|
||||||
// // 已存在该视频
|
}
|
||||||
// return true;
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
if (Objects.equals(r.getAction(), "add")){
|
||||||
|
if (caseClinicalVideo != null){
|
||||||
|
// 已存在该视频
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增视频
|
||||||
|
caseClinicalVideo = new CaseClinicalVideoModel();
|
||||||
|
caseClinicalVideo.setVideoTitle(r.getVideoTitle());
|
||||||
|
caseClinicalVideo.setVideoNo(r.getVideoNo());
|
||||||
|
caseClinicalVideo.setPushDate(LocalDateTime.parse(r.getPushDate()));
|
||||||
|
caseClinicalVideo.setIsLink(r.getIsLink());
|
||||||
|
caseClinicalVideo.setIsLinkUrl(r.getIsLinkUrl());
|
||||||
|
int res = caseClinicalVideoDao.insert(caseClinicalVideo);
|
||||||
|
if (res <= 0){
|
||||||
|
throw new BusinessException("-1", "内部错误,添加视频失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增标签
|
||||||
|
for (addClinicalVideoApp.Label label : r.getLabel()){
|
||||||
|
CaseClinicalVideoLabelModel caseClinicalVideoLabel = new CaseClinicalVideoLabelModel();
|
||||||
|
caseClinicalVideoLabel.setVideoId(caseClinicalVideo.getVideoId());
|
||||||
|
caseClinicalVideoLabel.setAppIden(label.getAppIden());
|
||||||
|
caseClinicalVideoLabel.setLabelName(label.getLabelName());
|
||||||
|
res = caseClinicalVideoLabelDao.insert(caseClinicalVideoLabel);
|
||||||
|
if (res <= 0){
|
||||||
|
throw new BusinessException("-1", "内部错误,添加视频标签失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增标签统计
|
||||||
|
caseClinicalService.AddStatsCaseClinicalLabel(label.getAppIden(),label.getLabelName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增作者
|
||||||
|
for (addClinicalVideoApp.Author author : r.getAuthor()){
|
||||||
|
// 获取app用户数据
|
||||||
|
GetUserInfoResponse result = userInfo.getUserInfoByUuid(author.getDoctorIden());
|
||||||
|
CaseClinicalDoctorModel caseClinicalDoctor = userService.GetCaseClinicalDoctor(result);
|
||||||
|
|
||||||
|
CaseClinicalVideoAuthorModel caseClinicalVideoAuthor = new CaseClinicalVideoAuthorModel();
|
||||||
|
caseClinicalVideoAuthor.setVideoId(caseClinicalVideo.getVideoId());
|
||||||
|
caseClinicalVideoAuthor.setDoctorId(String.valueOf(caseClinicalDoctor.getDoctorId()));
|
||||||
|
caseClinicalVideoAuthorDao.insert(caseClinicalVideoAuthor);
|
||||||
|
|
||||||
|
// 新增作者统计
|
||||||
|
caseClinicalService.AddStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()));
|
||||||
|
|
||||||
|
// 新增医院统计
|
||||||
|
caseClinicalService.AddStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增统计
|
||||||
|
IncClinicalVideoStats(String.valueOf(caseClinicalVideo.getVideoId()),4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
if (Objects.equals(r.getAction(), "update")){
|
||||||
|
if (caseClinicalVideo == null){
|
||||||
|
throw new BusinessException("-1", "无法完成此操作");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文章主体
|
||||||
|
if (!Objects.equals(caseClinicalVideo.getVideoNo(), r.getVideoNo())){
|
||||||
|
caseClinicalVideo.setVideoNo(r.getVideoNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(caseClinicalVideo.getIsLink(), r.getIsLink())){
|
||||||
|
caseClinicalVideo.setIsLink(r.getIsLink());
|
||||||
|
|
||||||
|
if (!Objects.equals(caseClinicalVideo.getIsLinkUrl(), r.getIsLinkUrl())){
|
||||||
|
caseClinicalVideo.setIsLinkUrl(r.getIsLinkUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
caseClinicalVideoDao.updateById(caseClinicalVideo);
|
||||||
|
|
||||||
|
// 作者
|
||||||
|
// 获取全部作者
|
||||||
|
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, caseClinicalVideo.getVideoId());
|
||||||
|
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||||
|
|
||||||
|
List<addClinicalVideoApp.Author> addList = new ArrayList<>();
|
||||||
|
List<CaseClinicalVideoAuthorModel> deleteList = new ArrayList<>();
|
||||||
|
|
||||||
|
// // 新增作者和删除作者判断
|
||||||
|
// // 构建现有作者的唯一标识集合
|
||||||
|
// Map<String, CaseClinicalVideoAuthorModel> existingAuthorsMap = new HashMap<>();
|
||||||
|
// for (CaseClinicalVideoAuthorModel a : caseClinicalVideoAuthors) {
|
||||||
|
// String key = a.getCaseClinicalDoctor().getDoctorIden();
|
||||||
|
// existingAuthorsMap.put(key, a);
|
||||||
// }
|
// }
|
||||||
//
|
// // 构建新作者的唯一标识集合
|
||||||
// // 新增视频
|
// Map<String, addClinicalVideoApp.Author> newAuthorsMap = new HashMap<>();
|
||||||
// caseClinicalVideo = new CaseClinicalVideoModel();
|
// for (addClinicalVideoApp.Author a : r.getAuthor()) {
|
||||||
// caseClinicalVideo.setVideoTitle(r.getVideoTitle());
|
// String key = a.getDoctorIden();
|
||||||
// caseClinicalVideo.setVideoNo(r.getVideoNo());
|
// newAuthorsMap.put(key, a);
|
||||||
// caseClinicalVideo.setPushDate(r.getPushDate());
|
|
||||||
// caseClinicalVideo.setIsLink(r.getIsLink());
|
|
||||||
// caseClinicalVideo.setIsLinkUrl(r.getIsLinkUrl());
|
|
||||||
// int res = caseClinicalVideoDao.insert(caseClinicalVideo);
|
|
||||||
// if (res <= 0){
|
|
||||||
// throw new BusinessException("-1", "内部错误,添加视频失败");
|
|
||||||
// }
|
// }
|
||||||
//
|
// // 找出需要新增的作者
|
||||||
// // 新增标签
|
// for (addClinicalVideoApp.Author a : r.getAuthor()) {
|
||||||
// CaseClinicalVideoLabelModel caseClinicalVideoLabel = new CaseClinicalVideoLabelModel();
|
// String key = a.getDoctorIden();
|
||||||
// caseClinicalVideoLabel.setVideoId(caseClinicalVideo.getVideoId());
|
// if (!existingAuthorsMap.containsKey(key)) {
|
||||||
// }
|
// addList.add(a);
|
||||||
//
|
// }
|
||||||
// // 修改
|
// }
|
||||||
// if (Objects.equals(r.getAction(), "update")){
|
// // 找出需要删除的作者
|
||||||
//
|
// for (CaseClinicalVideoAuthorModel a : caseClinicalVideoAuthors) {
|
||||||
// }
|
// String key = a.getDoctorIden();
|
||||||
//
|
// if (!newAuthorsMap.containsKey(key)) {
|
||||||
// // 删除
|
// deleteList.add(a);
|
||||||
// if (Objects.equals(r.getAction(), "delete")){
|
// }
|
||||||
//
|
// }
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
if (Objects.equals(r.getAction(), "delete")){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,9 @@ public class CaseExchangeService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserVoteExchangeDao userVoteExchangeDao;
|
private UserVoteExchangeDao userVoteExchangeDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StatsCaseClinicalLabelDao statsCaseClinicalLabelDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增-病例交流
|
* 新增-病例交流
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
@ -472,7 +475,7 @@ public class CaseExchangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 新增统计字段
|
// 新增统计字段
|
||||||
boolean r = IncCaseExchangeStats(exchangeId,2);
|
boolean r = IncCaseExchangeStats(exchangeId,3);
|
||||||
if (!r){
|
if (!r){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return false;
|
return false;
|
||||||
@ -518,7 +521,7 @@ public class CaseExchangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 减少统计字段
|
// 减少统计字段
|
||||||
boolean r = DecCaseExchangeStats(String.valueOf(comment.getExchangeId()),1,1);
|
boolean r = DecCaseExchangeStats(String.valueOf(comment.getExchangeId()),3,1);
|
||||||
if (!r){
|
if (!r){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return false;
|
return false;
|
||||||
@ -752,6 +755,8 @@ public class CaseExchangeService {
|
|||||||
throw new BusinessException("操作失败");
|
throw new BusinessException("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 阅读量
|
// 阅读量
|
||||||
if (type == 1){
|
if (type == 1){
|
||||||
// 总
|
// 总
|
||||||
@ -762,6 +767,8 @@ public class CaseExchangeService {
|
|||||||
|
|
||||||
// 用户
|
// 用户
|
||||||
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_read_num",num);
|
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_read_num",num);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏量
|
// 收藏量
|
||||||
|
|||||||
@ -229,5 +229,44 @@ public class UserService {
|
|||||||
return basicHospital;
|
return basicHospital;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取临床医生数据
|
||||||
|
* @return UserModel
|
||||||
|
*/
|
||||||
|
public CaseClinicalDoctorModel GetCaseClinicalDoctor(GetUserInfoResponse r) throws BusinessException {
|
||||||
|
GetUserInfoResponse.ResponsData data = r.getData();
|
||||||
|
|
||||||
|
// 获取app医院数据
|
||||||
|
BasicHospitalModel basicHospital = GetAppHospital(data.getHospitalUuid());
|
||||||
|
|
||||||
|
// 获取对应医生数据
|
||||||
|
LambdaQueryWrapper<CaseClinicalDoctorModel> caseClinicalDoctorWrapper = new LambdaQueryWrapper<>();
|
||||||
|
caseClinicalDoctorWrapper.eq(CaseClinicalDoctorModel::getDoctorIden, data.getUuid());
|
||||||
|
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectOne(caseClinicalDoctorWrapper);
|
||||||
|
if (caseClinicalDoctor == null){
|
||||||
|
CaseClinicalDoctorModel c = new CaseClinicalDoctorModel();
|
||||||
|
c.setDoctorName(data.getRealname());
|
||||||
|
c.setDoctorIden(data.getUuid());
|
||||||
|
c.setHospitalId(basicHospital.getHospitalId());
|
||||||
|
c.setAvatar(data.getPhoto());
|
||||||
|
int res = caseClinicalDoctorDao.insert(c);
|
||||||
|
if (res <= 0){
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (!Objects.equals(caseClinicalDoctor.getDoctorName(), data.getRealname())){
|
||||||
|
caseClinicalDoctor.setDoctorName(data.getRealname());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(basicHospital.getHospitalId(), caseClinicalDoctor.getHospitalId())){
|
||||||
|
caseClinicalDoctor.setHospitalId(basicHospital.getHospitalId());
|
||||||
|
}
|
||||||
|
|
||||||
|
caseClinicalDoctorDao.updateById(caseClinicalDoctor);
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseClinicalDoctor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user