太湖云医 医案、文章

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 {
}