|
|
|
@ -17,6 +17,8 @@ import com.supervision.manage.service.ProcessRecordService;
|
|
|
|
|
import com.supervision.service.ProcessService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
@ -57,32 +59,33 @@ public class ProcessRecordServiceImpl implements ProcessRecordService {
|
|
|
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
|
|
|
HashSet<String> diseaseIdSet = new HashSet<>();
|
|
|
|
|
page.getRecords().forEach(e -> {
|
|
|
|
|
if (StrUtil.isNotEmpty(e.getContainDiseaseIdJsonStr())){
|
|
|
|
|
diseaseIdSet.addAll(JSONUtil.toList(e.getContainDiseaseIdJsonStr(),String.class));
|
|
|
|
|
}else if (StrUtil.isNotBlank(e.getDiseaseId())){
|
|
|
|
|
if (StrUtil.isNotEmpty(e.getContainDiseaseIdJsonStr())) {
|
|
|
|
|
diseaseIdSet.addAll(JSONUtil.toList(e.getContainDiseaseIdJsonStr(), String.class));
|
|
|
|
|
} else if (StrUtil.isNotBlank(e.getDiseaseId())) {
|
|
|
|
|
diseaseIdSet.add(e.getDiseaseId());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseIdSet)) {
|
|
|
|
|
Map<String, Disease> diseaseMap = diseaseService.listByIds(diseaseIdSet).stream().collect(Collectors.toMap(Disease::getId, Function.identity()));
|
|
|
|
|
for (ProcessRecordVO record : page.getRecords()) {
|
|
|
|
|
List<String> diseaseName = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotEmpty(record.getContainDiseaseIdJsonStr())){
|
|
|
|
|
for (String containsDiseaseId : JSONUtil.toList(record.getContainDiseaseIdJsonStr(), String.class)) {
|
|
|
|
|
Optional.ofNullable(diseaseMap.get(containsDiseaseId)).ifPresent(disease -> diseaseName.add(disease.getDiseaseNameAlias()));
|
|
|
|
|
});
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseIdSet)) {
|
|
|
|
|
Map<String, Disease> diseaseMap = diseaseService.listByIds(diseaseIdSet).stream().collect(Collectors.toMap(Disease::getId, Function.identity()));
|
|
|
|
|
for (ProcessRecordVO record : page.getRecords()) {
|
|
|
|
|
List<String> diseaseName = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotEmpty(record.getContainDiseaseIdJsonStr())) {
|
|
|
|
|
for (String containsDiseaseId : JSONUtil.toList(record.getContainDiseaseIdJsonStr(), String.class)) {
|
|
|
|
|
Optional.ofNullable(diseaseMap.get(containsDiseaseId)).ifPresent(disease -> diseaseName.add(disease.getDiseaseNameAlias()));
|
|
|
|
|
}
|
|
|
|
|
} else if (StrUtil.isNotBlank(record.getDiseaseId())) {
|
|
|
|
|
Optional.ofNullable(diseaseMap.get(record.getDiseaseId())).ifPresent(disease -> diseaseName.add(disease.getDiseaseNameAlias()));
|
|
|
|
|
}
|
|
|
|
|
}else if (StrUtil.isNotBlank(record.getDiseaseId())){
|
|
|
|
|
Optional.ofNullable(diseaseMap.get(record.getDiseaseId())).ifPresent(disease -> diseaseName.add(disease.getDiseaseNameAlias()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
record.setDiseaseType(CollUtil.join(diseaseName, ","));
|
|
|
|
|
record.setDiseaseType(CollUtil.join(diseaseName, ","));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ProcessEvaluation saveOrUpdateProcessEvaluation(ProcessEvaluation processEvaluation) {
|
|
|
|
|
// 如果processId不为空,校验是否已经存在
|
|
|
|
|
if (StrUtil.isNotBlank(processEvaluation.getProcessId())) {
|
|
|
|
@ -94,13 +97,15 @@ public class ProcessRecordServiceImpl implements ProcessRecordService {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
processEvaluationService.saveOrUpdate(processEvaluation);
|
|
|
|
|
// 状态更新为已评估
|
|
|
|
|
processService.lambdaUpdate().set(Process::getStatus, 3).eq(Process::getId, processEvaluation.getProcessId()).update();
|
|
|
|
|
return processEvaluation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ProcessEvaluation queryProcessEvaluation(String processId) {
|
|
|
|
|
Assert.notEmpty(processId,() -> new BusinessException("流程ID不能为空"));
|
|
|
|
|
return processEvaluationService.lambdaQuery().eq(ProcessEvaluation::getProcessId,processId).last(" limit 1").one();
|
|
|
|
|
Assert.notEmpty(processId, () -> new BusinessException("流程ID不能为空"));
|
|
|
|
|
return processEvaluationService.lambdaQuery().eq(ProcessEvaluation::getProcessId, processId).last(" limit 1").one();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|