Compare commits
23 Commits
37dcdc20dd
...
c6a24e287a
| Author | SHA1 | Date | |
|---|---|---|---|
| c6a24e287a | |||
| db5d869f43 | |||
| 9ec9847c4b | |||
| b56cac4ffd | |||
| 7c310bb9a0 | |||
| b35c0e5b29 | |||
| 50b841c68f | |||
| 6814bd7b6e | |||
| 5509480265 | |||
| dc2b451911 | |||
| 7c91ce170f | |||
| 70b69c17a5 | |||
| 4bceffd6aa | |||
| 5d86e004b3 | |||
| 5cc3a7043c | |||
| b9bf589000 | |||
| 11f455aa0c | |||
| f83f74f592 | |||
| ea2bf574db | |||
| c77c2e328d | |||
| 3ad7d77cfd | |||
| dd89bfa023 | |||
| 428f8742ab |
@ -1,5 +1,5 @@
|
||||
# 第一阶段:使用 Maven + Java8 构建 JAR 包
|
||||
FROM maven:3.9.2-eclipse-temurin-8-alpine AS builder
|
||||
FROM maven:3.9.2-eclipse-temurin-17-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@ -22,13 +22,13 @@ RUN mkdir -p /root/.m2 && \
|
||||
# 复制项目代码
|
||||
COPY pom.xml .
|
||||
COPY sa-admin ./sa-admin
|
||||
COPY sa-common ./sa-common
|
||||
COPY sa-base ./sa-base
|
||||
|
||||
# 构建项目
|
||||
RUN mvn clean package -Dmaven.test.skip=true -P dev
|
||||
|
||||
# 第二阶段:使用更小的 Java8 JDK 镜像运行
|
||||
FROM eclipse-temurin:8-jdk-alpine
|
||||
FROM eclipse-temurin:17-jdk-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# 第一阶段:使用 Maven + Java8 构建 JAR 包
|
||||
FROM maven:3.9.2-eclipse-temurin-8-alpine AS builder
|
||||
FROM maven:3.9.2-eclipse-temurin-17-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@ -22,13 +22,13 @@ RUN mkdir -p /root/.m2 && \
|
||||
# 复制项目代码
|
||||
COPY pom.xml .
|
||||
COPY sa-admin ./sa-admin
|
||||
COPY sa-common ./sa-common
|
||||
COPY sa-base ./sa-base
|
||||
|
||||
# 构建项目
|
||||
RUN mvn clean package -Dmaven.test.skip=true -P prod
|
||||
|
||||
# 第二阶段:使用更小的 Java8 JDK 镜像运行
|
||||
FROM eclipse-temurin:8-jdk-alpine
|
||||
FROM eclipse-temurin:17-jdk-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
194
GET_APP_DOCTOR_CHANGE_README.md
Normal file
194
GET_APP_DOCTOR_CHANGE_README.md
Normal file
@ -0,0 +1,194 @@
|
||||
# getAppDoctor方法修改说明
|
||||
|
||||
## 🎯 修改目标
|
||||
|
||||
1. 修改后端 `getAppDoctor` 方法,不再将医院信息存储到数据库
|
||||
2. 处理返回的医生列表数据(之前是单个对象,现在是列表)
|
||||
3. 更新前端代码,支持从多个医生中选择
|
||||
4. 确保找到医生信息后,医院名称数据能正确展示
|
||||
|
||||
## 🔧 后端修改内容
|
||||
|
||||
### 1. 修改 `CaseClinicalDoctorService.java`
|
||||
|
||||
#### 主要变化:
|
||||
- **返回类型**: 从 `ResponseDTO<AppDoctorVO>` 改为 `ResponseDTO<List<AppDoctorVO>>`
|
||||
- **医院信息处理**: 不再存储到数据库,只获取并返回
|
||||
- **列表处理**: 遍历返回的医生列表,为每个医生创建VO对象
|
||||
|
||||
#### 具体修改:
|
||||
```java
|
||||
// 修改前
|
||||
public ResponseDTO<AppDoctorVO> getAppDoctor(String doctorName)
|
||||
|
||||
// 修改后
|
||||
public ResponseDTO<List<AppDoctorVO>> getAppDoctor(String doctorName)
|
||||
```
|
||||
|
||||
#### 医院信息处理逻辑:
|
||||
```java
|
||||
// 修改前:查询数据库并存储
|
||||
if (existingHospital != null) {
|
||||
appDoctor.setHospitalId(existingHospital.getHospitalId());
|
||||
appDoctor.setHospitalName(existingHospital.getHospitalName());
|
||||
} else {
|
||||
// 创建新的医院实体并插入数据库
|
||||
BasicHospitalEntity newHospital = new BasicHospitalEntity();
|
||||
// ... 设置医院信息
|
||||
basicHospitalDao.insert(newHospital);
|
||||
appDoctor.setHospitalId(newHospital.getHospitalId());
|
||||
appDoctor.setHospitalName(newHospital.getHospitalName());
|
||||
}
|
||||
|
||||
// 修改后:只获取信息,不存储
|
||||
if (hospitalResponse != null && hospitalResponse.getData() != null) {
|
||||
GetHospitalByUuidResponse.GetHospitalByUuidData hospitalData = hospitalResponse.getData();
|
||||
appDoctor.setHospitalName(hospitalData.getName());
|
||||
}
|
||||
```
|
||||
|
||||
## 🎨 前端修改内容
|
||||
|
||||
### 1. 修改 `case-clinical-doctor-form.vue`
|
||||
|
||||
#### 新增功能:
|
||||
- **医生选择对话框**: 当搜索到多个医生时,显示选择对话框
|
||||
- **列表展示**: 显示医生姓名、手机号、省份、医院等信息
|
||||
- **智能选择**: 只有一个结果时自动选择,多个结果时用户手动选择
|
||||
- **医院名称显示**: 在医生信息提示和医院选择区域显示医生所在医院
|
||||
|
||||
#### 新增变量:
|
||||
```javascript
|
||||
const doctorSelectionVisible = ref(false); // 医生选择对话框显示状态
|
||||
const doctorSelectionList = ref([]); // 医生选择列表
|
||||
```
|
||||
|
||||
#### 新增函数:
|
||||
```javascript
|
||||
// 显示医生选择对话框
|
||||
function showDoctorSelectionModal(doctorList) {
|
||||
doctorSelectionList.value = doctorList;
|
||||
doctorSelectionVisible.value = true;
|
||||
}
|
||||
|
||||
// 关闭医生选择对话框
|
||||
function closeDoctorSelectionModal() {
|
||||
doctorSelectionVisible.value = false;
|
||||
doctorSelectionList.value = [];
|
||||
}
|
||||
|
||||
// 选择医生
|
||||
function selectDoctor(doctor) {
|
||||
appDoctorInfo.value = doctor;
|
||||
closeDoctorSelectionModal();
|
||||
message.info('已选择医生,请确认是否使用此信息');
|
||||
}
|
||||
```
|
||||
|
||||
#### 修改搜索逻辑:
|
||||
```javascript
|
||||
// 修改前:直接使用返回数据
|
||||
if (result.data) {
|
||||
appDoctorInfo.value = result.data;
|
||||
message.info('找到APP医生信息,请确认是否使用');
|
||||
}
|
||||
|
||||
// 修改后:处理列表数据
|
||||
if (result.data && Array.isArray(result.data) && result.data.length > 0) {
|
||||
if (result.data.length === 1) {
|
||||
// 只有一个结果,直接使用
|
||||
appDoctorInfo.value = result.data[0];
|
||||
message.info('找到APP医生信息,请确认是否使用');
|
||||
} else {
|
||||
// 多个结果,显示选择对话框
|
||||
showDoctorSelectionModal(result.data);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 医院名称显示逻辑:
|
||||
```javascript
|
||||
// 医生信息提示中显示医院名称
|
||||
:description="`手机号:${appDoctorInfo.phone || '未知'} | 省份:${appDoctorInfo.province || '未知'}${appDoctorInfo.hospitalName ? ' | 医院:' + appDoctorInfo.hospitalName : ''}`"
|
||||
|
||||
// 医院选择区域显示医生所在医院
|
||||
<div v-if="form.hospitalName && !form.doctorId" style="margin-bottom: 8px;">
|
||||
<a-alert
|
||||
:message="`医生所在医院:${form.hospitalName}`"
|
||||
type="success"
|
||||
show-icon
|
||||
closable
|
||||
@close="form.hospitalName = undefined"
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
|
||||
#### 新增UI组件:
|
||||
```html
|
||||
<!-- 医生选择对话框 -->
|
||||
<a-modal
|
||||
title="选择医生"
|
||||
:open="doctorSelectionVisible"
|
||||
@cancel="closeDoctorSelectionModal"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
width="600px"
|
||||
>
|
||||
<div class="doctor-selection-list">
|
||||
<a-list :data-source="doctorSelectionList" item-layout="horizontal">
|
||||
<!-- 医生信息展示 -->
|
||||
</a-list>
|
||||
</div>
|
||||
</a-modal>
|
||||
```
|
||||
|
||||
## 📋 修改检查清单
|
||||
|
||||
### 后端修改:
|
||||
- [x] 修改返回类型为 `List<AppDoctorVO>`
|
||||
- [x] 移除医院信息存储逻辑
|
||||
- [x] 添加列表遍历处理
|
||||
- [x] 添加必要的import语句
|
||||
|
||||
### 前端修改:
|
||||
- [x] 修改搜索逻辑处理列表数据
|
||||
- [x] 添加医生选择对话框
|
||||
- [x] 添加相关状态变量
|
||||
- [x] 添加选择处理函数
|
||||
- [x] 添加样式美化
|
||||
|
||||
## 🚀 使用方法
|
||||
|
||||
### 1. 搜索医生
|
||||
- 在医生姓名输入框中输入姓名
|
||||
- 点击搜索按钮或按回车键
|
||||
|
||||
### 2. 处理搜索结果
|
||||
- **单个结果**: 自动显示医生信息,用户确认后使用
|
||||
- **多个结果**: 显示选择对话框,用户手动选择
|
||||
|
||||
### 3. 选择医生
|
||||
- 在选择对话框中查看医生详细信息
|
||||
- 点击"选择此医生"按钮确认选择
|
||||
|
||||
### 4. 医院信息显示
|
||||
- **医生信息提示**: 显示医生姓名、手机号、省份、医院名称
|
||||
- **医院选择区域**: 在所属医院字段上方显示医生所在医院
|
||||
- **手动选择**: 用户需要手动选择对应的医院(不自动设置)
|
||||
|
||||
## ⚠️ 注意事项
|
||||
|
||||
1. **数据一致性**: 后端不再存储医院信息,每次查询都是实时获取
|
||||
2. **性能考虑**: 多个医生时会有多次API调用获取医院信息
|
||||
3. **错误处理**: 如果医院信息获取失败,医生信息仍然可用
|
||||
4. **用户体验**: 多个结果时用户需要手动选择,增加了操作步骤
|
||||
|
||||
## ✅ 完成状态
|
||||
|
||||
- [x] 后端 `getAppDoctor` 方法修改完成
|
||||
- [x] 前端医生选择对话框添加完成
|
||||
- [x] 列表数据处理逻辑完成
|
||||
- [x] 样式美化完成
|
||||
- [x] 文档说明完成
|
||||
|
||||
**所有修改已完成!** 现在系统支持从多个医生中选择,并且不再将医院信息存储到数据库。
|
||||
@ -12,6 +12,8 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* SmartAdmin 项目启动类
|
||||
*
|
||||
@ -33,6 +35,10 @@ public class AdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication application = new SpringApplication(AdminApplication.class);
|
||||
|
||||
// 设置 JVM 全局默认时区(建议与数据库一致,比如 "Asia/Shanghai")
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||
|
||||
// 添加 日志监听器,使 log4j2-spring.xml 可以间接读取到配置文件的属性
|
||||
application.addListeners(new LogVariableListener(), new Ip2RegionListener());
|
||||
application.run(args);
|
||||
|
||||
@ -42,6 +42,9 @@ public class GetHospitalByUuidResponse
|
||||
/** 城市 */
|
||||
private String city_name;
|
||||
|
||||
/** 区县 */
|
||||
private String county_name;
|
||||
|
||||
/** 医生数量 */
|
||||
private Integer expert_num;
|
||||
}
|
||||
|
||||
@ -65,4 +65,50 @@ public class Hospital extends Base {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据医院名称获取医院数据
|
||||
public GetHospitalByUuidResponse getHospitalByName(String hospitalIden) throws BusinessException {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
|
||||
// 处理参数
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("hospital_uuid", hospitalIden);
|
||||
requestData.put("platform", appConfig.getPlatform());
|
||||
requestData.put("timestamp", timestamp);
|
||||
|
||||
// 生成签名
|
||||
String sign = genSignature(requestData,appConfig.getSecretKey());
|
||||
|
||||
String url = appConfig.getApiUrl() + "/expert-api/getHospitalByUuid";
|
||||
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
|
||||
GetHospitalByUuidResponse result = JSONUtil.toBean(response.body(), GetHospitalByUuidResponse.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package net.lab1024.sa.admin.extend.app.UserInfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GetUserInfoListResponse {
|
||||
/** 接口调用状态。200:正常;其它值:调用出错 */
|
||||
private int code;
|
||||
|
||||
/** 结果说明。如果接口调用出错,那么返回错误描述。成功则返回 ok */
|
||||
private String msg;
|
||||
|
||||
/** 接口返回的用户信息数据 */
|
||||
private List<ResponsData> data;
|
||||
|
||||
/** 接口是否调用成功 */
|
||||
private boolean success;
|
||||
|
||||
/** 错误信息或提示信息 */
|
||||
private String message;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ResponsData {
|
||||
|
||||
/** app唯一标识 */
|
||||
private String uuid;
|
||||
|
||||
/** 科室 */
|
||||
private String officeName;
|
||||
|
||||
/** 姓名 */
|
||||
private String realname;
|
||||
|
||||
/** 医院唯一标识 */
|
||||
private String hospitalUuid;
|
||||
|
||||
/** 手机号 */
|
||||
private String mobile;
|
||||
|
||||
/** 头像地址 */
|
||||
private String img_host;
|
||||
|
||||
/** 头像地址 */
|
||||
private String photo;
|
||||
|
||||
/** 创建时间 */
|
||||
private String createDate;
|
||||
|
||||
/** 职称 */
|
||||
private String positionName;
|
||||
|
||||
/** 省份 */
|
||||
private String provName;
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -159,7 +160,7 @@ public class UserInfo extends Base {
|
||||
}
|
||||
|
||||
// 根据姓名获取信息
|
||||
public GetUserInfoResponse getUserInfoByName(String doctorName) throws BusinessException {
|
||||
public GetUserInfoListResponse getUserInfoByName(String doctorName) throws BusinessException {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
|
||||
// 处理参数
|
||||
@ -186,7 +187,7 @@ public class UserInfo extends Base {
|
||||
}
|
||||
|
||||
// 反序列化 JSON
|
||||
GetUserInfoResponse result = JSONUtil.toBean(response.body(), GetUserInfoResponse.class);
|
||||
GetUserInfoListResponse result = JSONUtil.toBean(response.body(), GetUserInfoListResponse.class);
|
||||
log.info("获取app数据返回:{}",result);
|
||||
if (result.getCode() != 200){
|
||||
if (!Objects.equals(result.getMsg(), "")){
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.basicHospital.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -71,11 +73,13 @@ public class BasicHospitalEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
package net.lab1024.sa.admin.module.business.basicHospital.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import net.lab1024.sa.admin.extend.app.Hospital.GetHospitalByUuidResponse;
|
||||
import net.lab1024.sa.admin.extend.app.Hospital.Hospital;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.dao.BasicHospitalDao;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.entity.BasicHospitalEntity;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.form.BasicHospitalQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.form.BasicHospitalQueryListForm;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.vo.BasicHospitalVO;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
@ -16,6 +21,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.baomidou.mybatisplus.extension.toolkit.Db.save;
|
||||
|
||||
/**
|
||||
* 基础数据-医院 Service
|
||||
*
|
||||
@ -30,6 +37,9 @@ public class BasicHospitalService {
|
||||
@Resource
|
||||
private BasicHospitalDao basicHospitalDao;
|
||||
|
||||
@Resource
|
||||
private Hospital hospital;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@ -43,6 +53,75 @@ public class BasicHospitalService {
|
||||
* 列表查询
|
||||
*/
|
||||
public List<BasicHospitalVO> queryList(BasicHospitalQueryListForm queryForm) {
|
||||
// 获取app医院名称
|
||||
try {
|
||||
GetAppHospitalByName(queryForm.getKeywords());
|
||||
} catch (Exception e) {
|
||||
// 不处理
|
||||
}
|
||||
|
||||
return basicHospitalDao.queryList(queryForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app医院数据
|
||||
* @param hospitalIden app医院唯一标识
|
||||
* @return BasicHospitalEntity
|
||||
*/
|
||||
public BasicHospitalEntity GetAppHospital(String hospitalIden) throws BusinessException {
|
||||
// 查询数据库医院信息
|
||||
LambdaQueryWrapper<BasicHospitalEntity> basicHospitalWrapper = new LambdaQueryWrapper<>();
|
||||
basicHospitalWrapper.eq(BasicHospitalEntity::getHospitalIden, hospitalIden);
|
||||
BasicHospitalEntity basicHospital = basicHospitalDao.selectOne(basicHospitalWrapper);
|
||||
if (basicHospital == null){
|
||||
// 请求接口获取数据
|
||||
GetHospitalByUuidResponse result = hospital.getHospitalByUuid(hospitalIden);
|
||||
GetHospitalByUuidResponse.GetHospitalByUuidData data = result.getData();
|
||||
|
||||
// 构造 UserEntity 对象
|
||||
basicHospital = new BasicHospitalEntity();
|
||||
basicHospital.setHospitalIden(hospitalIden);
|
||||
basicHospital.setHospitalName(data.getName());
|
||||
basicHospital.setSource(2);
|
||||
basicHospital.setHospitalLevel(data.getLevel());
|
||||
basicHospital.setDoctorNumber(data.getExpert_num());
|
||||
basicHospital.setProvince(data.getProv_name());
|
||||
basicHospital.setCity(data.getCity_name());
|
||||
basicHospital.setCounty(data.getCounty_name());
|
||||
save(basicHospital);
|
||||
}
|
||||
|
||||
return basicHospital;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app医院数据 -名称搜索
|
||||
* @param hospitalName app医院名称
|
||||
* @return BasicHospitalEntity
|
||||
*/
|
||||
public BasicHospitalEntity GetAppHospitalByName(String hospitalName) throws BusinessException {
|
||||
// 查询数据库医院信息
|
||||
LambdaQueryWrapper<BasicHospitalEntity> basicHospitalWrapper = new LambdaQueryWrapper<>();
|
||||
basicHospitalWrapper.eq(BasicHospitalEntity::getHospitalName, hospitalName);
|
||||
BasicHospitalEntity basicHospital = basicHospitalDao.selectOne(basicHospitalWrapper);
|
||||
if (basicHospital == null){
|
||||
// 请求接口获取数据
|
||||
GetHospitalByUuidResponse result = hospital.getHospitalByName(hospitalName);
|
||||
GetHospitalByUuidResponse.GetHospitalByUuidData data = result.getData();
|
||||
|
||||
// 构造 UserEntity 对象
|
||||
basicHospital = new BasicHospitalEntity();
|
||||
basicHospital.setHospitalIden(data.getUuid());
|
||||
basicHospital.setHospitalName(data.getName());
|
||||
basicHospital.setSource(2);
|
||||
basicHospital.setHospitalLevel(data.getLevel());
|
||||
basicHospital.setDoctorNumber(data.getExpert_num());
|
||||
basicHospital.setProvince(data.getProv_name());
|
||||
basicHospital.setCity(data.getCity_name());
|
||||
basicHospital.setCounty(data.getCounty_name());
|
||||
save(basicHospital);
|
||||
}
|
||||
|
||||
return basicHospital;
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ public class CaseClinicalService {
|
||||
|
||||
// 新增医院统计
|
||||
@Transactional
|
||||
public StatsCaseClinicalHospitalEntity IncStatsCaseClinicalHospital(String hospitalId, Integer type, LocalDateTime lastPushDate){
|
||||
public StatsCaseClinicalHospitalEntity IncStatsCaseClinicalHospital(String hospitalId, Integer type, LocalDateTime lastPushDate,Integer num){
|
||||
LambdaQueryWrapper<StatsCaseClinicalHospitalEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseClinicalHospitalEntity::getHospitalId, hospitalId);
|
||||
StatsCaseClinicalHospitalEntity statsCaseClinicalHospital = statsCaseClinicalHospitalDao.selectOne(mapQueryWrapper);
|
||||
@ -185,9 +185,9 @@ public class CaseClinicalService {
|
||||
statsCaseClinicalHospital.setHospitalId(Long.valueOf(hospitalId));
|
||||
|
||||
if (type == 1){
|
||||
statsCaseClinicalHospital.setArticleNum(1);
|
||||
statsCaseClinicalHospital.setArticleNum(num);
|
||||
}else if(type == 2){
|
||||
statsCaseClinicalHospital.setVideoNum(1);
|
||||
statsCaseClinicalHospital.setVideoNum(num);
|
||||
}
|
||||
|
||||
if (lastPushDate!=null){
|
||||
@ -196,9 +196,14 @@ public class CaseClinicalService {
|
||||
statsCaseClinicalHospitalDao.insert(statsCaseClinicalHospital);
|
||||
}else{
|
||||
if (type == 1){
|
||||
statsCaseClinicalHospitalDao.inc(statsCaseClinicalHospital.getHospitalId(),"article_num",1);
|
||||
if (lastPushDate!=null){
|
||||
statsCaseClinicalHospital.setLastPushDate(lastPushDate);
|
||||
statsCaseClinicalHospitalDao.updateById(statsCaseClinicalHospital);
|
||||
}
|
||||
|
||||
statsCaseClinicalHospitalDao.inc(statsCaseClinicalHospital.getHospitalId(),"article_num",num);
|
||||
}else{
|
||||
statsCaseClinicalHospitalDao.inc(statsCaseClinicalHospital.getHospitalId(),"video_num",1);
|
||||
statsCaseClinicalHospitalDao.inc(statsCaseClinicalHospital.getHospitalId(),"video_num",num);
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +217,7 @@ public class CaseClinicalService {
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public StatsCaseClinicalHospitalEntity DecStatsCaseClinicalHospital(String hospitalId,Integer type){
|
||||
public StatsCaseClinicalHospitalEntity DecStatsCaseClinicalHospital(String hospitalId,Integer type,Integer num){
|
||||
LambdaQueryWrapper<StatsCaseClinicalHospitalEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseClinicalHospitalEntity::getHospitalId, hospitalId);
|
||||
StatsCaseClinicalHospitalEntity statsCaseClinicalHospital = statsCaseClinicalHospitalDao.selectOne(mapQueryWrapper);
|
||||
@ -227,7 +232,7 @@ public class CaseClinicalService {
|
||||
statsCaseClinicalHospitalDao.updateById(statsCaseClinicalHospital);
|
||||
}
|
||||
|
||||
statsCaseClinicalHospitalDao.dec(statsCaseClinicalHospital.getHospitalId(),"article_num",1);
|
||||
statsCaseClinicalHospitalDao.dec(statsCaseClinicalHospital.getHospitalId(),"article_num",num);
|
||||
}else{
|
||||
// 最后一篇文章发表时间
|
||||
LocalDateTime lastPushDate = caseClinicalVideoDao.selectLastVideoPushDateByHospitalId(Long.valueOf(hospitalId));
|
||||
@ -235,7 +240,7 @@ public class CaseClinicalService {
|
||||
statsCaseClinicalHospital.setLastPushDate(lastPushDate);
|
||||
statsCaseClinicalHospitalDao.updateById(statsCaseClinicalHospital);
|
||||
}
|
||||
statsCaseClinicalHospitalDao.dec(statsCaseClinicalHospital.getHospitalId(),"video_num",1);
|
||||
statsCaseClinicalHospitalDao.dec(statsCaseClinicalHospital.getHospitalId(),"video_num",num);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.controller;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateDeleteStatusForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.service.UserCommentClinicalArticleService;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import net.lab1024.sa.base.common.domain.ValidateList;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 Controller
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Tag(name = "用户评论-临床病例-文章")
|
||||
public class UserCommentClinicalArticleController {
|
||||
|
||||
@Resource
|
||||
private UserCommentClinicalArticleService userCommentClinicalArticleService;
|
||||
|
||||
@Operation(summary = "分页查询 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/queryPage")
|
||||
@SaCheckPermission("userCommentClinicalArticle:query")
|
||||
public ResponseDTO<PageResult<UserCommentClinicalArticleVO>> queryPage(@RequestBody @Valid UserCommentClinicalArticleQueryForm queryForm) {
|
||||
return ResponseDTO.ok(userCommentClinicalArticleService.queryPage(queryForm));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/add")
|
||||
@SaCheckPermission("userCommentClinicalArticle:add")
|
||||
public ResponseDTO<String> add(@RequestBody @Valid UserCommentClinicalArticleAddForm addForm) {
|
||||
return userCommentClinicalArticleService.add(addForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/update")
|
||||
@SaCheckPermission("userCommentClinicalArticle:update")
|
||||
public ResponseDTO<String> update(@RequestBody @Valid UserCommentClinicalArticleUpdateForm updateForm) {
|
||||
return userCommentClinicalArticleService.update(updateForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改评论状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/updateStatus")
|
||||
@SaCheckPermission("userCommentClinicalArticle:update")
|
||||
public ResponseDTO<String> updateStatus(@RequestBody @Valid UserCommentStatusUpdateForm updateForm) {
|
||||
return userCommentClinicalArticleService.updateStatus(updateForm.getCommentId(), updateForm.getStatus());
|
||||
}
|
||||
|
||||
@Operation(summary = "修改置顶状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/updateTopStatus")
|
||||
@SaCheckPermission("userCommentClinicalArticle:update")
|
||||
public ResponseDTO<String> updateTopStatus(@RequestBody @Valid UserCommentTopUpdateForm updateForm) {
|
||||
return userCommentClinicalArticleService.updateTopStatus(updateForm.getCommentId(), updateForm.getIsTop());
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/batchDelete")
|
||||
@SaCheckPermission("userCommentClinicalArticle:delete")
|
||||
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
|
||||
return userCommentClinicalArticleService.batchDelete(idList);
|
||||
}
|
||||
|
||||
@Operation(summary = "单个删除 @author xing")
|
||||
@GetMapping("/userCommentClinicalArticle/delete/{commentId}")
|
||||
@SaCheckPermission("userCommentClinicalArticle:delete")
|
||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||
return userCommentClinicalArticleService.delete(commentId);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新删除状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalArticle/updateDeleteStatus")
|
||||
@SaCheckPermission("userCommentClinicalArticle:delete")
|
||||
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentClinicalArticleUpdateDeleteStatusForm updateForm) {
|
||||
return userCommentClinicalArticleService.updateDeleteStatus(updateForm);
|
||||
}
|
||||
}
|
||||
@ -39,8 +39,8 @@ public interface CaseClinicalArticleDao extends BaseMapper<CaseClinicalArticleEn
|
||||
* @param numeral 增加的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_clinical SET ${field} = ${field} + #{numeral} WHERE stats_id = #{statsId}")
|
||||
int inc(@Param("statsId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
@Update("UPDATE case_clinical_article SET ${field} = ${field} + #{numeral} WHERE article_id = #{articleId}")
|
||||
int inc(@Param("articleId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* Dec 自减
|
||||
@ -50,10 +50,10 @@ public interface CaseClinicalArticleDao extends BaseMapper<CaseClinicalArticleEn
|
||||
* @param numeral 减少的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_clinical " +
|
||||
@Update("UPDATE case_clinical_article " +
|
||||
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
||||
"WHERE stats_id = #{statsId}")
|
||||
int dec(@Param("statsId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
"WHERE article_id = #{articleId}")
|
||||
int dec(@Param("articleId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* 根据医院ID查询该医院最后一篇文章的发表时间
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity.UserCommentClinicalArticleEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 Dao
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface UserCommentClinicalArticleDao extends BaseMapper<UserCommentClinicalArticleEntity> {
|
||||
|
||||
/**
|
||||
* 分页 查询
|
||||
*
|
||||
* @param page
|
||||
* @param queryForm
|
||||
* @return
|
||||
*/
|
||||
List<UserCommentClinicalArticleVO> queryPage(Page page, @Param("queryForm") UserCommentClinicalArticleQueryForm queryForm);
|
||||
|
||||
}
|
||||
@ -92,11 +92,13 @@ public class CaseClinicalArticleEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 作者
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -41,11 +43,13 @@ public class CaseClinicalArticleLabelEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 实体类
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("user_comment_clinical_article")
|
||||
public class UserCommentClinicalArticleEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 删除状态(0:否 1:是)
|
||||
*/
|
||||
private Integer deleteStatus;
|
||||
|
||||
/**
|
||||
* 是否置顶(0:否 1:是)
|
||||
*/
|
||||
private Integer isTop;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 是否作者评论(0:否 1:是)
|
||||
*/
|
||||
private Integer isAuthor;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 评论图片
|
||||
*/
|
||||
private String commentImage;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -35,8 +35,7 @@ public class CaseClinicalArticleAddForm {
|
||||
@NotNull(message = "发表时间 不能为空")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
@Schema(description = "是否外部链接(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否外部链接(0:否 1:是) 不能为空")
|
||||
@Schema(description = "是否外部链接(0:否 1:是)")
|
||||
private Integer isLink;
|
||||
|
||||
@Schema(description = "外部链接地址")
|
||||
@ -46,8 +45,7 @@ public class CaseClinicalArticleAddForm {
|
||||
@JsonDeserialize(using = FileKeyVoDeserializer.class)
|
||||
private String shareQrcode;
|
||||
|
||||
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "内容 不能为空")
|
||||
@Schema(description = "内容")
|
||||
private String articleContent;
|
||||
|
||||
@Schema(description = "作者列表")
|
||||
|
||||
@ -42,8 +42,7 @@ public class CaseClinicalArticleUpdateForm {
|
||||
@NotNull(message = "发表时间 不能为空")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
@Schema(description = "是否外部链接(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否外部链接(0:否 1:是) 不能为空")
|
||||
@Schema(description = "是否外部链接(0:否 1:是)")
|
||||
private Integer isLink;
|
||||
|
||||
@Schema(description = "外部链接地址")
|
||||
@ -53,8 +52,7 @@ public class CaseClinicalArticleUpdateForm {
|
||||
@JsonDeserialize(using = FileKeyVoDeserializer.class)
|
||||
private String shareQrcode;
|
||||
|
||||
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "内容 不能为空")
|
||||
@Schema(description = "内容")
|
||||
private String articleContent;
|
||||
|
||||
@Schema(description = "作者列表")
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 新建表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalArticleAddForm {
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 分页查询表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserCommentClinicalArticleQueryForm extends PageParam {
|
||||
|
||||
@Schema(description = "关键词(内容、标题)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 更新删除状态表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalArticleUpdateDeleteStatusForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "删除状态 不能为空")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalArticleUpdateForm {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "主键id 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentStatusUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "状态值", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "状态值 不能为空")
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论置顶状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentTopUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "置顶状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "置顶状态 不能为空")
|
||||
private Integer isTop;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.admin.util.Replace;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 列表VO
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalArticleVO {
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "医院名称")
|
||||
private String hospitalName;
|
||||
|
||||
@Schema(description = "父级ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||
private Integer isSensitive;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "点赞数量")
|
||||
private Integer likeNum;
|
||||
|
||||
@Schema(description = "是否作者评论(0:否 1:是)")
|
||||
private Integer isAuthor;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "评论内容(原版)")
|
||||
private String contentWord;
|
||||
|
||||
@Schema(description = "评论图片")
|
||||
private String commentImage;
|
||||
|
||||
public String getCommentImage() {
|
||||
if (commentImage == null || commentImage.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return Replace.addOssDomain(commentImage);
|
||||
}
|
||||
|
||||
@Schema(description = "文章标题")
|
||||
private String articleTitle;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.manager;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.dao.UserCommentClinicalArticleDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity.UserCommentClinicalArticleEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 Manager
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
@Service
|
||||
public class UserCommentClinicalArticleManager extends ServiceImpl<UserCommentClinicalArticleDao, UserCommentClinicalArticleEntity> {
|
||||
|
||||
|
||||
}
|
||||
@ -23,9 +23,8 @@ import net.lab1024.sa.admin.util.Replace;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticleAuthor.dao.CaseClinicalArticleAuthorDao;
|
||||
@ -238,7 +237,7 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),1);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +304,7 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),1);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1,1);
|
||||
}
|
||||
|
||||
caseClinicalArticleDao.deleteById(articleId);
|
||||
@ -360,7 +359,7 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),1);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1,1);
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
@ -517,7 +516,8 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()), 1);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()), 1);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),
|
||||
1,1);
|
||||
}
|
||||
} else if (status == 1) {
|
||||
// 状态改为正常,增加统计数量
|
||||
@ -551,7 +551,8 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()), 1, lastPushDate);
|
||||
|
||||
// 增加医院统计
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()), 1, lastPushDate);
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),
|
||||
1, lastPushDate,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -694,6 +695,7 @@ public class CaseClinicalArticleService {
|
||||
}
|
||||
|
||||
// 删除
|
||||
Set<String> deleteHospitalSet = new LinkedHashSet<>();
|
||||
for (CaseClinicalArticleAuthorEntity author : deleteList){
|
||||
// 获取医生数据
|
||||
LambdaQueryWrapper<CaseClinicalDoctorEntity> doctorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@ -712,8 +714,8 @@ public class CaseClinicalArticleService {
|
||||
// 减少作者统计
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),1);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1);
|
||||
// 增加需要减少的医院数据
|
||||
deleteHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||
|
||||
// 删除该作者
|
||||
caseClinicalArticleAuthorDao.deleteById(author.getAuthorId());
|
||||
@ -726,7 +728,15 @@ public class CaseClinicalArticleService {
|
||||
caseClinicalDoctorCertDao.delete(certWrapper);
|
||||
}
|
||||
|
||||
if (!deleteHospitalSet.isEmpty()){
|
||||
// 减少医院统计
|
||||
for (String hospitalId : deleteHospitalSet ){
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(hospitalId,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增新的作者
|
||||
Set<String> addHospitalSet = new LinkedHashSet<>();
|
||||
for (CaseClinicalArticleAuthorForm author : addList){
|
||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
@ -740,8 +750,8 @@ public class CaseClinicalArticleService {
|
||||
// 新增作者统计
|
||||
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),1,lastPushDate);
|
||||
|
||||
// 新增医院统计
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1,lastPushDate);
|
||||
// 增加需要增加的医院数据
|
||||
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||
|
||||
// 生成用户证书-文章/视频
|
||||
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
||||
@ -787,6 +797,16 @@ public class CaseClinicalArticleService {
|
||||
avatarByte
|
||||
);
|
||||
}
|
||||
|
||||
if (!addHospitalSet.isEmpty()){
|
||||
// 增加医院统计
|
||||
for (String hospitalId : addHospitalSet ){
|
||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByHospitalId(Long.valueOf(hospitalId));
|
||||
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(hospitalId,1,
|
||||
lastPushDate,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理文章标签
|
||||
|
||||
@ -0,0 +1,267 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticle.service;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.dao.UserCommentClinicalArticleDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity.UserCommentClinicalArticleEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateDeleteStatusForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-文章 Service
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UserCommentClinicalArticleService {
|
||||
|
||||
@Resource
|
||||
private UserCommentClinicalArticleDao userCommentClinicalArticleDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalArticleService caseClinicalArticleService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<UserCommentClinicalArticleVO> queryPage(UserCommentClinicalArticleQueryForm queryForm) {
|
||||
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
|
||||
List<UserCommentClinicalArticleVO> list = userCommentClinicalArticleDao.queryPage(page, queryForm);
|
||||
return SmartPageUtil.convert2PageResult(page, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> add(UserCommentClinicalArticleAddForm addForm) {
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticleEntity = SmartBeanUtil.copy(addForm, UserCommentClinicalArticleEntity.class);
|
||||
userCommentClinicalArticleDao.insert(userCommentClinicalArticleEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> update(UserCommentClinicalArticleUpdateForm updateForm) {
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticleEntity = SmartBeanUtil.copy(updateForm, UserCommentClinicalArticleEntity.class);
|
||||
userCommentClinicalArticleDao.updateById(userCommentClinicalArticleEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateStatus(Long commentId, Integer status) {
|
||||
if (null == commentId || null == status) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(commentId);
|
||||
if (null == userCommentClinicalArticle) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentClinicalArticle.getStatus(), status)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentClinicalArticle.setStatus(status);
|
||||
userCommentClinicalArticleDao.updateById(userCommentClinicalArticle);
|
||||
|
||||
// 正常
|
||||
if (status == 1){
|
||||
// 新增文章的统计字段
|
||||
boolean r = caseClinicalArticleService.IncClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 禁用
|
||||
if (status == 2){
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseClinicalArticleService.DecClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改置顶状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateTopStatus(Long commentId, Integer isTop) {
|
||||
if (null == commentId || null == isTop) {
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(commentId);
|
||||
if (null == userCommentClinicalArticle) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentClinicalArticle.getIsTop(), isTop)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentClinicalArticle.setIsTop(isTop);
|
||||
userCommentClinicalArticleDao.updateById(userCommentClinicalArticle);
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> batchDelete(List<Long> idList) {
|
||||
if (CollectionUtils.isEmpty(idList)){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
for (Long id : idList){
|
||||
// 获取评论数据
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(id);
|
||||
if (null == userCommentClinicalArticle) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseClinicalArticleService.DecClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentClinicalArticleDao.deleteById(id);
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> delete(Long commentId) {
|
||||
if (null == commentId){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(commentId);
|
||||
if (null == userCommentClinicalArticle) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseClinicalArticleService.DecClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentClinicalArticleDao.deleteById(commentId);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新删除状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateDeleteStatus(UserCommentClinicalArticleUpdateDeleteStatusForm updateForm) {
|
||||
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(updateForm.getCommentId());
|
||||
if (null == userCommentClinicalArticle) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 更新删除状态
|
||||
userCommentClinicalArticle.setDeleteStatus(updateForm.getDeleteStatus());
|
||||
userCommentClinicalArticleDao.updateById(userCommentClinicalArticle);
|
||||
|
||||
// 如果是从删除状态恢复,需要增加统计字段
|
||||
if (updateForm.getDeleteStatus() == 0) {
|
||||
boolean r = caseClinicalArticleService.IncClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
} else {
|
||||
// 如果是设置为删除状态,需要减少统计字段
|
||||
boolean r = caseClinicalArticleService.DecClinicalArticleStats(
|
||||
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalArticleAuthor.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -41,11 +42,13 @@ public class CaseClinicalArticleAuthorEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
|
||||
@ -92,7 +92,7 @@ public class CaseClinicalDoctorController {
|
||||
@Operation(summary = "获取APP医生信息 @author xing")
|
||||
@GetMapping("/caseClinicalDoctor/getAppDoctor")
|
||||
@SaCheckPermission("caseClinicalDoctor:query")
|
||||
public ResponseDTO<AppDoctorVO> getAppDoctor(@RequestParam String doctorName) {
|
||||
public ResponseDTO<List<AppDoctorVO>> getAppDoctor(@RequestParam String doctorName) {
|
||||
return caseClinicalDoctorService.getAppDoctor(doctorName);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -42,15 +44,16 @@ public class CaseClinicalDoctorCertEntity {
|
||||
* 证书图片
|
||||
*/
|
||||
private String certImage;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -53,11 +54,13 @@ public class CaseClinicalDoctorEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
|
||||
@ -34,4 +34,7 @@ public class CaseClinicalDoctorUpdateForm {
|
||||
@JsonDeserialize(using = FileKeyVoDeserializer.class)
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "所属医院id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "所属医院id 不能为空")
|
||||
private Long hospitalId;
|
||||
}
|
||||
@ -26,6 +26,12 @@ public class AppDoctorVO {
|
||||
@Schema(description = "省份")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "区")
|
||||
private String county;
|
||||
|
||||
@Schema(description = "医院UUID")
|
||||
private String hospitalUuid;
|
||||
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalDoctor.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.admin.extend.app.UserInfo.GetUserInfoListResponse;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.service.BasicHospitalService;
|
||||
import net.lab1024.sa.admin.module.business.caseClinical.service.CaseClinicalService;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.dao.CaseClinicalArticleDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.dao.CaseClinicalDoctorDao;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.dao.BasicHospitalDao;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.entity.BasicHospitalEntity;
|
||||
@ -13,6 +19,8 @@ import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.form.CaseC
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.form.CaseClinicalDoctorUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.vo.CaseClinicalDoctorVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.vo.AppDoctorVO;
|
||||
import net.lab1024.sa.admin.module.business.statsCaseClinical.dao.StatsCaseClinicalDoctorDao;
|
||||
import net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity.StatsCaseClinicalDoctorEntity;
|
||||
import net.lab1024.sa.admin.module.business.user.service.UserService;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
import net.lab1024.sa.admin.extend.app.UserInfo.UserInfo;
|
||||
@ -27,6 +35,7 @@ import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -61,6 +70,18 @@ public class CaseClinicalDoctorService {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalService caseClinicalService;
|
||||
|
||||
@Autowired
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
@Autowired
|
||||
private CaseClinicalArticleDao caseClinicalArticleDao;
|
||||
|
||||
@Autowired
|
||||
private BasicHospitalService basicHospitalService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@ -170,9 +191,25 @@ public class CaseClinicalDoctorService {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
// 没有 uuid 时,按表单直接新增
|
||||
// 没有 uuid 时,二次匹配
|
||||
// 二次匹配:姓名 + 医院
|
||||
LambdaQueryWrapper<CaseClinicalDoctorEntity> doctorWrapper = new LambdaQueryWrapper<>();
|
||||
doctorWrapper.eq(CaseClinicalDoctorEntity::getDoctorName, addForm.getDoctorName());
|
||||
doctorWrapper.eq(CaseClinicalDoctorEntity::getHospitalId, addForm.getHospitalId());
|
||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectOne(doctorWrapper);
|
||||
if (caseClinicalDoctor != null) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
CaseClinicalDoctorEntity caseClinicalDoctorEntity = SmartBeanUtil.copy(addForm, CaseClinicalDoctorEntity.class);
|
||||
caseClinicalDoctorDao.insert(caseClinicalDoctorEntity);
|
||||
|
||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByHospitalId(addForm.getHospitalId());
|
||||
|
||||
// 新增新的医院统计-文章
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(addForm.getHospitalId()),1,
|
||||
lastPushDate,0);
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -181,8 +218,40 @@ public class CaseClinicalDoctorService {
|
||||
*
|
||||
*/
|
||||
public ResponseDTO<String> update(CaseClinicalDoctorUpdateForm updateForm) {
|
||||
CaseClinicalDoctorEntity caseClinicalDoctorEntity = SmartBeanUtil.copy(updateForm, CaseClinicalDoctorEntity.class);
|
||||
caseClinicalDoctorDao.updateById(caseClinicalDoctorEntity);
|
||||
// 获取医生数据
|
||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectById(updateForm.getDoctorId());
|
||||
if (caseClinicalDoctor == null) {
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 检测医院是否改动
|
||||
if (!Objects.equals(caseClinicalDoctor.getHospitalId(), updateForm.getHospitalId())){
|
||||
// 获取医生统计
|
||||
LambdaQueryWrapper<StatsCaseClinicalDoctorEntity> doctorWrapper = new LambdaQueryWrapper<>();
|
||||
doctorWrapper.eq(StatsCaseClinicalDoctorEntity::getDoctorId, caseClinicalDoctor.getDoctorId());
|
||||
StatsCaseClinicalDoctorEntity statsCaseClinicalDoctor = statsCaseClinicalDoctorDao.selectOne(doctorWrapper);
|
||||
if (statsCaseClinicalDoctor != null) {
|
||||
// 减少医院统计-文章
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),1
|
||||
,statsCaseClinicalDoctor.getArticleNum());
|
||||
|
||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByHospitalId(updateForm.getHospitalId());
|
||||
|
||||
// 新增新的医院统计-文章
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(updateForm.getHospitalId()),1,
|
||||
lastPushDate,statsCaseClinicalDoctor.getArticleNum());
|
||||
|
||||
// 减少医院统计-视频
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2
|
||||
,statsCaseClinicalDoctor.getVideoNum());
|
||||
|
||||
// 新增新的医院统计-视频
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(updateForm.getHospitalId()),1,
|
||||
lastPushDate,statsCaseClinicalDoctor.getVideoNum());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -238,78 +307,55 @@ public class CaseClinicalDoctorService {
|
||||
/**
|
||||
* 获取APP医生信息
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<AppDoctorVO> getAppDoctor(String doctorName) {
|
||||
public ResponseDTO<List<AppDoctorVO>> getAppDoctor(String doctorName) {
|
||||
if (doctorName == null || doctorName.trim().isEmpty()) {
|
||||
return ResponseDTO.userErrorParam("医生姓名不能为空");
|
||||
}
|
||||
|
||||
// 调用UserInfo获取医生信息
|
||||
GetUserInfoResponse userInfoResponse = userInfo.getUserInfoByName(doctorName);
|
||||
GetUserInfoListResponse userInfoResponse = userInfo.getUserInfoByName(doctorName);
|
||||
|
||||
if (userInfoResponse == null || userInfoResponse.getData() == null) {
|
||||
throw new BusinessException("未找到医生信息");
|
||||
}
|
||||
|
||||
if (userInfoResponse.getData().getUuid() == null) {
|
||||
List<GetUserInfoListResponse.ResponsData> userDataList = userInfoResponse.getData();
|
||||
if (userDataList.isEmpty()) {
|
||||
throw new BusinessException("未找到医生信息");
|
||||
}
|
||||
|
||||
GetUserInfoResponse.ResponsData userData = userInfoResponse.getData();
|
||||
List<AppDoctorVO> appDoctorList = new ArrayList<>();
|
||||
|
||||
for (GetUserInfoListResponse.ResponsData userData : userDataList) {
|
||||
if (userData.getUuid() == null) {
|
||||
continue; // 跳过无效数据
|
||||
}
|
||||
|
||||
// 转换为AppDoctorVO
|
||||
AppDoctorVO appDoctor = new AppDoctorVO();
|
||||
appDoctor.setUuid(userData.getUuid());
|
||||
appDoctor.setDoctorName(userData.getRealname());
|
||||
appDoctor.setPhone(userData.getMobile());
|
||||
appDoctor.setProvince(userData.getProvName());
|
||||
appDoctor.setHospitalUuid(userData.getHospitalUuid());
|
||||
// 转换为AppDoctorVO
|
||||
AppDoctorVO appDoctor = new AppDoctorVO();
|
||||
appDoctor.setUuid(userData.getUuid());
|
||||
appDoctor.setDoctorName(userData.getRealname());
|
||||
appDoctor.setPhone(userData.getMobile());
|
||||
appDoctor.setProvince(userData.getProvName());
|
||||
appDoctor.setHospitalUuid(userData.getHospitalUuid());
|
||||
|
||||
// 如果存在hospitalUuid,检查并获取医院信息
|
||||
if (userData.getHospitalUuid() != null && !userData.getHospitalUuid().trim().isEmpty()) {
|
||||
// 先查询数据库中是否已存在该医院
|
||||
LambdaQueryWrapper<BasicHospitalEntity> hospitalQueryWrapper = new LambdaQueryWrapper<>();
|
||||
hospitalQueryWrapper.eq(BasicHospitalEntity::getHospitalIden, userData.getHospitalUuid());
|
||||
BasicHospitalEntity existingHospital = basicHospitalDao.selectOne(hospitalQueryWrapper);
|
||||
|
||||
if (existingHospital != null) {
|
||||
// 医院已存在,设置hospitalId和hospitalName
|
||||
appDoctor.setHospitalId(existingHospital.getHospitalId());
|
||||
appDoctor.setHospitalName(existingHospital.getHospitalName());
|
||||
} else {
|
||||
// 医院不存在,调用API获取医院信息并存储
|
||||
GetHospitalByUuidResponse hospitalResponse = hospital.getHospitalByUuid(userData.getHospitalUuid());
|
||||
|
||||
if (hospitalResponse == null || hospitalResponse.getData() == null) {
|
||||
// 如果存在hospitalUuid,获取医院信息(不存储到数据库)
|
||||
if (userData.getHospitalUuid() != null && !userData.getHospitalUuid().trim().isEmpty()) {
|
||||
BasicHospitalEntity existingHospital = basicHospitalService.GetAppHospital(userData.getHospitalUuid());
|
||||
if (existingHospital == null){
|
||||
throw new BusinessException("获取医院信息失败:医院数据为空");
|
||||
}
|
||||
|
||||
GetHospitalByUuidResponse.GetHospitalByUuidData hospitalData = hospitalResponse.getData();
|
||||
|
||||
// 创建新的医院实体
|
||||
BasicHospitalEntity newHospital = new BasicHospitalEntity();
|
||||
newHospital.setHospitalIden(hospitalData.getUuid());
|
||||
newHospital.setHospitalName(hospitalData.getName());
|
||||
newHospital.setHospitalLevel(hospitalData.getLevel());
|
||||
newHospital.setProvince(hospitalData.getProv_name());
|
||||
newHospital.setCity(hospitalData.getCity_name());
|
||||
newHospital.setDoctorNumber(hospitalData.getExpert_num());
|
||||
newHospital.setSource(2); // 默认来源为肝胆相照
|
||||
|
||||
// 插入医院数据
|
||||
basicHospitalDao.insert(newHospital);
|
||||
|
||||
// 设置返回的hospitalId和hospitalName
|
||||
appDoctor.setHospitalId(newHospital.getHospitalId());
|
||||
appDoctor.setHospitalName(newHospital.getHospitalName());
|
||||
|
||||
appDoctor.setHospitalId(existingHospital.getHospitalId());
|
||||
appDoctor.setHospitalName(existingHospital.getHospitalName());
|
||||
appDoctor.setCity(existingHospital.getCity());
|
||||
appDoctor.setCounty(existingHospital.getCounty());
|
||||
}
|
||||
} else {
|
||||
// 没有hospitalUuid,设置为null
|
||||
appDoctor.setHospitalId(null);
|
||||
appDoctor.setHospitalName(null);
|
||||
|
||||
appDoctorList.add(appDoctor);
|
||||
}
|
||||
|
||||
return ResponseDTO.ok(appDoctor);
|
||||
return ResponseDTO.ok(appDoctorList);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -404,34 +450,4 @@ public class CaseClinicalDoctorService {
|
||||
//
|
||||
// return caseClinicalDoctor;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取app医院数据
|
||||
* @param hospitalIden app医院唯一标识
|
||||
* @return BasicHospitalEntity
|
||||
*/
|
||||
public BasicHospitalEntity GetAppHospital(String hospitalIden) throws BusinessException {
|
||||
// 查询数据库医院信息
|
||||
LambdaQueryWrapper<BasicHospitalEntity> basicHospitalWrapper = new LambdaQueryWrapper<>();
|
||||
basicHospitalWrapper.eq(BasicHospitalEntity::getHospitalIden, hospitalIden);
|
||||
BasicHospitalEntity basicHospital = basicHospitalDao.selectOne(basicHospitalWrapper);
|
||||
if (basicHospital == null){
|
||||
// 请求接口获取数据
|
||||
GetHospitalByUuidResponse result = hospital.getHospitalByUuid(hospitalIden);
|
||||
GetHospitalByUuidResponse.GetHospitalByUuidData data = result.getData();
|
||||
|
||||
// 构造 UserEntity 对象
|
||||
basicHospital = new BasicHospitalEntity();
|
||||
basicHospital.setHospitalIden(hospitalIden);
|
||||
basicHospital.setHospitalName(data.getName());
|
||||
basicHospital.setSource(2);
|
||||
basicHospital.setHospitalLevel(data.getLevel());
|
||||
basicHospital.setDoctorNumber(data.getExpert_num());
|
||||
basicHospital.setProvince(data.getProv_name());
|
||||
basicHospital.setCity(data.getCity_name());
|
||||
save(basicHospital);
|
||||
}
|
||||
|
||||
return basicHospital;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.controller;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.form.CaseClinicalRecordScoreQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.vo.CaseClinicalRecordScoreVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.service.CaseClinicalRecordScoreService;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 积分发放记录 Controller
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Tag(name = "积分发放记录")
|
||||
public class CaseClinicalRecordScoreController {
|
||||
|
||||
@Resource
|
||||
private CaseClinicalRecordScoreService caseClinicalRecordScoreService;
|
||||
|
||||
@Operation(summary = "分页查询 @author xing")
|
||||
@PostMapping("/caseClinicalRecordScore/queryPage")
|
||||
@SaCheckPermission("caseClinicalRecordScore:query")
|
||||
public ResponseDTO<PageResult<CaseClinicalRecordScoreVO>> queryPage(@RequestBody @Valid CaseClinicalRecordScoreQueryForm queryForm) {
|
||||
return ResponseDTO.ok(caseClinicalRecordScoreService.queryPage(queryForm));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao;
|
||||
|
||||
import java.util.List;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity.CaseClinicalRecordScoreEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.form.CaseClinicalRecordScoreQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.vo.CaseClinicalRecordScoreVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 积分发放记录 Dao
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface CaseClinicalRecordScoreDao extends BaseMapper<CaseClinicalRecordScoreEntity> {
|
||||
|
||||
/**
|
||||
* 分页 查询
|
||||
*
|
||||
* @param page
|
||||
* @param queryForm
|
||||
* @return
|
||||
*/
|
||||
List<CaseClinicalRecordScoreVO> queryPage(Page page, @Param("queryForm") CaseClinicalRecordScoreQueryForm queryForm);
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分发放记录 实体类
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("case_clinical_record_score")
|
||||
public class CaseClinicalRecordScoreEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long scoreId;
|
||||
|
||||
/**
|
||||
* id(根据type不同,对应不同类型)
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型(1:文章 2:视频 3:病例交流)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 积分类型(1:完成阅读 2:阅读时间满足 3:优质留言 4:再次优质留言 5:病例互动-病例库)
|
||||
*/
|
||||
private Integer scoreType;
|
||||
|
||||
/**
|
||||
* 获取积分节点名称(如:阅读时间足够)
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.form;
|
||||
|
||||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 积分发放记录 分页查询表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CaseClinicalRecordScoreQueryForm extends PageParam {
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分发放记录 列表VO
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CaseClinicalRecordScoreVO {
|
||||
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long scoreId;
|
||||
|
||||
@Schema(description = "id(根据type不同,对应不同类型)")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型(1:文章 2:视频 3:病例交流)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "积分类型(1:完成阅读 2:阅读时间满足 3:优质留言 4:再次优质留言 5:病例互动-病例库)")
|
||||
private Integer scoreType;
|
||||
|
||||
@Schema(description = "获取积分节点名称(如:阅读时间足够)")
|
||||
private String nodeName;
|
||||
|
||||
@Schema(description = "积分")
|
||||
private Integer score;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.manager;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao.CaseClinicalRecordScoreDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity.CaseClinicalRecordScoreEntity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 积分发放记录 Manager
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
@Service
|
||||
public class CaseClinicalRecordScoreManager extends ServiceImpl<CaseClinicalRecordScoreDao, CaseClinicalRecordScoreEntity> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalRecordScore.service;
|
||||
|
||||
import java.util.List;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao.CaseClinicalRecordScoreDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity.CaseClinicalRecordScoreEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.form.CaseClinicalRecordScoreQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.vo.CaseClinicalRecordScoreVO;
|
||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 积分发放记录 Service
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-11 18:09:51
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CaseClinicalRecordScoreService {
|
||||
|
||||
@Resource
|
||||
private CaseClinicalRecordScoreDao caseClinicalRecordScoreDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<CaseClinicalRecordScoreVO> queryPage(CaseClinicalRecordScoreQueryForm queryForm) {
|
||||
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
|
||||
List<CaseClinicalRecordScoreVO> list = caseClinicalRecordScoreDao.queryPage(page, queryForm);
|
||||
return SmartPageUtil.convert2PageResult(page, list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.controller;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateDeleteStatusForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo.UserCommentClinicalVideoVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.service.UserCommentClinicalVideoService;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import net.lab1024.sa.base.common.domain.ValidateList;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 Controller
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Tag(name = "用户评论-临床病例-视频")
|
||||
public class UserCommentClinicalVideoController {
|
||||
|
||||
@Resource
|
||||
private UserCommentClinicalVideoService userCommentClinicalVideoService;
|
||||
|
||||
@Operation(summary = "分页查询 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/queryPage")
|
||||
@SaCheckPermission("userCommentClinicalVideo:query")
|
||||
public ResponseDTO<PageResult<UserCommentClinicalVideoVO>> queryPage(@RequestBody @Valid UserCommentClinicalVideoQueryForm queryForm) {
|
||||
return ResponseDTO.ok(userCommentClinicalVideoService.queryPage(queryForm));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/add")
|
||||
@SaCheckPermission("userCommentClinicalVideo:add")
|
||||
public ResponseDTO<String> add(@RequestBody @Valid UserCommentClinicalVideoAddForm addForm) {
|
||||
return userCommentClinicalVideoService.add(addForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/update")
|
||||
@SaCheckPermission("userCommentClinicalVideo:update")
|
||||
public ResponseDTO<String> update(@RequestBody @Valid UserCommentClinicalVideoUpdateForm updateForm) {
|
||||
return userCommentClinicalVideoService.update(updateForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改评论状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/updateStatus")
|
||||
@SaCheckPermission("userCommentClinicalVideo:update")
|
||||
public ResponseDTO<String> updateStatus(@RequestBody @Valid UserCommentStatusUpdateForm updateForm) {
|
||||
return userCommentClinicalVideoService.updateStatus(updateForm.getCommentId(), updateForm.getStatus());
|
||||
}
|
||||
|
||||
@Operation(summary = "修改置顶状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/updateTopStatus")
|
||||
@SaCheckPermission("userCommentClinicalVideo:update")
|
||||
public ResponseDTO<String> updateTopStatus(@RequestBody @Valid UserCommentTopUpdateForm updateForm) {
|
||||
return userCommentClinicalVideoService.updateTopStatus(updateForm.getCommentId(), updateForm.getIsTop());
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/batchDelete")
|
||||
@SaCheckPermission("userCommentClinicalVideo:delete")
|
||||
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
|
||||
return userCommentClinicalVideoService.batchDelete(idList);
|
||||
}
|
||||
|
||||
@Operation(summary = "单个删除 @author xing")
|
||||
@GetMapping("/userCommentClinicalVideo/delete/{commentId}")
|
||||
@SaCheckPermission("userCommentClinicalVideo:delete")
|
||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||
return userCommentClinicalVideoService.delete(commentId);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新删除状态 @author xing")
|
||||
@PostMapping("/userCommentClinicalVideo/updateDeleteStatus")
|
||||
@SaCheckPermission("userCommentClinicalVideo:delete")
|
||||
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentClinicalVideoUpdateDeleteStatusForm updateForm) {
|
||||
return userCommentClinicalVideoService.updateDeleteStatus(updateForm);
|
||||
}
|
||||
}
|
||||
@ -34,26 +34,27 @@ public interface CaseClinicalVideoDao extends BaseMapper<CaseClinicalVideoEntity
|
||||
|
||||
/**
|
||||
* Inc 自增
|
||||
* @param videoId 视频 ID
|
||||
* @param articleId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 增加的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_clinical SET ${field} = ${field} + #{numeral} WHERE stats_id = #{statsId}")
|
||||
int inc(@Param("statsId") Long videoId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
@Update("UPDATE case_clinical_video SET ${field} = ${field} + #{numeral} WHERE video_id = #{videoId}")
|
||||
int inc(@Param("videoId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
|
||||
/**
|
||||
* Dec 自减
|
||||
*
|
||||
* @param videoId 视频 ID
|
||||
* @param articleId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 减少的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_clinical " +
|
||||
@Update("UPDATE case_clinical_video " +
|
||||
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
||||
"WHERE stats_id = #{statsId}")
|
||||
int dec(@Param("statsId") Long videoId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
"WHERE video_id = #{videoId}")
|
||||
int dec(@Param("videoId") Long articleId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* 根据医院ID查询该医院最后一个视频的发表时间
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity.UserCommentClinicalVideoEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo.UserCommentClinicalVideoVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 Dao
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface UserCommentClinicalVideoDao extends BaseMapper<UserCommentClinicalVideoEntity> {
|
||||
|
||||
/**
|
||||
* 分页 查询
|
||||
*
|
||||
* @param page
|
||||
* @param queryForm
|
||||
* @return
|
||||
*/
|
||||
List<UserCommentClinicalVideoVO> queryPage(Page page, @Param("queryForm") UserCommentClinicalVideoQueryForm queryForm);
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -44,11 +45,13 @@ public class CaseClinicalVideoAuthorEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -91,11 +91,13 @@ public class CaseClinicalVideoEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 作者
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -41,11 +43,13 @@ public class CaseClinicalVideoLabelEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 实体类
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("user_comment_clinical_video")
|
||||
public class UserCommentClinicalVideoEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 删除状态(0:否 1:是)
|
||||
*/
|
||||
private Integer deleteStatus;
|
||||
|
||||
/**
|
||||
* 是否置顶(0:否 1:是)
|
||||
*/
|
||||
private Integer isTop;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 是否作者评论(0:否 1:是)
|
||||
*/
|
||||
private Integer isAuthor;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 评论图片
|
||||
*/
|
||||
private String commentImage;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -36,16 +36,14 @@ public class CaseClinicalVideoAddForm {
|
||||
@NotNull(message = "删除状态(0:否 1:是) 不能为空")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@Schema(description = "视频编号(保利)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "视频编号 不能为空")
|
||||
@Schema(description = "视频编号(保利)")
|
||||
private String videoNo;
|
||||
|
||||
@Schema(description = "发表时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "发表时间 不能为空")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
@Schema(description = "是否外部链接(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否外部链接(0:否 1:是) 不能为空")
|
||||
@Schema(description = "是否外部链接(0:否 1:是)")
|
||||
private Integer isLink;
|
||||
|
||||
@Schema(description = "外部链接地址")
|
||||
|
||||
@ -39,7 +39,7 @@ public class CaseClinicalVideoUpdateForm {
|
||||
@NotNull(message = "删除状态(0:否 1:是) 不能为空")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@Schema(description = "视频编号(保利)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "视频编号(保利)")
|
||||
@NotBlank(message = "视频编号 不能为空")
|
||||
private String videoNo;
|
||||
|
||||
@ -47,8 +47,7 @@ public class CaseClinicalVideoUpdateForm {
|
||||
@NotNull(message = "发表时间 不能为空")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
@Schema(description = "是否外部链接(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否外部链接(0:否 1:是) 不能为空")
|
||||
@Schema(description = "是否外部链接(0:否 1:是)")
|
||||
private Integer isLink;
|
||||
|
||||
@Schema(description = "外部链接地址")
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 新建表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalVideoAddForm {
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 分页查询表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserCommentClinicalVideoQueryForm extends PageParam {
|
||||
|
||||
@Schema(description = "关键词(内容、标题)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 更新删除状态表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalVideoUpdateDeleteStatusForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "删除状态 不能为空")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalVideoUpdateForm {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "主键id 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentStatusUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "状态值", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "状态值 不能为空")
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论置顶状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentTopUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "置顶状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "置顶状态 不能为空")
|
||||
private Integer isTop;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.admin.util.Replace;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 列表VO
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalVideoVO {
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "医院名称")
|
||||
private String hospitalName;
|
||||
|
||||
@Schema(description = "父级ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||
private Integer isSensitive;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "点赞数量")
|
||||
private Integer likeNum;
|
||||
|
||||
@Schema(description = "是否作者评论(0:否 1:是)")
|
||||
private Integer isAuthor;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "评论内容(原版)")
|
||||
private String contentWord;
|
||||
|
||||
@Schema(description = "评论图片")
|
||||
private String commentImage;
|
||||
|
||||
public String getCommentImage() {
|
||||
if (commentImage == null || commentImage.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return Replace.addOssDomain(commentImage);
|
||||
}
|
||||
|
||||
@Schema(description = "视频标题")
|
||||
private String videoTitle;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.manager;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.dao.UserCommentClinicalVideoDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity.UserCommentClinicalVideoEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 Manager
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
@Service
|
||||
public class UserCommentClinicalVideoManager extends ServiceImpl<UserCommentClinicalVideoDao, UserCommentClinicalVideoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@ -23,9 +23,8 @@ import net.lab1024.sa.admin.util.Replace;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.dao.CaseClinicalVideoAuthorDao;
|
||||
@ -237,7 +236,8 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),2);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2
|
||||
,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,8 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),2);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2
|
||||
,1);
|
||||
}
|
||||
|
||||
caseClinicalVideoDao.deleteById(videoId);
|
||||
@ -359,7 +360,7 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()),2);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2,1);
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
@ -516,7 +517,8 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()), 2);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()), 2);
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),
|
||||
2,1);
|
||||
}
|
||||
} else if (status == 1) {
|
||||
// 状态改为正常,增加统计数量
|
||||
@ -550,7 +552,8 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(author.getDoctorId()), 2, lastPushDate);
|
||||
|
||||
// 增加医院统计
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()), 2, lastPushDate);
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),
|
||||
2, lastPushDate,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,6 +608,7 @@ public class CaseClinicalVideoService {
|
||||
}
|
||||
|
||||
// 删除
|
||||
Set<String> deleteHospitalSet = new LinkedHashSet<>();
|
||||
for (CaseClinicalVideoAuthorEntity author : deleteList){
|
||||
// 获取医生数据
|
||||
LambdaQueryWrapper<CaseClinicalDoctorEntity> doctorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@ -623,8 +627,8 @@ public class CaseClinicalVideoService {
|
||||
// 减少作者统计
|
||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),2);
|
||||
|
||||
// 减少医院统计
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2);
|
||||
// 增加需要减少的医院数据
|
||||
deleteHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||
|
||||
// 删除该作者
|
||||
caseClinicalVideoAuthorDao.deleteById(author.getAuthorId());
|
||||
@ -637,7 +641,15 @@ public class CaseClinicalVideoService {
|
||||
caseClinicalDoctorCertDao.delete(certWrapper);
|
||||
}
|
||||
|
||||
if (!deleteHospitalSet.isEmpty()){
|
||||
// 减少医院统计
|
||||
for (String hospitalId : deleteHospitalSet ){
|
||||
caseClinicalService.DecStatsCaseClinicalHospital(hospitalId,2,1);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增新的作者
|
||||
Set<String> addHospitalSet = new LinkedHashSet<>();
|
||||
for (CaseClinicalVideoAuthorForm author : addList){
|
||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
@ -651,8 +663,8 @@ public class CaseClinicalVideoService {
|
||||
// 新增作者统计
|
||||
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),2,lastPushDate);
|
||||
|
||||
// 新增医院统计
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2,lastPushDate);
|
||||
// 增加需要增加的医院数据
|
||||
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||
|
||||
// 生成用户证书-文章/视频
|
||||
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
||||
@ -698,6 +710,17 @@ public class CaseClinicalVideoService {
|
||||
avatarByte
|
||||
);
|
||||
}
|
||||
|
||||
if (!addHospitalSet.isEmpty()){
|
||||
// 增加医院统计
|
||||
for (String hospitalId : addHospitalSet ){
|
||||
LocalDateTime lastPushDate = caseClinicalVideoDao.selectLastVideoPushDateByHospitalId(Long.valueOf(hospitalId));
|
||||
|
||||
// 新增医院统计
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(hospitalId,2,
|
||||
lastPushDate,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,265 @@
|
||||
package net.lab1024.sa.admin.module.business.caseClinicalVideo.service;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity.UserCommentClinicalVideoEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity.UserCommentClinicalVideoEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.dao.UserCommentClinicalVideoDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.entity.UserCommentClinicalVideoEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo.UserCommentClinicalVideoVO;
|
||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateDeleteStatusForm;
|
||||
|
||||
/**
|
||||
* 用户评论-临床病例-视频 Service
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UserCommentClinicalVideoService {
|
||||
|
||||
@Resource
|
||||
private UserCommentClinicalVideoDao userCommentClinicalVideoDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalVideoService caseClinicalVideoService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<UserCommentClinicalVideoVO> queryPage(UserCommentClinicalVideoQueryForm queryForm) {
|
||||
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
|
||||
List<UserCommentClinicalVideoVO> list = userCommentClinicalVideoDao.queryPage(page, queryForm);
|
||||
return SmartPageUtil.convert2PageResult(page, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> add(UserCommentClinicalVideoAddForm addForm) {
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideoEntity = SmartBeanUtil.copy(addForm, UserCommentClinicalVideoEntity.class);
|
||||
userCommentClinicalVideoDao.insert(userCommentClinicalVideoEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> update(UserCommentClinicalVideoUpdateForm updateForm) {
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideoEntity = SmartBeanUtil.copy(updateForm, UserCommentClinicalVideoEntity.class);
|
||||
userCommentClinicalVideoDao.updateById(userCommentClinicalVideoEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateStatus(Long commentId, Integer status) {
|
||||
if (null == commentId || null == status) {
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(commentId);
|
||||
if (null == userCommentClinicalVideo) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentClinicalVideo.getStatus(), status)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentClinicalVideo.setStatus(status);
|
||||
userCommentClinicalVideoDao.updateById(userCommentClinicalVideo);
|
||||
|
||||
// 正常
|
||||
if (status == 1){
|
||||
// 新增文章的统计字段
|
||||
boolean r = caseClinicalVideoService.IncClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 禁用
|
||||
if (status == 2){
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改置顶状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateTopStatus(Long commentId, Integer isTop) {
|
||||
if (null == commentId || null == isTop) {
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(commentId);
|
||||
if (null == userCommentClinicalVideo) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentClinicalVideo.getIsTop(), isTop)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentClinicalVideo.setIsTop(isTop);
|
||||
userCommentClinicalVideoDao.updateById(userCommentClinicalVideo);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> batchDelete(List<Long> idList) {
|
||||
if (CollectionUtils.isEmpty(idList)){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
for (Long id : idList){
|
||||
// 获取评论数据
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(id);
|
||||
if (null == userCommentClinicalVideo) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentClinicalVideoDao.deleteById(id);
|
||||
}
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> delete(Long commentId) {
|
||||
if (null == commentId){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(commentId);
|
||||
if (null == userCommentClinicalVideo) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少视频的统计字段
|
||||
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentClinicalVideoDao.deleteById(commentId);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新删除状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateDeleteStatus(UserCommentClinicalVideoUpdateDeleteStatusForm updateForm) {
|
||||
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(updateForm.getCommentId());
|
||||
if (null == userCommentClinicalVideo) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 更新删除状态
|
||||
userCommentClinicalVideo.setDeleteStatus(updateForm.getDeleteStatus());
|
||||
userCommentClinicalVideoDao.updateById(userCommentClinicalVideo);
|
||||
|
||||
// 如果是从删除状态恢复,需要增加统计字段
|
||||
if (updateForm.getDeleteStatus() == 0) {
|
||||
boolean r = caseClinicalVideoService.IncClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
} else {
|
||||
// 如果是设置为删除状态,需要减少统计字段
|
||||
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchang
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeSelectedUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeVoteUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeAuditStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.CaseExchangeVO;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.CaseExchangeVoteDetailVO;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.service.CaseExchangeService;
|
||||
@ -111,4 +112,11 @@ public class CaseExchangeController {
|
||||
public ResponseDTO<String> selectedUpdate(@RequestBody @Valid CaseExchangeSelectedUpdateForm updateForm) {
|
||||
return caseExchangeService.updateSelected(updateForm.getExchangeId(), updateForm.getIsSelected());
|
||||
}
|
||||
|
||||
@Operation(summary = "更新审核状态 @author xing")
|
||||
@PostMapping("/caseExchange/auditStatus/update")
|
||||
@SaCheckPermission("caseExchange:auditStatusUpdate")
|
||||
public ResponseDTO<String> auditStatusUpdate(@RequestBody @Valid CaseExchangeAuditStatusUpdateForm updateForm) {
|
||||
return caseExchangeService.updateAuditStatus(updateForm.getExchangeId(), updateForm.getAuditStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.controller;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateDeleteStatusForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.service.UserCommentExchangeService;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import net.lab1024.sa.base.common.domain.ValidateList;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 Controller
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Tag(name = "用户评论-病例交流")
|
||||
public class UserCommentExchangeController {
|
||||
|
||||
@Resource
|
||||
private UserCommentExchangeService userCommentExchangeService;
|
||||
|
||||
@Operation(summary = "分页查询 @author xing")
|
||||
@PostMapping("/userCommentExchange/queryPage")
|
||||
@SaCheckPermission("userCommentExchange:query")
|
||||
public ResponseDTO<PageResult<UserCommentExchangeVO>> queryPage(@RequestBody @Valid UserCommentExchangeQueryForm queryForm) {
|
||||
return ResponseDTO.ok(userCommentExchangeService.queryPage(queryForm));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加 @author xing")
|
||||
@PostMapping("/userCommentExchange/add")
|
||||
@SaCheckPermission("userCommentExchange:add")
|
||||
public ResponseDTO<String> add(@RequestBody @Valid UserCommentExchangeAddForm addForm) {
|
||||
return userCommentExchangeService.add(addForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新 @author xing")
|
||||
@PostMapping("/userCommentExchange/update")
|
||||
@SaCheckPermission("userCommentExchange:update")
|
||||
public ResponseDTO<String> update(@RequestBody @Valid UserCommentExchangeUpdateForm updateForm) {
|
||||
return userCommentExchangeService.update(updateForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改评论状态 @author xing")
|
||||
@PostMapping("/userCommentExchange/updateStatus")
|
||||
@SaCheckPermission("userCommentExchange:update")
|
||||
public ResponseDTO<String> updateStatus(@RequestBody @Valid UserCommentStatusUpdateForm updateForm) {
|
||||
return userCommentExchangeService.updateStatus(updateForm.getCommentId(), updateForm.getStatus());
|
||||
}
|
||||
|
||||
@Operation(summary = "修改置顶状态 @author xing")
|
||||
@PostMapping("/userCommentExchange/updateTopStatus")
|
||||
@SaCheckPermission("userCommentExchange:update")
|
||||
public ResponseDTO<String> updateTopStatus(@RequestBody @Valid UserCommentTopUpdateForm updateForm) {
|
||||
return userCommentExchangeService.updateTopStatus(updateForm.getCommentId(), updateForm.getIsTop());
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除 @author xing")
|
||||
@PostMapping("/userCommentExchange/batchDelete")
|
||||
@SaCheckPermission("userCommentExchange:delete")
|
||||
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
|
||||
return userCommentExchangeService.batchDelete(idList);
|
||||
}
|
||||
|
||||
@Operation(summary = "单个删除 @author xing")
|
||||
@GetMapping("/userCommentExchange/delete/{commentId}")
|
||||
@SaCheckPermission("userCommentExchange:delete")
|
||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||
return userCommentExchangeService.delete(commentId);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新删除状态 @author xing")
|
||||
@PostMapping("/userCommentExchange/updateDeleteStatus")
|
||||
@SaCheckPermission("userCommentExchange:delete")
|
||||
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentExchangeUpdateDeleteStatusForm updateForm) {
|
||||
return userCommentExchangeService.updateDeleteStatus(updateForm);
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -30,4 +31,25 @@ public interface CaseExchangeDao extends BaseMapper<CaseExchangeEntity> {
|
||||
*/
|
||||
List<CaseExchangeVO> queryPage(Page page, @Param("queryForm") CaseExchangeQueryForm queryForm);
|
||||
|
||||
/**
|
||||
* Inc 自增
|
||||
* @param exchangeId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 增加的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE case_exchange SET ${field} = ${field} + #{numeral} WHERE exchange_id = #{exchangeId}")
|
||||
int inc(@Param("exchangeId") Long exchangeId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* Dec 自减
|
||||
*
|
||||
* @param exchangeId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 减少的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE case_exchange SET ${field} = ${field} - #{numeral} WHERE exchange_id = #{exchangeId}")
|
||||
int dec(@Param("exchangeId") Long exchangeId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -30,4 +31,26 @@ public interface StatsCaseExchangeDao extends BaseMapper<StatsCaseExchangeEntity
|
||||
*/
|
||||
List<StatsCaseExchangeVO> queryPage(Page page, @Param("queryForm") StatsCaseExchangeQueryForm queryForm);
|
||||
|
||||
/**
|
||||
* Inc 自增
|
||||
* @param statsId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 增加的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_exchange SET ${field} = ${field} + #{numeral} WHERE stats_id = #{statsId}")
|
||||
int inc(@Param("statsId") Long statsId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* Dec 自减
|
||||
*
|
||||
* @param statsId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 减少的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_exchange " +
|
||||
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
||||
"WHERE stats_id = #{statsId}")
|
||||
int dec(@Param("statsId") Long statsId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -30,4 +31,26 @@ public interface StatsCaseExchangeUserDao extends BaseMapper<StatsCaseExchangeUs
|
||||
*/
|
||||
List<StatsCaseExchangeUserVO> queryPage(Page page, @Param("queryForm") StatsCaseExchangeUserQueryForm queryForm);
|
||||
|
||||
/**
|
||||
* Inc 自增
|
||||
* @param userId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 增加的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_exchange_user SET ${field} = ${field} + #{numeral} WHERE user_id = #{userId}")
|
||||
int inc(@Param("userId") Long userId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
|
||||
/**
|
||||
* Dec 自减
|
||||
*
|
||||
* @param userId 文章 ID
|
||||
* @param field 字段名称
|
||||
* @param numeral 减少的数值
|
||||
* @return 更新的行数
|
||||
*/
|
||||
@Update("UPDATE stats_case_exchange_user " +
|
||||
"SET ${field} = CASE WHEN ${field} >= #{numeral} THEN ${field} - #{numeral} ELSE 0 END " +
|
||||
"WHERE user_id = #{userId}")
|
||||
int dec(@Param("userId") Long userId, @Param("field") String field, @Param("numeral") int numeral);
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.UserCommentExchangeEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 Dao
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface UserCommentExchangeDao extends BaseMapper<UserCommentExchangeEntity> {
|
||||
|
||||
/**
|
||||
* 分页 查询
|
||||
*
|
||||
* @param page
|
||||
* @param queryForm
|
||||
* @return
|
||||
*/
|
||||
List<UserCommentExchangeVO> queryPage(Page page, @Param("queryForm") UserCommentExchangeQueryForm queryForm);
|
||||
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -48,6 +50,11 @@ public class CaseExchangeEntity {
|
||||
*/
|
||||
private Integer isSelected;
|
||||
|
||||
/**
|
||||
* 审核状态(0:否 1:是)
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@ -96,11 +103,13 @@ public class CaseExchangeEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -41,11 +43,13 @@ public class CaseExchangeLabelEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -41,11 +43,13 @@ public class CaseExchangeVoteEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -41,11 +43,12 @@ public class CaseExchangeVoteOptionEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -46,11 +48,13 @@ public class StatsCaseExchangeEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -51,11 +53,13 @@ public class StatsCaseExchangeUserEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 实体类
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("user_comment_exchange")
|
||||
public class UserCommentExchangeEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 病例交流id
|
||||
*/
|
||||
private Long exchangeId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 删除状态(0:否 1:是)
|
||||
*/
|
||||
private Integer deleteStatus;
|
||||
|
||||
/**
|
||||
* 是否置顶(0:否 1:是)
|
||||
*/
|
||||
private Integer isTop;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 是否作者评论(0:否 1:是)
|
||||
*/
|
||||
private Integer isAuthor;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 评论图片
|
||||
*/
|
||||
private String commentImage;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 病例库-病例交流 审核状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-08 18:28:17
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "病例库-病例交流 审核状态更新表单")
|
||||
public class CaseExchangeAuditStatusUpdateForm {
|
||||
|
||||
@Schema(description = "病例交流ID")
|
||||
@NotNull(message = "病例交流ID不能为空")
|
||||
private Long exchangeId;
|
||||
|
||||
@Schema(description = "审核状态 0:待审核 1:审核通过 2:审核不通过")
|
||||
@NotNull(message = "审核状态不能为空")
|
||||
private Integer auditStatus;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 新建表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentExchangeAddForm {
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 分页查询表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserCommentExchangeQueryForm extends PageParam {
|
||||
|
||||
@Schema(description = "关键词(内容、标题)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 更新删除状态表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentExchangeUpdateDeleteStatusForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "删除状态 不能为空")
|
||||
private Integer deleteStatus;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentExchangeUpdateForm {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "主键id 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentStatusUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "状态值", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "状态值 不能为空")
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户评论置顶状态更新表单
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentTopUpdateForm {
|
||||
|
||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "评论ID 不能为空")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "置顶状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "置顶状态 不能为空")
|
||||
private Integer isTop;
|
||||
}
|
||||
@ -43,6 +43,9 @@ public class CaseExchangeVO {
|
||||
@Schema(description = "是否被精选(0:否 1:是)")
|
||||
private Integer isSelected;
|
||||
|
||||
@Schema(description = "审核状态(0:否 1:是)")
|
||||
private Integer auditStatus;
|
||||
|
||||
@Schema(description = "阅读量")
|
||||
private Integer readNum;
|
||||
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.admin.util.Replace;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 列表VO
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserCommentExchangeVO {
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long commentId;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "医院名称")
|
||||
private String hospitalName;
|
||||
|
||||
@Schema(description = "父级ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "评论状态(0:禁用 1:正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||
private Integer isSensitive;
|
||||
|
||||
@Schema(description = "删除状态(0:否 1:是)")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@Schema(description = "是否置顶(0:否 1:是)")
|
||||
private Integer isTop;
|
||||
|
||||
@Schema(description = "点赞数量")
|
||||
private Integer likeNum;
|
||||
|
||||
@Schema(description = "是否作者评论(0:否 1:是)")
|
||||
private Integer isAuthor;
|
||||
|
||||
@Schema(description = "评论内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "评论内容(原版)")
|
||||
private String contentWord;
|
||||
|
||||
@Schema(description = "评论图片")
|
||||
private String commentImage;
|
||||
|
||||
public String getCommentImage() {
|
||||
if (commentImage == null || commentImage.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return Replace.addOssDomain(commentImage);
|
||||
}
|
||||
|
||||
@Schema(description = "交流标题")
|
||||
private String exchangeTitle;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.manager;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.UserCommentExchangeDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.UserCommentExchangeEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 Manager
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
@Service
|
||||
public class UserCommentExchangeManager extends ServiceImpl<UserCommentExchangeDao, UserCommentExchangeEntity> {
|
||||
|
||||
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import net.lab1024.sa.admin.module.business.basicHospital.domain.entity.BasicHospitalEntity;
|
||||
import net.lab1024.sa.admin.module.business.basicSensitiveWord.service.BasicSensitiveWordService;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity.CaseClinicalArticleEntity;
|
||||
@ -14,10 +15,13 @@ import net.lab1024.sa.admin.module.business.caseClinicalArticleAuthor.domain.ent
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticleAuthor.domain.vo.CaseClinicalArticleAuthorVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.entity.CaseClinicalDoctorEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.vo.CaseClinicalDoctorVO;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao.CaseClinicalRecordScoreDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity.CaseClinicalRecordScoreEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.CaseExchangeDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.CaseExchangeLabelDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.CaseExchangeEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.CaseExchangeLabelEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.StatsCaseExchangeDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.StatsCaseExchangeUserDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.*;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeUpdateForm;
|
||||
@ -25,6 +29,7 @@ import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchang
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeSelectedUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.CaseExchangeLabelVO;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.CaseExchangeVO;
|
||||
import net.lab1024.sa.admin.module.business.user.service.UserService;
|
||||
import net.lab1024.sa.admin.util.RegularUtil;
|
||||
import net.lab1024.sa.admin.util.Replace;
|
||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||
@ -37,6 +42,8 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
/**
|
||||
* 病例库-病例交流 Service
|
||||
@ -61,6 +68,18 @@ public class CaseExchangeService {
|
||||
@Resource
|
||||
private RegularUtil regularUtil;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalRecordScoreDao caseClinicalRecordScoreDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseExchangeUserDao statsCaseExchangeUserDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseExchangeDao statsCaseExchangeDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@ -192,7 +211,22 @@ public class CaseExchangeService {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
caseExchangeDao.deleteBatchIds(idList);
|
||||
for (Long id : idList){
|
||||
// 获取评论数据
|
||||
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(id);
|
||||
if (null == caseExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
|
||||
caseExchange.setDeleteStatus(1);
|
||||
caseExchangeDao.updateById(caseExchange);
|
||||
|
||||
// 修改统计数量
|
||||
DecCaseExchangeStats(String.valueOf(caseExchange.getExchangeId()),4,1);
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -204,7 +238,19 @@ public class CaseExchangeService {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
caseExchangeDao.deleteById(exchangeId);
|
||||
// 获取评论数据
|
||||
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(exchangeId);
|
||||
if (null == caseExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
caseExchange.setDeleteStatus(1);
|
||||
caseExchangeDao.updateById(caseExchange);
|
||||
|
||||
// 修改统计数量
|
||||
DecCaseExchangeStats(String.valueOf(caseExchange.getExchangeId()),4,1);
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -273,6 +319,10 @@ public class CaseExchangeService {
|
||||
return ResponseDTO.userErrorParam("病例交流不存在");
|
||||
}
|
||||
|
||||
if (caseExchange.getAuditStatus() == 0) {
|
||||
return ResponseDTO.userErrorParam("请先审核");
|
||||
}
|
||||
|
||||
// 如果精选状态没有变化,直接返回
|
||||
if (Objects.equals(caseExchange.getIsSelected(), isSelected)) {
|
||||
return ResponseDTO.ok();
|
||||
@ -282,6 +332,73 @@ public class CaseExchangeService {
|
||||
caseExchange.setIsSelected(isSelected);
|
||||
caseExchangeDao.updateById(caseExchange);
|
||||
|
||||
// 检测是否已发放积分
|
||||
if (isSelected == 1){
|
||||
LambdaQueryWrapper<CaseClinicalRecordScoreEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getId, exchangeId);
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getType, 3);
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getUserId, caseExchange.getUserId());
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getScoreType, 6);
|
||||
CaseClinicalRecordScoreEntity caseClinicalRecordScore = caseClinicalRecordScoreDao.selectOne(queryWrapper);
|
||||
if (caseClinicalRecordScore == null) {
|
||||
// 发放积分
|
||||
userService.ReportUserScore(String.valueOf(exchangeId),3, String.valueOf(caseExchange.getUserId()),100,6,"病例库-精选病例交流");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新审核状态
|
||||
*/
|
||||
public ResponseDTO<String> updateAuditStatus(Long exchangeId, Integer auditStatus) {
|
||||
if (null == exchangeId) {
|
||||
return ResponseDTO.userErrorParam("病例交流ID不能为空");
|
||||
}
|
||||
|
||||
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(exchangeId);
|
||||
if (caseExchange == null) {
|
||||
return ResponseDTO.userErrorParam("病例交流不存在");
|
||||
}
|
||||
|
||||
if (caseExchange.getExchangeStatus() == 2) {
|
||||
return ResponseDTO.userErrorParam("状态为 禁用 禁止审核");
|
||||
}
|
||||
|
||||
// 如果精选状态没有变化,直接返回
|
||||
if (Objects.equals(caseExchange.getAuditStatus(), auditStatus)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
// 更新精选状态
|
||||
caseExchange.setAuditStatus(auditStatus);
|
||||
caseExchangeDao.updateById(caseExchange);
|
||||
|
||||
// 检测是否已发放积分
|
||||
if (auditStatus == 1){
|
||||
LambdaQueryWrapper<CaseClinicalRecordScoreEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getId, exchangeId);
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getType, 3);
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getUserId, caseExchange.getUserId());
|
||||
queryWrapper.eq(CaseClinicalRecordScoreEntity::getScoreType, 7);
|
||||
CaseClinicalRecordScoreEntity caseClinicalRecordScore = caseClinicalRecordScoreDao.selectOne(queryWrapper);
|
||||
if (caseClinicalRecordScore == null) {
|
||||
// 发放积分
|
||||
userService.ReportUserScore(String.valueOf(exchangeId),3, String.valueOf(caseExchange.getUserId()),50,7,"病例库-病例交流发帖");
|
||||
}
|
||||
}
|
||||
|
||||
// 病例交流统计
|
||||
if (!handleStatsCaseExchange()){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 新增病例交流统计-用户
|
||||
if (!handleStatsCaseExchangeUser(String.valueOf(caseExchange.getUserId()),"exchange_num")){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -316,4 +433,184 @@ public class CaseExchangeService {
|
||||
caseExchangeLabelDao.insert(labelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增病例交流统计
|
||||
* @return bool
|
||||
*/
|
||||
public boolean handleStatsCaseExchange(){
|
||||
LambdaQueryWrapper<StatsCaseExchangeEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
StatsCaseExchangeEntity statsCaseExchange = statsCaseExchangeDao.selectOne(mapQueryWrapper);
|
||||
if (statsCaseExchange == null){
|
||||
// 新增
|
||||
StatsCaseExchangeEntity statsCaseExchangeData = new StatsCaseExchangeEntity();
|
||||
statsCaseExchangeData.setExchangeNum(1);
|
||||
int res = statsCaseExchangeDao.insert(statsCaseExchangeData);
|
||||
return res > 0;
|
||||
}else{
|
||||
// 增加数量
|
||||
statsCaseExchangeDao.inc(statsCaseExchange.getStatsId(),"exchange_num",1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增病例交流统计-用户
|
||||
* @return bool
|
||||
*/
|
||||
public boolean handleStatsCaseExchangeUser(String userId,String field){
|
||||
LambdaQueryWrapper<StatsCaseExchangeUserEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseExchangeUserEntity::getUserId, userId);
|
||||
StatsCaseExchangeUserEntity statsCaseExchangeUser = statsCaseExchangeUserDao.selectOne(mapQueryWrapper);
|
||||
if (statsCaseExchangeUser == null){
|
||||
// 新增
|
||||
StatsCaseExchangeUserEntity statsCaseExchangeUserData = new StatsCaseExchangeUserEntity();
|
||||
statsCaseExchangeUserData.setUserId(Long.valueOf(userId));
|
||||
statsCaseExchangeUserData.setExchangeNum(1);
|
||||
int res = statsCaseExchangeUserDao.insert(statsCaseExchangeUserData);
|
||||
return res > 0;
|
||||
}else{
|
||||
// 增加数量
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getStatsId(),field,1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增病例交流统计字段
|
||||
* @param exchangeId 病例id
|
||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数
|
||||
*/
|
||||
@Transactional
|
||||
public boolean IncCaseExchangeStats(String exchangeId,Integer type){
|
||||
try {
|
||||
// 获取病例数据
|
||||
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(exchangeId);
|
||||
if (caseExchange == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<StatsCaseExchangeUserEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseExchangeUserEntity::getUserId, caseExchange.getUserId());
|
||||
StatsCaseExchangeUserEntity statsCaseExchangeUser = statsCaseExchangeUserDao.selectOne(mapQueryWrapper);
|
||||
if (statsCaseExchangeUser == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 阅读量
|
||||
if (type == 1){
|
||||
// 总
|
||||
statsCaseExchangeDao.inc(1L,"exchange_read_num",1);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.inc(Long.valueOf(exchangeId),"read_num",1);
|
||||
|
||||
// 用户-此处无需担心stats_case_exchange_user无数据,发布病例时会新增
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getUserId(),"exchange_read_num",1);
|
||||
}
|
||||
|
||||
// 收藏量
|
||||
if (type == 2){
|
||||
// 总
|
||||
statsCaseExchangeDao.inc(1L,"exchange_collect_num",1);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.inc(Long.valueOf(exchangeId),"collect_num",1);
|
||||
|
||||
// 用户-此处无需担心stats_case_exchange_user无数据,发布病例时会新增
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getUserId(),"exchange_collect_num",1);
|
||||
}
|
||||
|
||||
// 评论数
|
||||
if (type == 3){
|
||||
// 总
|
||||
statsCaseExchangeDao.inc(1L,"exchange_comment_num",1);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.inc(Long.valueOf(exchangeId),"comment_num",1);
|
||||
|
||||
// 用户-此处无需担心stats_case_exchange_user无数据,发布病例时会新增
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getUserId(),"exchange_comment_num",1);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少病例交流统计字段
|
||||
* @param exchangeId 病例id
|
||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:数量
|
||||
*/
|
||||
@Transactional
|
||||
public boolean DecCaseExchangeStats(String exchangeId,Integer type,Integer num){
|
||||
try {
|
||||
// 获取病例数据
|
||||
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(exchangeId);
|
||||
if (caseExchange == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<StatsCaseExchangeUserEntity> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseExchangeUserEntity::getUserId, caseExchange.getUserId());
|
||||
StatsCaseExchangeUserEntity statsCaseExchangeUser = statsCaseExchangeUserDao.selectOne(mapQueryWrapper);
|
||||
if (statsCaseExchangeUser == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 阅读量
|
||||
if (type == 1){
|
||||
// 总
|
||||
statsCaseExchangeDao.dec(1L,"exchange_read_num",num);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.dec(Long.valueOf(exchangeId),"read_num",num);
|
||||
|
||||
// 用户
|
||||
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_read_num",num);
|
||||
}
|
||||
|
||||
// 收藏量
|
||||
if (type == 2){
|
||||
// 总
|
||||
statsCaseExchangeDao.dec(1L,"exchange_collect_num",num);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.dec(Long.valueOf(exchangeId),"collect_num",num);
|
||||
|
||||
// 用户
|
||||
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_collect_num",num);
|
||||
}
|
||||
|
||||
// 评论数
|
||||
if (type == 3){
|
||||
// 总
|
||||
statsCaseExchangeDao.dec(1L,"exchange_comment_num",num);
|
||||
|
||||
// 单
|
||||
caseExchangeDao.dec(Long.valueOf(exchangeId),"comment_num",num);
|
||||
|
||||
// 用户
|
||||
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_comment_num",num);
|
||||
}
|
||||
|
||||
// 数量
|
||||
if (type == 4){
|
||||
// 总
|
||||
statsCaseExchangeDao.dec(1L,"exchange_num",num);
|
||||
|
||||
// 用户
|
||||
statsCaseExchangeUserDao.dec(statsCaseExchangeUser.getUserId(),"exchange_num",num);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,262 @@
|
||||
package net.lab1024.sa.admin.module.business.caseExchange.service;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.UserCommentExchangeEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.dao.UserCommentExchangeDao;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.UserCommentExchangeEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeAddForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeQueryForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateDeleteStatusForm;
|
||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户评论-病例交流 Service
|
||||
*
|
||||
* @Author xing
|
||||
* @Date 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UserCommentExchangeService {
|
||||
|
||||
@Resource
|
||||
private UserCommentExchangeDao userCommentExchangeDao;
|
||||
|
||||
@Resource
|
||||
private CaseExchangeService caseExchangeService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<UserCommentExchangeVO> queryPage(UserCommentExchangeQueryForm queryForm) {
|
||||
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
|
||||
List<UserCommentExchangeVO> list = userCommentExchangeDao.queryPage(page, queryForm);
|
||||
return SmartPageUtil.convert2PageResult(page, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> add(UserCommentExchangeAddForm addForm) {
|
||||
UserCommentExchangeEntity userCommentExchangeEntity = SmartBeanUtil.copy(addForm, UserCommentExchangeEntity.class);
|
||||
userCommentExchangeDao.insert(userCommentExchangeEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> update(UserCommentExchangeUpdateForm updateForm) {
|
||||
UserCommentExchangeEntity userCommentExchangeEntity = SmartBeanUtil.copy(updateForm, UserCommentExchangeEntity.class);
|
||||
userCommentExchangeDao.updateById(userCommentExchangeEntity);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateStatus(Long commentId, Integer status) {
|
||||
if (null == commentId || null == status) {
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(commentId);
|
||||
if (null == userCommentExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentExchange.getStatus(), status)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentExchange.setStatus(status);
|
||||
userCommentExchangeDao.updateById(userCommentExchange);
|
||||
|
||||
// 正常
|
||||
if (status == 1){
|
||||
// 新增文章的统计字段
|
||||
boolean r = caseExchangeService.IncCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 禁用
|
||||
if (status == 2){
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseExchangeService.DecCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改置顶状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateTopStatus(Long commentId, Integer isTop) {
|
||||
if (null == commentId || null == isTop) {
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(commentId);
|
||||
if (null == userCommentExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
if (Objects.equals(userCommentExchange.getIsTop(), isTop)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
userCommentExchange.setIsTop(isTop);
|
||||
userCommentExchangeDao.updateById(userCommentExchange);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> batchDelete(List<Long> idList) {
|
||||
if (CollectionUtils.isEmpty(idList)){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
for (Long id : idList){
|
||||
// 获取评论数据
|
||||
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(id);
|
||||
if (null == userCommentExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseExchangeService.DecCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentExchangeDao.deleteById(id);
|
||||
}
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> delete(Long commentId) {
|
||||
if (null == commentId){
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(commentId);
|
||||
if (null == userCommentExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 减少文章的统计字段
|
||||
boolean r = caseExchangeService.DecCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
userCommentExchangeDao.deleteById(commentId);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新删除状态
|
||||
*/
|
||||
@Transactional
|
||||
public ResponseDTO<String> updateDeleteStatus(UserCommentExchangeUpdateDeleteStatusForm updateForm) {
|
||||
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||
return ResponseDTO.userErrorParam("参数不能为空");
|
||||
}
|
||||
|
||||
// 获取评论数据
|
||||
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(updateForm.getCommentId());
|
||||
if (null == userCommentExchange) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
|
||||
// 更新删除状态
|
||||
userCommentExchange.setDeleteStatus(updateForm.getDeleteStatus());
|
||||
userCommentExchangeDao.updateById(userCommentExchange);
|
||||
|
||||
// 如果是从删除状态恢复,需要增加统计字段
|
||||
if (updateForm.getDeleteStatus() == 0) {
|
||||
boolean r = caseExchangeService.IncCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
} else {
|
||||
// 如果是设置为删除状态,需要减少统计字段
|
||||
boolean r = caseExchangeService.DecCaseExchangeStats(
|
||||
String.valueOf(userCommentExchange.getExchangeId()),
|
||||
3,
|
||||
1
|
||||
);
|
||||
if (!r){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResponseDTO.userErrorParam("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -76,11 +78,13 @@ public class StatsCaseClinicalDoctorEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -66,11 +68,13 @@ public class StatsCaseClinicalEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -76,11 +78,13 @@ public class StatsCaseClinicalHospitalEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
@ -81,11 +83,13 @@ public class StatsCaseClinicalLabelEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Year;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -12,14 +13,18 @@ import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import net.lab1024.sa.admin.config.EnvConfig;
|
||||
import net.lab1024.sa.admin.extend.aliyun.Oss;
|
||||
import net.lab1024.sa.admin.extend.app.Score.Score;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.dao.CaseClinicalArticleDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.entity.CaseClinicalArticleEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.dao.CaseClinicalDoctorCertDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.dao.CaseClinicalDoctorDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.entity.CaseClinicalDoctorCertEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalDoctor.domain.entity.CaseClinicalDoctorEntity;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao.CaseClinicalRecordScoreDao;
|
||||
import net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.entity.CaseClinicalRecordScoreEntity;
|
||||
import net.lab1024.sa.admin.module.business.statsCaseClinical.dao.StatsCaseClinicalDao;
|
||||
import net.lab1024.sa.admin.module.business.statsCaseClinical.domain.entity.StatsCaseClinicalEntity;
|
||||
import net.lab1024.sa.admin.module.business.user.dao.UserDao;
|
||||
@ -72,6 +77,12 @@ public class UserService {
|
||||
@Resource
|
||||
private EnvConfig envConfig;
|
||||
|
||||
@Resource
|
||||
private Score score;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalRecordScoreDao caseClinicalRecordScoreDao;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@ -276,4 +287,48 @@ public class UserService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放积分
|
||||
* @param type 类型(1:文章 2:视频 3:病例交流)
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public boolean ReportUserScore(String id,Integer type,String userId,Integer point,Integer scoreType,String bonuspointsNote) throws BusinessException{
|
||||
// 获取积分发放记录
|
||||
// 获取今天的日期,并设置时间为 00:00:00
|
||||
LocalDateTime startOfToday = LocalDate.now().atStartOfDay(); // 例如:2025-07-30 00:00:00
|
||||
|
||||
QueryWrapper<CaseClinicalRecordScoreEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId)
|
||||
.ge("created_at", startOfToday) // created_at >= 今天 00:00:00
|
||||
.ge("score_type", 5)
|
||||
.orderByDesc("created_at"); // 最新的在前
|
||||
List<CaseClinicalRecordScoreEntity> caseClinicalRecordScores = caseClinicalRecordScoreDao.selectList(queryWrapper);
|
||||
if (caseClinicalRecordScores.size() >= 3){
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取用户数据
|
||||
UserEntity user = userDao.selectById(userId);
|
||||
if (user == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 发放积分
|
||||
score.ReportUserScore(user.getUserIden(),point,bonuspointsNote);
|
||||
|
||||
// 添加打赏记录
|
||||
CaseClinicalRecordScoreEntity data = new CaseClinicalRecordScoreEntity();
|
||||
data.setUserId(Long.valueOf(userId));
|
||||
data.setScore(point);
|
||||
data.setId(Long.valueOf(id));
|
||||
data.setUserName(user.getUserName());
|
||||
data.setNodeName("病例库-病例互动");
|
||||
data.setType(type);
|
||||
data.setScoreType(scoreType);
|
||||
caseClinicalRecordScoreDao.insert(data);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,8 @@ package net.lab1024.sa.admin.util;
|
||||
import net.lab1024.sa.admin.config.OssConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Component
|
||||
@RequestMapping("/config")
|
||||
public class Replace {
|
||||
private static OssConfig ossConfig;
|
||||
|
||||
|
||||
@ -19,4 +19,11 @@ server:
|
||||
# 环境
|
||||
spring:
|
||||
profiles:
|
||||
active: '@profiles.active@'
|
||||
active: '@profiles.active@'
|
||||
|
||||
# 文件上传配置
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 5MB
|
||||
max-request-size: 5MB
|
||||
enabled: true
|
||||
@ -68,6 +68,7 @@
|
||||
<!--医生姓名-->
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND INSTR(d.doctor_name,#{queryForm.keywords})
|
||||
OR INSTR(h.hospital_name,#{queryForm.keywords})
|
||||
</if>
|
||||
</where>
|
||||
<if test="queryForm.limit != null and queryForm.limit > 0">
|
||||
|
||||
@ -27,21 +27,29 @@
|
||||
<include refid="base_columns"/>
|
||||
FROM case_clinical_article
|
||||
<where>
|
||||
<!--关键字-->
|
||||
<!--关键字搜索:支持疾病名称、标题、作者搜索-->
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND (
|
||||
INSTR(case_clinical_article.article_title,#{queryForm.keywords})
|
||||
OR INSTR(case_clinical_article.article_content,#{queryForm.keywords})
|
||||
INSTR(case_clinical_article.article_title, #{queryForm.keywords}) > 0
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM case_clinical_article_author caa
|
||||
INNER JOIN case_clinical_doctor cd ON caa.doctor_id = cd.doctor_id
|
||||
WHERE caa.article_id = case_clinical_article.article_id
|
||||
AND INSTR(cd.doctor_name, #{queryForm.keywords}) > 0
|
||||
)
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM case_clinical_article_label cal
|
||||
WHERE cal.article_id = case_clinical_article.article_id
|
||||
AND INSTR(cal.label_name, #{queryForm.keywords}) > 0
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<!--删除状态-->
|
||||
AND case_clinical_article.delete_status = 0
|
||||
<!--状态-->
|
||||
<if test="queryForm.articleStatus != null">
|
||||
AND case_clinical_article.article_status = #{queryForm.articleStatus}
|
||||
</if>
|
||||
<!--删除状态-->
|
||||
<if test="queryForm.deleteStatus != null">
|
||||
AND case_clinical_article.delete_status = #{queryForm.deleteStatus}
|
||||
</if>
|
||||
<!--发表时间-->
|
||||
<if test="queryForm.pushDateBegin != null">
|
||||
AND case_clinical_article.push_date >= #{queryForm.pushDateBegin}
|
||||
@ -50,6 +58,7 @@
|
||||
AND case_clinical_article.push_date <= #{queryForm.pushDateEnd}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY case_clinical_article.created_at DESC
|
||||
</select>
|
||||
|
||||
<select id="selectLastArticlePushDateByHospitalId" resultType="java.time.LocalDateTime">
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="net.lab1024.sa.admin.module.business.caseClinicalArticle.dao.UserCommentClinicalArticleDao">
|
||||
|
||||
<!-- 查询结果列 -->
|
||||
<sql id="base_columns">
|
||||
user_comment_clinical_article.comment_id,
|
||||
user.user_name,
|
||||
basic_hospital.hospital_name,
|
||||
user_comment_clinical_article.status,
|
||||
user_comment_clinical_article.parent_id,
|
||||
user_comment_clinical_article.is_sensitive,
|
||||
user_comment_clinical_article.delete_status,
|
||||
user_comment_clinical_article.is_top,
|
||||
user_comment_clinical_article.like_num,
|
||||
user_comment_clinical_article.is_author,
|
||||
user_comment_clinical_article.content,
|
||||
user_comment_clinical_article.content_word,
|
||||
user_comment_clinical_article.comment_image,
|
||||
case_clinical_article.article_title,
|
||||
user_comment_clinical_article.created_at
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="queryPage" resultType="net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO">
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM user_comment_clinical_article
|
||||
LEFT JOIN user ON user_comment_clinical_article.user_id = user.user_id
|
||||
LEFT JOIN basic_hospital ON user.hospital_id = basic_hospital.hospital_id
|
||||
LEFT JOIN case_clinical_article ON user_comment_clinical_article.article_id = case_clinical_article.article_id
|
||||
<where>
|
||||
<!--关键词搜索:支持评论内容、文章标题搜索-->
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND (
|
||||
INSTR(user_comment_clinical_article.content, #{queryForm.keywords}) > 0
|
||||
OR INSTR(case_clinical_article.article_title, #{queryForm.keywords}) > 0
|
||||
)
|
||||
</if>
|
||||
<!--是否置顶-->
|
||||
<if test="queryForm.isTop != null">
|
||||
AND user_comment_clinical_article.is_top = #{queryForm.isTop}
|
||||
</if>
|
||||
<!--删除状态-->
|
||||
<if test="queryForm.deleteStatus != null">
|
||||
AND user_comment_clinical_article.delete_status = #{queryForm.deleteStatus}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY user_comment_clinical_article.created_at DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="net.lab1024.sa.admin.module.business.caseClinicalRecordScore.dao.CaseClinicalRecordScoreDao">
|
||||
|
||||
<!-- 查询结果列 -->
|
||||
<sql id="base_columns">
|
||||
case_clinical_record_score.score_id,
|
||||
case_clinical_record_score.id,
|
||||
case_clinical_record_score.type,
|
||||
case_clinical_record_score.user_id,
|
||||
case_clinical_record_score.user_name,
|
||||
case_clinical_record_score.score_type,
|
||||
case_clinical_record_score.node_name,
|
||||
case_clinical_record_score.score,
|
||||
case_clinical_record_score.created_at,
|
||||
case_clinical_record_score.updated_at
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="queryPage" resultType="net.lab1024.sa.admin.module.business.caseClinicalRecordScore.domain.vo.CaseClinicalRecordScoreVO">
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM case_clinical_record_score
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -27,18 +27,29 @@
|
||||
<include refid="base_columns"/>
|
||||
FROM case_clinical_video
|
||||
<where>
|
||||
<!--关键字-->
|
||||
<!--关键字搜索:支持疾病名称、标题、作者搜索-->
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND INSTR(case_clinical_video.video_title,#{queryForm.keywords})
|
||||
AND (
|
||||
INSTR(case_clinical_video.video_title, #{queryForm.keywords}) > 0
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM case_clinical_video_author cva
|
||||
INNER JOIN case_clinical_doctor cd ON cva.doctor_id = cd.doctor_id
|
||||
WHERE cva.video_id = case_clinical_video.video_id
|
||||
AND INSTR(cd.doctor_name, #{queryForm.keywords}) > 0
|
||||
)
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM case_clinical_video_label cvl
|
||||
WHERE cvl.video_id = case_clinical_video.video_id
|
||||
AND INSTR(cvl.label_name, #{queryForm.keywords}) > 0
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<!--删除状态-->
|
||||
AND case_clinical_video.delete_status = 0
|
||||
<!--状态-->
|
||||
<if test="queryForm.videoStatus != null">
|
||||
AND case_clinical_video.video_status = #{queryForm.videoStatus}
|
||||
</if>
|
||||
<!--删除状态-->
|
||||
<if test="queryForm.deleteStatus != null">
|
||||
AND case_clinical_video.delete_status = #{queryForm.deleteStatus}
|
||||
</if>
|
||||
<!--发表时间开始-->
|
||||
<if test="queryForm.pushDateBegin != null">
|
||||
AND case_clinical_video.push_date >= #{queryForm.pushDateBegin}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user