ソースを参照

通过图谱推送医保疾病信息

MarkHuang 4 年 前
コミット
9ffa4522e4

+ 118 - 0
src/main/java/com/diagbot/entity/node/YiBaoDisease.java

@@ -0,0 +1,118 @@
+package com.diagbot.entity.node;
+
+import com.diagbot.entity.node.Disease;
+import com.diagbot.entity.node.LIS;
+import com.diagbot.entity.node.Medicine;
+import com.diagbot.entity.node.PACS;
+import com.diagbot.entity.node.base.BaseNode;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.NodeEntity;
+import org.neo4j.ogm.annotation.Property;
+import org.neo4j.ogm.annotation.Relationship;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Setter
+@Getter
+//@EqualsAndHashCode(callSuper = false)
+@NodeEntity(label = "医保ICD-10疾病")
+public class YiBaoDisease extends BaseNode  {
+
+    @Property(name = "医保ICD-10代码")
+    private String icd_code;
+
+    @Property(name = "疾病名称")
+    private String disease_name;
+
+    @Relationship(type="医保ICD-10疾病相关年龄", direction = Relationship.OUTGOING)
+    private Age age;
+
+    @Relationship(type="医保ICD-10疾病相关性别", direction = Relationship.OUTGOING)
+    private Gender gender;
+
+    @Relationship(type="医保ICD-10疾病相关治愈率", direction = Relationship.OUTGOING)
+    private CureRate curerate;
+
+    @Relationship(type="医保ICD-10疾病相关治疗周期", direction = Relationship.OUTGOING)
+    private TreatCycle treatcycle;
+
+    @Relationship(type="医保ICD-10疾病相关传染途径", direction = Relationship.OUTGOING)
+    private Set<Infection> infections = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关多发人群", direction = Relationship.OUTGOING)
+    private Set<Group> groups = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关别名", direction = Relationship.OUTGOING)
+    private Set<Alias> alias = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关体征", direction = Relationship.OUTGOING)
+    private Set<Vital> vitals = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关科室", direction = Relationship.OUTGOING)
+    private Set<Dept> depts = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关症状", direction = Relationship.OUTGOING)
+    private Set<Symptom> symptoms = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关发病情况", direction = Relationship.OUTGOING)
+    private Set<Situation> situations = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关标准科室", direction = Relationship.OUTGOING)
+    private Set<Dept> stddepts = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关并发症", direction = Relationship.OUTGOING)
+    private Set<Complication> complications = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关检查", direction = Relationship.OUTGOING)
+    private Set<PACS> pacss = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关药品", direction = Relationship.OUTGOING)
+    private Set<Medicine> medicines = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关发病原因", direction = Relationship.OUTGOING)
+    private Set<Cause> causes = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关鉴别诊断", direction = Relationship.OUTGOING)
+    private Set<Disease> diff_diseases = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关手术和操作", direction = Relationship.OUTGOING)
+    private Set<Operation> operations = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关病原体", direction = Relationship.OUTGOING)
+    private Set<Pathogen> pathogens = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关遗传性", direction = Relationship.OUTGOING)
+    private Set<Heredity> hereditys = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关治疗", direction = Relationship.OUTGOING)
+    private Set<Treatment> treatments = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关分型", direction = Relationship.OUTGOING)
+    private Set<DiseaseType> diseasetypes = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关局部并发症", direction = Relationship.OUTGOING)
+    private Set<Complication> localcompls = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关全身并发症", direction = Relationship.OUTGOING)
+    private Set<Complication> generalcompls = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关化验", direction = Relationship.OUTGOING)
+    private Set<LIS> liss = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关实验室检查", direction = Relationship.OUTGOING)
+    private Set<LIS> liss_dis = new HashSet<>();
+
+    @Relationship(type="医保ICD-10疾病相关辅助检查", direction = Relationship.OUTGOING)
+    private Set<PACS> pacs = new HashSet<>();
+
+    @Relationship(type="药品通用名禁忌医保ICD-10疾病", direction = Relationship.INCOMING)
+    private Set<Medicine> medicine_conflict_diseases;
+
+    @Relationship(type="辅助检查禁忌医保ICD-10疾病", direction = Relationship.INCOMING)
+    private Set<PACS> pacs_conflict_diseases;
+
+    @Relationship(type="实验室检查禁忌医保ICD-10疾病", direction = Relationship.INCOMING)
+    private Set<Disease> lis_conflict_diseases;
+}

+ 38 - 33
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -13,31 +13,16 @@ import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.entity.node.Disease;
 import com.diagbot.entity.node.Medicine_Code;
 import com.diagbot.entity.node.OralMedicine;
+import com.diagbot.entity.node.YiBaoDisease;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.repository.DiseaseNode;
-import com.diagbot.repository.DiseaseRepository;
-import com.diagbot.repository.LisNode;
-import com.diagbot.repository.LisPackNode;
-import com.diagbot.repository.LisPackRepository;
-import com.diagbot.repository.LisRepository;
-import com.diagbot.repository.MedicineCodeRepository;
-import com.diagbot.repository.MedicineNode;
-import com.diagbot.repository.MedicineRepository;
-import com.diagbot.repository.OperationNode;
-import com.diagbot.repository.OperationRepository;
-import com.diagbot.repository.PACSNode;
-import com.diagbot.repository.PacsRepository;
+import com.diagbot.repository.*;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
 import com.diagbot.util.StringUtil;
-import com.diagbot.vo.BillNeoVO;
-import com.diagbot.vo.CriticalNeoVO;
-import com.diagbot.vo.HighRiskNeoVO;
-import com.diagbot.vo.NeoPushVO;
-import com.diagbot.vo.StandConvert;
-import com.diagbot.vo.StandConvertCrfVO;
+import com.diagbot.vo.*;
+import com.diagbot.vo.neoPushEntity.Diag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.Cacheable;
@@ -75,6 +60,8 @@ public class NeoFacade {
     @Autowired
     MedicineCodeRepository medicineCodeRepository;
     @Autowired
+    YiBaoDiseaseRepository yiBaoDiseaseRepository;
+    @Autowired
     ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
     @Autowired
     NeoFacade self;
@@ -127,7 +114,19 @@ public class NeoFacade {
      */
     public List<NeoPushDTO> getPush(NeoPushVO pushVO){
         List<NeoPushDTO> neoPushDTOS = new ArrayList<>();
-        // TODO: 2020/8/18
+        List<String> diags = new ArrayList<>();
+        // 如果有诊断名称,则通过诊断反推
+        // 如果没有诊断名称,则通过其它信息推送诊断
+        if (null!=pushVO.getDiagVo() && pushVO.getDiagVo().getDiags().size()==0) {
+            for (Diag diag : pushVO.getDiagVo().getDiags()) {
+                diags.add(diag.getName());
+            }
+
+            neoPushDTOS = getDiagInfo(pushVO);
+        }
+        else {
+
+        }
 
         return neoPushDTOS;
     }
@@ -226,28 +225,34 @@ public class NeoFacade {
     }
 
 
+    /**
+     * 推送疾病信息
+     * @param neoPushVO
+     * @return
+     */
+    public List<NeoPushDTO> getDiagInfo(NeoPushVO neoPushVO) {
 
+        List<NeoPushDTO> neoPushDTOs = new ArrayList<>();
+        NeoPushDTO pushDTO;
 
-    public Map<String, PushDTO> getDiag(List<String> diaglist) {
-
-        Map<String, PushDTO> pushDTOs = new HashMap<>();
-        PushDTO pushDTO;
-
-        DiseaseNode diseaseNode = new DiseaseNode();
-        Disease disease;
+        YiBaoDiseaseNode yiBaoDiseaseNode = new YiBaoDiseaseNode();
+        String term;
 
-        for (String term : diaglist) {
+        for (Diag diag : neoPushVO.getDiagVo().getDiags()) {
+            term = diag.getName();
 
-            disease = diseaseRepository.findByNameIs(term);
+            YiBaoDisease yiBaoDisease = yiBaoDiseaseRepository.findByNameIs(term);
 
-            if (disease != null) {
-                pushDTO = diseaseNode.DiseasetoDiseaseDTO(disease);
+            if (yiBaoDisease != null) {
+                pushDTO = yiBaoDiseaseNode.YiBaoDiseasetoPushDTO(yiBaoDisease, neoPushVO);
 
-                pushDTOs.put(term, pushDTO);
+                if (null!=pushDTO) {
+                    neoPushDTOs.add(pushDTO);
+                }
             }
         }
 
-        return pushDTOs;
+        return neoPushDTOs;
     }
 
 

+ 245 - 0
src/main/java/com/diagbot/repository/YiBaoDiseaseNode.java

@@ -0,0 +1,245 @@
+package com.diagbot.repository;
+
+import com.diagbot.dto.NeoPushDTO;
+import com.diagbot.dto.PushBaseDTO;
+import com.diagbot.entity.node.*;
+import com.diagbot.enums.MedicalAdviceEnum;
+import com.diagbot.util.NeoUtil;
+import com.diagbot.vo.NeoPushVO;
+
+import java.util.*;
+
+public class YiBaoDiseaseNode {
+
+	public NeoPushDTO YiBaoDiseasetoPushDTO(YiBaoDisease disease, NeoPushVO neoPushVO) {
+
+        NeoPushDTO pushDTO = null;
+        PushBaseDTO pushBaseDTO;
+        List<PushBaseDTO> pushBaseDTOS;
+
+        int gender = neoPushVO.getSex();
+        int age = neoPushVO.getAge();
+
+        if (matchBasic(disease, gender, age)) {
+
+
+        	pushBaseDTO = new PushBaseDTO();
+			pushBaseDTO.setName(disease.getName());
+			pushDTO.setDisease(pushBaseDTO);
+
+
+			pushBaseDTO = new PushBaseDTO();
+			pushBaseDTO.setName(disease.getIcd_code());
+			pushDTO.setIcd10(pushBaseDTO);
+
+			/*
+			CureRate curerate = disease.getCurerate();
+			if (null != curerate) {
+				NeoUtil.updateNodeInfo(curerate.getName(), null, null, null);
+			}
+
+			TreatCycle treatcycle = disease.getTreatcycle();
+			if (null != treatcycle) {
+				NeoUtil.updateNodeInfo(treatcycle.getName(), null, null, null);
+			}
+
+			Set<Infection> infections = disease.getInfections();
+			for (Infection infection : infections) {
+				NeoUtil.updateNodeInfo(infection.getName(), null, null, null);
+			}
+
+			Set<Group> groups = disease.getGroups();
+			for (Group group : groups) {
+				NeoUtil.updateNodeInfo(group.getName(), null, null, null);
+			}
+
+			Set<Alias> aliass = disease.getAlias();
+			for (Alias alias : aliass) {
+				NeoUtil.updateNodeInfo(alias.getName(), null, null, null);
+			}
+			*/
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<Vital> vitals = disease.getVitals();
+			for (Vital vital : vitals) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(vital.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.setVitals(pushBaseDTOS);
+
+			/*
+			Set<Dept> depts = disease.getDepts();
+			for (Dept dept : depts) {
+				NeoUtil.updateNodeInfo(dept.getName(), null, null, null);
+			}
+			*/
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<Symptom> symptoms = disease.getSymptoms();
+			for (Symptom symptom : symptoms) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(symptom.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.setSymptoms(pushBaseDTOS);
+
+			/*
+			Set<Situation> situations = disease.getSituations();
+			for (Situation situation : situations) {
+				NeoUtil.updateNodeInfo(situation.getName(), null, null, null);
+			}
+
+			Set<Dept> stddepts = disease.getDepts();
+			for (Dept stddept : stddepts) {
+				NeoUtil.updateNodeInfo(stddept.getName(), null, null, null);
+			}
+
+
+			Set<Complication> complications = disease.getComplications();
+			for (Complication complication : complications) {
+				pushDTO.getComplications().add(NeoUtil.updatePushInfo(complication.getName()));
+			}
+			*/
+
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<PACS> pacss = disease.getPacs();
+			for (PACS pacs : pacss) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(pacs.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.setPacs(pushBaseDTOS);
+
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<Medicine> medicines = disease.getMedicines();
+			for (Medicine medicine : medicines) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(medicine.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.getTreat().put(MedicalAdviceEnum.getName(1), pushBaseDTOS);
+
+			/*
+			Set<Cause> causes = disease.getCauses();
+			for (Cause cause : causes) {
+				NeoUtil.updateNodeInfo(cause.getName(), null, null, null);
+			}
+
+
+			Set<Disease> diff_diseases = disease.getDiff_diseases();
+			List<PushBaseDTO> pushBaseDTOs = new ArrayList<>();
+			for (Disease diff_disease : diff_diseases) {
+				pushBaseDTOs.add(NeoUtil.updatePushInfo(diff_disease.getName()));
+			}
+			Map<String, List<PushBaseDTO>> dis = new HashMap<>();
+			dis.put("鉴别诊断", pushBaseDTOs);
+			pushDTO.setDis(dis);
+			*/
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<Operation> operations = disease.getOperations();
+			for (Operation operation : operations) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(operation.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.getTreat().put(MedicalAdviceEnum.getName(2), pushBaseDTOS);
+
+			/*
+			Set<Pathogen> pathogens = disease.getPathogens();
+			for (Pathogen pathogen : pathogens) {
+				NeoUtil.updateNodeInfo(pathogen.getName(), null, null, null);
+			}
+
+			Set<Heredity> hereditys = disease.getHereditys();
+			for (Heredity heredity : hereditys) {
+				NeoUtil.updateNodeInfo(heredity.getName(), null, null, null);
+			}
+
+			Set<Treatment> treatments = disease.getTreatments();
+			for (Treatment treatment : treatments) {
+				NeoUtil.updateNodeInfo(treatment.getName(), null, null, null);
+			}
+
+			Set<DiseaseType> diseasetypes = disease.getDiseasetypes();
+			for (DiseaseType diseasetype : diseasetypes) {
+				NeoUtil.updateNodeInfo(diseasetype.getName(), null, null, null);
+			}
+
+			Set<Complication> localcompls = disease.getLocalcompls();
+			for (Complication localcompl : localcompls) {
+				NeoUtil.updateNodeInfo(localcompl.getName(), null, null, null);
+			}
+
+			Set<Complication> generalcompls = disease.getGeneralcompls();
+			for (Complication generalcompl : generalcompls) {
+				NeoUtil.updateNodeInfo(generalcompl.getName(), null, null, null);
+			}
+			*/
+
+
+			pushBaseDTOS = new ArrayList<>();
+			Set<LIS> liss = disease.getLiss_dis();
+			for (LIS lis : liss) {
+				pushBaseDTO = new PushBaseDTO();
+				pushBaseDTO.setName(lis.getName());
+				pushBaseDTOS.add(pushBaseDTO);
+			}
+			pushDTO.setLis(pushBaseDTOS);
+
+
+			/*
+			Set<PACS> pacs_disease= disease.getPacs_disease();
+			for (PACS pacs : pacs_disease) {
+				String name = pacs.getName();
+				String min = pacs.getMinval();
+				String max = pacs.getMaxval();
+				String unit = pacs.getUnit();
+				NeoUtil.updateNodeInfo(name, min, max, unit);
+			}
+
+			Medicine_Code medicine_code = disease.getMedicine_code();
+			if (null != medicine_code) {
+				NeoUtil.updateNodeInfo(medicine_code.getName(), null, null, null);
+			}
+			*/
+		}
+
+		return pushDTO;
+	}
+
+
+	private boolean matchBasic(YiBaoDisease disease, int gender_code, int age) {
+		boolean match = true;
+
+		String gender = null;
+
+		if (gender_code==1) {
+			gender = "男";
+		}
+		else if (gender_code==2) {
+			gender = "女";
+		}
+
+		if (null!=disease.getGender() && gender!=null) {
+			if (!disease.getGender().getName().contains(gender)) {
+				match = false;
+			}
+		}
+
+		if (null!=disease.getAge()) {
+			int min = disease.getAge().getMinval();
+			int max = disease.getAge().getMaxval();
+			if (age < min || age > max) {
+				match = false;
+			}
+		}
+
+		return match;
+	}
+
+}
+

+ 11 - 0
src/main/java/com/diagbot/repository/YiBaoDiseaseRepository.java

@@ -0,0 +1,11 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.YiBaoDisease;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+
+public interface YiBaoDiseaseRepository extends Neo4jRepository<YiBaoDisease, Long> {
+
+    YiBaoDisease findByNameIs(String name);
+}
+