|
@@ -0,0 +1,582 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.diagbot.client.KnowledgemanServiceClient;
|
|
|
+import com.diagbot.client.UserServiceClient;
|
|
|
+import com.diagbot.dto.ConceptBaseDTO;
|
|
|
+import com.diagbot.dto.DeptDTO;
|
|
|
+import com.diagbot.dto.GetAllDeptAndDisInfoDTO;
|
|
|
+import com.diagbot.dto.GetModuleDetailInfoDTO;
|
|
|
+import com.diagbot.dto.GetModuleInfoOneDTO;
|
|
|
+import com.diagbot.dto.GetModuleTypeDTO;
|
|
|
+import com.diagbot.dto.GetQuestionInfoDTO;
|
|
|
+import com.diagbot.dto.GetQuestiongAndModuleRelationsDTO;
|
|
|
+import com.diagbot.dto.ModuleInfoDTO;
|
|
|
+import com.diagbot.dto.ModuleInfoListDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.DictionaryInfo;
|
|
|
+import com.diagbot.entity.ModuleDetail;
|
|
|
+import com.diagbot.entity.ModuleInfo;
|
|
|
+import com.diagbot.entity.QuestionInfo;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.ModuleInfoTypeEnum;
|
|
|
+import com.diagbot.enums.QuestionTypeEnum;
|
|
|
+import com.diagbot.service.impl.ModuleInfoServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.vo.AddModuleInfoVO;
|
|
|
+import com.diagbot.vo.ConceptTypeVO;
|
|
|
+import com.diagbot.vo.GetAllDeptAndDisInfoVO;
|
|
|
+import com.diagbot.vo.GetModuleDetailInfoVO;
|
|
|
+import com.diagbot.vo.GetModuleInfoOneVO;
|
|
|
+import com.diagbot.vo.GetModuleInfoVO;
|
|
|
+import com.diagbot.vo.GetModuleTypeVO;
|
|
|
+import com.diagbot.vo.GetQuestiongAndModuleRelationsVO;
|
|
|
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
|
|
|
+import com.diagbot.vo.UpdateModuleInfoVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @Author:zhoutg
|
|
|
+ * @time: 2018/11/23 11:37
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class ModuleInfoFacade extends ModuleInfoServiceImpl {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ModuleDetailFacade moduleDetailFacade;
|
|
|
+ @Autowired
|
|
|
+ QuestionFacade questionFacade;
|
|
|
+ @Autowired
|
|
|
+ UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
+ DictionaryFacade dictionaryFacade;
|
|
|
+ @Autowired
|
|
|
+ KnowledgemanServiceClient knowledgemanServiceClient;
|
|
|
+ /**
|
|
|
+ * 根据id删除标签模板
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean deleteByIdsFac(String ids) {
|
|
|
+ //如果是子模板,删除该子模板与其他模板的关联
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id",ids);
|
|
|
+ ModuleInfo moduleInfo = this.getOne(moduleInfoQueryWrapper);
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date date = DateUtil.now();
|
|
|
+ if(null != moduleInfo){
|
|
|
+ if("31".equals(moduleInfo.getType())
|
|
|
+ || "32".equals(moduleInfo.getType())
|
|
|
+ || "322".equals(moduleInfo.getType())){
|
|
|
+ UpdateWrapper<ModuleDetail> moduleDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ moduleDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("relation_module", moduleInfo.getId())
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .set("modifier", userId)
|
|
|
+ .set("gmt_modified",date );
|
|
|
+ moduleDetailFacade.update(new ModuleDetail(),moduleDetailUpdateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtil.isEmpty(ids)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ Map paramMap = new HashMap<>();
|
|
|
+ paramMap.put("delete", IsDeleteEnum.Y.getKey());
|
|
|
+ paramMap.put("ids", Arrays.asList(ids.split(",")));
|
|
|
+ paramMap.put("gmtModified", date);
|
|
|
+ paramMap.put("modifier", userId);
|
|
|
+
|
|
|
+ //删除模板
|
|
|
+ this.deleteByIds(paramMap);
|
|
|
+
|
|
|
+ //删除明细表
|
|
|
+ moduleDetailFacade.deleteByModuleIdFac(paramMap);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加模板
|
|
|
+ *
|
|
|
+ * @param addModulInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean saveModuleInfo(AddModuleInfoVO addModulInfoVO) {
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ ModuleInfo moduleInfo = new ModuleInfo();
|
|
|
+ BeanUtil.copyProperties(addModulInfoVO, moduleInfo);
|
|
|
+ moduleInfo.setCreator(userId);
|
|
|
+ moduleInfo.setModifier(userId);
|
|
|
+ moduleInfo.setGmtCreate(now);
|
|
|
+ moduleInfo.setGmtModified(now);
|
|
|
+ moduleInfo.setType(addModulInfoVO.getType());
|
|
|
+ moduleInfo.setModuleType(addModulInfoVO.getModuleType());
|
|
|
+ //当添加为科室专用模板或者慢病模板时添加关联id
|
|
|
+ if(addModulInfoVO.getModuleType().intValue() == 1 || addModulInfoVO.getModuleType().intValue() == 2){
|
|
|
+ moduleInfo.setRelationId(addModulInfoVO.getRelationId());
|
|
|
+ }
|
|
|
+ this.save(moduleInfo);
|
|
|
+ Long moduleId = moduleInfo.getId();
|
|
|
+ return moduleDetailFacade.saveOrUpdateInfos(addModulInfoVO, moduleId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改模板
|
|
|
+ *
|
|
|
+ * @param updateModuleInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean updateModuleInfo(UpdateModuleInfoVO updateModuleInfoVO) {
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ UpdateWrapper<ModuleInfo> moduleInfoUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ moduleInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", updateModuleInfoVO.getId())
|
|
|
+ .set("name", updateModuleInfoVO.getName())
|
|
|
+ .set("type", updateModuleInfoVO.getType())
|
|
|
+ .set("module_type",updateModuleInfoVO.getModuleType())
|
|
|
+ .set("modifier", userId)
|
|
|
+ .set("gmt_modified", DateUtil.now());
|
|
|
+ if(updateModuleInfoVO.getRelationId() != null){
|
|
|
+ moduleInfoUpdateWrapper.set("relation_id", updateModuleInfoVO.getRelationId());
|
|
|
+ }
|
|
|
+ this.update(new ModuleInfo(), moduleInfoUpdateWrapper);
|
|
|
+ AddModuleInfoVO addModuleInfoVO = new AddModuleInfoVO();
|
|
|
+ BeanUtil.copyProperties(updateModuleInfoVO, addModuleInfoVO);
|
|
|
+ return moduleDetailFacade.saveOrUpdateInfos(addModuleInfoVO, updateModuleInfoVO.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取标签池信息
|
|
|
+ *
|
|
|
+ * @param moduleGetQuestionInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GetQuestionInfoDTO> getQuestionInfos(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
|
|
|
+ List<GetQuestionInfoDTO> getQuestionInfoDTOS = new ArrayList<>();
|
|
|
+ GetQuestionInfoDTO getQuestionInfoDTO = new GetQuestionInfoDTO();
|
|
|
+ //如果是辅检,调用aipt-获取概念信息
|
|
|
+ if(moduleGetQuestionInfoVO.getType().intValue() == QuestionTypeEnum.Pacs.getKey()){
|
|
|
+ getQuestionInfoDTOS = new ArrayList<>();
|
|
|
+ ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
|
|
|
+ conceptTypeVO.setType(2);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> conceptBaseDTOS = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
|
|
|
+ RespDTOUtil.respNGDeal(conceptBaseDTOS,"获取辅检标签失败");
|
|
|
+ if(ListUtil.isNotEmpty(moduleGetQuestionInfoVO.getNoIds())){
|
|
|
+ Iterator<ConceptBaseDTO> conceptBaseDTOIterator = conceptBaseDTOS.data.iterator();
|
|
|
+ while (conceptBaseDTOIterator.hasNext()){
|
|
|
+ for (Long notId : moduleGetQuestionInfoVO.getNoIds()) {
|
|
|
+ if(conceptBaseDTOIterator.next().getConceptId().intValue() == notId.intValue()){
|
|
|
+ conceptBaseDTOIterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (ConceptBaseDTO conceptBaseDTO : conceptBaseDTOS.data) {
|
|
|
+ getQuestionInfoDTO = new GetQuestionInfoDTO();
|
|
|
+ getQuestionInfoDTO.setId(conceptBaseDTO.getConceptId());
|
|
|
+ getQuestionInfoDTO.setTagName(conceptBaseDTO.getName());
|
|
|
+ getQuestionInfoDTOS.add(getQuestionInfoDTO);
|
|
|
+ }
|
|
|
+ }else {//返回除辅检以外的questionInfo信息
|
|
|
+ getQuestionInfoDTOS = new ArrayList<>();
|
|
|
+ getQuestionInfoDTOS = questionFacade.moduleGetQuestiongInfoByName(moduleGetQuestionInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return getQuestionInfoDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取子模板
|
|
|
+ *
|
|
|
+ * @param getModuleInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ModuleInfoDTO> getModuleInfo(GetModuleInfoVO getModuleInfoVO) {
|
|
|
+ //获取模板信息
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ if (getModuleInfoVO.getModuleType() != null) {
|
|
|
+ moduleInfoQueryWrapper.eq("module_type", getModuleInfoVO.getModuleType());
|
|
|
+ }
|
|
|
+ if(getModuleInfoVO.getType() != null) {
|
|
|
+ moduleInfoQueryWrapper.eq("type", getModuleInfoVO.getType());
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(getModuleInfoVO.getNoIds())){
|
|
|
+ moduleInfoQueryWrapper.notIn("id", getModuleInfoVO.getNoIds());
|
|
|
+ }
|
|
|
+ if(getModuleInfoVO.getRelationId() != null) {
|
|
|
+ moduleInfoQueryWrapper.eq("relation_id", getModuleInfoVO.getRelationId());
|
|
|
+ }
|
|
|
+ List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
|
|
|
+ List<Long> moduleIdList = moduleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
|
|
+ //获取模板明细信息
|
|
|
+ QueryWrapper<ModuleDetail> moduleDetailQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("module_id", moduleIdList);
|
|
|
+ List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(moduleDetailQueryWrapper);
|
|
|
+ //将模板明细根据模板id放入map
|
|
|
+ Map<Long, List<ModuleDetail>> moduleDetailMap = new HashMap<>();
|
|
|
+ List<ModuleDetail> allModuleDetials = null;
|
|
|
+ for (ModuleInfo moduleInfo : moduleInfoList) {
|
|
|
+ allModuleDetials = new ArrayList<>();
|
|
|
+ for (ModuleDetail moduleDetail : moduleDetailList) {
|
|
|
+ if (moduleInfo.getId().longValue() == moduleDetail.getModuleId().longValue()) {
|
|
|
+ allModuleDetials.add(moduleDetail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ moduleDetailMap.put(moduleInfo.getId(), allModuleDetials);
|
|
|
+ }
|
|
|
+ //给ModuleInfoDTO设值
|
|
|
+ List<ModuleInfoDTO> moduleInfoDTOList = new ArrayList<>();
|
|
|
+ ModuleInfoDTO moduleInfoDTO = null;
|
|
|
+ for (ModuleInfo moduleInfo : moduleInfoList) {
|
|
|
+ moduleInfoDTO = new ModuleInfoDTO();
|
|
|
+ moduleInfoDTO.setId(moduleInfo.getId());
|
|
|
+ moduleInfoDTO.setName(moduleInfo.getName());
|
|
|
+ moduleInfoDTO.setModuleDetails(moduleDetailMap.get(moduleInfoDTO.getId()));
|
|
|
+ moduleInfoDTOList.add(moduleInfoDTO);
|
|
|
+ }
|
|
|
+ return moduleInfoDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模板维护页面获取模板列表
|
|
|
+ *
|
|
|
+ * @param getModuleInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<ModuleInfoListDTO> getModuleInfoList(GetModuleInfoVO getModuleInfoVO) {
|
|
|
+ //获取模板信息
|
|
|
+ IPage<ModuleInfoListDTO> moduleInfoDTOIPage = this.getModuleInfoListByType(getModuleInfoVO);
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ List<Long> deptId = new ArrayList<>();
|
|
|
+ List<Long> disId = new ArrayList<>();
|
|
|
+ for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
|
|
|
+ ids.add(moduleInfoListDTO.getModifier());
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 1){
|
|
|
+ deptId.add(moduleInfoListDTO.getRelationId());
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 2){
|
|
|
+ disId.add(moduleInfoListDTO.getRelationId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取科室名称
|
|
|
+ ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
|
|
|
+ conceptTypeVO.setType(1);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
|
|
|
+ RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
|
|
|
+ Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
|
|
|
+ //获取疾病名称
|
|
|
+ conceptTypeVO = new ConceptTypeVO();
|
|
|
+ conceptTypeVO.setType(3);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> disInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
|
|
|
+ RespDTOUtil.respNGDeal(disInfoList,"获取疾病信息失败");
|
|
|
+ Map<Long, ConceptBaseDTO> disInfoMap = disInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
|
|
|
+ /*QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", disId);
|
|
|
+ List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
+ Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));*/
|
|
|
+ //获取模板类型名称
|
|
|
+ QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("group_type", 4)
|
|
|
+ .eq("return_type", 1)
|
|
|
+ .orderByDesc("order_no");
|
|
|
+ List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
|
|
|
+ Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
|
|
|
+ if(ListUtil.isNotEmpty(moduleInfoDTOIPage.getRecords())){
|
|
|
+ //获取用户信息
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
+ RespDTOUtil.respNGDeal(respDTO,"获取用户信息失败");
|
|
|
+ //将用户信息放入实体
|
|
|
+ for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
|
|
|
+ moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
|
|
|
+ if(dictionaryInfoMap.get(moduleInfoListDTO.getType()) != null ){
|
|
|
+ moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(moduleInfoListDTO.getType()).getName());
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 1){//根据科室
|
|
|
+ if(moduleInfoListDTO.getRelationId().intValue() != -1){//判断是不是科室通用子模板
|
|
|
+ if(null != deptInfoMap.get(moduleInfoListDTO.getRelationId())){
|
|
|
+ moduleInfoListDTO.setRelationName(deptInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ moduleInfoListDTO.setRelationName(ModuleInfoTypeEnum.Common.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 2){//根据疾病
|
|
|
+ if(moduleInfoListDTO.getRelationId().intValue() != -1){//判断是不是疾病通用子模板
|
|
|
+ if(null != disInfoMap.get(moduleInfoListDTO.getRelationId())){
|
|
|
+ moduleInfoListDTO.setRelationName(disInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ moduleInfoListDTO.setRelationName(ModuleInfoTypeEnum.Common.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ moduleInfoListDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(moduleInfoListDTO.getModuleType().intValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return moduleInfoDTOIPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模板维护修改获取已添加标签信息
|
|
|
+ *
|
|
|
+ * @param getModuleDetailInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GetModuleDetailInfoDTO> getModuleDetailInfo(GetModuleDetailInfoVO getModuleDetailInfoVO) {
|
|
|
+ List<GetModuleDetailInfoDTO> getModuleDetailInfoDTOList = new ArrayList<>();
|
|
|
+ GetModuleDetailInfoDTO getModuleDetailInfoDTO = null;
|
|
|
+ //获取模板明细
|
|
|
+ QueryWrapper<ModuleDetail> moduleDetailQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("module_id", getModuleDetailInfoVO.getModuleId())
|
|
|
+ .orderByAsc("order_no");
|
|
|
+ List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(moduleDetailQueryWrapper);
|
|
|
+ List<Long> questionIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getQuestionId()).collect(Collectors.toList());
|
|
|
+ List<Long> moduleIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getRelationModule()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(getModuleDetailInfoVO.getType().intValue() == QuestionTypeEnum.Pacs.getKey()){//如果是辅检,调用knowledgeman获取辅检信息
|
|
|
+ ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
|
|
|
+ conceptTypeVO.setType(2);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> pacsCeptInfo = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
|
|
|
+ Map<Long,ConceptBaseDTO> pacsCeptMap = pacsCeptInfo.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
|
|
|
+ //循环给出参赋值
|
|
|
+ for (ModuleDetail moduleDetail : moduleDetailList) {
|
|
|
+ getModuleDetailInfoDTO = new GetModuleDetailInfoDTO();
|
|
|
+ BeanUtil.copyProperties(moduleDetail, getModuleDetailInfoDTO);
|
|
|
+ getModuleDetailInfoDTO.setTagName(pacsCeptMap.get(moduleDetail.getQuestionId()).getName());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //获取标签信息
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", questionIdList);
|
|
|
+ List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
+ Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId, questionInfo -> questionInfo));
|
|
|
+ //获取模板信息
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", moduleIdList);
|
|
|
+ List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
|
|
|
+ Map<Long, ModuleInfo> moduleInfoMap = moduleInfoList.stream().collect(Collectors.toMap(ModuleInfo::getId, moduleInfo -> moduleInfo));
|
|
|
+ //循环给出参赋值
|
|
|
+ for (ModuleDetail moduleDetail : moduleDetailList) {
|
|
|
+ getModuleDetailInfoDTO = new GetModuleDetailInfoDTO();
|
|
|
+ BeanUtil.copyProperties(moduleDetail, getModuleDetailInfoDTO);
|
|
|
+ if (moduleDetail.getQuestionId() != null) {
|
|
|
+ getModuleDetailInfoDTO.setTagName(questionInfoMap.get(moduleDetail.getQuestionId()).getTagName());
|
|
|
+ getModuleDetailInfoDTO.setTagType(questionInfoMap.get(moduleDetail.getQuestionId()).getTagType());
|
|
|
+ } else {
|
|
|
+ getModuleDetailInfoDTO.setRelationModuleName(moduleInfoMap.get(moduleDetail.getRelationModule()).getName());
|
|
|
+ }
|
|
|
+ getModuleDetailInfoDTOList.add(getModuleDetailInfoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getModuleDetailInfoDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模板维护页面获取模板列表
|
|
|
+ *
|
|
|
+ * @param getModuleInfoOneVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GetModuleInfoOneDTO getModuleInfoOne(GetModuleInfoOneVO getModuleInfoOneVO) {
|
|
|
+ GetModuleInfoOneDTO getModuleInfoOneDTO = new GetModuleInfoOneDTO();
|
|
|
+ List<Long> deptId = new ArrayList<>();
|
|
|
+ List<Long> disId = new ArrayList<>();
|
|
|
+ //获取模板信息
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", getModuleInfoOneVO.getModuleId());
|
|
|
+ ModuleInfo moduleInfo = this.getOne(moduleInfoQueryWrapper);
|
|
|
+ //获取模板类型名称
|
|
|
+ if(moduleInfo.getModuleType().intValue() == 1){
|
|
|
+ deptId.add(moduleInfo.getRelationId());
|
|
|
+ }
|
|
|
+ if(moduleInfo.getModuleType().intValue() == 2){
|
|
|
+ disId.add(moduleInfo.getRelationId());
|
|
|
+ }
|
|
|
+ //获取科室名称
|
|
|
+ ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
|
|
|
+ conceptTypeVO.setType(1);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
|
|
|
+ RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
|
|
|
+ Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
|
|
|
+ //获取疾病名称
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", disId);
|
|
|
+ List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
+ Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
|
|
|
+ //获取模板类型
|
|
|
+ QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("group_type", 4)
|
|
|
+ .eq("return_type", 1)
|
|
|
+ .orderByDesc("order_no");
|
|
|
+ List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
|
|
|
+ Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
|
|
|
+ BeanUtil.copyProperties(moduleInfo, getModuleInfoOneDTO);
|
|
|
+ getModuleInfoOneDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfo.getType())).getName());
|
|
|
+ getModuleInfoOneDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(getModuleInfoOneDTO.getModuleType().intValue()));
|
|
|
+ if(getModuleInfoOneDTO.getModuleType().intValue() == 1){
|
|
|
+ getModuleInfoOneDTO.setRelationName(deptInfoMap.get(getModuleInfoOneDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ if(getModuleInfoOneDTO.getModuleType().intValue() == 2){
|
|
|
+ getModuleInfoOneDTO.setRelationName(questionInfoMap.get(getModuleInfoOneDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ return getModuleInfoOneDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取模板类型(从主诉到诊断)
|
|
|
+ *
|
|
|
+ * @param getModuleTypeVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GetModuleTypeDTO> getModuleType(GetModuleTypeVO getModuleTypeVO){
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("module_Type", getModuleTypeVO.getModuleType());
|
|
|
+ if(getModuleTypeVO.getRelationId() != null){
|
|
|
+ moduleInfoQueryWrapper.eq("relation_id", getModuleTypeVO.getRelationId());
|
|
|
+ }
|
|
|
+ List<ModuleInfo> moduleInfos = this.list(moduleInfoQueryWrapper);
|
|
|
+ List<String> types = moduleInfos.stream().map(moduleInfo -> moduleInfo.getType()).collect(Collectors.toList());
|
|
|
+ //获取模板类型
|
|
|
+ QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("group_type", 4)
|
|
|
+ .eq("return_type", 1)
|
|
|
+ .notIn("val",types)
|
|
|
+ .orderByAsc("order_no");
|
|
|
+ if(getModuleTypeVO.getRelationId() != null && getModuleTypeVO.getRelationId().intValue() == -1){//如果是-1时返回所有子模板
|
|
|
+ dictionaryInfoQueryWrapper.in("val","322","31","32");
|
|
|
+ }
|
|
|
+ if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 2){//为慢病时过滤现病史空模板、主诉模板、现病史空模板子模板
|
|
|
+ dictionaryInfoQueryWrapper.notIn("val","1","22","31","322");
|
|
|
+ }
|
|
|
+ if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 0 || getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 1){//为通用或科室时过滤化验附件诊断
|
|
|
+ dictionaryInfoQueryWrapper.notIn("val","4","5","6","7");
|
|
|
+ }
|
|
|
+ List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
|
|
|
+ List<GetModuleTypeDTO> getModuleTypeDTOS = new ArrayList<>();
|
|
|
+ for (DictionaryInfo dictionaryInfo: dictionaryInfoList) {
|
|
|
+ GetModuleTypeDTO getModuleTypeDTO = new GetModuleTypeDTO();
|
|
|
+ getModuleTypeDTO.setName(dictionaryInfo.getName());
|
|
|
+ getModuleTypeDTO.setType(dictionaryInfo.getVal());
|
|
|
+ getModuleTypeDTOS.add(getModuleTypeDTO);
|
|
|
+ }
|
|
|
+ return getModuleTypeDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有的科室和疾病信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GetAllDeptAndDisInfoDTO getAllDeptAndDisInfo(GetAllDeptAndDisInfoVO getAllDeptAndDisInfoVO){
|
|
|
+ //获取所有科室
|
|
|
+ ConceptTypeVO deptType = new ConceptTypeVO();
|
|
|
+ deptType.setType(1);
|
|
|
+ RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(deptType);
|
|
|
+ RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
|
|
|
+ if(getAllDeptAndDisInfoVO.getModuleType() != null && getAllDeptAndDisInfoVO.getModuleType().intValue() == 1){//过滤添加过得科室
|
|
|
+ List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),getAllDeptAndDisInfoVO.getType());
|
|
|
+ List<Long> deptIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
|
|
|
+ Iterator<ConceptBaseDTO> deptIterator = deptInfoList.data.iterator();
|
|
|
+ for (Long deptId : deptIds) {
|
|
|
+ while (deptIterator.hasNext()){
|
|
|
+ Long deptConceptId = deptIterator.next().getConceptId();
|
|
|
+ if(deptId.intValue() == deptConceptId.intValue()){
|
|
|
+ deptIterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<DeptDTO> deptDTOS = BeanUtil.listCopyTo(deptInfoList.data,DeptDTO.class);
|
|
|
+ GetAllDeptAndDisInfoDTO getAllDeptAndDisInfoDTO = new GetAllDeptAndDisInfoDTO();
|
|
|
+ getAllDeptAndDisInfoDTO.setDeptDTOS(deptDTOS);
|
|
|
+ return getAllDeptAndDisInfoDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取模板信息
|
|
|
+ *
|
|
|
+ * @param moduleType
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ModuleInfo> getModuleInfos(Long moduleType,String type){
|
|
|
+ QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ moduleInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
+ .eq("module_type",moduleType)
|
|
|
+ .eq("type",type);
|
|
|
+ return this.list(moduleInfoQueryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回标签关联模板信息
|
|
|
+ *
|
|
|
+ * @param getQuestiongAndModuleRelationsVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelations(GetQuestiongAndModuleRelationsVO getQuestiongAndModuleRelationsVO){
|
|
|
+ StringBuffer errMsg = new StringBuffer();
|
|
|
+ List<ModuleDetail> moduleDetails = moduleDetailFacade.list(new QueryWrapper<ModuleDetail>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("question_id", getQuestiongAndModuleRelationsVO.getQuestionId()));
|
|
|
+ if (ListUtil.isNotEmpty(moduleDetails)) {
|
|
|
+ List<Long> moduleIds = moduleDetails.stream().map(row -> row.getModuleId()).collect(Collectors.toList());
|
|
|
+ List<String> moduleNames = this.list(new QueryWrapper<ModuleInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", moduleIds))
|
|
|
+ .stream().map(row -> row.getName()).collect(Collectors.toList());
|
|
|
+ for (String mouduleName: moduleNames) {
|
|
|
+ errMsg.append("该标签已关联").append("【" + mouduleName + "】").append("<br/>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuffer titalMsg = new StringBuffer();
|
|
|
+ StringBuffer questionMsg = new StringBuffer();
|
|
|
+ List<QuestionInfo> info = questionFacade.getParentQuestion(getQuestiongAndModuleRelationsVO.getQuestionId());
|
|
|
+ for (QuestionInfo bean : info) {
|
|
|
+ //TODO
|
|
|
+ if (bean.getTagType() != null /*&& bean.getTagType() == TagTypeEnum.T10.getKey()*/) {
|
|
|
+ List<QuestionInfo> info2 = questionFacade.getParentQuestion(bean.getId());
|
|
|
+ List<String> msg = info2.stream().map(row -> "【" + row.getTagName() + "】").collect(Collectors.toList());
|
|
|
+ questionMsg.append(String.join("", msg));
|
|
|
+ } else {
|
|
|
+ questionMsg.append("【"+bean.getTagName()+"】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ titalMsg.append("该标签已关联父级:").append(questionMsg).append("<br/>").append(errMsg);
|
|
|
+ GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelationsDTO = new GetQuestiongAndModuleRelationsDTO();
|
|
|
+ getQuestiongAndModuleRelationsDTO.setRelationInfos(titalMsg.append("是否删除?"));
|
|
|
+ return getQuestiongAndModuleRelationsDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|