1
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
package com.example.caseData;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.example.caseData.dao")
|
||||
public class CaseDataApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CaseDataApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.example.caseData;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
public class ServletInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(CaseDataApplication.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.example.caseData.common;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返回方法
|
||||
* @param <T>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Response<T> {
|
||||
private static final int SUCCESS_CODE = 200;
|
||||
private static final int ERROR_CODE = -1;
|
||||
|
||||
private int code; // 状态码
|
||||
private T data; // 返回数据
|
||||
private String message; // 消息
|
||||
|
||||
public static <T> Response<T> success() {
|
||||
return new Response<>(SUCCESS_CODE, null, "成功");
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(String message) {
|
||||
return new Response<>(SUCCESS_CODE, null, message);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(T data) {
|
||||
return new Response<>(SUCCESS_CODE, data, "成功");
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(T data, String message) {
|
||||
return new Response<>(SUCCESS_CODE, data, message);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(int code, T data, String message) {
|
||||
return new Response<>(code, data, message);
|
||||
}
|
||||
|
||||
public static <T> Response<T> error() {
|
||||
return new Response<>(ERROR_CODE, null, "失败");
|
||||
}
|
||||
|
||||
public static <T> Response<T> error(String message) {
|
||||
return new Response<>(ERROR_CODE, null, message);
|
||||
}
|
||||
|
||||
public static <T> Response<T> error(T data, String message) {
|
||||
return new Response<>(ERROR_CODE, data, message);
|
||||
}
|
||||
|
||||
public static <T> Response<T> error(int code, T data, String message) {
|
||||
return new Response<>(code, data, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.example.caseData.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
public class AppConfig {
|
||||
@Value("${app.apiUrl}")
|
||||
private String apiUrl;
|
||||
|
||||
@Value("${app.secretKey}")
|
||||
private String secretKey;
|
||||
|
||||
@Value("${app.imagePrefix}")
|
||||
private String imagePrefix;
|
||||
|
||||
@Value("${app.platform}")
|
||||
private String platform;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.caseData.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
public class EnvConfig {
|
||||
@Value("${spring.profiles.active}")
|
||||
private String active;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.example.caseData.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
public class JwtConfig {
|
||||
@Value("${jwt.sign-key}")
|
||||
private String signKey;
|
||||
|
||||
@Value("${jwt.ttl}")
|
||||
private Integer ttl;
|
||||
|
||||
@Value("${jwt.algo}")
|
||||
private String algo;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.example.caseData.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
public class OssConfig {
|
||||
@Value("${oss.access-key}")
|
||||
private String accessKey;
|
||||
|
||||
@Value("${oss.access-key-secret}")
|
||||
private String accessKeySecret;
|
||||
|
||||
@Value("${oss.bucket}")
|
||||
private String bucket;
|
||||
|
||||
@Value("${oss.endpoint}")
|
||||
private String endpoint;
|
||||
|
||||
@Value("${oss.custom-domain-name}")
|
||||
private String customDomainName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.example.caseData.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
public class WxMaConfig {
|
||||
@Value("${wechat.miniapp.appid}")
|
||||
private String appid;
|
||||
|
||||
@Value("${wechat.miniapp.secret}")
|
||||
private String secret;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
public abstract class BaseController {
|
||||
@Resource
|
||||
protected HttpServletRequest request;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.*;
|
||||
import com.example.caseData.dto.basicHospital.BasicHospitalDto;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.CaseClinicalArticleAuthorModel;
|
||||
import com.example.caseData.model.CaseClinicalArticleModel;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalHospitalSearchPage;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class CaseClinicalArticleController {
|
||||
@Resource
|
||||
private CaseClinicalArticleDao caseClinicalArticleDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private BasicHospitalDao basicHospitalDao;
|
||||
|
||||
/**
|
||||
* 临床病例库-文章-详情
|
||||
*/
|
||||
@GetMapping("/clinical/article/{article_id}")
|
||||
public Response<CaseClinicalArticleDto> getClinicalHospitalSearchPage(
|
||||
@PathVariable("article_id") String articleId
|
||||
) {
|
||||
|
||||
// 获取文章数据
|
||||
CaseClinicalArticleModel article = caseClinicalArticleDao.selectById(articleId);
|
||||
if (article == null) {
|
||||
return Response.error("非法文章");
|
||||
}
|
||||
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, article.getArticleId());
|
||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
// 查询医生所属医院
|
||||
BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
caseClinicalDoctor.setBasicHospital(basicHospital);
|
||||
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
article.setAuthor(caseClinicalArticleAuthors);
|
||||
|
||||
CaseClinicalArticleDto g = CaseClinicalArticleDto.GetDto(article);
|
||||
return Response.success(g);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.*;
|
||||
import com.example.caseData.dto.caseClinicalVideo.CaseClinicalVideoDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.CaseClinicalVideoAuthorModel;
|
||||
import com.example.caseData.model.CaseClinicalVideoModel;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class CaseClinicalVideoController {
|
||||
@Resource
|
||||
private CaseClinicalVideoDao caseClinicalVideoDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalVideoAuthorDao caseClinicalVideoAuthorDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private BasicHospitalDao basicHospitalDao;
|
||||
|
||||
/**
|
||||
* 临床病例库-视频-详情
|
||||
*/
|
||||
@GetMapping("/clinical/video/{video_id}")
|
||||
public Response<CaseClinicalVideoDto> getClinicalHospitalSearchPage(
|
||||
@PathVariable("video_id") String videoId
|
||||
) {
|
||||
// 获取视频数据
|
||||
CaseClinicalVideoModel article = caseClinicalVideoDao.selectById(videoId);
|
||||
if (article == null) {
|
||||
return Response.error("非法视频");
|
||||
}
|
||||
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, article.getVideoId());
|
||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
|
||||
// 查询医生所属医院
|
||||
BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
caseClinicalDoctor.setBasicHospital(basicHospital);
|
||||
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
article.setAuthor(caseClinicalVideoAuthors);
|
||||
|
||||
CaseClinicalVideoDto g = CaseClinicalVideoDto.GetDto(article);
|
||||
return Response.success(g);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.*;
|
||||
import com.example.caseData.dto.basicHospital.BasicHospitalDto;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||
import com.example.caseData.dto.caseClinicalDoctor.CaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.caseClinicalVideo.CaseClinicalVideoDto;
|
||||
import com.example.caseData.dto.caseClinicalVideoAuthor.CaseClinicalVideoAuthorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.CaseClinicalArticleAuthorModel;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
import com.example.caseData.model.CaseClinicalVideoAuthorModel;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalDoctorSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalHospitalSearchPage;
|
||||
import com.example.caseData.request.clinicalRequest.getClinicalSearchPage;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class ClinicalController extends BaseController {
|
||||
@Resource
|
||||
private CaseClinicalArticleDao caseClinicalArticleDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalArticleAuthorDao caseClinicalArticleAuthorDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalVideoDao caseClinicalVideoDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalVideoAuthorDao caseClinicalVideoAuthorDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalDao statsCaseClinicalDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalHospitalDao statsCaseClinicalHospitalDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private CaseClinicalDoctorDao caseClinicalDoctorDao;
|
||||
|
||||
@Resource
|
||||
private BasicHospitalDao basicHospitalDao;
|
||||
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
*/
|
||||
@PostMapping("/clinical/search")
|
||||
public Response<Map<String, Object>> getClinicalSearchPage(
|
||||
@Validated({getClinicalSearchPage.class})
|
||||
@RequestBody getClinicalSearchPage request
|
||||
) {
|
||||
request.validateForPage();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
if (request.getType() == 1){
|
||||
Page<CaseClinicalArticleDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取文章数据
|
||||
IPage<CaseClinicalArticleDto> resultPage = caseClinicalArticleDao.getCaseClinicalArticleSearchPage(
|
||||
page,
|
||||
request.getTitle(),
|
||||
request.getDoctorName(),
|
||||
request.getLabelName(),
|
||||
request.getHospitalId(),
|
||||
request.getDoctorId(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (CaseClinicalArticleDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalArticleAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorModel::getArticleId, dto.getArticleId());
|
||||
List<CaseClinicalArticleAuthorModel> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalArticleAuthorModel author : caseClinicalArticleAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
List<CaseClinicalArticleAuthorDto> caseClinicalArticleAuthorListDto = CaseClinicalArticleAuthorDto.GetListDto(caseClinicalArticleAuthors);
|
||||
dto.setAuthor(caseClinicalArticleAuthorListDto);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
} else if (request.getType() == 2) {
|
||||
Page<CaseClinicalVideoDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取视频数据
|
||||
IPage<CaseClinicalVideoDto> resultPage = caseClinicalVideoDao.getCaseClinicalVideoSearchPage(
|
||||
page,
|
||||
request.getTitle(),
|
||||
request.getDoctorName(),
|
||||
request.getLabelName(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (CaseClinicalVideoDto dto : resultPage.getRecords()) {
|
||||
// 查找作者
|
||||
LambdaQueryWrapper<CaseClinicalVideoAuthorModel> authorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
authorQueryWrapper.eq(CaseClinicalVideoAuthorModel::getVideoId, dto.getVideoId());
|
||||
List<CaseClinicalVideoAuthorModel> caseClinicalVideoAuthors = caseClinicalVideoAuthorDao.selectList(authorQueryWrapper);
|
||||
for (CaseClinicalVideoAuthorModel author : caseClinicalVideoAuthors) {
|
||||
// 查询医生
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
||||
author.setCaseClinicalDoctor(caseClinicalDoctor);
|
||||
}
|
||||
|
||||
List<CaseClinicalVideoAuthorDto> caseClinicalVideoAuthorListDto = CaseClinicalVideoAuthorDto.GetListDto(caseClinicalVideoAuthors);
|
||||
dto.setAuthor(caseClinicalVideoAuthorListDto);
|
||||
}
|
||||
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
}
|
||||
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临床病例库-医院-搜索
|
||||
*/
|
||||
@PostMapping("/clinical/hospital/search")
|
||||
public Response<Map<String, Object>> getClinicalHospitalSearchPage(
|
||||
@Validated()
|
||||
@RequestBody getClinicalHospitalSearchPage request
|
||||
) {
|
||||
request.validateForPage();
|
||||
|
||||
Page<StatsCaseClinicalHospitalDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取医院数据
|
||||
IPage<StatsCaseClinicalHospitalDto> resultPage = statsCaseClinicalHospitalDao.getStatsCaseClinicalHospitalSearchPage(
|
||||
page,
|
||||
request.getHospitalName(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (StatsCaseClinicalHospitalDto dto : resultPage.getRecords()) {
|
||||
// 查询医院基础数据
|
||||
BasicHospitalModel basicHospital = basicHospitalDao.selectById(dto.getHospitalId());
|
||||
BasicHospitalDto basicHospitalDto = BasicHospitalDto.GetDto(basicHospital);
|
||||
dto.setBasicHospital(basicHospitalDto);
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临床病例库-医生-搜索
|
||||
*/
|
||||
@PostMapping("/clinical/doctor/search")
|
||||
public Response<Map<String, Object>> getClinicalDoctorSearchPage(
|
||||
@Validated()
|
||||
@RequestBody getClinicalDoctorSearchPage request
|
||||
) {
|
||||
request.validateForPage();
|
||||
|
||||
Page<StatsCaseClinicalDoctorDto> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
|
||||
// 获取医生数据
|
||||
IPage<StatsCaseClinicalDoctorDto> resultPage = statsCaseClinicalDoctorDao.getStatsCaseClinicalDoctorSearchPage(
|
||||
page,
|
||||
request.getDoctorName(),
|
||||
request.handleOrder()
|
||||
);
|
||||
|
||||
for (StatsCaseClinicalDoctorDto dto : resultPage.getRecords()) {
|
||||
// 查询医生数据
|
||||
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectById(dto.getDoctorId());
|
||||
|
||||
// 查询医生所属医院
|
||||
BasicHospitalModel basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
caseClinicalDoctor.setBasicHospital(basicHospital);
|
||||
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(caseClinicalDoctor);
|
||||
|
||||
dto.setCaseClinicalDoctor(caseClinicalDoctorDto);
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", resultPage.getRecords());
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dto.index.GetIndexClinicalDto;
|
||||
import com.example.caseData.service.IndexService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class IndexController extends BaseController {
|
||||
@Resource
|
||||
private IndexService indexService;
|
||||
|
||||
// 首页-临床病例库
|
||||
@GetMapping("/index/clinical")
|
||||
public Response<GetIndexClinicalDto> getIndexClinical() {
|
||||
return Response.success(indexService.GetIndexClinical());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.UserDao;
|
||||
import com.example.caseData.dto.PublicDto;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.UserModel;
|
||||
import com.example.caseData.request.PublicRequest;
|
||||
import com.example.caseData.request.UserRequest;
|
||||
import com.example.caseData.service.UserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class PublicController {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
// 登陆
|
||||
@PostMapping("/login/wechat/mobile")
|
||||
public Response<PublicDto> login(@Validated({PublicRequest.Login.class}) @ModelAttribute PublicRequest request) {
|
||||
// 微信手机号授权登录
|
||||
// 获取手机号
|
||||
// 获取用户openid
|
||||
|
||||
// 临时测试使用
|
||||
String phone = "18221234167";
|
||||
|
||||
// 用户登陆
|
||||
PublicDto g = userService.UserLogin(phone);
|
||||
|
||||
return Response.success(g);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.StatsCaseClinicalDao;
|
||||
import com.example.caseData.dao.StatsCaseClinicalDoctorDao;
|
||||
import com.example.caseData.dao.StatsCaseClinicalHospitalDao;
|
||||
import com.example.caseData.dto.statsCaseClinical.StatsCaseClinicalDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class StatsCaseClinicalController extends BaseController {
|
||||
@Resource
|
||||
private StatsCaseClinicalDao statsCaseClinicalDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalHospitalDao statsCaseClinicalHospitalDao;
|
||||
|
||||
@Resource
|
||||
private StatsCaseClinicalDoctorDao statsCaseClinicalDoctorDao;
|
||||
|
||||
/**
|
||||
* 临床病例库-统计
|
||||
*/
|
||||
@GetMapping("/clinical/stats")
|
||||
public Response<StatsCaseClinicalDto> getClinicalStats(){
|
||||
// 统计表-病例库-临床
|
||||
LambdaQueryWrapper<StatsCaseClinicalModel> statsCaseClinicalQueryWrapper = new LambdaQueryWrapper<>();
|
||||
StatsCaseClinicalModel statsCaseClinical = statsCaseClinicalDao.selectOne(statsCaseClinicalQueryWrapper);
|
||||
|
||||
StatsCaseClinicalDto g = StatsCaseClinicalDto.GetDto(statsCaseClinical);
|
||||
|
||||
return Response.success(g);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临床病例库-统计-医院
|
||||
*/
|
||||
@GetMapping("/clinical/stats/hospital/{hospital_id}")
|
||||
public Response<StatsCaseClinicalHospitalDto> getClinicalStatsHospital(
|
||||
@PathVariable("hospital_id") String hospitalId
|
||||
){
|
||||
|
||||
// 统计表-病例库-临床
|
||||
LambdaQueryWrapper<StatsCaseClinicalHospitalModel> statsCaseClinicalHospitalQueryWrapper = new LambdaQueryWrapper<>();
|
||||
statsCaseClinicalHospitalQueryWrapper.eq(StatsCaseClinicalHospitalModel::getHospitalId, hospitalId);
|
||||
StatsCaseClinicalHospitalModel statsCaseClinicalHospital = statsCaseClinicalHospitalDao.selectOne(statsCaseClinicalHospitalQueryWrapper);
|
||||
|
||||
StatsCaseClinicalHospitalDto g = StatsCaseClinicalHospitalDto.GetDto(statsCaseClinicalHospital);
|
||||
|
||||
return Response.success(g);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临床病例库-统计-医生
|
||||
*/
|
||||
@GetMapping("/clinical/stats/doctor/{doctor_id}")
|
||||
public Response<StatsCaseClinicalDoctorDto> getClinicalStatsDoctor(
|
||||
@PathVariable("doctor_id") String doctorId
|
||||
){
|
||||
// 统计表-病例库-临床
|
||||
LambdaQueryWrapper<StatsCaseClinicalDoctorModel> statsCaseClinicalDoctorQueryWrapper = new LambdaQueryWrapper<>();
|
||||
statsCaseClinicalDoctorQueryWrapper.eq(StatsCaseClinicalDoctorModel::getDoctorId, doctorId);
|
||||
StatsCaseClinicalDoctorModel statsCaseClinicalDoctor = statsCaseClinicalDoctorDao.selectOne(statsCaseClinicalDoctorQueryWrapper);
|
||||
|
||||
StatsCaseClinicalDoctorDto g = StatsCaseClinicalDoctorDto.GetDto(statsCaseClinicalDoctor);
|
||||
|
||||
return Response.success(g);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.example.caseData.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.dao.UserDao;
|
||||
import com.example.caseData.dto.UserDto;
|
||||
import com.example.caseData.model.UserModel;
|
||||
import com.example.caseData.request.UserRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class UserController extends BaseController {
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
|
||||
// 查询所有用户
|
||||
@GetMapping("/users")
|
||||
public Response<Map<String, Object>> getUserPage(@Validated({UserRequest.Page.class}) @ModelAttribute UserRequest request) {
|
||||
request.validateForPage(); // 确保分页参数有默认值
|
||||
|
||||
Page<UserModel> page = new Page<>(request.getPage(), request.getPageSize()); // 创建分页对象
|
||||
|
||||
QueryWrapper<UserModel> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like("user_id", "吴");
|
||||
|
||||
// 执行分页查询
|
||||
Page<UserModel> resultPage = userDao.selectPage(page, queryWrapper);
|
||||
|
||||
// 返回
|
||||
List<UserDto> userDtoList = UserDto.getUserListDto(resultPage.getRecords());
|
||||
|
||||
// 组装分页结果
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("page", resultPage.getCurrent());
|
||||
resultMap.put("pageSize", resultPage.getSize());
|
||||
resultMap.put("total", resultPage.getTotal());
|
||||
resultMap.put("data", userDtoList);
|
||||
|
||||
return Response.success(resultMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
||||
registry.addMapping("/**") // 允许所有路径
|
||||
.allowedOriginPatterns("*") // 允许所有来源(Spring 2.4+ 用 `allowedOriginPatterns`)
|
||||
.allowedMethods("POST", "GET", "OPTIONS", "PUT", "DELETE", "UPDATE") // 允许的 HTTP 方法
|
||||
.allowedHeaders("Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization") // 允许的请求头
|
||||
.exposedHeaders("Content-Length", "Access-Control-Allow-Origin",
|
||||
"Access-Control-Allow-Headers", "Cache-Control",
|
||||
"Content-Language", "Content-Type") // 允许前端访问的响应头
|
||||
.allowCredentials(false); // 是否允许携带 Cookie
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 统一全局时间格式配置
|
||||
*/
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
|
||||
private static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
private static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||
private static final String TIME_PATTERN = "HH:mm:ss";
|
||||
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
||||
|
||||
// 配置序列化器
|
||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATE_TIME_PATTERN)));
|
||||
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_PATTERN)));
|
||||
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_PATTERN)));
|
||||
|
||||
// 配置反序列化器
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATE_TIME_PATTERN)));
|
||||
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_PATTERN)));
|
||||
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_PATTERN)));
|
||||
|
||||
objectMapper.registerModule(javaTimeModule);
|
||||
|
||||
// 禁用时间戳
|
||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
|
||||
// 空字段不返回(根据需要,可加可不加)
|
||||
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
|
||||
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MyBatisPlusConfig {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // 添加分页拦截器
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "createdAt", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictInsertFill(metaObject, "updatedAt", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictUpdateFill(metaObject, "updatedAt", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
|
||||
// 使用String序列化方式
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
template.setKeySerializer(stringRedisSerializer);
|
||||
template.setValueSerializer(stringRedisSerializer);
|
||||
template.setHashKeySerializer(stringRedisSerializer);
|
||||
template.setHashValueSerializer(stringRedisSerializer);
|
||||
|
||||
return template;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.caseData.core;
|
||||
|
||||
import com.example.caseData.middlewares.AuthInterceptor;
|
||||
import com.example.caseData.middlewares.JwtInterceptor;
|
||||
import com.example.caseData.middlewares.LogRequestInterceptor;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
@Resource
|
||||
private LogRequestInterceptor logRequestInterceptor;
|
||||
|
||||
@Resource
|
||||
private JwtInterceptor jwtInterceptor;
|
||||
|
||||
@Resource
|
||||
private AuthInterceptor authInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册日志拦截器
|
||||
registry.addInterceptor(logRequestInterceptor)
|
||||
.addPathPatterns("/**"); // 对所有路径生效
|
||||
|
||||
// 注册JWT认证拦截器
|
||||
registry.addInterceptor(jwtInterceptor)
|
||||
.addPathPatterns("/**"); // 对所有路径生效
|
||||
// .addPathPatterns("/api/**") // 适用于/api下的所有路径
|
||||
// .excludePathPatterns("/api/user/1", "/api/register"); // 排除不需要认证的路径
|
||||
|
||||
// 注册用户权限拦截器
|
||||
registry.addInterceptor(authInterceptor)
|
||||
.addPathPatterns("/**"); // 对所有路径生效
|
||||
// .addPathPatterns("/api/secure/**"); // 适用于需要权限验证的路径
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
|
||||
public interface BasicHospitalDao extends BaseMapper<BasicHospitalModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.BasicSensitiveWordModel;
|
||||
|
||||
public interface BasicSensitiveWordDao extends BaseMapper<BasicSensitiveWordModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseClinicalArticleAuthorModel;
|
||||
|
||||
public interface CaseClinicalArticleAuthorDao extends BaseMapper<CaseClinicalArticleAuthorModel> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.model.CaseClinicalArticleModel;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CaseClinicalArticleDao extends BaseMapper<CaseClinicalArticleModel> {
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* @param page 分页数据
|
||||
* @param title 标题
|
||||
* @param doctorName 医生名称
|
||||
* @param labelName 标签名称
|
||||
* @param order 排序
|
||||
*/
|
||||
IPage<CaseClinicalArticleDto> getCaseClinicalArticleSearchPage(
|
||||
Page<?> page,
|
||||
@Param("title") String title,
|
||||
@Param("doctorName") String doctorName,
|
||||
@Param("labelName") String labelName,
|
||||
@Param("hospital_id") String hospitalId,
|
||||
@Param("doctor_id") String doctorId,
|
||||
@Param("order") Map<String, String> order
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseClinicalArticleLabelModel;
|
||||
|
||||
public interface CaseClinicalArticleLabelDao extends BaseMapper<CaseClinicalArticleLabelModel> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
|
||||
public interface CaseClinicalDoctorDao extends BaseMapper<CaseClinicalDoctorModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseClinicalVideoAuthorModel;
|
||||
|
||||
public interface CaseClinicalVideoAuthorDao extends BaseMapper<CaseClinicalVideoAuthorModel> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.caseClinicalVideo.CaseClinicalVideoDto;
|
||||
import com.example.caseData.model.CaseClinicalVideoModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CaseClinicalVideoDao extends BaseMapper<CaseClinicalVideoModel> {
|
||||
/**
|
||||
* 临床病例库-搜索
|
||||
* @param page 分页数据
|
||||
* @param title 标题
|
||||
* @param doctorName 医生名称
|
||||
* @param labelName 标签名称
|
||||
* @param order 排序
|
||||
*/
|
||||
IPage<CaseClinicalVideoDto> getCaseClinicalVideoSearchPage(
|
||||
Page<?> page,
|
||||
@Param("title") String title,
|
||||
@Param("doctorName") String doctorName,
|
||||
@Param("labelName") String labelName,
|
||||
@Param("order") Map<String, String> order
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.CaseClinicalVideoLabelModel;
|
||||
|
||||
public interface CaseClinicalVideoLabelDao extends BaseMapper<CaseClinicalVideoLabelModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.StatsCaseClinicalModel;
|
||||
|
||||
public interface StatsCaseClinicalDao extends BaseMapper<StatsCaseClinicalModel> {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.StatsCaseClinicalDoctorModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface StatsCaseClinicalDoctorDao extends BaseMapper<StatsCaseClinicalDoctorModel> {
|
||||
/**
|
||||
* 医院病例库推荐-搜索
|
||||
* @param page 分页数据
|
||||
* @param doctorName 医生名称
|
||||
* @param order 排序
|
||||
*/
|
||||
IPage<StatsCaseClinicalDoctorDto> getStatsCaseClinicalDoctorSearchPage(
|
||||
Page<?> page,
|
||||
@Param("doctor_name") String doctorName,
|
||||
@Param("order") Map<String, String> order
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.example.caseData.dto.statsCaseClinicalHospital.StatsCaseClinicalHospitalDto;
|
||||
import com.example.caseData.model.StatsCaseClinicalHospitalModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.checkerframework.checker.units.qual.N;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface StatsCaseClinicalHospitalDao extends BaseMapper<StatsCaseClinicalHospitalModel> {
|
||||
/**
|
||||
* 医院病例库推荐-搜索
|
||||
* @param page 分页数据
|
||||
* @param hospitalName 医院名称
|
||||
* @param order 排序
|
||||
*/
|
||||
IPage<StatsCaseClinicalHospitalDto> getStatsCaseClinicalHospitalSearchPage(
|
||||
Page<?> page,
|
||||
@Param("hospital_name") String hospitalName,
|
||||
@Param("order") Map<String, String> order
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.UserCollectClinicalArticleModel;
|
||||
|
||||
public interface UserCollectClinicalArticleDao extends BaseMapper<UserCollectClinicalArticleModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.UserCollectClinicalVideoModel;
|
||||
|
||||
public interface UserCollectClinicalVideoDao extends BaseMapper<UserCollectClinicalVideoModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.UserCommentClinicalArticleModel;
|
||||
|
||||
public interface UserCommentClinicalArticleDao extends BaseMapper<UserCommentClinicalArticleModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.UserCommentClinicalVideoModel;
|
||||
|
||||
public interface UserCommentClinicalVideoDao extends BaseMapper<UserCommentClinicalVideoModel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.caseData.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.caseData.model.UserModel;
|
||||
|
||||
public interface UserDao extends BaseMapper<UserModel> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.example.caseData.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PublicDto {
|
||||
@JsonProperty("user_id")
|
||||
private String userId; // 主键id
|
||||
|
||||
@JsonProperty("user_name")
|
||||
private String userName; // 用户名称
|
||||
|
||||
private String avatar; // 头像
|
||||
private String token; // token
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.example.caseData.dto;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||
import com.example.caseData.model.CaseClinicalArticleModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// 示例
|
||||
public class T {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private String articleId;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("article_title")
|
||||
private String articleTitle;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@JsonProperty("article_status")
|
||||
private Integer articleStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 发表时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@JsonProperty("article_content")
|
||||
private String articleContent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<CaseClinicalArticleAuthorDto> author;
|
||||
|
||||
/**
|
||||
* 将文章实体类列表转换为 DTO 列表,只映射字段,不处理嵌套字段(如作者等)
|
||||
*/
|
||||
public static List<CaseClinicalArticleDto> listDto1(List<CaseClinicalArticleModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(v -> BeanUtil.copyProperties(v, CaseClinicalArticleDto.class))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个对象转换,只做字段映射
|
||||
*/
|
||||
public static CaseClinicalArticleDto dto1(CaseClinicalArticleModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BeanUtil.copyProperties(model, CaseClinicalArticleDto.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将文章实体类列表转换为 DTO 列表,只映射字段,不处理嵌套字段(如作者等)
|
||||
* 如果字段类型不同(如 Long -> String),可在此处手动处理
|
||||
*/
|
||||
public static List<CaseClinicalArticleDto> listDto2(List<CaseClinicalArticleModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalArticleDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getArticleId() != null) {
|
||||
dto.setArticleId(String.valueOf(model.getArticleId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getPushDate() != null) {
|
||||
dto.setPushDate(model.getPushDate()); // 这里类型一致,其实可以不用写,仅作示范
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将单个实体类转换为 DTO,只映射字段,不处理嵌套字段
|
||||
*/
|
||||
public static CaseClinicalArticleDto dto2(CaseClinicalArticleModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalArticleDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getArticleId() != null) {
|
||||
dto.setArticleId(String.valueOf(model.getArticleId())); // Long -> String
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.example.caseData.dto;
|
||||
|
||||
import com.example.caseData.model.UserModel;
|
||||
import com.example.caseData.utils.Replace;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDto {
|
||||
private String userId; // 主键id
|
||||
private String userIden; // 第三方平台唯一标识
|
||||
private String userName; // 用户名称
|
||||
private String userMobile; // 手机号
|
||||
private Integer status; // 状态(0:禁用 1:正常 2:删除)
|
||||
private Integer registerSource;// 注册来源(1:未知 2:app用户 3:佳动例)
|
||||
private String openId; // 用户微信标识
|
||||
private String unionId; // 微信开放平台标识
|
||||
private Integer sex; // 性别(0:未知 1:男 2:女)
|
||||
private String avatar; // 头像
|
||||
private Integer title; // 医生职称
|
||||
private String departmentName; // 科室名称
|
||||
private String hospitalId; // 所属医院id
|
||||
private LocalDateTime createdAt; // 创建时间
|
||||
private LocalDateTime updatedAt; // 修改时间
|
||||
|
||||
public static UserDto getUserDto(UserModel userModel) {
|
||||
if (userModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserDto dto = new UserDto();
|
||||
dto.setUserId(userModel.getUserId().toString());
|
||||
dto.setUserIden(userModel.getUserIden());
|
||||
dto.setUserName(userModel.getUserName());
|
||||
dto.setUserMobile(userModel.getUserMobile());
|
||||
dto.setStatus(userModel.getStatus());
|
||||
dto.setRegisterSource(userModel.getRegisterSource());
|
||||
dto.setOpenId(userModel.getOpenId());
|
||||
dto.setUnionId(userModel.getUnionId());
|
||||
dto.setSex(userModel.getSex());
|
||||
dto.setAvatar(userModel.getAvatar());
|
||||
dto.setTitle(userModel.getTitle());
|
||||
dto.setDepartmentName(userModel.getDepartmentName());
|
||||
dto.setHospitalId(userModel.getHospitalId().toString());
|
||||
dto.setCreatedAt(userModel.getCreatedAt());
|
||||
dto.setUpdatedAt(userModel.getUpdatedAt());
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
public static List<UserDto> getUserListDto(List<UserModel> userModels) {
|
||||
List<UserDto> userDtoList = new ArrayList<>();
|
||||
|
||||
for (UserModel userModel : userModels) {
|
||||
UserDto dto = getUserDto(userModel);
|
||||
|
||||
// 在这里对字段做一些操作(暂时不做任何处理)
|
||||
// 例如: dto.setUserName(dto.getUserName().toUpperCase());
|
||||
|
||||
userDtoList.add(dto);
|
||||
}
|
||||
|
||||
return userDtoList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.example.caseData.dto.basicHospital;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.example.caseData.model.BasicHospitalModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class BasicHospitalDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@JsonProperty("hospital_iden")
|
||||
private String hospitalIden;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
|
||||
/**
|
||||
* 来源(2:肝胆相照 3:佳动例)
|
||||
*/
|
||||
@JsonProperty("source")
|
||||
private Integer source;
|
||||
|
||||
/**
|
||||
* 医院等级(0:未知 1:三级甲等 2:三级乙等 3:三级丙等 4:二级甲等 5:二级乙等 6:二级丙等 7:一级甲等 8:一级乙等 9:一级丙等)
|
||||
*/
|
||||
@JsonProperty("hospital_level")
|
||||
private String hospitalLevel;
|
||||
|
||||
/**
|
||||
* 医院性质(0:未知 1:公立 2:私立)
|
||||
*/
|
||||
@JsonProperty("hospital_nature")
|
||||
private Integer hospitalNature;
|
||||
|
||||
/**
|
||||
* 医生数量
|
||||
*/
|
||||
@JsonProperty("doctor_number")
|
||||
private Integer doctorNumber;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@JsonProperty("province")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@JsonProperty("city")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
@JsonProperty("county")
|
||||
private String county;
|
||||
|
||||
/**
|
||||
* 医院地址
|
||||
*/
|
||||
@JsonProperty("hospital_address")
|
||||
private String hospitalAddress;
|
||||
|
||||
/**
|
||||
* 医院简介
|
||||
*/
|
||||
@JsonProperty("hospital_intro")
|
||||
private String hospitalIntro;
|
||||
|
||||
/**
|
||||
* 医院logo
|
||||
*/
|
||||
@JsonProperty("hospital_logo")
|
||||
private String hospitalLogo;
|
||||
|
||||
/**
|
||||
* 状态(0:禁用 1:正常)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<BasicHospitalDto> GetListDto(List<BasicHospitalModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
BasicHospitalDto dto = BeanUtil.copyProperties(model, BasicHospitalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId())); // Long -> String
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static BasicHospitalDto GetDto(BasicHospitalModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BasicHospitalDto dto = BeanUtil.copyProperties(model, BasicHospitalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId())); // Long -> String
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.example.caseData.dto.basicSensitiveWord;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class BasicSensitiveWordDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 敏感词
|
||||
*/
|
||||
@JsonProperty("word")
|
||||
private String word;
|
||||
|
||||
/**
|
||||
* 状态(0:禁用 1:正常)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.example.caseData.dto.caseClinicalArticle;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.dto.caseClinicalArticleAuthor.CaseClinicalArticleAuthorDto;
|
||||
import com.example.caseData.model.CaseClinicalArticleModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalArticleDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private String articleId;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("article_title")
|
||||
private String articleTitle;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@JsonProperty("article_status")
|
||||
private Integer articleStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 发表时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@JsonProperty("article_content")
|
||||
private String articleContent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<CaseClinicalArticleAuthorDto> author;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<CaseClinicalArticleDto> GetListDto(List<CaseClinicalArticleModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalArticleDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getArticleId() != null) {
|
||||
dto.setArticleId(String.valueOf(model.getArticleId())); // Long -> String
|
||||
}
|
||||
|
||||
// 作者
|
||||
if (model.getAuthor() != null && !model.getAuthor().isEmpty()) {
|
||||
List<CaseClinicalArticleAuthorDto> caseClinicalArticleAuthorListDto = CaseClinicalArticleAuthorDto.GetListDto(model.getAuthor());
|
||||
dto.setAuthor(caseClinicalArticleAuthorListDto);
|
||||
}
|
||||
|
||||
dto.setArticleContent("");
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static CaseClinicalArticleDto GetDto(CaseClinicalArticleModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalArticleDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getArticleId() != null) {
|
||||
dto.setArticleId(String.valueOf(model.getArticleId())); // Long -> String
|
||||
}
|
||||
|
||||
// 作者
|
||||
if (model.getAuthor() != null && !model.getAuthor().isEmpty()) {
|
||||
List<CaseClinicalArticleAuthorDto> caseClinicalArticleAuthorListDto = CaseClinicalArticleAuthorDto.GetListDto(model.getAuthor());
|
||||
dto.setAuthor(caseClinicalArticleAuthorListDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.example.caseData.dto.caseClinicalArticleAuthor;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.example.caseData.dto.caseClinicalDoctor.CaseClinicalDoctorDto;
|
||||
import com.example.caseData.model.CaseClinicalArticleAuthorModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalArticleAuthorDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("author_id")
|
||||
private String authorId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private String articleId;
|
||||
|
||||
/**
|
||||
* 医生id
|
||||
*/
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<CaseClinicalArticleAuthorDto> GetListDto(List<CaseClinicalArticleAuthorModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalArticleAuthorDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleAuthorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getAuthorId() != null) {
|
||||
dto.setAuthorId(String.valueOf(model.getAuthorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setDoctorName(caseClinicalDoctorDto.getDoctorName());
|
||||
dto.setHospitalName(caseClinicalDoctorDto.getHospitalName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static CaseClinicalArticleAuthorDto GetDto(CaseClinicalArticleAuthorModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalArticleAuthorDto dto = BeanUtil.copyProperties(model, CaseClinicalArticleAuthorDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getAuthorId() != null) {
|
||||
dto.setAuthorId(String.valueOf(model.getAuthorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setDoctorName(caseClinicalDoctorDto.getDoctorName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.example.caseData.dto.caseClinicalArticleLabel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalArticleLabelDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("article_label_id")
|
||||
private Long articleLabelId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@JsonProperty("app_iden")
|
||||
private String appIden;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@JsonProperty("label_name")
|
||||
private String labelName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.example.caseData.dto.caseClinicalDoctor;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.model.CaseClinicalDoctorModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalDoctorDto {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* app唯一标识(存在即表示为注册用户)
|
||||
*/
|
||||
@JsonProperty("doctor_iden")
|
||||
private String doctorIden;
|
||||
|
||||
/**
|
||||
* 医生名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@JsonProperty("avatar")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<CaseClinicalDoctorDto> GetListDto(List<CaseClinicalDoctorModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalDoctorDto dto = BeanUtil.copyProperties(model, CaseClinicalDoctorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId())); // Long -> String
|
||||
}
|
||||
|
||||
// 医院名称
|
||||
if (model.getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getBasicHospital().getHospitalName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static CaseClinicalDoctorDto GetDto(CaseClinicalDoctorModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalDoctorDto dto = BeanUtil.copyProperties(model, CaseClinicalDoctorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId())); // Long -> String
|
||||
}
|
||||
|
||||
// 医院名称
|
||||
if (model.getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getBasicHospital().getHospitalName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.example.caseData.dto.caseClinicalVideo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.example.caseData.dto.caseClinicalVideo.CaseClinicalVideoDto;
|
||||
import com.example.caseData.dto.caseClinicalVideoAuthor.CaseClinicalVideoAuthorDto;
|
||||
import com.example.caseData.dto.caseClinicalVideoAuthor.CaseClinicalVideoAuthorDto;
|
||||
import com.example.caseData.model.CaseClinicalVideoModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalVideoDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private String videoId;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@JsonProperty("video_title")
|
||||
private String videoTitle;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@JsonProperty("video_status")
|
||||
private Integer videoStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@JsonProperty("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@JsonProperty("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 视频编号(保利)
|
||||
*/
|
||||
@JsonProperty("video_no")
|
||||
private String videoNo;
|
||||
|
||||
/**
|
||||
* 发表时间
|
||||
*/
|
||||
@JsonProperty("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@JsonProperty("author")
|
||||
private List<CaseClinicalVideoAuthorDto> author;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<CaseClinicalVideoDto> GetListDto(List<CaseClinicalVideoModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalVideoDto dto = BeanUtil.copyProperties(model, CaseClinicalVideoDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getVideoId() != null) {
|
||||
dto.setVideoId(String.valueOf(model.getVideoId())); // Long -> String
|
||||
}
|
||||
|
||||
// 作者
|
||||
if (model.getAuthor() != null && !model.getAuthor().isEmpty()) {
|
||||
List<CaseClinicalVideoAuthorDto> caseClinicalVideoAuthorListDto = CaseClinicalVideoAuthorDto.GetListDto(model.getAuthor());
|
||||
dto.setAuthor(caseClinicalVideoAuthorListDto);
|
||||
}
|
||||
|
||||
dto.setVideoNo("");
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static CaseClinicalVideoDto GetDto(CaseClinicalVideoModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalVideoDto dto = BeanUtil.copyProperties(model, CaseClinicalVideoDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getVideoId() != null) {
|
||||
dto.setVideoId(String.valueOf(model.getVideoId())); // Long -> String
|
||||
}
|
||||
|
||||
// 作者
|
||||
if (model.getAuthor() != null && !model.getAuthor().isEmpty()) {
|
||||
List<CaseClinicalVideoAuthorDto> caseClinicalVideoAuthorListDto = CaseClinicalVideoAuthorDto.GetListDto(model.getAuthor());
|
||||
dto.setAuthor(caseClinicalVideoAuthorListDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.example.caseData.dto.caseClinicalVideoAuthor;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.dto.caseClinicalVideoAuthor.CaseClinicalVideoAuthorDto;
|
||||
import com.example.caseData.dto.caseClinicalDoctor.CaseClinicalDoctorDto;
|
||||
import com.example.caseData.model.CaseClinicalVideoAuthorModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalVideoAuthorDto {
|
||||
/**
|
||||
* 主键id(可选)
|
||||
*/
|
||||
@JsonProperty("author_id")
|
||||
private String authorId;
|
||||
|
||||
/**
|
||||
* 临床视频id(作为主键)
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private String videoId;
|
||||
|
||||
/**
|
||||
* 医生id
|
||||
*/
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<CaseClinicalVideoAuthorDto> GetListDto(List<CaseClinicalVideoAuthorModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
CaseClinicalVideoAuthorDto dto = BeanUtil.copyProperties(model, CaseClinicalVideoAuthorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getAuthorId() != null) {
|
||||
dto.setAuthorId(String.valueOf(model.getAuthorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setDoctorName(caseClinicalDoctorDto.getDoctorName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static CaseClinicalVideoAuthorDto GetDto(CaseClinicalVideoAuthorModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseClinicalVideoAuthorDto dto = BeanUtil.copyProperties(model, CaseClinicalVideoAuthorDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getAuthorId() != null) {
|
||||
dto.setAuthorId(String.valueOf(model.getAuthorId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setDoctorName(caseClinicalDoctorDto.getDoctorName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.example.caseData.dto.caseClinicalVideoLabel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CaseClinicalVideoLabelDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("video_label_id")
|
||||
private Long videoLabelId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@JsonProperty("app_iden")
|
||||
private String appIden;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@JsonProperty("label_name")
|
||||
private String labelName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.example.caseData.dto.index;
|
||||
|
||||
import com.example.caseData.dto.caseClinicalArticle.CaseClinicalArticleDto;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GetIndexClinicalDto {
|
||||
@JsonProperty("new_articles")
|
||||
private List<CaseClinicalArticleDto> newArticles; // 最新上线
|
||||
|
||||
@JsonProperty("most_read_articles")
|
||||
private List<CaseClinicalArticleDto> mostReadArticles; // 最多阅读
|
||||
|
||||
@JsonProperty("recommend_hospital")
|
||||
private List<RecommendHospitalDto> recommendHospital; // 医院病例库推荐
|
||||
|
||||
@JsonProperty("recommend_doctor")
|
||||
private List<RecommendDoctorDto> recommendDoctor; // 医生病例库推荐
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.example.caseData.dto.index;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.model.StatsCaseClinicalDoctorModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 医生病例库推荐
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RecommendDoctorDto {
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId; // 医生id
|
||||
|
||||
@JsonProperty("doctor_name")
|
||||
private String doctorName; // 医生名称
|
||||
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName; // 医院名称
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<RecommendDoctorDto> GetListDto(List<StatsCaseClinicalDoctorModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
RecommendDoctorDto dto = BeanUtil.copyProperties(model, RecommendDoctorDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId()));
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
dto.setDoctorName(model.getCaseClinicalDoctor().getDoctorName());
|
||||
|
||||
if (model.getCaseClinicalDoctor().getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getCaseClinicalDoctor().getBasicHospital().getHospitalName());
|
||||
}
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static RecommendDoctorDto GetDto(StatsCaseClinicalDoctorModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
RecommendDoctorDto dto = BeanUtil.copyProperties(model, RecommendDoctorDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId()));
|
||||
}
|
||||
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
dto.setDoctorName(model.getCaseClinicalDoctor().getDoctorName());
|
||||
|
||||
if (model.getCaseClinicalDoctor().getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getCaseClinicalDoctor().getBasicHospital().getHospitalName());
|
||||
}
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.example.caseData.dto.index;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.model.StatsCaseClinicalHospitalModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 医院病例库推荐
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RecommendHospitalDto {
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId; // 医院id
|
||||
|
||||
@JsonProperty("hospital_name")
|
||||
private String hospitalName; // 医院名称
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<RecommendHospitalDto> GetListDto(List<StatsCaseClinicalHospitalModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
RecommendHospitalDto dto = BeanUtil.copyProperties(model, RecommendHospitalDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId()));
|
||||
}
|
||||
|
||||
if (model.getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getBasicHospital().getHospitalName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static RecommendHospitalDto GetDto(StatsCaseClinicalHospitalModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
RecommendHospitalDto dto = BeanUtil.copyProperties(model, RecommendHospitalDto.class);
|
||||
|
||||
// 类型转换示例
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId()));
|
||||
}
|
||||
|
||||
if (model.getBasicHospital() != null) {
|
||||
dto.setHospitalName(model.getBasicHospital().getHospitalName());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.example.caseData.dto.statsCaseClinical;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.model.StatsCaseClinicalModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class StatsCaseClinicalDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("stats_id")
|
||||
private String statsId;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@JsonProperty("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@JsonProperty("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@JsonProperty("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@JsonProperty("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<StatsCaseClinicalDto> GetListDto(List<StatsCaseClinicalModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
StatsCaseClinicalDto dto = BeanUtil.copyProperties(model, StatsCaseClinicalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static StatsCaseClinicalDto GetDto(StatsCaseClinicalModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StatsCaseClinicalDto dto = BeanUtil.copyProperties(model, StatsCaseClinicalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package com.example.caseData.dto.statsCaseClinicalDoctor;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.example.caseData.dto.basicHospital.BasicHospitalDto;
|
||||
import com.example.caseData.dto.caseClinicalDoctor.CaseClinicalDoctorDto;
|
||||
import com.example.caseData.model.StatsCaseClinicalDoctorModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class StatsCaseClinicalDoctorDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("stats_id")
|
||||
private String statsId;
|
||||
|
||||
/**
|
||||
* 医院id
|
||||
*/
|
||||
@JsonProperty("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* 数量-文章
|
||||
*/
|
||||
@JsonProperty("article_num")
|
||||
private Integer articleNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@JsonProperty("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@JsonProperty("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 最后一篇文章发表时间
|
||||
*/
|
||||
@JsonProperty("last_push_date")
|
||||
private LocalDateTime lastPushDate;
|
||||
|
||||
/**
|
||||
* 数量-视频
|
||||
*/
|
||||
@JsonProperty("video_num")
|
||||
private Integer videoNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@JsonProperty("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@JsonProperty("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 基础数据-医生
|
||||
*/
|
||||
@JsonProperty("case_clinical_doctor")
|
||||
private CaseClinicalDoctorDto caseClinicalDoctor;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto> GetListDto(List<StatsCaseClinicalDoctorModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto dto = BeanUtil.copyProperties(model, com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId())); // Long -> String
|
||||
}
|
||||
|
||||
// 基础数据-医生
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setCaseClinicalDoctor(caseClinicalDoctorDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto GetDto(StatsCaseClinicalDoctorModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto dto = BeanUtil.copyProperties(model, com.example.caseData.dto.statsCaseClinicalDoctor.StatsCaseClinicalDoctorDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getDoctorId() != null) {
|
||||
dto.setDoctorId(String.valueOf(model.getDoctorId())); // Long -> String
|
||||
}
|
||||
|
||||
// 基础数据-医生
|
||||
if (model.getCaseClinicalDoctor() != null) {
|
||||
CaseClinicalDoctorDto caseClinicalDoctorDto = CaseClinicalDoctorDto.GetDto(model.getCaseClinicalDoctor());
|
||||
dto.setCaseClinicalDoctor(caseClinicalDoctorDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package com.example.caseData.dto.statsCaseClinicalHospital;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.example.caseData.dto.basicHospital.BasicHospitalDto;
|
||||
import com.example.caseData.model.StatsCaseClinicalHospitalModel;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//@JsonInclude(JsonInclude.Include.ALWAYS) // 这行是关键,强制序列化 null 值
|
||||
@Data
|
||||
public class StatsCaseClinicalHospitalDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("stats_id")
|
||||
private String statsId;
|
||||
|
||||
/**
|
||||
* 医院id
|
||||
*/
|
||||
@JsonProperty("hospital_id")
|
||||
private String hospitalId;
|
||||
|
||||
/**
|
||||
* 数量-文章
|
||||
*/
|
||||
@JsonProperty("article_num")
|
||||
private Integer articleNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@JsonProperty("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@JsonProperty("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 最后一篇文章发表时间
|
||||
*/
|
||||
@JsonProperty("last_push_date")
|
||||
private LocalDateTime lastPushDate;
|
||||
|
||||
/**
|
||||
* 数量-视频
|
||||
*/
|
||||
@JsonProperty("video_num")
|
||||
private Integer videoNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@JsonProperty("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@JsonProperty("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 基础数据-医院
|
||||
*/
|
||||
@JsonProperty("basic_hospital")
|
||||
private BasicHospitalDto basicHospital;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public static List<StatsCaseClinicalHospitalDto> GetListDto(List<StatsCaseClinicalHospitalModel> models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return models.stream()
|
||||
.map(model -> {
|
||||
StatsCaseClinicalHospitalDto dto = BeanUtil.copyProperties(model, StatsCaseClinicalHospitalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
// 基础数据-医院
|
||||
if (model.getBasicHospital() != null) {
|
||||
BasicHospitalDto basicHospitalListDto = BasicHospitalDto.GetDto(model.getBasicHospital());
|
||||
dto.setBasicHospital(basicHospitalListDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public static StatsCaseClinicalHospitalDto GetDto(StatsCaseClinicalHospitalModel model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StatsCaseClinicalHospitalDto dto = BeanUtil.copyProperties(model, StatsCaseClinicalHospitalDto.class);
|
||||
|
||||
// 示例:手动处理字段类型不一致
|
||||
if (model.getStatsId() != null) {
|
||||
dto.setStatsId(String.valueOf(model.getStatsId())); // Long -> String
|
||||
}
|
||||
|
||||
if (model.getHospitalId() != null) {
|
||||
dto.setHospitalId(String.valueOf(model.getHospitalId())); // Long -> String
|
||||
}
|
||||
|
||||
// 基础数据-医院
|
||||
if (model.getBasicHospital() != null) {
|
||||
BasicHospitalDto basicHospitalListDto = BasicHospitalDto.GetDto(model.getBasicHospital());
|
||||
dto.setBasicHospital(basicHospitalListDto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.example.caseData.dto.userCollectClinicalArticle;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserCollectClinicalArticleDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("collect_id")
|
||||
private Long collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.example.caseData.dto.userCollectClinicalVideo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserCollectClinicalVideoDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("collect_id")
|
||||
private Long collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.example.caseData.dto.userCommentClinicalArticle;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalArticleDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("comment_id")
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@JsonProperty("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
@JsonProperty("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
@JsonProperty("root_id")
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
@JsonProperty("is_sensitive")
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 是否优质留言(0:否 1:是)
|
||||
*/
|
||||
@JsonProperty("is_high_quality")
|
||||
private Integer isHighQuality;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
@JsonProperty("like_num")
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@JsonProperty("content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
@JsonProperty("content_word")
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.example.caseData.dto.userCommentClinicalVideo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserCommentClinicalVideoDto {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("comment_id")
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonProperty("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@JsonProperty("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
@JsonProperty("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
@JsonProperty("root_id")
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
@JsonProperty("is_sensitive")
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 是否优质留言(0:否 1:是)
|
||||
*/
|
||||
@JsonProperty("is_high_quality")
|
||||
private Integer isHighQuality;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
@JsonProperty("like_num")
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@JsonProperty("content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
@JsonProperty("content_word")
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.example.caseData.exception;
|
||||
|
||||
import com.example.caseData.config.EnvConfig;
|
||||
import com.example.caseData.config.OssConfig;
|
||||
import com.example.caseData.utils.EnvUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
public class BusinessException extends RuntimeException {
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private final String message;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param code 错误码
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public BusinessException(String code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public BusinessException(String message) {
|
||||
this("500", message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param code 错误码
|
||||
* @param message 错误信息
|
||||
* @param cause 原始异常
|
||||
*/
|
||||
public BusinessException(String code, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.example.caseData.exception;
|
||||
|
||||
import com.example.caseData.common.Response;
|
||||
import com.example.caseData.utils.EnvUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.ibatis.binding.BindingException;
|
||||
import org.apache.ibatis.exceptions.PersistenceException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.apache.ibatis.exceptions.PersistenceException;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 全局异常类
|
||||
*/
|
||||
@Slf4j
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
// 处理所有未捕获的异常
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<Map<String, Object>> handleGlobalException(Exception ex) {
|
||||
System.out.print(ExceptionUtils.getStackTrace(ex));
|
||||
Map<String, Object> errorResponse = new HashMap<>();
|
||||
|
||||
String message = ExceptionUtils.getStackTrace(ex);
|
||||
if (EnvUtil.isProd()) {
|
||||
log.error("error:{}", message);
|
||||
message = "内部错误";
|
||||
}
|
||||
|
||||
errorResponse.put("message", "异常");
|
||||
errorResponse.put("data", null);
|
||||
errorResponse.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
||||
}
|
||||
|
||||
// 处理 404 请求(接口不存在)
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||
public ResponseEntity<Map<String, Object>> handleNotFoundException(HttpRequestMethodNotSupportedException ex) {
|
||||
Map<String, Object> errorResponse = new HashMap<>();
|
||||
errorResponse.put("message", "接口不存在");
|
||||
errorResponse.put("code", 404);
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse);
|
||||
}
|
||||
|
||||
// 处理参数校验异常
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public ResponseEntity<Map<String, Object>> handleValidationException(MethodArgumentNotValidException ex) {
|
||||
// 记录的错误
|
||||
// Map<String, Object> errors = new HashMap<>();
|
||||
// ex.getBindingResult().getFieldErrors().forEach(error ->
|
||||
// errors.put(error.getField(), error.getDefaultMessage()));
|
||||
|
||||
// Map<String, Object> errorResponse = new HashMap<>();
|
||||
// errorResponse.put("code", HttpStatus.BAD_REQUEST.value());
|
||||
// errorResponse.put("message", "错误请求");
|
||||
|
||||
|
||||
Map<String, Object> errorResponse = new HashMap<>();
|
||||
// 获取第一个字段错误
|
||||
FieldError fieldError = ex.getBindingResult().getFieldErrors().stream().findFirst().orElse(null);
|
||||
|
||||
if (fieldError != null) {
|
||||
// 返回第一个字段的错误信息
|
||||
errorResponse.put("code", HttpStatus.BAD_REQUEST.value());
|
||||
errorResponse.put("message", fieldError.getDefaultMessage());
|
||||
} else {
|
||||
// 如果没有具体错误信息
|
||||
errorResponse.put("code", HttpStatus.BAD_REQUEST.value());
|
||||
errorResponse.put("message", "错误请求");
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(errorResponse);
|
||||
}
|
||||
|
||||
// 处理业务异常
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public ResponseEntity<Map<String, Object>> handleBusinessException(BusinessException ex) {
|
||||
Map<String, Object> errorResponse = new HashMap<>();
|
||||
errorResponse.put("message", ex.getMessage());
|
||||
errorResponse.put("code", ex.getCode());
|
||||
return ResponseEntity.ok(errorResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.example.caseData.extend.app;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
public class Base {
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
* @param params 需要签名的参数(支持嵌套 Map)
|
||||
* @param secretKey 密钥
|
||||
* @return 签名字符串
|
||||
*/
|
||||
public static String genSignature(Map<String, Object> params, String secretKey) {
|
||||
try {
|
||||
// Step 1: 对 Map 进行递归排序
|
||||
Map<String, Object> sortedMap = sortMapRecursively(params);
|
||||
|
||||
// Step 2: 转为 JSON 字符串
|
||||
String json = objectMapper.writeValueAsString(sortedMap);
|
||||
|
||||
// Step 3: 使用 HMAC-SHA256 签名
|
||||
return hmacSha256(json, secretKey);
|
||||
} catch (JsonProcessingException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对 Map<String, Object> 进行递归排序(key 排序),支持嵌套 Map 和 List
|
||||
*/
|
||||
public static Map<String, Object> sortMapRecursively(Map<String, Object> data) {
|
||||
Map<String, Object> sortedMap = new TreeMap<>(); // TreeMap 会自动按 key 排序
|
||||
|
||||
for (Map.Entry<String, Object> entry : data.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
if (value instanceof Map) {
|
||||
// 如果是嵌套 map,递归排序
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> nestedMap = (Map<String, Object>) value;
|
||||
sortedMap.put(key, sortMapRecursively(nestedMap));
|
||||
} else if (value instanceof List) {
|
||||
// 如果是列表,检查每一项是否是 map,如果是则排序
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> list = (List<Object>) value;
|
||||
List<Object> sortedList = new ArrayList<>();
|
||||
for (Object item : list) {
|
||||
if (item instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> nestedItemMap = (Map<String, Object>) item;
|
||||
sortedList.add(sortMapRecursively(nestedItemMap));
|
||||
} else {
|
||||
sortedList.add(item);
|
||||
}
|
||||
}
|
||||
sortedMap.put(key, sortedList);
|
||||
} else {
|
||||
// 普通字段,直接插入
|
||||
sortedMap.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* HMAC-SHA256 加密
|
||||
*/
|
||||
private static String hmacSha256(String data, String key) {
|
||||
try {
|
||||
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
sha256_HMAC.init(secretKeySpec);
|
||||
byte[] result = sha256_HMAC.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
// 转为 16 进制字符串
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte b : result) {
|
||||
String hex = Integer.toHexString(0xff & b);
|
||||
if (hex.length() == 1) hexString.append('0');
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 POST JSON 请求
|
||||
* @param url 请求地址
|
||||
* @param jsonData JSON 字符串
|
||||
* @param headers 请求头
|
||||
* @return 响应字符串
|
||||
*/
|
||||
public String postJson(String url, String jsonData, Map<String, String> headers) {
|
||||
HttpRequest request = HttpRequest.post(url)
|
||||
.body(jsonData)
|
||||
.header("Content-Type", "application/json");
|
||||
|
||||
if (headers != null) {
|
||||
headers.forEach(request::header);
|
||||
}
|
||||
|
||||
try (HttpResponse response = request.execute()) {
|
||||
return response.body();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.example.caseData.extend.app.Hospital;
|
||||
|
||||
import com.example.caseData.extend.app.UserInfo.GetUserInfoByMobileResponse;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetHospitalByUuidResponse
|
||||
{
|
||||
/** 接口调用状态。200:正常;其它值:调用出错 */
|
||||
private int code;
|
||||
|
||||
/** 结果说明。如果接口调用出错,那么返回错误描述。成功则返回 ok */
|
||||
private String msg;
|
||||
|
||||
/** 接口返回的用户信息数据 */
|
||||
private GetHospitalByUuidData data;
|
||||
|
||||
/** 接口是否调用成功 */
|
||||
private boolean success;
|
||||
|
||||
/** 错误信息或提示信息 */
|
||||
private String message;
|
||||
|
||||
|
||||
/**
|
||||
* 根据手机号获取医生信息 - 详细数据
|
||||
*/
|
||||
@Data
|
||||
public static class GetHospitalByUuidData {
|
||||
|
||||
/** 医院唯一标识 */
|
||||
private String uuid;
|
||||
|
||||
/** 科室 */
|
||||
private String name;
|
||||
|
||||
/** 等级 */
|
||||
private String level;
|
||||
|
||||
/** 省份 */
|
||||
private String prov_name;
|
||||
|
||||
/** 医生数量 */
|
||||
private Integer expert_num;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.example.caseData.extend.app.Hospital;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.caseData.config.AppConfig;
|
||||
import com.example.caseData.exception.BusinessException;
|
||||
import com.example.caseData.extend.app.Base;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class Hospital extends Base {
|
||||
@Resource
|
||||
private AppConfig appConfig;
|
||||
|
||||
// 根据医院唯一标识获取医院数据
|
||||
public GetHospitalByUuidResponse getHospitalByUuid(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.example.caseData.extend.app.UserInfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetUserInfoByMobileResponse {
|
||||
/** 接口调用状态。200:正常;其它值:调用出错 */
|
||||
private int code;
|
||||
|
||||
/** 结果说明。如果接口调用出错,那么返回错误描述。成功则返回 ok */
|
||||
private String msg;
|
||||
|
||||
/** 接口返回的用户信息数据 */
|
||||
private GetUserInfoByMobileData data;
|
||||
|
||||
/** 接口是否调用成功 */
|
||||
private boolean success;
|
||||
|
||||
/** 错误信息或提示信息 */
|
||||
private String message;
|
||||
|
||||
|
||||
/**
|
||||
* 根据手机号获取医生信息 - 详细数据
|
||||
*/
|
||||
@Data
|
||||
public static class GetUserInfoByMobileData {
|
||||
|
||||
/** app唯一标识 */
|
||||
private String uuid;
|
||||
|
||||
/** 科室 */
|
||||
private String officeName;
|
||||
|
||||
/** 姓名 */
|
||||
private String realname;
|
||||
|
||||
/** 医院唯一标识 */
|
||||
private String hospitalUuid;
|
||||
|
||||
/** 手机号 */
|
||||
private String mobile;
|
||||
|
||||
/** 头像地址 */
|
||||
private String photo;
|
||||
|
||||
/** 创建时间 */
|
||||
private String createDate;
|
||||
|
||||
/** 职称 */
|
||||
private String positionName;
|
||||
|
||||
/** 省份 */
|
||||
private String provName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.example.caseData.extend.app.UserInfo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.caseData.config.AppConfig;
|
||||
import com.example.caseData.exception.BusinessException;
|
||||
import com.example.caseData.extend.app.Base;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserInfo extends Base {
|
||||
@Resource
|
||||
private AppConfig appConfig;
|
||||
|
||||
// 根据手机号获取信息V3
|
||||
public GetUserInfoByMobileResponse getUserInfoByMobile(String mobile) throws BusinessException {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
|
||||
// 处理参数
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("mobile", mobile);
|
||||
requestData.put("platform", appConfig.getPlatform());
|
||||
requestData.put("timestamp", timestamp);
|
||||
|
||||
// 生成签名
|
||||
String sign = genSignature(requestData,appConfig.getSecretKey());
|
||||
|
||||
String url = appConfig.getApiUrl() + "/expert-api/getInfoByMobileV3";
|
||||
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
|
||||
GetUserInfoByMobileResponse result = JSONUtil.toBean(response.body(), GetUserInfoByMobileResponse.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,47 @@
|
||||
package com.example.caseData.extend.weChat;
|
||||
|
||||
|
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
public class WxMaRedisConfig extends WxMaDefaultConfigImpl {
|
||||
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
public WxMaRedisConfig(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessToken() {
|
||||
String redisKey = "wx:ma:access_token:" + this.getAppid();
|
||||
String token = redisTemplate.opsForValue().get(redisKey);
|
||||
if (token != null) {
|
||||
return token;
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
token = redisTemplate.opsForValue().get(redisKey);
|
||||
if (token != null) return token;
|
||||
|
||||
try {
|
||||
String newToken = super.getAccessToken(); // 强制刷新
|
||||
redisTemplate.opsForValue().set(redisKey, newToken, this.getExpiresTime() - 200L, TimeUnit.SECONDS);
|
||||
return newToken;
|
||||
} catch (Exception e) {
|
||||
log.error("获取access_token失败", e);
|
||||
throw new RuntimeException("获取access_token失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAccessToken(String accessToken, int expiresInSeconds) {
|
||||
String redisKey = "wx:ma:access_token:" + this.getAppid();
|
||||
redisTemplate.opsForValue().set(redisKey, accessToken, expiresInSeconds - 200L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.example.caseData.extend.weChat;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
import com.example.caseData.config.WxMaConfig;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
@Configuration
|
||||
public class WxMaServiceConfig {
|
||||
@Bean
|
||||
public WxMaService wxMaService(WxMaConfig config, StringRedisTemplate redisTemplate) {
|
||||
WxMaRedisConfig redisConfig = new WxMaRedisConfig(redisTemplate);
|
||||
redisConfig.setAppid(config.getAppid());
|
||||
redisConfig.setSecret(config.getSecret());
|
||||
|
||||
WxMaServiceImpl service = new WxMaServiceImpl();
|
||||
service.setWxMaConfig(redisConfig);
|
||||
return service;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.example.caseData.extend.weChat;
|
||||
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaServiceUtils {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
/**
|
||||
* 通过 code 换取 session 信息(openid/unionid)
|
||||
*/
|
||||
public WxMaJscode2SessionResult getSessionInfo(String code) {
|
||||
try {
|
||||
return wxMaService.getUserService().getSessionInfo(code);
|
||||
} catch (WxErrorException e) {
|
||||
log.error("获取 session 失败", e);
|
||||
throw new RuntimeException("微信 session 获取失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密手机号信息
|
||||
*/
|
||||
public WxMaPhoneNumberInfo getPhoneNumber(String code) {
|
||||
try {
|
||||
return wxMaService.getUserService().getPhoneNumber(code); // 注意:此方法为新版本推荐方法
|
||||
} catch (WxErrorException e) {
|
||||
log.error("获取手机号失败", e);
|
||||
throw new RuntimeException("微信手机号获取失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 access_token(仅调试或日志用)
|
||||
*/
|
||||
public String getAccessToken() {
|
||||
try {
|
||||
return wxMaService.getAccessToken();
|
||||
} catch (WxErrorException e) {
|
||||
log.error("获取 access_token 失败", e);
|
||||
throw new RuntimeException("获取 access_token 失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.example.caseData.middlewares;
|
||||
|
||||
import com.example.caseData.dao.UserDao;
|
||||
import com.example.caseData.exception.BusinessException;
|
||||
import com.example.caseData.model.UserModel;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AuthInterceptor extends BaseInterceptor {
|
||||
private final UserDao userDao;
|
||||
|
||||
public AuthInterceptor(UserDao userDao) {
|
||||
this.userDao = userDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws Exception {
|
||||
|
||||
// 放行白名单路径
|
||||
if (isWhiteListed(request)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String userId = (String) request.getAttribute("userId");
|
||||
|
||||
if (userId == null) {
|
||||
throw new BusinessException("-1","错误");
|
||||
}
|
||||
|
||||
// 获取用户数据
|
||||
UserModel user = userDao.selectById(userId);
|
||||
if (user == null) {
|
||||
throw new BusinessException("-1","用户数据错误");
|
||||
}
|
||||
|
||||
if (user.getStatus() == 0){
|
||||
throw new BusinessException("-1","用户已禁用");
|
||||
}
|
||||
|
||||
if (user.getStatus() == 2){
|
||||
throw new BusinessException("-1","用户已禁用");
|
||||
}
|
||||
|
||||
return true; // 如果权限验证通过,则继续处理请求
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.example.caseData.middlewares;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseInterceptor implements HandlerInterceptor {
|
||||
|
||||
// 请求白名单(格式:请求方式:路径正则)
|
||||
private final List<String> whiteList = List.of(
|
||||
// "GET:/api/user/\\d+", // GET 请求,匹配 /api/user/123
|
||||
// "POST:/api/public/.*", // POST 请求,匹配 /api/public/xx
|
||||
// "GET:/api/users" , // GET 请求,匹配具体路径
|
||||
"POST:/api/login/wechat/mobile", // 登陆
|
||||
"GET:/api/index/clinical" // 首页-临床病例库
|
||||
);
|
||||
|
||||
/**
|
||||
* 判断当前请求是否在白名单中
|
||||
* @param request 请求对象
|
||||
* @return 是否放行
|
||||
*/
|
||||
public boolean isWhiteListed(HttpServletRequest request) {
|
||||
String uri = request.getRequestURI();
|
||||
String method = request.getMethod().toUpperCase();
|
||||
|
||||
for (String rule : whiteList) {
|
||||
String[] parts = rule.split(":", 2);
|
||||
if (parts.length == 2) {
|
||||
String ruleMethod = parts[0];
|
||||
String rulePattern = parts[1];
|
||||
|
||||
if (method.equals(ruleMethod) && uri.matches(rulePattern)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.example.caseData.middlewares;
|
||||
|
||||
import com.example.caseData.config.AppConfig;
|
||||
import com.example.caseData.config.JwtConfig;
|
||||
import com.example.caseData.exception.BusinessException;
|
||||
import com.example.caseData.utils.EnvUtil;
|
||||
import com.example.caseData.utils.JwtUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
@Component
|
||||
public class JwtInterceptor extends BaseInterceptor {
|
||||
@Resource
|
||||
private JwtUtil jwtUtil;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws Exception {
|
||||
// 放行白名单路径
|
||||
if (isWhiteListed(request)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String token = request.getHeader("Authorization");
|
||||
|
||||
if (token != null && token.startsWith("Bearer ")) {
|
||||
try {
|
||||
token = token.substring(7); // 去除 "Bearer " 前缀
|
||||
Claims claims = jwtUtil.verifyToken(token);
|
||||
|
||||
// 将解析出来的数据放入请求属性中供后续使用
|
||||
request.setAttribute("userId", claims.get("user_id"));
|
||||
|
||||
return true;
|
||||
} catch (ExpiredJwtException e) {
|
||||
throw new BusinessException("406","token过期");
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("405","token错误");
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException("405","请求未授权");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.example.caseData.middlewares;
|
||||
|
||||
import com.example.caseData.utils.Fmt;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class LogRequestInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogRequestInterceptor.class);
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws Exception {
|
||||
ContentCachingRequestWrapper requestWrapper;
|
||||
if (request instanceof ContentCachingRequestWrapper) {
|
||||
requestWrapper = (ContentCachingRequestWrapper) request;
|
||||
} else {
|
||||
requestWrapper = new ContentCachingRequestWrapper(request);
|
||||
}
|
||||
|
||||
String url = requestWrapper.getRequestURL().toString();
|
||||
String ip = requestWrapper.getRemoteAddr();
|
||||
String method = requestWrapper.getMethod();
|
||||
String contentType = requestWrapper.getContentType() == null ? "" : requestWrapper.getContentType();
|
||||
|
||||
final Map<String, Object> paramMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
if (Objects.equals(method, "GET")){
|
||||
requestWrapper.getParameterMap().forEach((key, values) -> {
|
||||
paramMap.put(key, values[0]);
|
||||
});
|
||||
}else{
|
||||
if (contentType.contains("application/json")){
|
||||
// 先触发请求体的读取,将内容缓存起来
|
||||
Map<String,String[]> a = requestWrapper.getParameterMap();
|
||||
|
||||
// 从缓存中获取请求体
|
||||
String body = new String(requestWrapper.getContentAsByteArray(), StandardCharsets.UTF_8);
|
||||
if (!body.isEmpty()) {
|
||||
Map<String, Object> jsonBody = objectMapper.readValue(body, new TypeReference<Map<String, Object>>() {});
|
||||
paramMap.putAll(jsonBody);
|
||||
}
|
||||
}
|
||||
|
||||
if (contentType.contains("application/x-www-form-urlencoded") || contentType.contains("multipart/form-data")){
|
||||
requestWrapper.getParameterMap().forEach((key, values) -> {
|
||||
paramMap.put(key, values[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
paramMap.put("error", "读取参数失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
logger.info("uri: {}, ip: {}, method: {}, params: {}", url, ip, method, paramMap);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("`basic_hospital`")
|
||||
public class BasicHospitalModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@TableField("hospital_iden")
|
||||
private String hospitalIden;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@TableField("hospital_name")
|
||||
private String hospitalName;
|
||||
|
||||
/**
|
||||
* 来源(2:肝胆相照 3:佳动例)
|
||||
*/
|
||||
private Integer source;
|
||||
|
||||
/**
|
||||
* 医院等级
|
||||
*/
|
||||
@TableField("hospital_level")
|
||||
private String hospitalLevel;
|
||||
|
||||
/**
|
||||
* 医生数量
|
||||
*/
|
||||
@TableField("doctor_number")
|
||||
private Integer doctorNumber;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
private String county;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`basic_sensitive_word`") // 指定数据库表名
|
||||
public class BasicSensitiveWordModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 敏感词
|
||||
*/
|
||||
@TableField("word")
|
||||
private String word;
|
||||
|
||||
/**
|
||||
* 状态(0:禁用 1:正常)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_article_author`") // 指定数据库表名
|
||||
public class CaseClinicalArticleAuthorModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long authorId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@TableField("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 医生id
|
||||
*/
|
||||
@TableField("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 医生
|
||||
@TableField(exist = false)
|
||||
private CaseClinicalDoctorModel caseClinicalDoctor;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_article_label`") // 指定数据库表名
|
||||
public class CaseClinicalArticleLabelModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long articleLabelId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@TableField("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@TableField("app_iden")
|
||||
private String appIden;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@TableField("label_name")
|
||||
private String labelName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("`case_clinical_article`")
|
||||
public class CaseClinicalArticleModel {
|
||||
@TableId(type = IdType.ASSIGN_ID) // 主键策略
|
||||
private Long articleId; // 主键id
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField("article_title")
|
||||
private String articleTitle;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@TableField("article_status")
|
||||
private Integer articleStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@TableField("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@TableField("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 发表时间
|
||||
*/
|
||||
@TableField("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@TableField("article_content")
|
||||
private String articleContent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 作者
|
||||
@TableField(exist = false)
|
||||
private List<CaseClinicalArticleAuthorModel> author;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 医生表实体类
|
||||
*/
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_doctor`") // 指定数据库表名
|
||||
public class CaseClinicalDoctorModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* app唯一标识(存在即表示为注册用户)
|
||||
*/
|
||||
@TableField("doctor_iden")
|
||||
private String doctorIden;
|
||||
|
||||
/**
|
||||
* 医生名称
|
||||
*/
|
||||
@TableField("doctor_name")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
@TableField("hospital_id")
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@TableField("avatar")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 医院
|
||||
@TableField(exist = false)
|
||||
private BasicHospitalModel basicHospital;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_video_author`") // 指定数据库表名
|
||||
public class CaseClinicalVideoAuthorModel {
|
||||
/**
|
||||
* 主键id(可选)
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long authorId;
|
||||
|
||||
/**
|
||||
* 临床视频id(作为主键)
|
||||
*/
|
||||
@TableField("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 医生id
|
||||
*/
|
||||
@TableField("doctor_id")
|
||||
private String doctorId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 医生
|
||||
@TableField(exist = false)
|
||||
private CaseClinicalDoctorModel caseClinicalDoctor;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_video_label`") // 指定数据库表名
|
||||
public class CaseClinicalVideoLabelModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long videoLabelId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@TableField("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* app唯一标识
|
||||
*/
|
||||
@TableField("app_iden")
|
||||
private String appIden;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@TableField("label_name")
|
||||
private String labelName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`case_clinical_video`") // 指定数据库表名
|
||||
public class CaseClinicalVideoModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField("video_title")
|
||||
private String videoTitle;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:禁用)
|
||||
*/
|
||||
@TableField("video_status")
|
||||
private Integer videoStatus;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@TableField("read_num")
|
||||
private Integer readNum;
|
||||
|
||||
/**
|
||||
* 收藏量
|
||||
*/
|
||||
@TableField("collect_num")
|
||||
private Integer collectNum;
|
||||
|
||||
/**
|
||||
* 视频编号(保利)
|
||||
*/
|
||||
@TableField("video_no")
|
||||
private String videoNo;
|
||||
|
||||
/**
|
||||
* 发表时间
|
||||
*/
|
||||
@TableField("push_date")
|
||||
private LocalDateTime pushDate;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 作者
|
||||
@TableField(exist = false)
|
||||
private List<CaseClinicalVideoAuthorModel> author;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 统计表-病例库-临床-用户实体类
|
||||
*/
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`stats_case_clinical_doctor`") // 指定数据库表名
|
||||
public class StatsCaseClinicalDoctorModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 医生id
|
||||
*/
|
||||
@TableField("doctor_id")
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* 数量-文章
|
||||
*/
|
||||
@TableField("article_num")
|
||||
private Integer articleNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@TableField("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@TableField("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 数量-视频
|
||||
*/
|
||||
@TableField("video_num")
|
||||
private Integer videoNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@TableField("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@TableField("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 医生
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private CaseClinicalDoctorModel caseClinicalDoctor;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`stats_case_clinical_hospital`") // 指定数据库表名
|
||||
public class StatsCaseClinicalHospitalModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 医院id
|
||||
*/
|
||||
@TableField("hospital_id")
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* 数量-文章
|
||||
*/
|
||||
@TableField("article_num")
|
||||
private Integer articleNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@TableField("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@TableField("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 最后一篇文章发表时间
|
||||
*/
|
||||
@TableField("last_push_date")
|
||||
private LocalDateTime lastPushDate;
|
||||
|
||||
/**
|
||||
* 数量-视频
|
||||
*/
|
||||
@TableField("video_num")
|
||||
private Integer videoNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@TableField("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@TableField("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonProperty("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// 医院
|
||||
@TableField(exist = false)
|
||||
private BasicHospitalModel basicHospital;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`stats_case_clinical`") // 指定数据库表名
|
||||
public class StatsCaseClinicalModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 总阅读量-文章
|
||||
*/
|
||||
@TableField("article_read_num")
|
||||
private Integer articleReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-文章
|
||||
*/
|
||||
@TableField("article_collect_num")
|
||||
private Integer articleCollectNum;
|
||||
|
||||
/**
|
||||
* 总阅读量-视频
|
||||
*/
|
||||
@TableField("video_read_num")
|
||||
private Integer videoReadNum;
|
||||
|
||||
/**
|
||||
* 总收藏量-视频
|
||||
*/
|
||||
@TableField("video_collect_num")
|
||||
private Integer videoCollectNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`user_collect_clinical_article`") // 指定数据库表名
|
||||
public class UserCollectClinicalArticleModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@TableField("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`user_collect_clinical_video`") // 指定数据库表名
|
||||
public class UserCollectClinicalVideoModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long collectId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@TableField("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`user_comment_clinical_article`") // 指定数据库表名
|
||||
public class UserCommentClinicalArticleModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床文章id
|
||||
*/
|
||||
@TableField("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
@TableField("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
@TableField("root_id")
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
@TableField("is_sensitive")
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 是否优质留言(0:否 1:是)
|
||||
*/
|
||||
@TableField("is_high_quality")
|
||||
private Integer isHighQuality;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
@TableField("like_num")
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
@TableField("content_word")
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data // Lombok注解,用于自动生成getter/setter方法等
|
||||
@TableName("`user_comment_clinical_video`") // 指定数据库表名
|
||||
public class UserCommentClinicalVideoModel {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID) // 使用MyBatis-Plus的ID生成策略
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 临床视频id
|
||||
*/
|
||||
@TableField("video_id")
|
||||
private Long videoId;
|
||||
|
||||
/**
|
||||
* 父级id,一级评论为null
|
||||
*/
|
||||
@TableField("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 根评论id,一级评论时为null。其余为一级评论id
|
||||
*/
|
||||
@TableField("root_id")
|
||||
private Long rootId;
|
||||
|
||||
/**
|
||||
* 评论状态(0:禁用 1:正常)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否存在敏感词(0:否 1:是)
|
||||
*/
|
||||
@TableField("is_sensitive")
|
||||
private Integer isSensitive;
|
||||
|
||||
/**
|
||||
* 是否优质留言(0:否 1:是)
|
||||
*/
|
||||
@TableField("is_high_quality")
|
||||
private Integer isHighQuality;
|
||||
|
||||
/**
|
||||
* 点赞数量
|
||||
*/
|
||||
@TableField("like_num")
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评论内容(原版)
|
||||
*/
|
||||
@TableField("content_word")
|
||||
private String contentWord;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.example.caseData.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("`user`")
|
||||
public class UserModel {
|
||||
/*
|
||||
主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 第三方平台唯一标识
|
||||
*/
|
||||
@TableField("user_iden")
|
||||
private String userIden;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号(第三方平台时可能为空)
|
||||
*/
|
||||
@TableField("user_mobile")
|
||||
private String userMobile;
|
||||
|
||||
/**
|
||||
* 手机号加密
|
||||
*/
|
||||
@TableField("mobile_encryption")
|
||||
private String mobileEncryption;
|
||||
|
||||
/**
|
||||
* 状态(0:禁用 1:正常 2:删除)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 注册来源(1:未知 2:app用户 3:佳动例)
|
||||
*/
|
||||
@TableField("register_source")
|
||||
private Integer registerSource;
|
||||
|
||||
/**
|
||||
* 用户微信标识
|
||||
*/
|
||||
@TableField("open_id")
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 微信开放平台标识
|
||||
*/
|
||||
@TableField("union_id")
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 性别(0:未知 1:男 2:女)
|
||||
*/
|
||||
@TableField("sex")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@TableField("avatar")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 医生职称(0:未知 1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
*/
|
||||
@TableField("title")
|
||||
private Integer title;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
@TableField("department_name")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
@TableField("hospital_id")
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* 医生地址
|
||||
*/
|
||||
@TableField("address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.caseData.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ClinicalHospitalRequest {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.caseData.request;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublicRequest {
|
||||
// ✅ 自定义校验分组
|
||||
public interface Login {}
|
||||
|
||||
@NotEmpty(message = "错误请求1", groups = {Login.class})
|
||||
private String phone_code;
|
||||
|
||||
@NotEmpty(message = "错误请求2", groups = {Login.class})
|
||||
private String wx_code;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.example.caseData.request;
|
||||
|
||||
import lombok.Data;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TestRequest {
|
||||
/**
|
||||
* 项目ID,不能为空
|
||||
* 适用于 Long 等对象类型
|
||||
*/
|
||||
@NotNull(message = "项目ID不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 开始时间,不能为空字符串,不能为 null 或空格
|
||||
*/
|
||||
@NotBlank(message = "开始时间不能为空")
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 结束时间,不能为空字符串,不能为 null 或空格
|
||||
*/
|
||||
@NotBlank(message = "结束时间不能为空")
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 用户名,不能为 null 或空字符串
|
||||
*/
|
||||
@NotEmpty(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 手机号,必须符合正则表达式格式
|
||||
*/
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 年龄,最小为1,最大为100
|
||||
*/
|
||||
@Min(value = 1, message = "年龄必须大于等于1岁")
|
||||
@Max(value = 100, message = "年龄不能超过100岁")
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 密码长度限制,最短6位,最长20位
|
||||
*/
|
||||
@Size(min = 6, max = 20, message = "密码长度必须在6到20之间")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 选项列表,不能为空且至少包含一个元素
|
||||
*/
|
||||
@NotEmpty(message = "选项列表不能为空")
|
||||
@Size(min = 1, message = "请至少选择一个选项")
|
||||
private List<String> options;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.caseData.request;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserRequest {
|
||||
// ✅ 自定义校验分组
|
||||
public interface Create {}
|
||||
public interface Update {}
|
||||
public interface Page {}
|
||||
|
||||
// ✅ 统一定义所有用户相关的参数
|
||||
// ✅ 分页参数
|
||||
@Min(value = 1, groups = Page.class, message = "页码最小为 1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Min(value = 1, groups = Page.class, message = "每页个数最小为 1")
|
||||
private Integer pageSize = 20;
|
||||
|
||||
@NotNull(message = "ID 不能为空", groups = {Update.class})
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "用户名不能为空", groups = {Create.class, Update.class})
|
||||
@Size(min = 3, max = 20, message = "用户名长度必须在 3 到 20 之间", groups = {Create.class, Update.class})
|
||||
private String username;
|
||||
|
||||
@NotNull(message = "年龄不能为空", groups = {Create.class})
|
||||
@Min(value = 18, message = "年龄必须大于或等于 18", groups = {Create.class, Update.class})
|
||||
@Max(value = 60, message = "年龄必须小于或等于 60", groups = {Create.class, Update.class})
|
||||
private Integer age;
|
||||
|
||||
@Email(message = "邮箱格式不正确", groups = {Create.class, Update.class})
|
||||
private String email;
|
||||
|
||||
// ✅ 校验分页参数
|
||||
public void validateForPage() {
|
||||
// 如果 page 为空,设为默认值 1
|
||||
if (page == null) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
if (pageSize == null) {
|
||||
pageSize = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user