|
|
@ -3,10 +3,14 @@ package com.supervision.manage.service.impl;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
|
|
|
|
import com.supervision.model.ProcessEvaluation;
|
|
|
|
import com.supervision.service.DiseaseService;
|
|
|
|
import com.supervision.service.DiseaseService;
|
|
|
|
|
|
|
|
import com.supervision.service.ProcessEvaluationService;
|
|
|
|
import com.supervision.vo.result.ProcessRecordVO;
|
|
|
|
import com.supervision.vo.result.ProcessRecordVO;
|
|
|
|
import com.supervision.manage.service.ProcessRecordService;
|
|
|
|
import com.supervision.manage.service.ProcessRecordService;
|
|
|
|
import com.supervision.service.ProcessService;
|
|
|
|
import com.supervision.service.ProcessService;
|
|
|
@ -26,6 +30,8 @@ public class ProcessRecordServiceImpl implements ProcessRecordService {
|
|
|
|
|
|
|
|
|
|
|
|
private final DiseaseService diseaseService;
|
|
|
|
private final DiseaseService diseaseService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ProcessEvaluationService processEvaluationService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public IPage<ProcessRecordVO> queryProcessRecordPage(String studentName, String medicalRecNo, String diseaseType, Integer pageNum, Integer pageSize) {
|
|
|
|
public IPage<ProcessRecordVO> queryProcessRecordPage(String studentName, String medicalRecNo, String diseaseType, Integer pageNum, Integer pageSize) {
|
|
|
@ -49,18 +55,45 @@ public class ProcessRecordServiceImpl implements ProcessRecordService {
|
|
|
|
IPage<ProcessRecordVO> page = processService.queryProcessRecordPage(studentName, medicalRecNo, diseaseList, pageNum, pageSize);
|
|
|
|
IPage<ProcessRecordVO> page = processService.queryProcessRecordPage(studentName, medicalRecNo, diseaseList, pageNum, pageSize);
|
|
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
|
|
HashSet<String> diseaseIdSet = new HashSet<>();
|
|
|
|
HashSet<String> diseaseIdSet = new HashSet<>();
|
|
|
|
page.getRecords().forEach(e -> diseaseIdSet.addAll(Optional.ofNullable(e.getContainDiseaseIds()).orElse(new ArrayList<>())));
|
|
|
|
page.getRecords().forEach(e -> {
|
|
|
|
|
|
|
|
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)) {
|
|
|
|
if (CollUtil.isNotEmpty(diseaseIdSet)) {
|
|
|
|
Map<String, Disease> diseaseMap = diseaseService.listByIds(diseaseIdSet).stream().collect(Collectors.toMap(Disease::getId, Function.identity()));
|
|
|
|
Map<String, Disease> diseaseMap = diseaseService.listByIds(diseaseIdSet).stream().collect(Collectors.toMap(Disease::getId, Function.identity()));
|
|
|
|
for (ProcessRecordVO record : page.getRecords()) {
|
|
|
|
for (ProcessRecordVO record : page.getRecords()) {
|
|
|
|
List<String> diseaseName = new ArrayList<>();
|
|
|
|
List<String> diseaseName = new ArrayList<>();
|
|
|
|
for (String containDiseaseId : record.getContainDiseaseIds()) {
|
|
|
|
if (StrUtil.isNotEmpty(record.getContainDiseaseIdJsonStr())){
|
|
|
|
Optional.ofNullable(diseaseMap.get(containDiseaseId)).ifPresent(disease -> diseaseName.add(disease.getDiseaseNameAlias()));
|
|
|
|
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()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
record.setDiseaseType(CollUtil.join(diseaseName, ","));
|
|
|
|
record.setDiseaseType(CollUtil.join(diseaseName, ","));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return page;
|
|
|
|
return page;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ProcessEvaluation saveOrUpdateProcessEvaluation(ProcessEvaluation processEvaluation) {
|
|
|
|
|
|
|
|
// 如果processId不为空,校验是否已经存在
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(processEvaluation.getProcessId())) {
|
|
|
|
|
|
|
|
processEvaluationService.lambdaQuery().eq(ProcessEvaluation::getProcessId, processEvaluation.getProcessId()).oneOpt().ifPresent(e -> {
|
|
|
|
|
|
|
|
// 如果ID不一致,则说明processId存在重复情况,这时报错
|
|
|
|
|
|
|
|
if (!StrUtil.equals(e.getId(), processEvaluation.getId())) {
|
|
|
|
|
|
|
|
throw new BusinessException("已存在相同的评估记录");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processEvaluationService.saveOrUpdate(processEvaluation);
|
|
|
|
|
|
|
|
return processEvaluation;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|