|
|
|
@ -3,6 +3,7 @@ package com.supervision.service.impl;
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.supervision.model.AskTemplateQuestionLibrary;
|
|
|
|
|
import com.supervision.model.CommonDic;
|
|
|
|
@ -36,17 +37,15 @@ public class DiagnosisQaRecordServiceImpl extends ServiceImpl<DiagnosisQaRecordM
|
|
|
|
|
|
|
|
|
|
private final AskTemplateQuestionLibraryService askTemplateQuestionLibraryService;
|
|
|
|
|
@Override
|
|
|
|
|
public List<DiagnosisQaRecordHistoryResVO> queryByProcessId(String processId) {
|
|
|
|
|
|
|
|
|
|
List<DiagnosisQaRecord> list = this.lambdaQuery().eq(DiagnosisQaRecord::getProcessId, processId).list();
|
|
|
|
|
|
|
|
|
|
public List<DiagnosisQaRecordHistoryResVO> queryByProcessId(String processId,Integer pageNum,Integer pageSize) {
|
|
|
|
|
Page<DiagnosisQaRecord> page = this.lambdaQuery().eq(DiagnosisQaRecord::getProcessId, processId).page(new Page<>(pageNum, pageSize));
|
|
|
|
|
// 根据questionLibraryId找到对应的字典
|
|
|
|
|
Set<String> questionIdList = list.stream().map(DiagnosisQaRecord::getQuestionLibraryId).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
|
|
|
|
Set<String> questionIdList = page.getRecords().stream().map(DiagnosisQaRecord::getQuestionLibraryId).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
|
|
|
|
List<AskTemplateQuestionLibrary> askTemplateQuestionLibraryList = askTemplateQuestionLibraryService.listByIds(questionIdList);
|
|
|
|
|
Map<String, Long> questionLibraryMap = askTemplateQuestionLibraryList.stream().collect(Collectors.toMap(AskTemplateQuestionLibrary::getId, AskTemplateQuestionLibrary::getDictId));
|
|
|
|
|
List<CommonDic> commonDicList = commonDicService.lambdaQuery().eq(CommonDic::getGroupCode, "AQT").list();
|
|
|
|
|
Map<Long, CommonDic> dicMap = commonDicList.stream().collect(Collectors.toMap(CommonDic::getId, Function.identity()));
|
|
|
|
|
List<DiagnosisQaRecordHistoryResVO> resVOS = BeanUtil.copyToList(list, DiagnosisQaRecordHistoryResVO.class);
|
|
|
|
|
List<DiagnosisQaRecordHistoryResVO> resVOS = BeanUtil.copyToList(page.getRecords(), DiagnosisQaRecordHistoryResVO.class);
|
|
|
|
|
for (DiagnosisQaRecordHistoryResVO resVO : resVOS) {
|
|
|
|
|
Long dictId = questionLibraryMap.get(resVO.getQuestionLibraryId());
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dictId)){
|
|
|
|
@ -54,6 +53,9 @@ public class DiagnosisQaRecordServiceImpl extends ServiceImpl<DiagnosisQaRecordM
|
|
|
|
|
resVO.setCommonDic(commonDic);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 分页转换
|
|
|
|
|
Page<DiagnosisQaRecordHistoryResVO> resultPage = new Page<>(page.getPages(), page.getSize(), page.getTotal());
|
|
|
|
|
resultPage.setRecords(resVOS);
|
|
|
|
|
return resVOS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|