|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.manage.service.*;
|
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
@ -97,21 +98,23 @@ public class DiseaseManageServiceImpl implements DiseaseManageService {
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<? extends Disease> queryPageList(Integer pageNum, Integer pageSize, DiseaseReqVo diseaseReqVo) {
|
|
|
|
|
|
|
|
|
|
if (null == diseaseReqVo.getDiseaseType()){
|
|
|
|
|
diseaseReqVo.setDiseaseType(0);
|
|
|
|
|
}
|
|
|
|
|
Page<Disease> page = diseaseService.lambdaQuery()
|
|
|
|
|
.eq(Objects.nonNull(diseaseReqVo.getDiseaseType()), Disease::getDiseaseType, diseaseReqVo.getDiseaseType())
|
|
|
|
|
.like(StrUtil.isNotEmpty(diseaseReqVo.getDiseaseName()), Disease::getDiseaseName, diseaseReqVo.getDiseaseName())
|
|
|
|
|
.orderByDesc(Disease::getCreateTime).page(new Page<>(pageNum, pageSize));
|
|
|
|
|
|
|
|
|
|
IPage<? extends Disease> page = diseaseService.queryPageList(pageNum, pageSize, diseaseReqVo);
|
|
|
|
|
if (page.getSize() == 0) {
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
// 查询已配置病例信息的疾病id
|
|
|
|
|
List<String> medicalDiseaseIds = medicalRecService.lambdaQuery()
|
|
|
|
|
.in(MedicalRec::getDiseaseId, page.getRecords().stream().map(Disease::getId).collect(Collectors.toList()))
|
|
|
|
|
.list().stream().map(MedicalRec::getDiseaseId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 根据diseaseIds查询疾病信息
|
|
|
|
|
List<String> containDiseaseIds = page.getRecords().stream()
|
|
|
|
|
.filter(disease -> CollUtil.isNotEmpty(disease.getContainDiseaseIds()))
|
|
|
|
|
.flatMap(disease -> disease.getContainDiseaseIds().stream()).distinct().collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isEmpty(containDiseaseIds)) {
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
Map<String, Disease> diseaseMap = diseaseService.listByIds(containDiseaseIds)
|
|
|
|
|
.stream().collect(Collectors.toMap(Disease::getId, disease -> disease, (v1, v2) -> v1));
|
|
|
|
|
|
|
|
|
@ -122,6 +125,7 @@ public class DiseaseManageServiceImpl implements DiseaseManageService {
|
|
|
|
|
bean.setContainDiseaseNames(bean.getContainDiseaseIds().stream()
|
|
|
|
|
.map(diseaseMap::get).filter(Objects::nonNull).map(Disease::getDiseaseName).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
bean.setUsedMedicalRec(medicalDiseaseIds.contains(bean.getId()));
|
|
|
|
|
return bean;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|