|
|
|
@ -2,6 +2,7 @@ package com.supervision.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.io.LineHandler;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
@ -14,6 +15,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -97,7 +101,8 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
basisIdentificationResultResVO.setIdentificationDiagnosis(diseasesList.stream().map(Disease::getBasisIdentification).collect(Collectors.toList()));
|
|
|
|
|
// 2.2 获取体格检查
|
|
|
|
|
List<PhysicalRecordByResultDAO> physicalRecordList = diagnosisPhysicalRecordService.queryPhysicalResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> nodeList = physicalRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> nodeList = physicalRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(PhysicalRecordByResultDAO::getToolLocationName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setType(1);
|
|
|
|
|
nodeResVO.setRecordName(e.getToolLocationName());
|
|
|
|
@ -108,7 +113,8 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
// 2.3 获取辅助检查
|
|
|
|
|
List<AncillaryRecordByResultDAO> ancillaryRecordList = diagnosisAncillaryRecordService.queryAncillaryResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(AncillaryRecordByResultDAO::getItemName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setCorrect(e.getBasisIdentification());
|
|
|
|
|
nodeResVO.setRecordId(e.getRecordId());
|
|
|
|
@ -126,23 +132,23 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
BasisConfirmResultResVO basisConfirmResultResVO = new BasisConfirmResultResVO();
|
|
|
|
|
basisConfirmResultResVO.setConfirmingDiagnosis(diseasesList.stream().map(Disease::getConfirmingDiagnosis).collect(Collectors.toList()));
|
|
|
|
|
// 2.2 获取体格检查
|
|
|
|
|
HashSet<String> physicalItemSet = new HashSet<>();
|
|
|
|
|
List<PhysicalRecordByResultDAO> physicalRecordList = diagnosisPhysicalRecordService.queryPhysicalResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> nodeList = physicalRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> nodeList = physicalRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(PhysicalRecordByResultDAO::getToolLocationName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setType(1);
|
|
|
|
|
nodeResVO.setRecordName(e.getToolLocationName());
|
|
|
|
|
nodeResVO.setRecordId(e.getRecordId());
|
|
|
|
|
// 如果是必做的,则是正确
|
|
|
|
|
nodeResVO.setCorrect(physicalItemSet.add(e.getToolLocationName()) ? e.getBasisConfirm() : Integer.valueOf(2));
|
|
|
|
|
nodeResVO.setCorrect(e.getBasisConfirm());
|
|
|
|
|
return nodeResVO;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
// 2.3 获取辅助检查
|
|
|
|
|
physicalItemSet.clear();
|
|
|
|
|
List<AncillaryRecordByResultDAO> ancillaryRecordList = diagnosisAncillaryRecordService.queryAncillaryResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(AncillaryRecordByResultDAO::getItemName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setCorrect(physicalItemSet.add(e.getItemName()) ? e.getBasisConfirm() : Integer.valueOf(2));
|
|
|
|
|
nodeResVO.setCorrect(e.getBasisConfirm());
|
|
|
|
|
nodeResVO.setRecordId(e.getRecordId());
|
|
|
|
|
nodeResVO.setRecordName(e.getItemName());
|
|
|
|
|
nodeResVO.setType(2);
|
|
|
|
@ -179,24 +185,24 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
basisDiagnosisNodeResVOS.addAll(qaList);
|
|
|
|
|
}
|
|
|
|
|
// 2.2 获取体格检查
|
|
|
|
|
HashSet<String> physicalItemSet = new HashSet<>();
|
|
|
|
|
List<PhysicalRecordByResultDAO> physicalRecordList = diagnosisPhysicalRecordService.queryPhysicalResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> physicalList = physicalRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> physicalList = physicalRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(PhysicalRecordByResultDAO::getToolLocationName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setType(1);
|
|
|
|
|
nodeResVO.setRecordName(e.getToolLocationName());
|
|
|
|
|
nodeResVO.setRecordId(e.getRecordId());
|
|
|
|
|
// 如果是必做的,则是正确
|
|
|
|
|
nodeResVO.setCorrect(physicalItemSet.add(e.getToolLocationName()) ? e.getRequireCheck() : Integer.valueOf(2));
|
|
|
|
|
nodeResVO.setCorrect(e.getRequireCheck());
|
|
|
|
|
return nodeResVO;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
basisDiagnosisNodeResVOS.addAll(physicalList);
|
|
|
|
|
// 2.3 获取辅助检查
|
|
|
|
|
physicalItemSet.clear();
|
|
|
|
|
List<AncillaryRecordByResultDAO> ancillaryRecordList = diagnosisAncillaryRecordService.queryAncillaryResultByProcessId(processId);
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream().map(e -> {
|
|
|
|
|
List<BasisDiagnosisNodeResVO> collect = ancillaryRecordList.stream()
|
|
|
|
|
.filter(distinctPredicateNotNull(AncillaryRecordByResultDAO::getItemName)).map(e -> {
|
|
|
|
|
BasisDiagnosisNodeResVO nodeResVO = new BasisDiagnosisNodeResVO();
|
|
|
|
|
nodeResVO.setCorrect(physicalItemSet.add(e.getItemName()) ? e.getRequireCheck() : Integer.valueOf(2));
|
|
|
|
|
nodeResVO.setCorrect(e.getRequireCheck());
|
|
|
|
|
nodeResVO.setRecordId(e.getRecordId());
|
|
|
|
|
nodeResVO.setRecordName(e.getItemName());
|
|
|
|
|
nodeResVO.setType(2);
|
|
|
|
@ -236,4 +242,13 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
}).collect(Collectors.toList()));
|
|
|
|
|
return expertDiagnosisResultResVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static <K> Predicate<K> distinctPredicateNotNull(Function<K,Object> function){
|
|
|
|
|
ConcurrentHashMap<Object, Boolean> map = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
return t-> null != function.apply(t) && null == map.putIfAbsent(function.apply(t), true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|