太湖云医 医案、文章

This commit is contained in:
wuchunlei
2025-08-25 10:41:35 +08:00
parent c4d61fe0ad
commit e92d1ca482
28 changed files with 588 additions and 179 deletions

View File

@@ -1,7 +1,8 @@
package com.peanut.modules.common.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
@@ -11,6 +12,7 @@ import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.data.MutableDataSet;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,10 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
@Slf4j
@RestController("commonMedicalRecords")
@@ -32,9 +31,11 @@ public class MedicalRecordsController {
@Autowired
private MedicalRecordsService medicalRecordsService;
@Autowired
private MedicalRecordsLabelService medicalRecordsLabelService;
private DeptLabelService deptLabelService;
@Autowired
private MedicalRecordsToLabelService medicalRecordsToLabelService;
private MedicalRecordsToDeptLabelService medicalRecordsToDeptLabelService;
@Autowired
private MedicalRecordsCheckUserService medicalRecordsCheckUserService;
@Autowired
private TaihuTalentService taihuTalentService;
@Autowired
@@ -52,16 +53,16 @@ public class MedicalRecordsController {
public R getMedicalRecordsLabelList(){
return R.ok().put("Medicals", medicalRecordsLabels(0));
}
private List<MedicalRecordsLabel> medicalRecordsLabels(int id){
List<MedicalRecordsLabel> medicalRecordsLabelList = medicalRecordsLabelService.list(new LambdaQueryWrapper<MedicalRecordsLabel>()
.eq(MedicalRecordsLabel::getPid, id));
for (MedicalRecordsLabel m : medicalRecordsLabelList){
private List<DeptLabel> medicalRecordsLabels(int id){
List<DeptLabel> deptLabelList = deptLabelService.list(new LambdaQueryWrapper<DeptLabel>()
.eq(DeptLabel::getPid, id));
for (DeptLabel m : deptLabelList){
if(m.getIsLast()!=1){
List<MedicalRecordsLabel> so = this.medicalRecordsLabels(m.getId());
List<DeptLabel> so = this.medicalRecordsLabels(m.getId());
m.setChildren(so);
}
}
return medicalRecordsLabelList;
return deptLabelList;
}
public MedicalRecordsController(ChatClient.Builder chatClientBuilder, ToolCallbackProvider tools) {
@@ -163,11 +164,11 @@ public class MedicalRecordsController {
MedicalRecords mr = medicalRecordsService.getOne(new MPJLambdaWrapper<MedicalRecords>()
.disableLogicDel()
.eq(MedicalRecords::getId,parmas.get("id").toString()));
MedicalRecordsToLabel toLabel = medicalRecordsToLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getRecordId,mr.getId()));
MedicalRecordsToDeptLabel toLabel = medicalRecordsToDeptLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getRecordId,mr.getId()));
if (toLabel!=null){
mr.setLabelId(toLabel.getLabelId());
MedicalRecordsLabel label = medicalRecordsLabelService.getById(toLabel.getLabelId());
DeptLabel label = deptLabelService.getById(toLabel.getLabelId());
if (label!=null){
mr.setLabelTitle(label.getTitle());
}
@@ -204,15 +205,17 @@ public class MedicalRecordsController {
+medicalRecords.getPhysicaExamination()+medicalRecords.getDiagnosis()+medicalRecords.getTreatmentPlan());
medicalRecordsService.saveOrUpdate(medicalRecords);
//绑定标签
MedicalRecordsToLabel toLabel = medicalRecordsToLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getLabelId, medicalRecords.getLabelId())
.eq(MedicalRecordsToLabel::getRecordId,medicalRecords.getId()));
if (toLabel==null){
toLabel = new MedicalRecordsToLabel();
if (medicalRecords.getLabelId()!=null&&medicalRecords.getLabelId()!=0){
MedicalRecordsToDeptLabel toLabel = medicalRecordsToDeptLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getLabelId, medicalRecords.getLabelId())
.eq(MedicalRecordsToDeptLabel::getRecordId,medicalRecords.getId()));
if (toLabel==null){
toLabel = new MedicalRecordsToDeptLabel();
}
toLabel.setRecordId(medicalRecords.getId());
toLabel.setLabelId(medicalRecords.getLabelId());
medicalRecordsToDeptLabelService.saveOrUpdate(toLabel);
}
toLabel.setRecordId(medicalRecords.getId());
toLabel.setLabelId(medicalRecords.getLabelId());
medicalRecordsToLabelService.saveOrUpdate(toLabel);
return R.ok().put("medicalRecords",medicalRecords);
}
@@ -226,9 +229,15 @@ public class MedicalRecordsController {
//医案列表
@RequestMapping(value = "/medicalRecordsList")
public R medicalRecordsList(@RequestBody Map<String,Object> parmas) {
List<MedicalRecords> medicalRecordsList = medicalRecordsService.list(new LambdaQueryWrapper<MedicalRecords>()
.eq(MedicalRecords::getUserId,ShiroUtils.getUId())
.eq(MedicalRecords::getState,parmas.get("state")));
LambdaQueryWrapper<MedicalRecords> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MedicalRecords::getUserId,ShiroUtils.getUId());
if (parmas.get("state").toString().contains(",")){
wrapper.and(t->t.eq(MedicalRecords::getState,parmas.get("state").toString().split(",")[0])
.or().eq(MedicalRecords::getState,parmas.get("state").toString().split(",")[1]));
}else {
wrapper.in(MedicalRecords::getState,parmas.get("state"));
}
List<MedicalRecords> medicalRecordsList = medicalRecordsService.list(wrapper);
return R.ok().put("medicalRecordsList",medicalRecordsList);
}
@@ -251,10 +260,93 @@ public class MedicalRecordsController {
article.setTitle(medicalRecords.getTitle());
article.setContent(medicalRecords.getData());
article.setImg(medicalRecords.getImg());
article.setCome(1);
taihuTalentArticleService.save(article);
medicalRecords.setArticleFlag(1);
medicalRecordsService.updateById(medicalRecords);
return R.ok();
}
//能否审批
@RequestMapping("/canCheck")
public R canCheck(){
boolean flag = false;
long c = medicalRecordsCheckUserService.count(new LambdaQueryWrapper<MedicalRecordsCheckUser>()
.eq(MedicalRecordsCheckUser::getUserId,ShiroUtils.getUId()));
if (c>0){
flag = true;
}
return R.ok().put("flag",flag);
}
//审批列表
@RequestMapping("/getMedicalRecordsCheckList")
public R getMedicalRecordsCheckList(@RequestBody Map<String,Object> parmas){
MPJLambdaWrapper<MedicalRecords> wrapper = new MPJLambdaWrapper();
wrapper.rightJoin(MedicalRecordsToDeptLabel.class, MedicalRecordsToDeptLabel::getRecordId,MedicalRecords::getId);
wrapper.rightJoin(MedicalRecordsCheckUser.class,MedicalRecordsCheckUser::getLabelId,MedicalRecordsToDeptLabel::getLabelId);
wrapper.selectAll(MedicalRecords.class);
wrapper.eq(MedicalRecordsCheckUser::getUserId,ShiroUtils.getUId());
wrapper.eq(MedicalRecords::getState,3);
if (parmas.containsKey("flag")&&parmas.get("flag")!=null){
if ("0".equals(parmas.get("flag").toString())){
wrapper.notLike(MedicalRecords::getStateInfo,"\""+ShiroUtils.getUId()+"\"");
}else if ("1".equals(parmas.get("flag").toString())){
wrapper.like(MedicalRecords::getStateInfo,"\""+ShiroUtils.getUId()+"\"");
}
}
List<MedicalRecords> list = medicalRecordsService.list(wrapper);
return R.ok().put("list",list);
}
//审批医案
@RequestMapping("/medicalRecordsCheck")
public R medicalRecordsCheck(@RequestBody Map<String,Object> parmas){
String stateInfo = "";
String state = parmas.get("state").toString();
String id = parmas.get("id").toString();
MedicalRecords medicalRecords = medicalRecordsService.getById(id);
Map<String,Object> userIdAndState = new HashMap<>();
if (StringUtils.isNotEmpty(medicalRecords.getStateInfo())){
boolean flag = true;//判断是否评价过
userIdAndState = JSON.parseObject(medicalRecords.getStateInfo());
for (Map.Entry<String,Object> key : userIdAndState.entrySet()) {
if (key.equals(ShiroUtils.getUId().toString())){
flag = false;
key.setValue(state);
}
}
if (flag) {
userIdAndState.put(""+ShiroUtils.getUId(),state);
}
}else {
userIdAndState.put(""+ShiroUtils.getUId(),state);
}
stateInfo = JSON.toJSONString(userIdAndState);
medicalRecords.setStateInfo(stateInfo);
LambdaUpdateWrapper<MedicalRecords> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MedicalRecords::getId,id);
wrapper.set(MedicalRecords::getStateInfo,stateInfo);
wrapper.set(MedicalRecords::getInfoCount,userIdAndState.size());
int same = 0;
for (Map.Entry<String,Object> key : userIdAndState.entrySet()) {
if (userIdAndState.size()==2&&key.getValue().equals(state)){
same++;
}
}
if (same==2){
if ("A".equals(state)){
wrapper.set(MedicalRecords::getState,6);
wrapper.set(MedicalRecords::getTrain,1);
}else if ("B".equals(state)){
wrapper.set(MedicalRecords::getState,5);
}else {
wrapper.set(MedicalRecords::getState,4);
}
}
medicalRecordsService.update(wrapper);
return R.ok();
}
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.DeptLabel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DeptLabelDao extends MPJBaseMapper<DeptLabel> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.MedicalRecordsCheckUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MedicalRecordsCheckUserDao extends MPJBaseMapper<MedicalRecordsCheckUser> {
}

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.MedicalRecordsLabel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MedicalRecordsLabelDao extends MPJBaseMapper<MedicalRecordsLabel> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.MedicalRecordsToDeptLabel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MedicalRecordsToDeptLabelDao extends MPJBaseMapper<MedicalRecordsToDeptLabel> {
}

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.MedicalRecordsToLabel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MedicalRecordsToLabelDao extends MPJBaseMapper<MedicalRecordsToLabel> {
}

View File

@@ -9,8 +9,8 @@ import java.util.Date;
import java.util.List;
@Data
@TableName("medical_records_label")
public class MedicalRecordsLabel {
@TableName("dept_label")
public class DeptLabel {
private static final long serialVersionUID = 1L;
@TableId
@@ -30,7 +30,7 @@ public class MedicalRecordsLabel {
private Integer delFlag;
@TableField(exist = false)
private List<MedicalRecordsLabel> children;
private List<DeptLabel> children;
@TableField(exist = false)
private List<MedicalRecords> medicalRecordsList;
}

View File

@@ -23,8 +23,12 @@ public class MedicalRecords {
private Integer articleFlag;
//标题
private String title;
//0暂存1提交审核2审核拒绝3审核成功
//0暂存1提交审核2审核拒绝3审核成功4C 5B 6A
private Integer state;
//二审详情
private String stateInfo;
//二审次数
private Integer infoCount;
//是否加入ai训练库0否1是
private Integer train;
//未加入训练库原因

View File

@@ -0,0 +1,21 @@
package com.peanut.modules.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("medical_records_check_user")
public class MedicalRecordsCheckUser {
private static final long serialVersionUID = 1L;
@TableId
private Integer id;
//科室id
private Integer labelId;
//用户id
private Integer userId;
@TableLogic
private Integer delFlag;
}

View File

@@ -8,8 +8,8 @@ import lombok.Data;
import java.util.Date;
@Data
@TableName("medical_records_to_label")
public class MedicalRecordsToLabel {
@TableName("medical_records_to_dept_label")
public class MedicalRecordsToDeptLabel {
private static final long serialVersionUID = 1L;
@TableId

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
@TableName("taihu_talent_article")
@@ -26,6 +27,10 @@ public class TaihuTalentArticle implements Serializable {
private Integer readCount;
//转发数
private Integer forwardCount;
//0文章1医案转
private Integer come;
//0下架1显示
private Integer showFlag;
private Date createTime;
@TableLogic
private Integer delFlag;
@@ -36,6 +41,8 @@ public class TaihuTalentArticle implements Serializable {
@TableField(exist = false)
private Integer likeCount;
@TableField(exist = false)
private List likeList;
@TableField(exist = false)
private Integer likeFlag;
@TableField(exist = false)
private TaihuTalent taihuTalent;

View File

@@ -29,4 +29,6 @@ public class TaihuTalentArticleComment implements Serializable {
private Integer delFlag;
@TableField(exist = false)
private List<TaihuTalentArticleComment> children;
@TableField(exist = false)
private MyUserEntity user;
}

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -17,4 +18,6 @@ public class TaihuTalentArticleLike implements Serializable {
private Integer userId;
@TableLogic
private Integer delFlag;
@TableField(exist = false)
private MyUserEntity user;
}

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.DeptLabel;
public interface DeptLabelService extends IService<DeptLabel> {
}

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.MedicalRecordsCheckUser;
public interface MedicalRecordsCheckUserService extends IService<MedicalRecordsCheckUser> {
}

View File

@@ -1,7 +0,0 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.MedicalRecordsLabel;
public interface MedicalRecordsLabelService extends IService<MedicalRecordsLabel> {
}

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.MedicalRecordsToDeptLabel;
public interface MedicalRecordsToDeptLabelService extends IService<MedicalRecordsToDeptLabel> {
}

View File

@@ -1,7 +0,0 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.MedicalRecordsToLabel;
public interface MedicalRecordsToLabelService extends IService<MedicalRecordsToLabel> {
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.DeptLabelDao;
import com.peanut.modules.common.entity.DeptLabel;
import com.peanut.modules.common.service.DeptLabelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonMedicalRecordsLabelService")
public class DeptLabelServiceImpl extends ServiceImpl<DeptLabelDao, DeptLabel> implements DeptLabelService {
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.MedicalRecordsCheckUserDao;
import com.peanut.modules.common.entity.MedicalRecordsCheckUser;
import com.peanut.modules.common.service.MedicalRecordsCheckUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonMedicalRecordsCheckUserService")
public class MedicalRecordsCheckUserServiceImpl extends ServiceImpl<MedicalRecordsCheckUserDao, MedicalRecordsCheckUser> implements MedicalRecordsCheckUserService {
}

View File

@@ -1,13 +0,0 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.MedicalRecordsLabelDao;
import com.peanut.modules.common.entity.MedicalRecordsLabel;
import com.peanut.modules.common.service.MedicalRecordsLabelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonMedicalRecordsLabelService")
public class MedicalRecordsLabelServiceImpl extends ServiceImpl<MedicalRecordsLabelDao, MedicalRecordsLabel> implements MedicalRecordsLabelService {
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.MedicalRecordsToDeptLabelDao;
import com.peanut.modules.common.entity.MedicalRecordsToDeptLabel;
import com.peanut.modules.common.service.MedicalRecordsToDeptLabelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonMedicalRecordsToLabelService")
public class MedicalRecordsToDeptLabelServiceImpl extends ServiceImpl<MedicalRecordsToDeptLabelDao, MedicalRecordsToDeptLabel> implements MedicalRecordsToDeptLabelService {
}

View File

@@ -1,13 +0,0 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.MedicalRecordsToLabelDao;
import com.peanut.modules.common.entity.MedicalRecordsToLabel;
import com.peanut.modules.common.service.MedicalRecordsToLabelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("commonMedicalRecordsToLabelService")
public class MedicalRecordsToLabelServiceImpl extends ServiceImpl<MedicalRecordsToLabelDao, MedicalRecordsToLabel> implements MedicalRecordsToLabelService {
}

View File

@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.MedicalRecordsLabelService;
import com.peanut.modules.common.service.MedicalRecordsService;
import com.peanut.modules.common.service.MedicalRecordsToLabelService;
import com.peanut.modules.common.service.*;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.MyUserService;
import lombok.extern.slf4j.Slf4j;
@@ -28,34 +26,48 @@ public class MedicalRecordsController {
@Autowired
private MedicalRecordsService medicalRecordsService;
@Autowired
private MedicalRecordsLabelService medicalRecordsLabelService;
private TaihuTalentService talentService;
@Autowired
private MedicalRecordsToLabelService toLabelService;
private DeptLabelService deptLabelService;
@Autowired
private MedicalRecordsToDeptLabelService toLabelService;
@Autowired
private MedicalRecordsCheckUserService medicalRecordsCheckUserService;
@Autowired
private MyUserService userService;
//获取医案待审核、拒绝列表
//获取医案待审核、拒绝、审核不同结果列表
@RequestMapping("/getMedicalRecordsListCheck")
public R getMedicalRecordsListCheck(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<MedicalRecords> wrapper = new MPJLambdaWrapper();
if ("3".equals(params.get("state"))){
wrapper.leftJoin(MedicalRecordsToLabel.class,MedicalRecordsToLabel::getRecordId,MedicalRecords::getId);
wrapper.leftJoin(MedicalRecordsLabel.class,MedicalRecordsLabel::getId,MedicalRecordsToLabel::getLabelId);
wrapper.selectAs(MedicalRecordsLabel::getTitle,"labelTitle");
}
if ("0".equals(params.get("state"))){
wrapper.eq(MedicalRecords::getUserId,"1");
if (params.containsKey("infoCount")&&params.get("infoCount")!=null&&StringUtils.isNotEmpty(params.get("infoCount").toString())&&
"2".equals(params.get("infoCount").toString())&&"3".equals(params.get("state").toString())){
wrapper.leftJoin(MedicalRecordsToDeptLabel.class, MedicalRecordsToDeptLabel::getRecordId,MedicalRecords::getId);
wrapper.leftJoin(DeptLabel.class, DeptLabel::getId, MedicalRecordsToDeptLabel::getLabelId);
wrapper.selectAs(DeptLabel::getTitle,"labelTitle");
wrapper.eq(MedicalRecords::getInfoCount,2);
}else {
if ("3".equals(params.get("state").toString())){
wrapper.leftJoin(MedicalRecordsToDeptLabel.class, MedicalRecordsToDeptLabel::getRecordId,MedicalRecords::getId);
wrapper.leftJoin(DeptLabel.class, DeptLabel::getId, MedicalRecordsToDeptLabel::getLabelId);
wrapper.selectAs(DeptLabel::getTitle,"labelTitle");
wrapper.lt(MedicalRecords::getInfoCount,2);
}
if ("0".equals(params.get("state").toString())){
wrapper.eq(MedicalRecords::getUserId,"1");
}
}
wrapper.selectAll(MedicalRecords.class);
wrapper.eq(MedicalRecords::getState,params.get("state"));
wrapper.orderByAsc(MedicalRecords::getCreateTime);
Page<MedicalRecords> page = medicalRecordsService.page(new Page<>(
Long.parseLong(params.get("current").toString()),Long.parseLong(params.get("limit").toString())),wrapper);
for (MedicalRecords mr:page.getRecords()){
mr.setUser(userService.getById(mr.getUserId()));
MedicalRecordsToLabel toLabel = toLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getRecordId,mr.getId()));
MedicalRecordsToDeptLabel toLabel = toLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getRecordId,mr.getId()));
if (toLabel!=null){
MedicalRecordsLabel label = medicalRecordsLabelService.getById(toLabel.getLabelId());
DeptLabel label = deptLabelService.getById(toLabel.getLabelId());
mr.setLabelId(label.getId());
mr.setLabelTitle(label.getTitle());
}
@@ -67,11 +79,11 @@ public class MedicalRecordsController {
@RequestMapping("/getMedicalRecordsList")
public R getMedicalRecordsList(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<MedicalRecords> wrapper = new MPJLambdaWrapper();
wrapper.rightJoin(MedicalRecordsToLabel.class,MedicalRecordsToLabel::getRecordId,MedicalRecords::getId);
wrapper.rightJoin(MedicalRecordsToDeptLabel.class, MedicalRecordsToDeptLabel::getRecordId,MedicalRecords::getId);
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,MedicalRecords::getUserId);
wrapper.selectAll(MedicalRecords.class);
wrapper.eq(MedicalRecordsToLabel::getLabelId,params.get("labelId"));
wrapper.eq(MedicalRecords::getState,3);
wrapper.eq(MedicalRecordsToDeptLabel::getLabelId,params.get("labelId"));
wrapper.gt(MedicalRecords::getState,4);
wrapper.like(StringUtils.isNotBlank(params.get("tel").toString()),MyUserEntity::getTel,params.get("tel"));
wrapper.eq(StringUtils.isNotBlank(params.get("train").toString()),MedicalRecords::getTrain,params.get("train"));
wrapper.like(StringUtils.isNotBlank(params.get("title").toString()),MedicalRecords::getTitle,params.get("title"));
@@ -88,7 +100,7 @@ public class MedicalRecordsController {
public R addMedicalRecords(@RequestBody MedicalRecords medicalRecords){
medicalRecords.setState(3);
medicalRecordsService.save(medicalRecords);
MedicalRecordsToLabel toLabel = new MedicalRecordsToLabel();
MedicalRecordsToDeptLabel toLabel = new MedicalRecordsToDeptLabel();
toLabel.setLabelId(medicalRecords.getLabelId());
toLabel.setRecordId(medicalRecords.getId());
toLabelService.save(toLabel);
@@ -98,13 +110,13 @@ public class MedicalRecordsController {
@RequestMapping("/editMedicalRecords")
@Transactional
public R editMedicalRecords(@RequestBody MedicalRecords medicalRecords){
MedicalRecordsToLabel toLabel = toLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getRecordId,medicalRecords.getId()));
MedicalRecordsToDeptLabel toLabel = toLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getRecordId,medicalRecords.getId()));
if (toLabel!=null){
toLabel.setLabelId(medicalRecords.getLabelId());
toLabelService.updateById(toLabel);
}else {
toLabel = new MedicalRecordsToLabel();
toLabel = new MedicalRecordsToDeptLabel();
toLabel.setRecordId(medicalRecords.getId());
toLabel.setLabelId(medicalRecords.getLabelId());
toLabelService.save(toLabel);
@@ -119,43 +131,69 @@ public class MedicalRecordsController {
return R.ok();
}
//医案审核员列表
@RequestMapping("/getMedicalRecordsCheckUserListByLabelId")
public R getMedicalRecordsCheckUserListByLabelId(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<MyUserEntity> wrapper = new MPJLambdaWrapper();
wrapper.rightJoin(MedicalRecordsCheckUser.class, MedicalRecordsCheckUser::getUserId,MyUserEntity::getId);
wrapper.selectAll(MyUserEntity.class);
wrapper.eq(MedicalRecordsCheckUser::getLabelId,params.get("labelId"));
Page<MyUserEntity> page = userService.page(new Page<>(
Long.parseLong(params.get("current").toString()),Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("page",page);
}
@RequestMapping("/addMedicalRecordsCheckUser")
public R addMedicalRecordsCheckUser(@RequestBody MedicalRecordsCheckUser checkUser){
medicalRecordsCheckUserService.save(checkUser);
return R.ok().put("MedicalRecordsCheckUser", checkUser);
}
@RequestMapping("/delMedicalRecordsCheckUser")
public R delMedicalRecordsCheckUser(@RequestBody MedicalRecordsCheckUser checkUser){
medicalRecordsCheckUserService.remove(new LambdaQueryWrapper<MedicalRecordsCheckUser>()
.eq(MedicalRecordsCheckUser::getUserId,checkUser.getUserId())
.eq(MedicalRecordsCheckUser::getLabelId,checkUser.getLabelId()));
return R.ok();
}
//科室标签
@RequestMapping("/getMedicalRecordsLabelList")
public R getMedicalRecordsLabelList(){
return R.ok().put("Medicals", medicalRecordsLabels(0));
}
private List<MedicalRecordsLabel> medicalRecordsLabels(int id){
List<MedicalRecordsLabel> medicalRecordsLabelList = medicalRecordsLabelService.list(new LambdaQueryWrapper<MedicalRecordsLabel>()
.eq(MedicalRecordsLabel::getPid, id));
for (MedicalRecordsLabel m : medicalRecordsLabelList){
private List<DeptLabel> medicalRecordsLabels(int id){
List<DeptLabel> deptLabelList = deptLabelService.list(new LambdaQueryWrapper<DeptLabel>()
.eq(DeptLabel::getPid, id));
for (DeptLabel m : deptLabelList){
if(m.getIsLast()!=1){
List<MedicalRecordsLabel> so = this.medicalRecordsLabels(m.getId());
List<DeptLabel> so = this.medicalRecordsLabels(m.getId());
m.setChildren(so);
}
}
return medicalRecordsLabelList;
return deptLabelList;
}
@RequestMapping("/addMedicalRecordsLabel")
public R addMedicalRecordsLabel(@RequestBody MedicalRecordsLabel medicalRecordsLabel){
medicalRecordsLabelService.save(medicalRecordsLabel);
return R.ok().put("medicalRecordsLabel", medicalRecordsLabel);
public R addMedicalRecordsLabel(@RequestBody DeptLabel deptLabel){
deptLabelService.save(deptLabel);
return R.ok().put("medicalRecordsLabel", deptLabel);
}
@RequestMapping("/delMedicalRecordsLabel")
public R delMedicalRecordsLabel(@RequestBody ParamTo param){
//查看下一级是否存在
long count = medicalRecordsLabelService.count(new LambdaQueryWrapper<MedicalRecordsLabel>()
.eq(MedicalRecordsLabel::getPid, param.getId()));
long count = deptLabelService.count(new LambdaQueryWrapper<DeptLabel>()
.eq(DeptLabel::getPid, param.getId()));
if(count>0){
return R.error(501,"删除失败,请先删除子项目后再尝试");
}
//查看绑定关系是否存在
List<MedicalRecordsToLabel> toLabels = toLabelService.list(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getLabelId, param.getId()));
for (MedicalRecordsToLabel toLabel:toLabels){
List<MedicalRecordsToDeptLabel> toLabels = toLabelService.list(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getLabelId, param.getId()));
for (MedicalRecordsToDeptLabel toLabel:toLabels){
MedicalRecords c = medicalRecordsService.getById(toLabel.getRecordId());
if (c!=null){
return R.error(502,"删除失败,请先解绑医案与标签的绑定关系");
@@ -163,29 +201,55 @@ public class MedicalRecordsController {
toLabelService.removeById(toLabel.getId());
}
}
medicalRecordsLabelService.removeById(param.getId());
//查看绑定关系是否存在
long taihuTalents = talentService.count(new LambdaQueryWrapper<TaihuTalent>()
.eq(TaihuTalent::getDeptLabelId, param.getId()));
if (taihuTalents>0){
return R.error(502,"删除失败,请先解绑太湖英才与标签的绑定关系");
}
//查看绑定关系是否存在
long checkUsers = medicalRecordsCheckUserService.count(new LambdaQueryWrapper<MedicalRecordsCheckUser>()
.eq(MedicalRecordsCheckUser::getLabelId, param.getId()));
if (checkUsers>0){
return R.error(502,"删除失败,请先解绑医案审核员与标签的绑定关系");
}
deptLabelService.removeById(param.getId());
return R.ok();
}
@RequestMapping("/editMedicalRecordsLabel")
public R editMedicalRecordsLabel(@RequestBody MedicalRecordsLabel medicalRecordsLabel){
MedicalRecordsLabel old = medicalRecordsLabelService.getById(medicalRecordsLabel.getId());
if(old.getIsLast()==0&& medicalRecordsLabel.getIsLast()==1){
MedicalRecordsLabel one = medicalRecordsLabelService.getOne(new LambdaQueryWrapper<MedicalRecordsLabel>()
.eq(MedicalRecordsLabel::getPid, medicalRecordsLabel.getId()));
public R editMedicalRecordsLabel(@RequestBody DeptLabel deptLabel){
DeptLabel old = deptLabelService.getById(deptLabel.getId());
if(old.getIsLast()==0&& deptLabel.getIsLast()==1){
DeptLabel one = deptLabelService.getOne(new LambdaQueryWrapper<DeptLabel>()
.eq(DeptLabel::getPid, deptLabel.getId()));
if(one!=null){
return R.error(501,"更新失败,请先清空此项的下级标签,才能将此标签变成终极标签");
}
}
if(old.getIsLast()==1&& medicalRecordsLabel.getIsLast()==0){
long c = toLabelService.count(new LambdaQueryWrapper<MedicalRecordsToLabel>()
.eq(MedicalRecordsToLabel::getLabelId, medicalRecordsLabel.getId()));
if(old.getIsLast()==1&& deptLabel.getIsLast()==0){
long c = toLabelService.count(new LambdaQueryWrapper<MedicalRecordsToDeptLabel>()
.eq(MedicalRecordsToDeptLabel::getLabelId, deptLabel.getId()));
if(c>0){
return R.error(502,"更新失败,请先把此项与医案的关联关系清空后才可把此标签变成普通标签");
}
}
medicalRecordsLabelService.updateById(medicalRecordsLabel);
return R.ok().put("medicalRecordsLabel", medicalRecordsLabel);
if(old.getIsLast()==0&& deptLabel.getIsLast()==1){
long c = talentService.count(new LambdaQueryWrapper<TaihuTalent>()
.eq(TaihuTalent::getDeptLabelId, deptLabel.getId()));
if(c>0){
return R.error(502,"更新失败,请先把此项与太湖英才的关联关系清空后才可把此标签变成普通标签");
}
}
if(old.getIsLast()==0&& deptLabel.getIsLast()==1){
long checkUsers = medicalRecordsCheckUserService.count(new LambdaQueryWrapper<MedicalRecordsCheckUser>()
.eq(MedicalRecordsCheckUser::getLabelId, deptLabel.getId()));
if (checkUsers>0){
return R.error(502,"删除失败,请先解绑医案审核员与标签的绑定关系");
}
}
deptLabelService.updateById(deptLabel);
return R.ok().put("medicalRecordsLabel", deptLabel);
}

View File

@@ -6,12 +6,14 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.MyUserService;
import com.peanut.modules.common.service.TaihuTalentArticleCommentService;
import com.peanut.modules.common.service.TaihuTalentArticleService;
import com.peanut.modules.common.service.TaihuTalentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -29,6 +31,8 @@ public class TaihuTalentArticleController {
private TaihuTalentService taihuTalentService;
@Autowired
private TaihuTalentArticleCommentService taihuTalentArticleCommentService;
@Autowired
private MyUserService userService;
//太湖英才文章列表
@RequestMapping("/getArticleList")
@@ -57,10 +61,20 @@ public class TaihuTalentArticleController {
return R.ok();
}
//编辑文章
@RequestMapping("/editArticle")
public R editArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
taihuTalentArticleService.updateById(taihuTalentArticle);
return R.ok();
}
//删除文章
@RequestMapping("/delArticle")
@Transactional
public R delArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
taihuTalentArticleService.removeById(taihuTalentArticle);
taihuTalentArticleCommentService.remove(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,taihuTalentArticle.getId()));
return R.ok();
}
@@ -70,7 +84,7 @@ public class TaihuTalentArticleController {
MPJLambdaWrapper<TaihuTalentArticleComment> wrapper = new MPJLambdaWrapper<>();
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,TaihuTalentArticleComment::getUserId);
wrapper.selectAll(TaihuTalentArticleComment.class);
wrapper.like(TaihuTalentArticleComment::getContent,params.get("conten"));
wrapper.like(TaihuTalentArticleComment::getContent,params.get("content"));
if (StringUtils.isNotEmpty(params.get("userInfo").toString())) {
wrapper.and(t->t.like(MyUserEntity::getName,params.get("userInfo")).or().like(MyUserEntity::getNickname,params.get("userInfo"))
.or().like(MyUserEntity::getTel,params.get("userInfo")).or().like(MyUserEntity::getEmail,params.get("userInfo")));
@@ -78,6 +92,9 @@ public class TaihuTalentArticleController {
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
Page<TaihuTalentArticleComment> page = taihuTalentArticleCommentService.page(new Page<>(Long.parseLong(params.get("current").toString()),
Long.parseLong(params.get("limit").toString())), wrapper);
for (TaihuTalentArticleComment comment : page.getRecords()) {
comment.setUser(userService.getById(comment.getUserId()));
}
return R.ok().put("page",page);
}

View File

@@ -7,9 +7,8 @@ import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.CourseToTaihumedService;
import com.peanut.modules.common.service.CourseToTalentService;
import com.peanut.modules.common.service.MedicalRecordsLabelService;
import com.peanut.modules.common.service.DeptLabelService;
import com.peanut.modules.common.service.TaihuTalentService;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController("masterTaihuTalent")
@@ -37,7 +35,7 @@ public class TaihuTalentController {
@Autowired
private CourseToTaihumedService courseToTaihumedService;
@Autowired
private MedicalRecordsLabelService medicalRecordsLabelService;
private DeptLabelService deptLabelService;
//太湖英才课程列表
@@ -109,9 +107,9 @@ public class TaihuTalentController {
@RequestMapping("/getTaihuTalents")
public R getTaihuTalents(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<TaihuTalent> wrapper = new MPJLambdaWrapper<>();
wrapper.leftJoin(MedicalRecordsLabel.class,MedicalRecordsLabel::getId,TaihuTalent::getDeptLabelId);
wrapper.leftJoin(DeptLabel.class, DeptLabel::getId,TaihuTalent::getDeptLabelId);
wrapper.selectAll(TaihuTalent.class);
wrapper.selectAs(MedicalRecordsLabel::getTitle,TaihuTalent::getDepartment);
wrapper.selectAs(DeptLabel::getTitle,TaihuTalent::getDepartment);
wrapper.like(StringUtils.isNotEmpty(params.get("name").toString()),TaihuTalent::getName,params.get("name"));
wrapper.like(StringUtils.isNotEmpty(params.get("region").toString()),TaihuTalent::getRegion,params.get("region"));
wrapper.orderByDesc(TaihuTalent::getCreateTime);
@@ -123,6 +121,10 @@ public class TaihuTalentController {
//新增太湖英才
@RequestMapping("/addTaihuTalent")
public R addTaihuTalent(@RequestBody TaihuTalent taihuTalent){
if (taihuTalentService.count(new LambdaQueryWrapper<TaihuTalent>()
.eq(TaihuTalent::getUserId,taihuTalent.getUserId()))>0){
return R.error("已绑定过");
}
taihuTalentService.save(taihuTalent);
return R.ok();
}
@@ -148,7 +150,7 @@ public class TaihuTalentController {
@RequestMapping("/taihuTalentInfo")
public R taihuTalentInfo(@RequestBody Map<String,Object> params){
TaihuTalent taihuTalent = taihuTalentService.getById(params.get("id").toString());
taihuTalent.setDepartment(medicalRecordsLabelService.getById(taihuTalent.getDeptLabelId()).getTitle());
taihuTalent.setDepartment(deptLabelService.getById(taihuTalent.getDeptLabelId()).getTitle());
return R.ok().put("taihuTalent",taihuTalent);
}

View File

@@ -1,6 +1,8 @@
package com.peanut.modules.taihumed.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
@@ -10,14 +12,12 @@ import com.peanut.modules.sys.entity.SysSensitiveWords;
import com.peanut.modules.sys.service.SysSensitiveWordsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
@Slf4j
@RestController("commonTaihuTalentArticle")
@@ -34,11 +34,16 @@ public class TaihuTalentArticleController {
private TaihuTalentArticleLikeService taihuTalentArticleLikeService;
@Autowired
private SysSensitiveWordsService sysSensitiveWordsService;
@Autowired
private MyUserService userService;
@Autowired
private MedicalRecordsService medicalRecordsService;
//太湖英才文章列表
@RequestMapping("/getArticleList")
public R getArticleList(@RequestBody Map<String,Object> params){
LambdaQueryWrapper<TaihuTalentArticle> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaihuTalentArticle::getShowFlag,1);
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
Page<TaihuTalentArticle> page = taihuTalentArticleService.page(new Page<>(Long.parseLong(params.get("current").toString()),
Long.parseLong(params.get("limit").toString())), wrapper);
@@ -49,6 +54,12 @@ public class TaihuTalentArticleController {
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())));
List<TaihuTalentArticleLike> likeList = taihuTalentArticleLikeService.list(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId()));
for (TaihuTalentArticleLike like: likeList) {
like.setUser(userService.getById(like.getUserId()));
}
article.setLikeList(likeList);
article.setLikeFlag((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
@@ -64,9 +75,14 @@ public class TaihuTalentArticleController {
.eq(TaihuTalent::getUserId, article.getUserId())));
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())));
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
List<TaihuTalentArticleLike> likeList = taihuTalentArticleLikeService.list(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId()));
for (TaihuTalentArticleLike like: likeList) {
like.setUser(userService.getById(like.getUserId()));
}
article.setLikeList(likeList);
article.setLikeCount(likeList.size());
article.setLikeFlag((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
List<TaihuTalentArticleComment> comments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
@@ -74,10 +90,15 @@ public class TaihuTalentArticleController {
.eq(TaihuTalentArticleComment::getPid,0)
.orderByDesc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment comment : comments) {
comment.setChildren(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
List<TaihuTalentArticleComment> childrenList = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
.ne(TaihuTalentArticleComment::getPid,0)
.orderByAsc(TaihuTalentArticleComment::getCreateTime)));
.eq(TaihuTalentArticleComment::getPid,comment.getId())
.orderByAsc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment cc : childrenList) {
cc.setUser(userService.getById(cc.getUserId()));
}
comment.setChildren(childrenList);
comment.setUser(userService.getById(comment.getUserId()));
}
if (!Objects.equals(article.getUserId(), ShiroUtils.getUId())){
article.setReadCount(article.getReadCount()+1);
@@ -86,12 +107,63 @@ public class TaihuTalentArticleController {
return R.ok().put("article",article).put("comments",comments);
}
//太湖英才文章点赞和评论数量
@RequestMapping("/getArticleLikeAndComment")
public R getArticleLikeAndComment(@RequestBody Map<String,Object> params){
TaihuTalentArticle article = taihuTalentArticleService.getById(params.get("articleId").toString());
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
List<TaihuTalentArticleLike> likeList = taihuTalentArticleLikeService.list(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId()));
for (TaihuTalentArticleLike like: likeList) {
like.setUser(userService.getById(like.getUserId()));
}
article.setLikeList(likeList);
article.setLikeCount(likeList.size());
article.setLikeFlag((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
List<TaihuTalentArticleComment> comments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
.eq(TaihuTalentArticleComment::getPid,0)
.orderByDesc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment comment : comments) {
List<TaihuTalentArticleComment> childrenList = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
.eq(TaihuTalentArticleComment::getPid,comment.getId())
.orderByAsc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment cc : childrenList) {
cc.setUser(userService.getById(cc.getUserId()));
}
comment.setChildren(childrenList);
comment.setUser(userService.getById(comment.getUserId()));
}
return R.ok().put("article",article).put("comments",comments);
}
//增加阅读数
@RequestMapping("/addReadCount")
public R addReadCount(@RequestBody Map<String,Object> params){
TaihuTalentArticle article = taihuTalentArticleService.getById(params.get("articleId").toString());
if (article!=null){
article.setReadCount(article.getReadCount()+1);
taihuTalentArticleService.updateById(article);
}
return R.ok();
}
//太湖英才文章点赞或取消
@RequestMapping("/addOrCancelArticleLike")
@Transactional
public R addOrCancelArticleLike(@RequestBody Map<String,Object> params){
TaihuTalentArticleLike like = taihuTalentArticleLikeService.getOne(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,params.get("articleId").toString())
.eq(TaihuTalentArticleLike::getUserId,ShiroUtils.getUId()));
TaihuTalentArticle article = taihuTalentArticleService.getById(params.get("articleId").toString());
if (article!=null){
article.setReadCount(article.getReadCount()+1);
taihuTalentArticleService.updateById(article);
}
if (like != null) {
taihuTalentArticleLikeService.removeById(like);
}else {
@@ -105,7 +177,13 @@ public class TaihuTalentArticleController {
//新增文章评论
@RequestMapping("/addArticleComment")
@Transactional
public R addArticleComment(@RequestBody TaihuTalentArticleComment comment){
TaihuTalentArticle article = taihuTalentArticleService.getById(comment.getArticleId());
if (article!=null){
article.setReadCount(article.getReadCount()+1);
taihuTalentArticleService.updateById(article);
}
R result = new R();
LambdaQueryWrapper<SysSensitiveWords> wrapper = new LambdaQueryWrapper<>();
wrapper.last(" where instr(\""+comment.getContent()+"\",word)>0");
@@ -121,34 +199,38 @@ public class TaihuTalentArticleController {
}
result.put("tip","您的评论含有敏感词:"+str+",请重新输入。");
}else {
comment.setUserId(ShiroUtils.getUId());
taihuTalentArticleCommentService.save(comment);
result.put("tip","评论成功!");
}
return result;
}
//评论提醒
@RequestMapping("/getCommentRemind")
public R getCommentRemind(@RequestBody Map<String,Object> params){
List<TaihuTalentArticleComment> list = new ArrayList<>();
public R getCommentRemind(){
Set<TaihuTalentArticle> set = new HashSet<>();
List<TaihuTalentArticleComment> userComments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getUserId,ShiroUtils.getUId())
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString()));
.eq(TaihuTalentArticleComment::getReadFlag,0));
for (TaihuTalentArticleComment comment : userComments) {
if(comment.getPid().equals(0)){
list.addAll(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getPid,comment.getId())
.eq(TaihuTalentArticleComment::getReadFlag,0)
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString())));
}else {
list.addAll(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getPid,comment.getPid())
.eq(TaihuTalentArticleComment::getReadFlag,0)
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString())));
TaihuTalentArticle article = taihuTalentArticleService.getById(comment.getArticleId());
if (article!=null){
set.add(article);
}
}
return R.ok().put("list",list);
return R.ok().put("set",set);
}
//评论提醒
@RequestMapping("/setReadFlag")
public R setReadFlag(@RequestBody Map<String,Object> params){
taihuTalentArticleCommentService.update(new LambdaUpdateWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getUserId,ShiroUtils.getUId())
.eq(TaihuTalentArticleComment::getReadFlag,0)
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString())
.set(TaihuTalentArticleComment::getReadFlag,1));
return R.ok();
}
//我的文章列表
@@ -156,17 +238,103 @@ public class TaihuTalentArticleController {
public R myArticleList(@RequestBody Map<String,Object> params){
LambdaQueryWrapper<TaihuTalentArticle> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaihuTalentArticle::getUserId,ShiroUtils.getUId());
wrapper.eq(TaihuTalentArticle::getShowFlag,params.get("showFlag").toString());
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
Page<TaihuTalentArticle> page = taihuTalentArticleService.page(new Page<>(Long.parseLong(params.get("current").toString()),
Long.parseLong(params.get("limit").toString())), wrapper);
for (TaihuTalentArticle article : page.getRecords()) {
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
List<TaihuTalentArticleLike> likeList = taihuTalentArticleLikeService.list(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId()));
for (TaihuTalentArticleLike like: likeList) {
like.setUser(userService.getById(like.getUserId()));
}
article.setLikeList(likeList);
article.setLikeCount(likeList.size());
article.setLikeFlag((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
List<TaihuTalentArticleComment> comments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
.eq(TaihuTalentArticleComment::getPid,0)
.orderByDesc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment comment : comments) {
List<TaihuTalentArticleComment> childrenList = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
.eq(TaihuTalentArticleComment::getPid,comment.getId())
.orderByAsc(TaihuTalentArticleComment::getCreateTime));
for (TaihuTalentArticleComment cc : childrenList) {
cc.setUser(userService.getById(cc.getUserId()));
}
comment.setChildren(childrenList);
comment.setUser(userService.getById(comment.getUserId()));
}
}
return R.ok().put("page",page);
}
//当前用户是否能新增文章
@RequestMapping("/getArticleRoleByUser")
public R getArticleRoleByUser(){
return R.ok().put("roleFlag", taihuTalentService.count(new LambdaQueryWrapper<TaihuTalent>()
.eq(TaihuTalent::getUserId,ShiroUtils.getUId())));
}
//新增文章
@RequestMapping("/addArticle")
public R addArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
taihuTalentArticle.setUserId(ShiroUtils.getUId());
taihuTalentArticleService.save(taihuTalentArticle);
LambdaQueryWrapper<SysSensitiveWords> wrapper = new LambdaQueryWrapper<>();
wrapper.last(" where instr(\""+taihuTalentArticle.getTitle()+"\",word)>0");
List<SysSensitiveWords> list = sysSensitiveWordsService.list(wrapper);
if (list.size() > 0){
String str = "";
for (SysSensitiveWords words:list) {
if ("".equals(str)){
str = words.getWord();
}else {
str = str + "" + words.getWord();
}
}
return R.error("您的标题含有敏感词:"+str+",请重新输入。");
}else {
LambdaQueryWrapper<SysSensitiveWords> cwrapper = new LambdaQueryWrapper<>();
cwrapper.last(" where instr(\""+taihuTalentArticle.getContent()+"\",word)>0");
List<SysSensitiveWords> clist = sysSensitiveWordsService.list(cwrapper);
if (clist.size() > 0){
String str = "";
for (SysSensitiveWords words:clist) {
if ("".equals(str)){
str = words.getWord();
}else {
str = str + "" + words.getWord();
}
}
return R.error("您的内容含有敏感词:"+str+",请重新输入。");
}else {
taihuTalentArticle.setUserId(ShiroUtils.getUId());
taihuTalentArticleService.save(taihuTalentArticle);
return R.ok();
}
}
}
//删除文章
@RequestMapping("/delArticle")
@Transactional
public R delArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
taihuTalentArticle = taihuTalentArticleService.getById(taihuTalentArticle.getId());
if (taihuTalentArticle.getCome()==1){
medicalRecordsService.update(new LambdaUpdateWrapper<MedicalRecords>()
.eq(MedicalRecords::getUserId,taihuTalentArticle.getUserId())
.eq(MedicalRecords::getTitle,taihuTalentArticle.getTitle())
.set(MedicalRecords::getArticleFlag,0));
}
taihuTalentArticleCommentService.remove(new LambdaQueryWrapper<TaihuTalentArticleComment>()
.eq(TaihuTalentArticleComment::getArticleId,taihuTalentArticle.getId()));
taihuTalentArticleLikeService.remove(new LambdaQueryWrapper<TaihuTalentArticleLike>()
.eq(TaihuTalentArticleLike::getArticleId,taihuTalentArticle.getId()));
taihuTalentArticleService.removeById(taihuTalentArticle);
return R.ok();
}

View File

@@ -31,15 +31,15 @@ public class TaihuTalentController {
@Autowired
private MedicalRecordsService medicalRecordsService;
@Autowired
private MedicalRecordsLabelService medicalRecordsLabelService;
private DeptLabelService deptLabelService;
//太湖英才列表
@RequestMapping("/getTaihuTalents")
public R getTaihuTalents(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<TaihuTalent> wrapper = new MPJLambdaWrapper<>();
wrapper.leftJoin(MedicalRecordsLabel.class,MedicalRecordsLabel::getId,TaihuTalent::getDeptLabelId);
wrapper.leftJoin(DeptLabel.class, DeptLabel::getId,TaihuTalent::getDeptLabelId);
wrapper.selectAll(TaihuTalent.class);
wrapper.selectAs(MedicalRecordsLabel::getTitle,TaihuTalent::getDepartment);
wrapper.selectAs(DeptLabel::getTitle,TaihuTalent::getDepartment);
wrapper.like(StringUtils.isNotEmpty(params.get("name").toString()),TaihuTalent::getName,params.get("name"));
wrapper.eq(StringUtils.isNotEmpty(params.get("deptLabelId").toString()),TaihuTalent::getDeptLabelId,params.get("deptLabelId"));
wrapper.like(StringUtils.isNotEmpty(params.get("region").toString()),TaihuTalent::getRegion,params.get("region"));
@@ -68,7 +68,7 @@ public class TaihuTalentController {
@RequestMapping("/taihuTalentInfo")
public R taihuTalentInfo(@RequestBody Map<String,Object> params){
TaihuTalent taihuTalent = taihuTalentService.getById(params.get("id").toString());
taihuTalent.setDepartment(medicalRecordsLabelService.getById(taihuTalent.getDeptLabelId()).getTitle());
taihuTalent.setDepartment(deptLabelService.getById(taihuTalent.getDeptLabelId()).getTitle());
List<UserCertificateLabel> labels = userCertificateLabelService.list(new LambdaQueryWrapper<UserCertificateLabel>()
.eq(UserCertificateLabel::getPid,0));
List<UserCertificateLabel> filterLabels = new ArrayList<>();
@@ -115,7 +115,7 @@ public class TaihuTalentController {
List<CourseEntity> courseList = courseService.list(wrapper);
//精彩医案
List<MedicalRecords> medicalRecords = medicalRecordsService.list(new LambdaQueryWrapper<MedicalRecords>()
.eq(MedicalRecords::getState,3)
.ge(MedicalRecords::getState,5)
.eq(MedicalRecords::getShowFlag,1)
.eq(MedicalRecords::getUserId,taihuTalent.getUserId())
.orderByDesc(MedicalRecords::getTrain));