Quellcode durchsuchen

Merge branch 'master' into 122run

gaodm vor 3 Jahren
Ursprung
Commit
0561d6f0ee

+ 15 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDiseaseDTO.java

@@ -29,6 +29,21 @@ public class KlDiseaseDTO implements Serializable {
      */
     private String icd10Code;
 
+    /**
+     * 国临名称
+     */
+    private String guoname;
+
+    /**
+     * 国临编码
+     */
+    private String guocode;
+
+    /**
+     * 国临拼音
+     */
+    private String guospell;
+
     /**
      * 病程
      */

+ 12 - 0
cdssman-service/src/main/java/com/diagbot/dto/StaticKnowledgeIndexDTO.java

@@ -19,6 +19,18 @@ public class StaticKnowledgeIndexDTO {
      * 术语名称
      */
     private String name;
+    /**
+     * 编码
+     */
+    private String code;
+    /**
+     * 国临版编码
+     */
+    private String guocode;
+    /**
+     * 国临版名称
+     */
+    private String guoname;
     /**
      * 词性
      */

+ 20 - 5
cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java

@@ -13,7 +13,7 @@ import java.util.Date;
  * </p>
  *
  * @author zhoutg
- * @since 2021-05-11
+ * @since 2022-03-03
  */
 @Data
 public class KlDisease implements Serializable {
@@ -66,6 +66,21 @@ public class KlDisease implements Serializable {
      */
     private String icd10Code;
 
+    /**
+     * 国临名称
+     */
+    private String guoname;
+
+    /**
+     * 国临编码
+     */
+    private String guocode;
+
+    /**
+     * 国临拼音
+     */
+    private String guospell;
+
     /**
      * 病程
      */
@@ -167,14 +182,14 @@ public class KlDisease implements Serializable {
     private String enName;
 
     /**
-     * 肿瘤细胞类型
+     * 形态学分类代码
      */
-    private String tumorCellType;
+    private String morphology;
 
     /**
-     * 形态学分类代码
+     * 肿瘤细胞类型
      */
-    private String morphology;
+    private String tumorCellType;
 
     /**
      * 备注

+ 0 - 427
cdssman-service/src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -1,46 +1,15 @@
 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.CdssCoreClient;
-import com.diagbot.dto.ConceptDetailDTO;
-import com.diagbot.dto.ConceptInfoDTO;
-import com.diagbot.dto.DictionaryInfoDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.entity.ConceptDetail;
 import com.diagbot.entity.ConceptInfo;
 import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.enums.StatusEnum;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
-import com.diagbot.service.ConceptDetailService;
 import com.diagbot.service.impl.ConceptInfoServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.EntityUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.RespDTOUtil;
-import com.diagbot.util.StringUtil;
-import com.diagbot.util.UserUtils;
-import com.diagbot.vo.ChangeStatusVO;
-import com.diagbot.vo.ConceptDetailVO;
-import com.diagbot.vo.ConceptInfoPageVO;
-import com.diagbot.vo.ConceptInfoVO;
-import com.diagbot.vo.HasStaticKnowledgeVO;
-import com.diagbot.vo.IdVO;
-import com.diagbot.vo.StaticKnowledgeIndexVO;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -50,15 +19,8 @@ import java.util.stream.Collectors;
  */
 @Component
 public class ConceptInfoFacade extends ConceptInfoServiceImpl {
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-    @Autowired
-    private DictionaryFacade dictionaryFacade;
     @Autowired
     private ConceptDetailFacade conceptDetailFacade;
-    @Autowired
-    @Qualifier("conceptDetailServiceImpl")
-    private ConceptDetailService conceptDetailService;
 
     /**
      * 获取全静态知识
@@ -84,393 +46,4 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         });
         return infoList;
     }
-
-    /**
-     * 返回不带静态知识的检索结果
-     *
-     * @param staticKnowledgeIndexVO
-     * @return
-     */
-    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndexWithoutInfo(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
-        staticKnowledgeIndexVO.setHasInfo(0);
-        List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = staticKnowledgeIndex(staticKnowledgeIndexVO);
-        //过滤没有静态知识的检索结果
-        staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList
-                .stream()
-                .filter(i -> i.getHasInfo().equals(0))
-                .collect(Collectors.toList());
-        return staticKnowledgeIndexDTOList;
-    }
-
-    /**
-     * 医学知识(静态信息)检索
-     *
-     * @param staticKnowledgeIndexVO
-     * @return
-     */
-    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
-        List<StaticKnowledgeIndexDTO> retList = Lists.newLinkedList();
-        //静态知识检索顺序
-        List<DictionaryInfoDTO> dicStaticIndexList = dictionaryFacade.getListByGroupType(7);
-        //页面术语类型和图谱映射
-        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(8);
-        //静态知识类型
-        List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
-
-        List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = Lists.newLinkedList();
-        RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
-        RespDTOUtil.respNGDealCover(respDTO, "检索失败");
-        staticKnowledgeIndexDTOList = respDTO.data;
-        if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)) {
-            //typeName转换
-            staticKnowledgeIndexDTOList.forEach(item -> {
-                item.setTypeName(convertTypeName(item.getTypeName(), 2, dicTypeMappingList));
-            });
-            if (staticKnowledgeIndexVO.getHasInfo().equals(1)) {
-                //是否有静态知识
-                List<String> conNameList = staticKnowledgeIndexDTOList
-                        .stream()
-                        .map(i -> i.getName())
-                        .collect(Collectors.toList());
-                QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
-                conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .in("name", conNameList)
-                        .eq("status", StatusEnum.Enable.getKey());
-                List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
-                if (ListUtil.isNotEmpty(conceptInfoList)) {
-                    //typeName转换
-                    conceptInfoList.forEach(item -> {
-                        item.setType(convertTypeName(item.getType(), 2, dicTypeMappingList));
-                    });
-                    Map<String, ConceptInfo> infoMap
-                            = EntityUtil.makeEntityMapByKeys(conceptInfoList, "_", "name", "type");
-                    for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
-                        if (infoMap.containsKey(item.getName() + "_" + item.getTypeName())) {
-                            item.setId(infoMap.get(item.getName() + "_" + item.getTypeName()).getId());
-                        }
-                    }
-                    List<Long> conceptIdList = conceptInfoList.stream()
-                            .map(i -> i.getId())
-                            .collect(Collectors.toList());
-                    if (ListUtil.isNotEmpty(conceptIdList)) {
-                        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-                        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
-                        conceptDetailQueryWrapper.in("concept_id", conceptIdList);
-                        List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
-                        Map<Long, List<ConceptDetail>> detailMap
-                                = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
-                        for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
-                            if (item.getId() == null
-                                    || !detailMap.containsKey(item.getId())) {
-                                item.setHasInfo(0);
-                                item.setHasStaticKnowledge(0);
-                                item.setHasClinicalPathway(0);
-                                item.setHasNotice((0));
-                                item.setHasTreatInfo(0);
-                                continue;
-                            }
-                            for (ConceptDetail detail : detailMap.get(item.getId())) {
-                                item.setHasInfo(1);
-                                List<String> contentTypeList = Arrays.asList(detail.getContentType().split(","));
-                                if (contentTypeList.contains("1")) {
-                                    item.setHasStaticKnowledge(1);
-                                }
-                                if (contentTypeList.contains("2")) {
-                                    item.setHasNotice(1);
-                                }
-                                if (contentTypeList.contains("3")) {
-                                    item.setHasClinicalPathway(1);
-                                }
-                                if (contentTypeList.contains("4")) {
-                                    item.setHasTreatInfo(1);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-            //排序
-            Map<String, List<StaticKnowledgeIndexDTO>> map
-                    = EntityUtil.makeEntityListMap(staticKnowledgeIndexDTOList, "typeName");
-            Map<Integer, String> staticTypeDicMap =
-                    EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-            for (DictionaryInfoDTO dic : dicStaticIndexList) {
-                if (dic.getName().equals("检验")) {
-                    //3-检验套餐、4-检验细项
-                    if (map.containsKey(staticTypeDicMap.get("3"))) {
-                        retList.addAll(map.get(staticTypeDicMap.get("3")));
-                    }
-                    if (map.containsKey(staticTypeDicMap.get("4"))) {
-                        retList.addAll(map.get(staticTypeDicMap.get("4")));
-                    }
-                } else if (dic.getName().equals("检查")) {
-                    //5-检查、6-检查子项
-                    if (map.containsKey(staticTypeDicMap.get("5"))) {
-                        retList.addAll(map.get(staticTypeDicMap.get("5")));
-                    }
-                    if (map.containsKey(staticTypeDicMap.get("6"))) {
-                        retList.addAll(map.get(staticTypeDicMap.get("6")));
-                    }
-                } else if (map.containsKey(dic.getName())) {
-                    retList.addAll(map.get(dic.getName()));
-                }
-            }
-        }
-        return retList;
-    }
-
-    /**
-     * 页面术语类型和图谱标签名称相互转换
-     *
-     * @param typeName
-     * @param flag     1-页面术语类型转图谱标签名称,2- 图谱标签名称转页面术语类型
-     * @param dicList
-     * @return
-     */
-    public String convertTypeName(String typeName, Integer flag, List<DictionaryInfoDTO> dicList) {
-        if (ListUtil.isNotEmpty(dicList)) {
-            Map<String, String> nameValMap = new HashMap<>();
-            if (flag.equals(1)) {
-                nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "name", "val");
-            } else if (flag.equals(2)) {
-                nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "val", "name");
-            }
-            if (nameValMap.containsKey(typeName)) {
-                return nameValMap.get(typeName);
-            }
-        }
-        return typeName;
-    }
-
-    /**
-     * 列表
-     *
-     * @param conceptInfoPageVO
-     * @return
-     */
-    public IPage<ConceptInfoDTO> getPage(ConceptInfoPageVO conceptInfoPageVO) {
-        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
-        //静态知识类型
-        List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
-        Map<Integer, String> dicStaticTypeValNameMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
-        if (StringUtil.isNotBlank(conceptInfoPageVO.getType())) {
-            String typeName
-                    = convertTypeName(dicStaticTypeValNameMap.get(conceptInfoPageVO.getType()), 1, dicList);
-            conceptInfoPageVO.setTypeName(typeName);
-        }
-        IPage<ConceptInfoDTO> page = super.getPage(conceptInfoPageVO);
-        List<ConceptInfoDTO> records = page.getRecords();
-        if (ListUtil.isNotEmpty(records)) {
-            records.forEach(record -> {
-                String typeName = convertTypeName(record.getType(), 2, dicList);
-                record.setTypeName(typeName);
-                record.setType(String.valueOf(dicStaticTypeNameValMap.get(typeName)));
-            });
-        }
-        page.setRecords(records);
-        return page;
-    }
-
-    /**
-     * 保存记录(新增or修改)
-     *
-     * @param conceptInfoVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(ConceptInfoVO conceptInfoVO) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
-        //静态知识类型
-        List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
-        Map<Integer, String> dicStaticTypeValNameMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
-        //术语类型转换
-        String typeName = convertTypeName(dicStaticTypeValNameMap.get(conceptInfoVO.getType()), 1, dicList);
-        conceptInfoVO.setTypeName(typeName);
-        ConceptInfo conceptInfo = new ConceptInfo();
-
-        if (conceptInfoVO.getId() != null) {
-            conceptInfo = this.getById(conceptInfoVO.getId());
-            if (conceptInfo != null
-                    && !conceptInfo.getName().equals(conceptInfoVO.getName())) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语名称不允许修改");
-            }
-        } else {
-            QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
-            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("name", conceptInfoVO.getName())
-                    .eq("type", typeName);
-            conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
-            //术语不存在,保存术语信息
-            if (conceptInfo == null) {
-                conceptInfo = new ConceptInfo();
-                conceptInfo.setCreator(userId);
-                conceptInfo.setGmtCreate(now);
-            }
-        }
-        conceptInfo.setName(conceptInfoVO.getName());
-        conceptInfo.setClinicalPathwayName(conceptInfoVO.getClinicalPathwayName());
-        conceptInfo.setNoticeName(conceptInfoVO.getNoticeName());
-        conceptInfo.setType(typeName);
-        conceptInfo.setModifier(userId);
-        conceptInfo.setGmtModified(now);
-
-        //是否包含静态信息
-        List<ConceptDetail> oldDetails = null;
-        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-        if (conceptInfo.getId() != null) {
-            conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
-            conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
-            oldDetails = conceptDetailFacade.list(conceptDetailQueryWrapper);
-        }
-        if (conceptInfoVO.getId() == null
-                && ListUtil.isNotEmpty(oldDetails)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "静态信息已添加,不允许重复添加");
-        }
-        if (ListUtil.isEmpty(oldDetails)
-                && ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
-            //TODO 更新图谱是否有静态信息
-            HasStaticKnowledgeVO hasStaticKnowledgeVO = new HasStaticKnowledgeVO();
-            hasStaticKnowledgeVO.setName(conceptInfoVO.getName());
-            hasStaticKnowledgeVO.setType(typeName);
-            hasStaticKnowledgeVO.setHasInfo(1);
-            RespDTO<Boolean> respDTO = cdssCoreClient.updateHasInfoStatus(hasStaticKnowledgeVO);
-            //更新失败
-            if (RespDTOUtil.respIsNG(respDTO)) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "图谱更新静态知识状态失败");
-            }
-        }
-
-        //删除已有静态信息
-        if (conceptInfo.getId() != null) {
-            conceptDetailFacade.remove(conceptDetailQueryWrapper);
-        }
-
-        //更新术语信息
-        this.saveOrUpdate(conceptInfo);
-
-        //插入新的静态信息
-        List<ConceptDetail> conceptDetailList = Lists.newLinkedList();
-        if (ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
-            for (ConceptDetailVO detailVO : conceptInfoVO.getDetails()) {
-                ConceptDetail conceptDetail = new ConceptDetail();
-                BeanUtil.copyProperties(detailVO, conceptDetail);
-                conceptDetail.setConceptId(conceptInfo.getId());
-                conceptDetail.setCreator(userId);
-                conceptDetail.setGmtCreate(now);
-                conceptDetail.setModifier(userId);
-                conceptDetail.setGmtModified(now);
-                conceptDetailList.add(conceptDetail);
-            }
-            conceptDetailService.saveBatch(conceptDetailList);
-        }
-        return true;
-    }
-
-    /**
-     * 启用禁用
-     *
-     * @param changeStatusVO
-     * @return
-     */
-    public Boolean changeStatus(ChangeStatusVO changeStatusVO) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        //更新主表
-        UpdateWrapper<ConceptInfo> conceptInfoUpdateWrapper = new UpdateWrapper<>();
-        conceptInfoUpdateWrapper.eq("id", changeStatusVO.getId())
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .set("gmt_modified", now)
-                .set("modifier", userId)
-                .set("status", changeStatusVO.getStatus());
-        this.update(conceptInfoUpdateWrapper);
-        //更新明细表
-        UpdateWrapper<ConceptDetail> conceptDetailUpdateWrapper = new UpdateWrapper<>();
-        conceptDetailUpdateWrapper.eq("concept_id", changeStatusVO.getId())
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .set("gmt_modified", now)
-                .set("modifier", userId);
-        conceptDetailService.update(conceptDetailUpdateWrapper);
-        return true;
-    }
-
-    /**
-     * 是否已存在
-     *
-     * @param conceptInfoVO
-     * @return
-     */
-    public Boolean isExist(ConceptInfoVO conceptInfoVO) {
-        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
-        //静态知识类型
-        List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
-        Map<Integer, String> dicStaticTypeValNameMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
-        //术语类型转换
-        String typeName = convertTypeName(dicStaticTypeValNameMap.get(Integer.valueOf(conceptInfoVO.getType())), 1, dicList);
-        conceptInfoVO.setTypeName(typeName);
-        QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
-        conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("name", conceptInfoVO.getName())
-                .eq("type", typeName);
-        ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
-        if (conceptInfo == null) {
-            return false;
-        }
-        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-        conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId())
-                .eq("is_deleted", IsDeleteEnum.N.getKey());
-        List<ConceptDetail> conceptDetailList = conceptDetailService.list(conceptDetailQueryWrapper);
-        if (ListUtil.isEmpty(conceptDetailList)) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 根据术语id获取静态信息
-     *
-     * @param idVO
-     * @return
-     */
-    public ConceptInfoDTO getRecordById(IdVO idVO) {
-        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
-        //静态知识类型
-        List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
-        Map<Integer, String> dicStaticTypeValNameMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
-        ConceptInfoDTO conceptInfoDTO = new ConceptInfoDTO();
-        ConceptInfo conceptInfo = this.getById(idVO.getId());
-        if (conceptInfo == null) {
-            return null;
-        }
-        BeanUtil.copyProperties(conceptInfo, conceptInfoDTO);
-        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("concept_id", idVO.getId())
-                .orderByAsc("order_no");
-        List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
-        if (ListUtil.isNotEmpty(conceptDetailList)) {
-            List<ConceptDetailDTO> details = BeanUtil.listCopyTo(conceptDetailList, ConceptDetailDTO.class);
-            conceptInfoDTO.setDetails(details);
-            //启用状态、修改人、修改时间为明细的内容
-            String typeName = convertTypeName(conceptInfoDTO.getType(), 2, dicList);
-            conceptInfoDTO.setTypeName(typeName);
-            conceptInfoDTO.setType(String.valueOf(dicStaticTypeNameValMap.get(typeName)));
-            conceptInfoDTO.setModifier(conceptDetailList.get(0).getModifier());
-            conceptInfoDTO.setGmtModified(conceptDetailList.get(0).getGmtModified());
-        }
-        return conceptInfoDTO;
-    }
 }

+ 29 - 0
cdssman-service/src/main/java/com/diagbot/facade/TermImportFacade.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.ExportConceptAllDTO;
 import com.diagbot.dto.ExportConceptModeDTO;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConceptCommon;
+import com.diagbot.entity.KlDisease;
 import com.diagbot.entity.KlLexicon;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.enums.IsDeleteEnum;
@@ -298,6 +299,7 @@ public class TermImportFacade {
             }
         }
         res = klLibraryInfoService.saveBatch(libraryInfosSub);
+        List<Long> conceptIds = new ArrayList<>();
         //年龄
         List<KlConceptCommon> conceptCommonList = new ArrayList<>();
         for (Map.Entry<String, ImportConceptAllVO> entry : conceptListMap.entrySet()) {
@@ -315,14 +317,41 @@ public class TermImportFacade {
                     conceptCommon.setGmtCreate(now);
                     conceptCommon.setGmtModified(now);
                     conceptCommonList.add(conceptCommon);
+                    conceptIds.add(klConcept.getId());
                 }
             }
 
 
         }
         res = klConceptCommonService.saveBatch(conceptCommonList);
+        //疾病表
+        if (ListUtil.isNotEmpty(conceptIds)) {
+            QueryWrapper<KlDisease> klDisease = new QueryWrapper<>();
+            klDisease.lambda().eq(KlDisease::getIsDeleted, IsDeleteEnum.N.getKey())
+                    .in(KlDisease::getConceptId, conceptIds);
+            List<KlDisease> list = klDiseaseFacade.list(klDisease);
+            List<Long> diseaseConceptId = list.stream().map(ac -> ac.getConceptId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(diseaseConceptId)) {
+                conceptIds.retainAll(diseaseConceptId);
+            }
+            List<KlDisease> klDiseaseData = new ArrayList<>();
+            for (Long id : conceptIds) {
+                KlDisease data = new KlDisease();
+                data.setConceptId(id);
+                data.setCreator(UserUtils.getCurrentPrincipleID());
+                data.setModifier(UserUtils.getCurrentPrincipleID());
+                data.setGmtCreate(now);
+                data.setGmtModified(now);
+                klDiseaseData.add(data);
+            }
+
+            res = klDiseaseService.saveBatch(klDiseaseData);
+        }
+
+
     }
 
+
     public void exportTemplateAll(HttpServletResponse response) {
         //类型数据
         QueryWrapper<KlLexicon> klLexiconQuer = new QueryWrapper<>();

+ 15 - 0
cdssman-service/src/main/java/com/diagbot/vo/KlDiseaseVO.java

@@ -25,6 +25,21 @@ public class KlDiseaseVO implements Serializable {
      */
     private String icd10Code;
 
+    /**
+     * 国临名称
+     */
+    private String guoname;
+
+    /**
+     * 国临编码
+     */
+    private String guocode;
+
+    /**
+     * 国临拼音
+     */
+    private String guospell;
+
     /**
      * 病程
      */

+ 3 - 0
cdssman-service/src/main/java/com/diagbot/web/KlConceptController.java

@@ -72,6 +72,9 @@ public class KlConceptController {
                     "<br>" +
                     "【klDiseaseVO:疾病扩展信息】\n" +
                     "icd10Code:ICD10编号\n" +
+                    "guoname:国临名称\n" +
+                    "guocode:国临编码\n" +
+                    "guospell:国临拼音\n" +
                     "course:病程\n" +
                     "inducement:诱因\n" +
                     "foodProhibition:饮食禁忌\n" +

+ 3 - 0
cdssman-service/src/main/resources/mapper/KlDiseaseMapper.xml

@@ -13,6 +13,9 @@
         <result column="concept_id" property="conceptId" />
         <result column="dept_id" property="deptId" />
         <result column="icd10_code" property="icd10Code" />
+        <result column="guoname" property="guoname" />
+        <result column="guocode" property="guocode" />
+        <result column="guospell" property="guospell" />
         <result column="course" property="course" />
         <result column="inducement" property="inducement" />
         <result column="food_prohibition" property="foodProhibition" />

+ 2 - 2
cdssman-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -49,14 +49,14 @@ public class CodeGeneration {
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
         dsc.setPassword("lantone");
-        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
         mpg.setDataSource(dsc);
 
         // 策略配置
         StrategyConfig strategy = new StrategyConfig();
         //strategy.setTablePrefix(new String[] { "test" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "tran_hospital_relation"}); // 需要生成的表
+        strategy.setInclude(new String[] { "kl_disease"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);

+ 10 - 4
common/pom.xml

@@ -107,11 +107,17 @@
             <scope>compile</scope>
         </dependency>
 
+<!--        <dependency>-->
+<!--            <groupId>com.belerweb</groupId>-->
+<!--            <artifactId>pinyin4j</artifactId>-->
+<!--            <version>2.5.1</version>-->
+<!--            <scope>compile</scope>-->
+<!--        </dependency>-->
+
         <dependency>
-            <groupId>com.belerweb</groupId>
-            <artifactId>pinyin4j</artifactId>
-            <version>2.5.1</version>
-            <scope>compile</scope>
+            <groupId>com.github.promeg</groupId>
+            <artifactId>tinypinyin</artifactId>
+            <version>2.0.3</version>
         </dependency>
 
         <dependency>

+ 60 - 37
common/src/main/java/com/diagbot/util/Cn2SpellUtil.java

@@ -1,9 +1,10 @@
 package com.diagbot.util;
 
-import net.sourceforge.pinyin4j.PinyinHelper;
-import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
-import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
-import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
+import com.github.promeg.pinyinhelper.Pinyin;
+import com.github.promeg.pinyinhelper.PinyinMapDict;
+
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @Description: 汉字转拼音
@@ -12,6 +13,31 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
  */
 public class Cn2SpellUtil {
 
+    private Cn2SpellUtil() {
+
+    }
+
+    //调用类时自动加载字典
+    static{
+        init();
+    }
+
+    //字典设置
+    public static void init() {
+        Pinyin.init(Pinyin.newConfig()
+                .with(new PinyinMapDict() {
+                    @Override
+                    public Map<String, String[]> mapping() {
+                        HashMap<String, String[]> map = new HashMap<String, String[]>();
+                        map.put("", new String[] { "HE" });
+                        map.put("𬌗", new String[] { "HE" });
+                        map.put("", new String[] { "MU" });
+                        map.put("𧿹", new String[] { "MU" });
+                        return map;
+                    }
+                }));
+    }
+
     /**
      * 汉字转换位汉语拼音首字母,英文字符不变
      *
@@ -20,20 +46,15 @@ public class Cn2SpellUtil {
      */
     public static String converterToFirstSpell(String chines) {
         String pinyinName = "";
-        char[] nameChar = chines.toCharArray();
-        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
-        defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
-        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
-        for (int i = 0; i < nameChar.length; i++) {
-            if (nameChar[i] > 128) {
-                try {
-                    pinyinName +=
-                            PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0].charAt(0);
-                } catch (Exception e) {
-                    e.printStackTrace();
+        String pinyinRes = Pinyin.toPinyin(chines, "*××*");
+        if (StringUtil.isNotBlank(pinyinRes)){
+            String[] nameChar = pinyinRes.split("\\*××\\*");
+            for (int i = 0; i < nameChar.length; i++) {
+                if (StringUtil.isNotBlank(nameChar[i])) {
+                    pinyinName += nameChar[i].charAt(0);
+                } else {
+                    pinyinName += nameChar[i];
                 }
-            } else {
-                pinyinName += nameChar[i];
             }
         }
         return pinyinName;
@@ -46,7 +67,7 @@ public class Cn2SpellUtil {
      * @return 拼音(大写)
      */
     public static String converterToSpell(String chines) {
-        return converterToSpellByCaseType(chines, HanyuPinyinCaseType.UPPERCASE);
+        return converterToSpellByCaseType(chines, 1);
     }
 
     /**
@@ -56,7 +77,7 @@ public class Cn2SpellUtil {
      * @return 拼音(小写)
      */
     public static String converterToSpellLow(String chines) {
-        return converterToSpellByCaseType(chines, HanyuPinyinCaseType.LOWERCASE);
+        return converterToSpellByCaseType(chines, 2);
     }
 
     /**
@@ -65,29 +86,31 @@ public class Cn2SpellUtil {
      * @param chines 汉字
      * @return 拼音
      */
-    private static String converterToSpellByCaseType(String chines, HanyuPinyinCaseType caseType) {
+    private static String converterToSpellByCaseType(String chines, Integer caseType) {
         String pinyinName = "";
-        char[] nameChar = chines.toCharArray();
-        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
-        defaultFormat.setCaseType(caseType);
-        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
-        for (int i = 0; i < nameChar.length; i++) {
-            if (nameChar[i] > 128) {
-                try {
-                    pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0];
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            } else {
-                pinyinName += nameChar[i];
-            }
+        if (caseType.equals(2)) {
+            pinyinName = Pinyin.toPinyin(chines, "").toLowerCase();
+        } else {
+            pinyinName = Pinyin.toPinyin(chines, "");
         }
         return pinyinName;
     }
 
     public static void main(String[] args) {
-        System.out.println(converterToFirstSpell("欢迎来到Java世界"));
-        System.out.println(converterToSpell("欢迎来到Java世界"));
-        System.out.println(converterToSpellLow("欢迎来到Java世界"));
+        System.out.println("================首字母================");
+        System.out.println(Cn2SpellUtil.converterToFirstSpell("欢迎来到Java世界"));
+        System.out.println(Cn2SpellUtil.converterToFirstSpell("11β-羟化酶缺陷症#11-羟化酶缺陷"));
+        System.out.println(Cn2SpellUtil.converterToFirstSpell("-"));
+        System.out.println(Cn2SpellUtil.converterToFirstSpell("𬌗-𧿹"));
+        System.out.println("================大写全拼================");
+        System.out.println(Cn2SpellUtil.converterToSpell("欢迎来到Java世界"));
+        System.out.println(Cn2SpellUtil.converterToSpell("11β-羟化酶缺陷症#11-羟化酶缺陷"));
+        System.out.println(Cn2SpellUtil.converterToSpell("-"));
+        System.out.println(Cn2SpellUtil.converterToSpell("𬌗-𧿹"));
+        System.out.println("================小写全拼================");
+        System.out.println(Cn2SpellUtil.converterToSpellLow("欢迎来到Java世界"));
+        System.out.println(Cn2SpellUtil.converterToSpellLow("11β-羟化酶缺陷症#11-羟化酶缺陷"));
+        System.out.println(Cn2SpellUtil.converterToSpellLow("-"));
+        System.out.println(Cn2SpellUtil.converterToSpellLow("𬌗-𧿹"));
     }
 }