病历夹

This commit is contained in:
wuchunlei
2025-05-19 15:25:53 +08:00
parent d004e86110
commit a0e5c26266
7 changed files with 144 additions and 68 deletions

View File

@@ -0,0 +1,74 @@
package com.peanut.modules.taihumed.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.common.entity.AiRecordFolder;
import com.peanut.modules.common.entity.AiRecordFolderChat;
import com.peanut.modules.common.service.AiRecordFolderChatService;
import com.peanut.modules.common.service.AiRecordFolderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController("taihumedAiRecordFolder")
@RequestMapping("taihumed/aiRecordFolder")
public class AiRecordFolderController {
@Autowired
private AiRecordFolderService aiRecordFolderService;
@Autowired
private AiRecordFolderChatService aiRecordFolderChatService;
//病历夹下患者列表
@RequestMapping("/getRecordFolderChats")
public R getRecordFolderChats(@RequestBody Map<String,Object> params){
LambdaQueryWrapper<AiRecordFolderChat> wrapper = new LambdaQueryWrapper();
wrapper.eq(AiRecordFolderChat::getFolderId,params.get("folderId"));
wrapper.like(StringUtils.isNotEmpty(params.get("patientName").toString()), AiRecordFolderChat::getPatientName,params.get("patientName"));
wrapper.orderByDesc(AiRecordFolderChat::getCreateTime);
List<AiRecordFolderChat> list = aiRecordFolderChatService.list(wrapper);
return R.ok().put("list",list);
}
//病历夹列表
@RequestMapping("/getRecordFolders")
public R getRecordFolders(@RequestBody Map<String,Object> params){
MPJLambdaWrapper<AiRecordFolder> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(AiRecordFolderChat.class,AiRecordFolderChat::getFolderId,AiRecordFolder::getId);
wrapper.selectAll(AiRecordFolder.class);
wrapper.distinct();
wrapper.eq(AiRecordFolder::getUserId, ShiroUtils.getUId());
wrapper.like(StringUtils.isNotEmpty(params.get("folderName").toString()), AiRecordFolder::getFolderName,params.get("folderName"));
wrapper.like(StringUtils.isNotEmpty(params.get("patientName").toString()), AiRecordFolderChat::getPatientName,params.get("patientName"));
wrapper.orderByAsc(AiRecordFolder::getSort);
wrapper.orderByDesc(AiRecordFolderChat::getCreateTime);
List<AiRecordFolder> list = aiRecordFolderService.list(wrapper);
return R.ok().put("list",list);
}
//将聊天记录加入病历夹
@RequestMapping("/addRecordFolderChat")
public R addRecordFolderChat(@RequestBody AiRecordFolderChat aiRecordFolderChat){
aiRecordFolderChatService.save(aiRecordFolderChat) ;
return R.ok();
}
//新建病例夹
@RequestMapping("/addRecordFolder")
public R addRecordFolder(@RequestBody AiRecordFolder aiRecordFolder){
aiRecordFolder.setUserId(ShiroUtils.getUId());
aiRecordFolderService.save(aiRecordFolder) ;
return R.ok();
}
}