Browse Source

标准术语维护

zhaops 4 years ago
parent
commit
c1c29a86f8

+ 57 - 0
src/main/java/com/diagbot/entity/node/EntityInfo.java

@@ -4,6 +4,8 @@ import lombok.Getter;
 import lombok.Setter;
 import org.springframework.data.neo4j.annotation.QueryResult;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * @Description:
  * @Author:zhaops
@@ -14,9 +16,64 @@ import org.springframework.data.neo4j.annotation.QueryResult;
 @QueryResult
 public class EntityInfo {
     private Long id;
+    @NotNull(message = "请输入术语名称")
     private String name;
     private String pycode;
     private Integer status;
     private Integer is_kl;
+    @NotNull(message = "请输入术语类型")
     private String labelType;
+
+    //通用属性
+    private String age;
+    private String ageRange;
+    private String gender;
+    //实验室检查名称、实验室检查、体征、实验室检查危急值
+    private String unit;
+    //医保诊断名称、药物过敏原、药品注册名称
+    private String alias;
+    //药物过敏原、药品注册名称
+    private String result;
+    //实验室检查名称
+    private Double minval;
+    //实验室检查名称
+    private Double maxval;
+    //实验室检查名称
+    private Integer range;
+
+
+    //个性化属性
+    //医保诊断名称属性
+    //"分类", "age(0-200)", "sex", "疾病别称", "dept"
+    private Integer category;
+    private String dep;
+    private Integer minAge;
+    private Integer maxAge;
+
+    //医保手术和操作属性
+    private String opgrade;
+    private String highriskcond;
+
+    //实验室检查名称
+    //"范围", "最小值", "单位", "最大值"
+
+    //实验室检查
+    //"单位"
+
+    //化验细项及结果
+    //"special"
+    private String special;
+
+    //药物过敏原
+    //"药品类型", "结果", "名称"
+    private String medtype;
+
+    //药品注册名称
+    //"药品高危级别", "禁忌给药途径", "禁忌性别", "结果", "名称"
+    private String risklevel;
+    private String conflict_geiyao;
+    private String conflict_gender;
+
+    //药品代码通用名
+
 }

+ 8 - 0
src/main/java/com/diagbot/entity/node/YiBaoDiseaseName.java

@@ -20,6 +20,14 @@ public class YiBaoDiseaseName extends BaseNode  {
 	private String gender;
 	@Property(name = "年龄")
 	private String age;
+	@Property(name="age")
+	private String ageRange;
+	@Property(name="dept")
+	private String dept;
+	@Property(name="疾病别称")
+	private String alias;
+	@Property(name="分类")
+	private Integer category;
 
 	@Relationship(type = "医保疾病名称相关医保ICD-10代码", direction = Relationship.OUTGOING)
 	private Set<YiBaoDiseaseNameYiBaoICD_10Code> yiBaoDiseaseNameYibaoicd_10codes = new HashSet<>();

+ 95 - 0
src/main/java/com/diagbot/enums/LabelTypeEnum.java

@@ -0,0 +1,95 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 17:56
+ */
+public enum LabelTypeEnum implements KeyedNamed {
+    YiBaoDiseaseName(1, "医保疾病名称"),
+    LisSet(2, "实验室检查套餐名"),
+    LisName(3, "实验室检查名称"),
+    PacsName(4, "辅助检查名称"),
+    PacsSubName(5, "辅助检查子项目名称"),
+    Medicine(6, "药品通用名称"),
+    YiBaoOperationName(7, "医保手术和操作名称"),
+    Disease(8, "疾病"),
+    Lis(9, "实验室检查"),
+    LisSubNameAndResult(10, "化验细项及结果"),
+    LisCritical(11, "实验室检查危急值"),
+    LisRemind(12, "化验提醒指标"),
+    LisBigName(13, "化验套餐名称"),
+    PacsCritical(14, "辅助检查危急值"),
+    PacsDescribe(15, "辅助检查名称描述"),
+    PacsResult(16, "辅助检查名称结果"),
+    PacsRemind(17, "辅检提醒指标"),
+    MedCodeName(18, "药品代码通用名"),
+    MedRegName(19, "药品注册名称"),
+    MedClass(20, "药品类别"),
+    MedZhiLiaoClass(21, "药品治疗学类别"),
+    MedYaoLiClass(22, "药品药理学类别"),
+    MedJiePouClass(23, "药品解剖学类别"),
+    MedChemClass(24, "药品化学物质类别"),
+    OralMedicine(25, "服用药品"),
+    ConflictDevice(26, "禁忌医疗器械及物品"),
+    Gender(27, "性别"),
+    Vital(28, "体征"),
+    Symptom(29, "症状"),
+    ClinicalFinding(30, "临床表现"),
+    Dept(31, "科室"),
+    BillConflictItem(32, "开单项互斥"),
+    Group(33, "禁忌人群"),
+    TransfusionSuggest(34, "建议输血提醒"),
+    MedAllergen(35, "药物过敏原"),
+    Allergen(36, "过敏原"),
+    FoodAllergen(37, "食物过敏原"),
+    TransfusionRemind(38, "输血提醒指标");
+
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    LabelTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static LabelTypeEnum getEnum(int key) {
+        for (LabelTypeEnum item : LabelTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static LabelTypeEnum getEnum(String value) {
+        for (LabelTypeEnum item : LabelTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        LabelTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 287 - 8
src/main/java/com/diagbot/facade/EntityInfoFacade.java

@@ -2,7 +2,14 @@ package com.diagbot.facade;
 
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.node.EntityInfo;
-import com.diagbot.repository.EntityInfoRepository;
+import com.diagbot.entity.node.LisName;
+import com.diagbot.enums.LabelTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.repository.*;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.Cn2SpellUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.EntityInfoVO;
 import com.diagbot.vo.EntityPageVO;
@@ -28,6 +35,81 @@ public class EntityInfoFacade {
     @Autowired
     EntityInfoRepository entityInfoRepository;
 
+    @Autowired
+    YiBaoDiseaseNameRepository yiBaoDiseaseNameRepository;
+    @Autowired
+    LisSetRepository lisSetRepository;
+    @Autowired
+    LisNameRepository lisNameRepository;
+    @Autowired
+    PacsNameRepository pacsNameRepository;
+    @Autowired
+    PacsSubNameRepository pacsSubNameRepository;
+    @Autowired
+    MedicineRepository medicineRepository;
+    @Autowired
+    YiBaoOperationNameRepository yiBaoOperationNameRepository;
+    @Autowired
+    DiseaseRepository diseaseRepository;
+    @Autowired
+    LisRepository lisRepository;
+    //TODO 化验细项及结果
+    @Autowired
+    LisCriticalRepository lisCriticalRepository;
+    @Autowired
+    LisRemindRepository lisRemindRepository;
+    @Autowired
+    LisBigNameRepository lisBigNameRepository;
+    @Autowired
+    PacsCriticalRepository pacsCriticalRepository;
+    @Autowired
+    PacsDescribeRepository pacsDescribeRepository;
+    @Autowired
+    PacsResultRepository pacsResultRepository;
+    @Autowired
+    PacsRemindRepository pacsRemindRepository;
+    @Autowired
+    MedicineCodeRepository medicineCodeRepository;
+    @Autowired
+    MedRegNameRepository medRegNameRepository;
+    @Autowired
+    MedClassRepository medClassRepository;
+    @Autowired
+    MedZhiLiaoClassRepository medZhiLiaoClassRepository;
+    @Autowired
+    MedYaoLiClassRepository medYaoLiClassRepository;
+    @Autowired
+    MedJiePouClassRepository medJiePouClassRepository;
+    @Autowired
+    MedChemClassRepository medChemClassRepository;
+    @Autowired
+    OralMedicineRepository oralMedicineRepository;
+    @Autowired
+    ConflictDeviceRepository conflictDeviceRepository;
+    @Autowired
+    GenderRepository genderRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    SymptomNameRepository symptomNameRepository;
+    @Autowired
+    ClinicalFindingRepository clinicalFindingRepository;
+    @Autowired
+    DeptRepository deptRepository;
+    @Autowired
+    BillConflictItemRepository billConflictItemRepository;
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    TransfusionSuggestRepository transfusionSuggestRepository;
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    AllergenRepository allergenRepository;
+    //TODO 食物过敏原
+    @Autowired
+    TransfusionRemindRepository transfusionRemindRepository;
+
     /**
      * 分页查询
      *
@@ -59,20 +141,217 @@ public class EntityInfoFacade {
      */
     public Boolean isExist(EntityInfoVO entityInfoVO) {
         Boolean exist = false;
-        Integer count = entityInfoRepository.existNodes(entityInfoVO.getName(), entityInfoVO.getLabelType());
-        if (count > 0) {
-            exist = true;
+        List<EntityInfo> entities = entityInfoRepository.existNodes(entityInfoVO.getName(), entityInfoVO.getLabelType());
+        if (ListUtil.isNotEmpty(entities)) {
+            if (entityInfoVO.getId() == null) {
+                exist = true;
+            } else {
+                //修改记录
+                List<Long> existIds = entities.stream().map(i -> i.getId()).collect(Collectors.toList());
+                if (existIds.contains(entityInfoVO.getId())) {
+                    exist = false;
+                }
+            }
         }
         if (!exist) {
             if (entityInfoVO.getLabelType().equals("辅助检查名称")) {
-                count = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查子项目名称");
+                entities = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查子项目名称");
             } else if (entityInfoVO.getLabelType().equals("辅助检查子项目名称")) {
-                count = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查名称");
+                entities = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查名称");
             }
-            if (count > 0) {
-                exist = true;
+            if (ListUtil.isNotEmpty(entities)) {
+                if (entityInfoVO.getId() == null) {
+                    exist = true;
+                } else {
+                    //修改记录
+                    List<Long> existIds = entities.stream().map(i -> i.getId()).collect(Collectors.toList());
+                    if (existIds.contains(entityInfoVO.getId())) {
+                        exist = false;
+                    }
+                }
             }
         }
         return exist;
     }
+
+    public EntityInfo getById(Long id) {
+        EntityInfo entityInfo = entityInfoRepository.getById(id);
+        if (entityInfo != null) {
+            if (entityInfo.getLabelType().equals(LabelTypeEnum.YiBaoDiseaseName.getName())) {
+                if (StringUtil.isNotBlank(entityInfo.getAgeRange())) {
+                    String[] ages = entityInfo.getAgeRange().split("-");
+                    if (ages.length == 2) {
+                        entityInfo.setMinAge(Integer.valueOf(ages[0]));
+                        entityInfo.setMaxAge(Integer.valueOf(ages[1]));
+                    } else if (ages.length == 1) {
+                        if (entityInfo.getAgeRange().startsWith("-")) {
+                            entityInfo.setMaxAge(Integer.valueOf(ages[0]));
+                        } else if (entityInfo.getAgeRange().endsWith("-")) {
+                            entityInfo.setMinAge(Integer.valueOf(ages[0]));
+                        }
+                    }
+                }
+            }
+        }
+        return entityInfo;
+    }
+
+    /**
+     * 术语保存
+     * @param entityInfo
+     * @return
+     */
+    public Boolean saveNode(EntityInfo entityInfo) {
+        EntityInfoVO entityInfoVO = new EntityInfoVO();
+        BeanUtil.copyProperties(entityInfo, entityInfoVO);
+        Boolean exists = isExist(entityInfoVO);
+        if (exists) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "术语已存在");
+        }
+
+        //术语类型校验
+        List<DictionaryInfoDTO> dicTypeLabelType = dictionaryFacade.getListByGroupType(8);
+        if (ListUtil.isEmpty(dicTypeLabelType)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "术语类型字典缺失");
+        }
+        List<String> labels = dicTypeLabelType.stream().map(i -> i.getVal()).collect(Collectors.toList());
+        if (!labels.contains(entityInfo.getLabelType())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "术语类型错误");
+        }
+
+        //默认值处理
+        if (StringUtil.isBlank(entityInfo.getPycode())) {
+            entityInfo.setPycode(Cn2SpellUtil.converterToFirstSpell(entityInfo.getName()));
+        }
+        if (entityInfo.getStatus() == null) {
+            entityInfo.setStatus(1);
+        }
+        if (entityInfo.getIs_kl() == null) {
+            entityInfo.setIs_kl(0);
+        }
+
+        switch (entityInfo.getLabelType()) {
+            case "医保疾病名称":
+                entityInfo.setAgeRange(entityInfo.getMinAge() + "-" + entityInfo.getMaxAge());
+                if (entityInfo.getId() != null) {
+                    yiBaoDiseaseNameRepository.update(entityInfo,
+                            entityInfo.getAgeRange(),
+                            entityInfo.getAlias(),
+                            entityInfo.getCategory(),
+                            entityInfo.getDep(),
+                            entityInfo.getGender());
+                } else {
+                    yiBaoDiseaseNameRepository.create(entityInfo,
+                            entityInfo.getAgeRange(),
+                            entityInfo.getAlias(),
+                            entityInfo.getCategory(),
+                            entityInfo.getDep(),
+                            entityInfo.getGender());
+                }
+                break;
+            case "实验室检查套餐名":
+                if (entityInfo.getId() != null) {
+                    lisSetRepository.update(entityInfo);
+                } else {
+                    lisSetRepository.create(entityInfo);
+                }
+                break;
+            case "实验室检查名称":
+                LisName lisName = new LisName();
+                BeanUtil.copyProperties(entityInfo, lisName);
+
+                break;
+            case "辅助检查名称":
+                if (entityInfo.getId() != null) {
+                    pacsNameRepository.update(entityInfo, entityInfo.getGender());
+                } else {
+                    pacsNameRepository.create(entityInfo, entityInfo.getGender());
+                }
+                break;
+            case "辅助检查子项目名称":
+                if (entityInfo.getId() != null) {
+                    pacsSubNameRepository.update(entityInfo, entityInfo.getGender());
+                } else {
+                    pacsSubNameRepository.create(entityInfo, entityInfo.getGender());
+                }
+                break;
+            case "药品通用名称":
+                break;
+            case "医保手术和操作名称":
+                if (entityInfo.getOpgrade() == null) {
+                    entityInfo.setOpgrade("0");
+                }
+                if (entityInfo.getId() != null) {
+                    yiBaoOperationNameRepository.update(entityInfo, entityInfo.getOpgrade());
+                } else {
+                    yiBaoOperationNameRepository.create(entityInfo, entityInfo.getOpgrade());
+                }
+                break;
+            case "疾病":
+                break;
+            case "实验室检查":
+                break;
+            case "化验细项及结果":
+                break;
+            case "实验室检查危急值":
+                break;
+            case "化验提醒指标":
+                break;
+            case "化验套餐名称":
+                break;
+            case "辅助检查危急值":
+                break;
+            case "辅助检查名称描述":
+                break;
+            case "辅助检查名称结果":
+                break;
+            case "辅检提醒指标":
+                break;
+            case "药品代码通用名":
+                break;
+            case "药品注册名称":
+                break;
+            case "药品类别":
+                break;
+            case "药品治疗学类别":
+                break;
+            case "药品药理学类别":
+                break;
+            case "药品解剖学类别":
+                break;
+            case "药品化学物质类别":
+                break;
+            case "服用药品":
+                break;
+            case "禁忌医疗器械及物品":
+                break;
+            case "性别":
+                break;
+            case "体征":
+                break;
+            case "症状":
+                break;
+            case "临床表现":
+                break;
+            case "科室":
+                break;
+            case "开单项互斥":
+                break;
+            case "禁忌人群":
+                break;
+            case "建议输血提醒":
+                break;
+            case "药物过敏原":
+                break;
+            case "过敏原":
+                break;
+            case "食物过敏原":
+                break;
+            case "输血提醒指标":
+                break;
+            default:
+                break;
+        }
+        return true;
+    }
 }

+ 63 - 2
src/main/java/com/diagbot/repository/EntityInfoRepository.java

@@ -34,6 +34,9 @@ public interface EntityInfoRepository extends Neo4jRepository<EntityBaseInfo,Lon
             "n.静态知识标识 = {is_kl} " +
             "else 1 = 1 " +
             "end ) \n" +
+            "and not(exists(n.禁忌人群指标)) \n" +
+            "and not(exists(n.体征指标)) \n" +
+            "and not(exists(n.实验室检查指标)) \n" +
             "return id(n) as id,n.name as name,n.拼音编码  as pycode,labels(n)[0] as labelType,n.状态 as status,n.静态知识标识 as is_kl\n" +
             "order by n.状态 desc, id(n) desc",
             countQuery = "with {labels} as nlabels\n" +
@@ -54,6 +57,9 @@ public interface EntityInfoRepository extends Neo4jRepository<EntityBaseInfo,Lon
                     "n.静态知识标识 = {is_kl} " +
                     "else 1 = 1 " +
                     "end ) \n" +
+                    "and not(exists(n.禁忌人群指标)) \n" +
+                    "and not(exists(n.体征指标)) \n" +
+                    "and not(exists(n.实验室检查指标)) \n" +
                     "return count(*)")
     Page<EntityInfo> getEntityPage(@Param("labels") List<String> labels,
                                    @Param("name") String name,
@@ -62,7 +68,62 @@ public interface EntityInfoRepository extends Neo4jRepository<EntityBaseInfo,Lon
                                    Pageable pageable);
 
     @Query(value = "match(n) where n.name={name} and {label} in labels(n) \n " +
-            "return count(*)")
-    Integer existNodes(@Param("name") String name,
+            "return id(n) as id,n.name as name,n.拼音编码  as pycode,labels(n)[0] as labelType,n.状态 as status,n.静态知识标识 as is_kl\n")
+    List<EntityInfo> existNodes(@Param("name") String name,
                                 @Param("label") String label);
+
+    @Query("merge (n{id:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.实验室检查指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.实验室检查指标={indication} " +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    Boolean updateEntity(@Param("id") Long id);
+
+    @Query(value = "match(n)\n" +
+            "where id(n)={id}\n" +
+            "return id(n) as id,\n" +
+            "n.name as name,\n" +
+            "n.拼音编码 as pycode,\n" +
+            "n.状态 as status,\n" +
+            "n.静态知识标识 as is_kl,\n" +
+            "labels(n)[0] as labelType,\n" +
+            "n.年龄 as age,\n" +
+            "n.age as ageRange,\n" +
+            "n.性别 as gender,\n" +
+            "n.单位 as unit,\n" +
+            "case labels(n)[0] \n" +
+            "when \"医保疾病名称\" then n.疾病别称\n" +
+            "when \"药物过敏原\" then n.名称\n" +
+            "when \"药品注册名称\" then n.名称\n" +
+            "end  as alias,\n" +
+            "n.结果 as result,\n" +
+            "n.最大值 as maxval,\n" +
+            "n.最小值 as minval,\n" +
+            "n.范围 as range,\n" +
+            "n.分类 as category,\n" +
+            "n.dept as dept,\n" +
+            //"n.年龄max as maxAge,\n" +
+            //"n.年龄min as minAge,\n" +
+            "n.手术级别 as opgrade,\n" +
+            "n.高危条件 as highriskcond,\n" +
+            "n.special as special,\n" +
+            "n.药品高危级别 as risklevel,\n" +
+            "n.禁忌给药途径 as conflict_geiyao,\n" +
+            "n.禁忌性别 as conflict_gender")
+    EntityInfo getById(@Param("id") Long id);
 }

+ 12 - 0
src/main/java/com/diagbot/repository/LisBigNameRepository.java

@@ -0,0 +1,12 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.LisBigName;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 16:47
+ */
+public interface LisBigNameRepository extends Neo4jRepository<LisBigName,Long> {
+}

+ 22 - 1
src/main/java/com/diagbot/repository/LisSetRepository.java

@@ -1,5 +1,6 @@
 package com.diagbot.repository;
 
+import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.entity.node.LisSet;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -52,5 +53,25 @@ public interface LisSetRepository extends Neo4jRepository<LisSet, Long> {
 
     @Query("MATCH (n:实验室检查套餐名) RETURN DISTINCT(n.name) LIMIT {size}")
     List<String> getname(@Param("size") Integer size);
-}
 
+    @Query("match (n:实验室检查套餐名) \n" +
+            "where id(n) = :#{#entityInfo.id} \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    LisSet update(@Param("entityInfo") EntityInfo entityInfo);
+
+    @Query("create (n:实验室检查套餐名) \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    LisSet create(@Param("entityInfo") EntityInfo entityInfo);
+}

+ 12 - 0
src/main/java/com/diagbot/repository/MedChemClassRepository.java

@@ -0,0 +1,12 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.MedChemClass;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 16:35
+ */
+public interface MedChemClassRepository extends Neo4jRepository<MedChemClass,Long> {
+}

+ 12 - 0
src/main/java/com/diagbot/repository/MedClassRepository.java

@@ -0,0 +1,12 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.MedClass;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 16:26
+ */
+public interface MedClassRepository extends Neo4jRepository<MedClass,Long> {
+}

+ 12 - 0
src/main/java/com/diagbot/repository/MedYaoLiClassRepository.java

@@ -0,0 +1,12 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.MedYaoLiClass;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 16:30
+ */
+public interface MedYaoLiClassRepository extends Neo4jRepository<MedYaoLiClass,Long> {
+}

+ 12 - 0
src/main/java/com/diagbot/repository/MedZhiLiaoClassRepository.java

@@ -0,0 +1,12 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.MedZhiLiaoClass;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 16:27
+ */
+public interface MedZhiLiaoClassRepository extends Neo4jRepository<MedZhiLiaoClass,Long> {
+}

+ 27 - 0
src/main/java/com/diagbot/repository/PacsNameRepository.java

@@ -1,7 +1,9 @@
 package com.diagbot.repository;
 
 import com.diagbot.entity.BaseNodeInfo;
+import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.entity.node.PacsName;
+import com.diagbot.entity.node.YiBaoDiseaseName;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.neo4j.annotation.Query;
@@ -94,4 +96,29 @@ public interface PacsNameRepository extends Neo4jRepository<PacsName, Long> {
     @Query("MATCH (n) WHERE (n:辅助检查名称 OR n:辅助检查子项目名称)\n" +
             "RETURN DISTINCT n.name as name LIMIT {size}\n")
     List<String> getPACSNames(@Param("size") Integer size);
+
+    @Query("match (n:医保疾病名称) \n" +
+            "where id(n) = :#{#entityInfo.id} \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    PacsName update(@Param("entityInfo") EntityInfo entityInfo,
+                    @Param("gender") String gender);
+
+    @Query("create (n:医保疾病名称) \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    PacsName create(@Param("entityInfo") EntityInfo entityInfo,
+                    @Param("gender") String gender);
 }

+ 26 - 0
src/main/java/com/diagbot/repository/PacsSubNameRepository.java

@@ -1,5 +1,6 @@
 package com.diagbot.repository;
 
+import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.entity.node.PacsSubName;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
@@ -30,5 +31,30 @@ public interface PacsSubNameRepository extends Neo4jRepository<PacsSubName, Long
             "WITH n SKIP 0 LIMIT $size\n" +
             "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
     List<PacsSubName> index(@Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
+
+    @Query("match (n:医保疾病名称) \n" +
+            "where id(n) = :#{#entityInfo.id} \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    PacsSubName update(@Param("entityInfo") EntityInfo entityInfo,
+                       @Param("gender") String gender);
+
+    @Query("create (n:医保疾病名称) \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    PacsSubName create(@Param("entityInfo") EntityInfo entityInfo,
+                       @Param("gender") String gender);
 }
 

+ 42 - 0
src/main/java/com/diagbot/repository/YiBaoDiseaseNameRepository.java

@@ -1,5 +1,6 @@
 package com.diagbot.repository;
 
+import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.entity.node.YiBaoDiseaseName;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -53,5 +54,46 @@ public interface YiBaoDiseaseNameRepository extends Neo4jRepository<YiBaoDisease
 
     @Query("MATCH (n:医保疾病名称) RETURN DISTINCT n.name as name LIMIT {size}")
     List<String> getDiseaseNames(@Param("size") Integer size);
+
+    @Query("match (n:医保疾病名称) \n" +
+            "where id(n) = :#{#entityInfo.id} \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.age = {ageRange}," +
+            "n.疾病别称 = {alias}," +
+            "n.分类 = {category}," +
+            "n.dept = {dept}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    YiBaoDiseaseName update(@Param("entityInfo") EntityInfo entityInfo,
+                            @Param("ageRange") String ageRange,
+                            @Param("alias") String alias,
+                            @Param("category") Integer category,
+                            @Param("dept") String dept,
+                            @Param("gender") String gender);
+
+    @Query("create (n:医保疾病名称) \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.age = {ageRange}," +
+            "n.疾病别称 = {alias}," +
+            "n.分类 = {category}," +
+            "n.dept = {dept}," +
+            "n.性别 = {gender}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    YiBaoDiseaseName create(@Param("entityInfo") EntityInfo entityInfo,
+                            @Param("ageRange") String ageRange,
+                            @Param("alias") String alias,
+                            @Param("category") Integer category,
+                            @Param("dept") String dept,
+                            @Param("gender") String gender);
 }
 

+ 26 - 0
src/main/java/com/diagbot/repository/YiBaoOperationNameRepository.java

@@ -1,5 +1,6 @@
 package com.diagbot.repository;
 
+import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.entity.node.YiBaoOperationName;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -53,4 +54,29 @@ public interface YiBaoOperationNameRepository extends Neo4jRepository<YiBaoOpera
 
     @Query("MATCH (n:医保手术和操作名称) RETURN DISTINCT n.name as name LIMIT {size}")
     List<String> getOperationNames(@Param("size") Integer size);
+
+    @Query("match (n:医保疾病名称) \n" +
+            "where id(n) = :#{#entityInfo.id} \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.手术级别 = {opgrade}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    YiBaoOperationName update(@Param("entityInfo") EntityInfo entityInfo,
+                              @Param("opgrade") String opgrade);
+
+    @Query("create (n:医保疾病名称) \n" +
+            "set  " +
+            "n.name = :#{#entityInfo.name}," +
+            "n.拼音编码 = :#{#entityInfo.pycode}," +
+            "n.静态知识标识 = :#{#entityInfo.is_kl}," +
+            "n.状态 = :#{#entityInfo.status}," +
+            "n.手术级别 = {opgrade}" +
+            "\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    YiBaoOperationName create(@Param("entityInfo") EntityInfo entityInf,
+                              @Param("opgrade") String opgrade);
 }

+ 1 - 0
src/main/java/com/diagbot/vo/EntityInfoVO.java

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class EntityInfoVO {
+    private Long id;
     private String name;
     private String labelType;
     private Integer status;

+ 15 - 0
src/main/java/com/diagbot/vo/IdVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/12/15 18:27
+ */
+@Getter
+@Setter
+public class IdVO {
+    private Long id;
+}

+ 18 - 0
src/main/java/com/diagbot/web/EntityInfoController.java

@@ -5,6 +5,7 @@ import com.diagbot.entity.node.EntityInfo;
 import com.diagbot.facade.EntityInfoFacade;
 import com.diagbot.vo.EntityInfoVO;
 import com.diagbot.vo.EntityPageVO;
+import com.diagbot.vo.IdVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,4 +49,21 @@ public class EntityInfoController {
         Boolean data = entityInfoFacade.isExist(entityInfoVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "保存[zhaops]",
+            notes = "name:术语名称(模糊匹配)<br>" +
+                    "labelType:术语类型-知识图谱标签类型(String)<br>")
+    @PostMapping("/saveNode")
+    public RespDTO<Boolean> saveNode(@RequestBody EntityInfo entityInfo) {
+        Boolean data = entityInfoFacade.saveNode(entityInfo);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "查看实体对象[zhaops]",
+            notes = "id:实体id<br>")
+    @PostMapping("/getById")
+    public RespDTO<EntityInfo> getById(@RequestBody IdVO idVO) {
+        EntityInfo data = entityInfoFacade.getById(idVO.getId());
+        return RespDTO.onSuc(data);
+    }
 }