|
|
|
@ -19,23 +19,18 @@ import com.supervision.common.domain.R;
|
|
|
|
|
import com.supervision.common.enums.ResultStatusEnum;
|
|
|
|
|
import com.supervision.common.exception.CustomException;
|
|
|
|
|
import com.supervision.common.utils.ExcelReader;
|
|
|
|
|
import com.supervision.common.utils.IPages;
|
|
|
|
|
import com.supervision.common.utils.StringUtils;
|
|
|
|
|
import com.supervision.config.BusinessException;
|
|
|
|
|
import com.supervision.constant.DataStatus;
|
|
|
|
|
import com.supervision.police.domain.CasePerson;
|
|
|
|
|
import com.supervision.police.domain.ComDictionary;
|
|
|
|
|
import com.supervision.police.domain.*;
|
|
|
|
|
import com.supervision.police.dto.*;
|
|
|
|
|
import com.supervision.police.mapper.ModelCaseMapper;
|
|
|
|
|
import com.supervision.police.domain.ModelCase;
|
|
|
|
|
import com.supervision.police.service.CasePersonService;
|
|
|
|
|
import com.supervision.police.service.CaseStatusManageService;
|
|
|
|
|
import com.supervision.police.service.ComDictionaryService;
|
|
|
|
|
import com.supervision.police.service.ModelCaseService;
|
|
|
|
|
import com.supervision.police.service.*;
|
|
|
|
|
import com.supervision.police.vo.ModelCaseVO;
|
|
|
|
|
import com.supervision.utils.JudgeLogicUtil;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
@ -67,6 +62,11 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
|
|
|
|
|
|
|
|
|
|
private final LangChainChatService langChainChatService;
|
|
|
|
|
|
|
|
|
|
private final ModelAtomicResultService modelAtomicResultService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private NoteRecordSplitService noteRecordSplitService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
*
|
|
|
|
@ -353,45 +353,68 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<IndexDetail> getIndexDetail(IndexResultQuery query, Integer page, Integer size) {
|
|
|
|
|
public IPage<IndexDetail> getIndexDetail(IndexResultQuery query, Integer pageNum, Integer pageSize) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(query.getCaseId(), "案件id不能为空");
|
|
|
|
|
Assert.notEmpty(query.getIndexType(), "指标类型不能为空");
|
|
|
|
|
|
|
|
|
|
IPage<IndexDetail> iPage = new Page<>(page, size);
|
|
|
|
|
iPage = modelCaseMapper.pageListIndexResult(query,iPage);
|
|
|
|
|
IPage<IndexDetail> iPage = modelCaseMapper.pageListIndexResult(query,Page.of(pageNum, pageSize));
|
|
|
|
|
List<IndexDetail> records = iPage.getRecords();
|
|
|
|
|
|
|
|
|
|
// 添加 附属内容
|
|
|
|
|
for (IndexDetail record : records) {
|
|
|
|
|
String judgeLogic = record.getJudgeLogic();
|
|
|
|
|
if (StringUtils.isEmpty(judgeLogic)) {
|
|
|
|
|
attachRecord(query.getCaseId(), records);
|
|
|
|
|
|
|
|
|
|
return iPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加 指标结果附属内容
|
|
|
|
|
* @param caseId 案件id
|
|
|
|
|
* @param indexDetails 指标结果
|
|
|
|
|
*/
|
|
|
|
|
private void attachRecord(String caseId,List<IndexDetail> indexDetails) {
|
|
|
|
|
if (CollUtil.isEmpty(indexDetails)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// indexDetails中涉及到的原子指标结果数据
|
|
|
|
|
List<String> indexIdList = indexDetails.stream().map(IndexDetail::getIndexId).toList();
|
|
|
|
|
List<ModelAtomicResult> modelAtomicResultList = modelAtomicResultService.lambdaQuery()
|
|
|
|
|
.eq(ModelAtomicResult::getCaseId, caseId)
|
|
|
|
|
.in(CollUtil.isNotEmpty(indexIdList), ModelAtomicResult::getIndexId, indexIdList).list();
|
|
|
|
|
|
|
|
|
|
// records中涉及到的笔录片段id
|
|
|
|
|
Set<String> recordSegmentList = modelAtomicResultList.stream()
|
|
|
|
|
.filter(atomic -> StrUtil.isNotEmpty(atomic.getRecordSplitId()))
|
|
|
|
|
.flatMap(atomic -> Arrays.stream(atomic.getRecordSplitId().split(","))).collect(Collectors.toSet());
|
|
|
|
|
List<NoteRecordSplit> nodeRecordSpliteList = noteRecordSplitService.lambdaQuery().in(NoteRecordSplit::getId, recordSegmentList).list();
|
|
|
|
|
Map<String, NoteRecordSplit> nodeRecordSpliteMap = nodeRecordSpliteList.stream().collect(Collectors.toMap(NoteRecordSplit::getId, v -> v));
|
|
|
|
|
|
|
|
|
|
for (IndexDetail record : indexDetails) {
|
|
|
|
|
if (StringUtils.isEmpty(record.getJudgeLogic())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 是否是新的结果
|
|
|
|
|
record.setNewFlag(!StrUtil.equals(record.getIndexResult(), record.getPreResult()));
|
|
|
|
|
// 获取原子指标的判断规则
|
|
|
|
|
record.setNewFlagValue();
|
|
|
|
|
|
|
|
|
|
// 配置的指标的逻辑
|
|
|
|
|
Map<String, String> indexJundgeLogicMap = parseLogicMap(judgeLogic);
|
|
|
|
|
List<String> atomicIds = JudgeLogicUtil.pickAtomicIndexIds(judgeLogic);
|
|
|
|
|
List<AtomicIndexDTO> atomics = modelCaseMapper.getAtomicDetail(query.getCaseId(), record.getIndexId(), atomicIds);
|
|
|
|
|
List<String> atomicIds = JudgeLogicUtil.pickAtomicIndexIds(record.getJudgeLogic());
|
|
|
|
|
List<AtomicIndexDTO> atomics = modelCaseMapper.getAtomicDetail(caseId, record.getIndexId(), atomicIds);
|
|
|
|
|
for (AtomicIndexDTO atomic : atomics) {
|
|
|
|
|
// 获取原子指标的判断规则
|
|
|
|
|
// 配置的指标的逻辑
|
|
|
|
|
Map<String, String> indexJundgeLogicMap = parseLogicMap(record.getJudgeLogic());
|
|
|
|
|
// 需要和原子指标的规则判断是否一致(解决出罪和入罪冲突的问题)
|
|
|
|
|
String s = indexJundgeLogicMap.get(atomic.getAtomicIndexId());
|
|
|
|
|
atomic.judgeWithIndexResult(s);
|
|
|
|
|
if (StrUtil.isBlank(atomic.getRecord())) {
|
|
|
|
|
atomic.setRecord("无");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
record.setRecord("无");
|
|
|
|
|
// 遍历,atomic的record字段存在不为空,且不是无的,如果有,就是有
|
|
|
|
|
if (atomics.stream().anyMatch(atomic -> StrUtil.isNotBlank(atomic.getRecord()) && !StrUtil.equals("无", atomic.getRecord()))) {
|
|
|
|
|
record.setRecord("有");
|
|
|
|
|
String relationalSymbol = indexJundgeLogicMap.get(atomic.getAtomicIndexId());
|
|
|
|
|
|
|
|
|
|
atomic.judgeWithIndexResult(relationalSymbol);
|
|
|
|
|
atomic.setSegmentation(nodeRecordSpliteMap);
|
|
|
|
|
atomic.setRecordIfSegmentationAbsent("无");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
record.setChildren(atomics);
|
|
|
|
|
record.setRecordValue();
|
|
|
|
|
}
|
|
|
|
|
return iPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, String> parseLogicMap(String judgeLogic) {
|
|
|
|
|