|
@@ -48,9 +48,11 @@ import com.diagbot.service.LibraryInfoService;
|
|
|
import com.diagbot.service.impl.ConceptServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.IntegerUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.ParamConvertUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddConceptInfoDetailVO;
|
|
@@ -162,14 +164,11 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
|
|
|
- IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
|
|
|
+ IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
|
|
|
if (ipage.getRecords().size() > 0) {
|
|
|
List<String> ids = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
|
|
|
RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
- if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
- "获取用户信息失败");
|
|
|
- }
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
|
ipage.getRecords().forEach(i -> {
|
|
|
i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
});
|
|
@@ -262,27 +261,27 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
* @return libName-标准术语,otherNames-同义词
|
|
|
*/
|
|
|
public GetConceptInfoDTO getConceptInfoDetail(GetConceptInfoDetailVO getConceptInfoDetailVO) {
|
|
|
- GetConceptInfoDTO getConceptInfoDTO = new GetConceptInfoDTO();
|
|
|
-
|
|
|
+ GetConceptInfoDTO getConceptInfoDTO = new GetConceptInfoDTO();
|
|
|
+
|
|
|
QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
libraryInfoQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
|
|
|
List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
|
|
|
-
|
|
|
+
|
|
|
getConceptInfoDTO.setLibName(BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() != null && i.getIsConcept() == 1).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
getConceptInfoDTO.setOtherNames(BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() == null || i.getIsConcept() == 0).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
|
|
|
|
|
|
Integer isHasCommon = lexiconFacade.getById(libraryInfoList.get(0).getTypeId()).getIsHasCommon();
|
|
|
- if(isHasCommon==1){
|
|
|
- QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
|
|
|
+ if (isHasCommon == 1) {
|
|
|
+ QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
|
|
|
conceptCommonQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
|
|
|
ConceptCommon conceptCommon = conceptCommonFacade.getOne(conceptCommonQe);
|
|
|
- if(conceptCommon!=null){
|
|
|
- getConceptInfoDTO.setSexType(conceptCommon.getSexType());
|
|
|
- getConceptInfoDTO.setMinAge(conceptCommon.getMinAge());
|
|
|
- getConceptInfoDTO.setMaxAge(conceptCommon.getMaxAge());
|
|
|
+ if (conceptCommon != null) {
|
|
|
+ getConceptInfoDTO.setSexType(conceptCommon.getSexType());
|
|
|
+ getConceptInfoDTO.setMinAge(conceptCommon.getMinAge());
|
|
|
+ getConceptInfoDTO.setMaxAge(conceptCommon.getMaxAge());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return getConceptInfoDTO;
|
|
|
}
|
|
|
|
|
@@ -430,17 +429,17 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
concept.setGmtModified(now);
|
|
|
concept.setModifier(currentUser);
|
|
|
updateById(concept);
|
|
|
-
|
|
|
- if(lexicon.getIsHasCommon()==1){
|
|
|
- QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
|
|
|
+
|
|
|
+ if (lexicon.getIsHasCommon() == 1) {
|
|
|
+ QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
|
|
|
conceptCommonQe.eq("concept_id", conceptId);
|
|
|
ConceptCommon conceptCommon = conceptCommonFacade.getOne(conceptCommonQe);
|
|
|
- if(conceptCommon==null){
|
|
|
- conceptCommon = new ConceptCommon();
|
|
|
+ if (conceptCommon == null) {
|
|
|
+ conceptCommon = new ConceptCommon();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
BeanUtil.copyProperties(addConceptInfoVO, conceptCommon);
|
|
|
-
|
|
|
+
|
|
|
conceptCommonFacade.saveOrUpdate(conceptCommon);
|
|
|
}
|
|
|
|
|
@@ -683,8 +682,8 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
* @return 术语列表
|
|
|
*/
|
|
|
public List<ConceptBaseDTO> getConceptListByType(ConceptTypeVO conceptTypeVO) {
|
|
|
- if(null == conceptTypeVO
|
|
|
- || IntegerUtil.isNull(conceptTypeVO.getType())){
|
|
|
+ if (null == conceptTypeVO
|
|
|
+ || IntegerUtil.isNull(conceptTypeVO.getType())) {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "类型不能为空");
|
|
|
}
|
|
|
List<ConceptBaseDTO> res = ListUtil.newArrayList();
|
|
@@ -752,65 +751,71 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据名称和类型获取概念列表Map
|
|
|
+ *
|
|
|
+ * @param conceptExistVO 搜索参数
|
|
|
+ * @return 术语id和术语 Map
|
|
|
+ */
|
|
|
+ public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO) {
|
|
|
+ // 入参验证
|
|
|
+ if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (conceptExistVO.getType() != null) {
|
|
|
+ Integer libType = ParamConvertUtil.conceptConvert2Lib(conceptExistVO.getType());
|
|
|
+ if (libType == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
|
|
|
+ }
|
|
|
+ conceptExistVO.setLibType(libType);
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 根据名称和类型获取概念列表Map
|
|
|
- *
|
|
|
- * @param conceptExistVO 搜索参数
|
|
|
- * @return 术语id和术语 Map
|
|
|
- */
|
|
|
- public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO) {
|
|
|
- //入参验证
|
|
|
- if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- if (conceptExistVO.getType() == null) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "类型不能为空");
|
|
|
- }
|
|
|
- Integer libType = ParamConvertUtil.conceptConvert2Lib(conceptExistVO.getType());
|
|
|
- if(libType == null) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
|
|
|
- }
|
|
|
- conceptExistVO.setLibType(libType);
|
|
|
- //获取结构
|
|
|
- List<Concept> concepts
|
|
|
- = this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
|
|
|
-
|
|
|
- //出参封装
|
|
|
- Map<String, Long> map = new HashMap<>();
|
|
|
- if (ListUtil.isNotEmpty(concepts)) {
|
|
|
- map = concepts.stream().collect(Collectors.toMap(r -> r.getLibName(), r -> r.getId()));
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据名称和词性获取概念列表
|
|
|
- *
|
|
|
- * @param nameList
|
|
|
- * @param libType
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<Concept> getListByNamesAndType(List<String> nameList, Integer libType) {
|
|
|
- QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("lib_name", nameList)
|
|
|
- .eq("lib_type", libType);
|
|
|
- List<Concept> list = this.list(conceptQueryWrapper);
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
|
|
|
- // 类型转换
|
|
|
- Integer libType = ParamConvertUtil.conceptConvert2Lib(indexVO.getType());
|
|
|
- if(libType == null) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
|
|
|
- }
|
|
|
- indexVO.setLibType(libType);
|
|
|
- return this.index(indexVO);
|
|
|
- }
|
|
|
+ //获取结构
|
|
|
+ List<Concept> concepts
|
|
|
+ = this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
|
|
|
+ Map<String, List<Concept>> map1 = EntityUtil.makeEntityListMap(concepts, "libName");
|
|
|
+ Map<String, List<Integer>> typeMap = new HashMap<>();
|
|
|
+ for(String key : map1.keySet()) {
|
|
|
+ List<Concept> list = map1.get(key);
|
|
|
+ List<Integer> typeList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ for (Concept c : list) {
|
|
|
+ typeList.add(ParamConvertUtil.libConvert2Concept(c.getLibType().intValue()));
|
|
|
+ }
|
|
|
+ typeMap.put(key, typeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return typeMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据名称和词性获取概念列表
|
|
|
+ *
|
|
|
+ * @param nameList
|
|
|
+ * @param libType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Concept> getListByNamesAndType(List<String> nameList, Integer libType) {
|
|
|
+ QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
|
|
|
+ conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("lib_name", nameList);
|
|
|
+ if (libType != null) {
|
|
|
+ conceptQueryWrapper.eq("lib_type", libType);
|
|
|
+ }
|
|
|
+ List<Concept> list = this.list(conceptQueryWrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
|
|
|
+ // 类型转换
|
|
|
+ Integer libType = ParamConvertUtil.conceptConvert2Lib(indexVO.getType());
|
|
|
+ if (libType == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
|
|
|
+ }
|
|
|
+ indexVO.setLibType(libType);
|
|
|
+ return this.index(indexVO);
|
|
|
+ }
|
|
|
}
|