瀏覽代碼

更新辅检开单合理性的返回数据结构

MarkHuang 4 年之前
父節點
當前提交
b83d247629

+ 0 - 14
src/main/java/com/diagbot/dto/AgeNeoDTO.java

@@ -1,14 +0,0 @@
-package com.diagbot.dto;
-
-
-import lombok.Data;
-
-@Data
-public class AgeNeoDTO {
-
-    // 年龄最小值
-    private Integer minage;
-
-    // 年龄最大值
-    private Integer maxage;
-}

+ 1 - 1
src/main/java/com/diagbot/dto/DrugBillNeoDTO.java

@@ -16,7 +16,7 @@ public class DrugBillNeoDTO {
     private String gender;
 
     // 禁忌年龄
-    private AgeNeoDTO ageNeoDTO;
+    private RangeNeoDTO ageNeoDTO;
 
     // 临床表现
     private List<String> clinicfindings = new ArrayList<>();

+ 4 - 7
src/main/java/com/diagbot/dto/PacsBillNeoDTO.java

@@ -14,20 +14,17 @@ public class PacsBillNeoDTO {
     // 禁忌性别
     private String gender;
 
-    // 年龄最小值
-    private Integer minage;
-
-    // 年龄最大值
-    private Integer maxage;
+    // 禁忌年龄
+    private RangeNeoDTO ageNeoDTO;
 
     // 临床表现
-    private List<String> clinicfindings;
+    private List<RangeNeoDTO> clinicfindings;
 
     // 服用药品
     private List<String> prescribe;
 
     // 禁忌过敏药品
-    private List<String> allergmeds;
+    private List<String> allergicmeds;
 
     // 禁忌手术
     private List<String> operations;

+ 20 - 0
src/main/java/com/diagbot/dto/RangeNeoDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+
+import lombok.Data;
+
+@Data
+public class RangeNeoDTO {
+
+    // 最小值
+    private Integer min;
+
+    // 最大值
+    private Integer max;
+
+    // 单位
+    private String unit;
+
+    // 名称
+    private String name;
+}

+ 4 - 0
src/main/java/com/diagbot/entity/node/Age.java

@@ -23,4 +23,8 @@ public class Age extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌年龄", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌年龄", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
+
 }

+ 3 - 0
src/main/java/com/diagbot/entity/node/AllergicMed.java

@@ -20,4 +20,7 @@ public class AllergicMed extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌过敏药品", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌过敏药品", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 12 - 1
src/main/java/com/diagbot/entity/node/ClinicalFinding.java

@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
 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.io.Serializable;
@@ -17,8 +18,18 @@ import java.util.Set;
 @NodeEntity(label = "临床表现")
 public class ClinicalFinding extends BaseNode  {
 
+    @Property(name = "最大值")
+    private Integer maxval;
+
+    @Property(name = "最小值")
+    private Integer minval;
+
+    @Property(name = "单位")
+    private String unit;
+
     @Relationship(type="药品通用名禁忌临床表现", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
 
-
+    @Relationship(type="辅助检查禁忌临床表现", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 3 - 0
src/main/java/com/diagbot/entity/node/Disease.java

@@ -20,4 +20,7 @@ public class Disease extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌疾病", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌疾病", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 3 - 0
src/main/java/com/diagbot/entity/node/Group.java

@@ -20,4 +20,7 @@ public class Group extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌人群", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌人群", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 3 - 0
src/main/java/com/diagbot/entity/node/LIS.java

@@ -20,4 +20,7 @@ public class LIS extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌实验室检查", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌实验室检查", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 6 - 3
src/main/java/com/diagbot/entity/node/Medicine.java

@@ -18,12 +18,12 @@ import java.util.Set;
 @NodeEntity(label = "药品通用名")
 public class Medicine extends BaseNode implements Serializable {
 
-    @Relationship(type = "药品通用名禁忌年龄", direction = Relationship.OUTGOING)
-    private Age age;
-
     @Relationship(type = "药品通用名禁忌性别", direction = Relationship.OUTGOING)
     private Gender gender;
 
+    @Relationship(type = "药品通用名禁忌年龄", direction = Relationship.OUTGOING)
+    private Age age;
+
     @Relationship(type = "药品通用名禁忌临床表现", direction = Relationship.OUTGOING)
     private Set<ClinicalFinding> clinicalfindings = new HashSet<>();
 
@@ -51,5 +51,8 @@ public class Medicine extends BaseNode implements Serializable {
     @Relationship(type = "药品通用名禁忌配伍", direction = Relationship.OUTGOING)
     private Set<ConflictMed> conflictmeds = new HashSet<>();
 
+    @Relationship(type="辅助检查禁忌服用药品", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
+
 }
 

+ 3 - 0
src/main/java/com/diagbot/entity/node/Operation.java

@@ -20,4 +20,7 @@ public class Operation extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌手术", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌手术", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 35 - 0
src/main/java/com/diagbot/entity/node/PACS.java

@@ -18,6 +18,41 @@ import java.util.Set;
 @NodeEntity(label = "辅助检查")
 public class PACS extends BaseNode  {
 
+    @Relationship(type = "药品通用名禁忌性别", direction = Relationship.OUTGOING)
+    private Gender gender;
+
+    @Relationship(type="辅助检查禁忌年龄", direction = Relationship.OUTGOING)
+    private Age age;
+
+    @Relationship(type="辅助检查禁忌临床表现", direction = Relationship.OUTGOING)
+    private Set<ClinicalFinding> clinicalfindings;
+
+    @Relationship(type="辅助检查禁忌服用药品", direction = Relationship.OUTGOING)
+    private Set<Medicine> conflict_medicines;
+
+    @Relationship(type="辅助检查禁忌过敏药品", direction = Relationship.OUTGOING)
+    private Set<AllergicMed> allergicmeds;
+
+    @Relationship(type="辅助检查禁忌手术", direction = Relationship.OUTGOING)
+    private Set<Operation> operations;
+
+    @Relationship(type="辅助检查禁忌操作", direction = Relationship.OUTGOING)
+    private Set<Procedure> procedures;
+
+    @Relationship(type="辅助检查禁忌实验室检查", direction = Relationship.OUTGOING)
+    private Set<LIS> liss;
+
+    @Relationship(type="辅助检查禁忌疾病", direction = Relationship.OUTGOING)
+    private Set<Disease> diseases;
+
+    @Relationship(type="辅助检查禁忌人群", direction = Relationship.OUTGOING)
+    private Set<Group> groups;
+
     @Relationship(type="药品通用名禁忌辅助检查", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
 }
+
+
+
+
+

+ 3 - 0
src/main/java/com/diagbot/entity/node/Procedure.java

@@ -20,4 +20,7 @@ public class Procedure extends BaseNode  {
 
     @Relationship(type="药品通用名禁忌操作", direction = Relationship.INCOMING)
     private Set<Medicine> medicines;
+
+    @Relationship(type="辅助检查禁忌操作", direction = Relationship.INCOMING)
+    private Set<PACS> pacs;
 }

+ 6 - 1
src/main/java/com/diagbot/facade/BillFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BillDTO;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.WordCrfDTO;
@@ -43,7 +44,7 @@ public class BillFacade {
 
         // 标准词转换 TODO
         Map<String, Map<String, String>> typeStand = neoFacade.standConvert(standConvert);
-        wordCrfDTO = commonFacade.dataTypeSet(wordCrfDTO, typeStand);
+//        wordCrfDTO = commonFacade.dataTypeSet(wordCrfDTO, typeStand);
 
         // 开单合理性图谱接口调用
         BillNeoVO billNeoVO = fillBillNeo(indicationPushVO);
@@ -64,6 +65,10 @@ public class BillFacade {
         for (Item item : items) {
             billNeoVO.getDrugList().add(item.getName());
         }
+        List<Pacs> pacslist = indicationPushVO.getPacs();
+        for (Pacs pacs : pacslist) {
+            billNeoVO.getPacsList().add(pacs.getName());
+        }
 
         return billNeoVO;
     }

+ 64 - 13
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -2,10 +2,14 @@ package com.diagbot.facade;
 
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.DrugBillNeoDTO;
+import com.diagbot.dto.PacsBillNeoDTO;
 import com.diagbot.entity.node.Medicine;
+import com.diagbot.entity.node.PACS;
 import com.diagbot.entity.relationship.Medicine_AgeMin;
 import com.diagbot.repository.MedicineNode;
 import com.diagbot.repository.MedicineRepository;
+import com.diagbot.repository.PACSNode;
+import com.diagbot.repository.PacsRepository;
 import com.diagbot.vo.BillNeoVO;
 import com.diagbot.vo.StandConvert;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +31,9 @@ public class NeoFacade {
 
     @Autowired
     MedicineRepository medicineRepository;
+    @Autowired
+    PacsRepository pacsRepository;
+
 
     /**
      * 返回药品缓存信息
@@ -51,12 +58,10 @@ public class NeoFacade {
 
         List<BillNeoDTO> billNeoDTOs = new ArrayList<>();
 
-        for (String medname : billNeoVO.getDrugList()) {
-            BillNeoDTO billNeoDTO = new BillNeoDTO();
-            billNeoDTO.setName(medname);
-            billNeoDTO.setDrugBillNeoDTOList(getDrugBill(medname));
-        }
+        billNeoDTOs.addAll(getDrugBill(billNeoVO.getDrugList()));
+        billNeoDTOs.addAll(getPacsBill(billNeoVO.getPacsList()));
 
+        System.out.println(billNeoDTOs);
         return billNeoDTOs;
     }
 
@@ -65,22 +70,68 @@ public class NeoFacade {
     /**
      * 处理处方开单合理性
      */
-    public List<DrugBillNeoDTO> getDrugBill(String medname) {
-        List<DrugBillNeoDTO> drugBillNeoDTOS = new ArrayList<>();
+    public List<BillNeoDTO> getDrugBill(List<String> meds) {
+        List<BillNeoDTO> billNeoDTOS = new ArrayList<>();
+        BillNeoDTO billNeoDTO;
+
         DrugBillNeoDTO drugBillNeoDTO;
 
         MedicineNode medicineNode = new MedicineNode();
         Medicine medicine;
 
-        medicine = medicineRepository.findByNameIs(medname);
+        for (String medname : meds) {
+            billNeoDTO = new BillNeoDTO();
+            billNeoDTO.setName(medname);
+            List<DrugBillNeoDTO> drugBillNeoDTOs = new ArrayList<>();
+
+            medicine = medicineRepository.findByNameIs(medname);
+
+            if (medicine!=null) {
+                drugBillNeoDTO = medicineNode.MedicinetoDrugDTO(medicine);
+
+                drugBillNeoDTOs.add(drugBillNeoDTO);
+            }
+
+            billNeoDTO.setDrugBillNeoDTOList(drugBillNeoDTOs);
+
+            billNeoDTOS.add(billNeoDTO);
+        }
+
+        return billNeoDTOS;
+    }
+
+
+    /**
+     * 处理辅检开单合理性
+     */
+    public List<BillNeoDTO> getPacsBill(List<String> pacslist) {
+        List<BillNeoDTO> billNeoDTOS = new ArrayList<>();
+        BillNeoDTO billNeoDTO;
+
+        PacsBillNeoDTO pacsBillNeoDTO;
+
+        PACSNode pacsNode = new PACSNode();
+        PACS pacs;
+
+        for (String pacsname : pacslist) {
+            billNeoDTO = new BillNeoDTO();
+            billNeoDTO.setName(pacsname);
+            List<PacsBillNeoDTO> pacsBillNeoDTOS = new ArrayList<>();
+
+            pacs = pacsRepository.findByNameIs(pacsname);
+
+            if (pacs!=null) {
+                pacsBillNeoDTO = pacsNode.PacstoPACSDTO(pacs);
+
+                pacsBillNeoDTOS.add(pacsBillNeoDTO);
+            }
+
+            billNeoDTO.setPacsBillNeoDTOList(pacsBillNeoDTOS);
 
-        if (medicine!=null) {
-            drugBillNeoDTO = medicineNode.MedicinetoDrugDTO(medicine);
-            System.out.println(drugBillNeoDTO);
-            drugBillNeoDTOS.add(drugBillNeoDTO);
+            billNeoDTOS.add(billNeoDTO);
         }
 
-        return drugBillNeoDTOS;
+        return billNeoDTOS;
     }
 
 

+ 4 - 5
src/main/java/com/diagbot/repository/MedicineNode.java

@@ -1,23 +1,22 @@
 package com.diagbot.repository;
 
-import com.diagbot.dto.AgeNeoDTO;
 import com.diagbot.dto.DrugBillNeoDTO;
+import com.diagbot.dto.RangeNeoDTO;
 import com.diagbot.entity.node.*;
 
 import java.util.Set;
 
 public class MedicineNode {
 
-    private String age_ch = "岁";
 
     public DrugBillNeoDTO MedicinetoDrugDTO(Medicine medicine) {
         DrugBillNeoDTO drugBillNeoDTO = new DrugBillNeoDTO();
 
         Age age = medicine.getAge();
         if (age!=null) {
-            AgeNeoDTO ageNeoDTO = new AgeNeoDTO();
-            ageNeoDTO.setMinage(age.getMinval());
-            ageNeoDTO.setMaxage(age.getMaxval());
+            RangeNeoDTO ageNeoDTO = new RangeNeoDTO();
+            ageNeoDTO.setMin(age.getMinval());
+            ageNeoDTO.setMax(age.getMaxval());
             drugBillNeoDTO.setAgeNeoDTO(ageNeoDTO);
         }
 

+ 94 - 0
src/main/java/com/diagbot/repository/PACSNode.java

@@ -0,0 +1,94 @@
+package com.diagbot.repository;
+
+import com.diagbot.dto.PacsBillNeoDTO;
+import com.diagbot.dto.RangeNeoDTO;
+import com.diagbot.entity.node.*;
+
+import java.util.Set;
+
+public class PACSNode {
+
+    public PacsBillNeoDTO PacstoPACSDTO(PACS pacs) {
+        PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
+
+        Age age = pacs.getAge();
+        if (age!=null) {
+            RangeNeoDTO ageNeoDTO = new RangeNeoDTO();
+            ageNeoDTO.setMin(age.getMinval());
+            ageNeoDTO.setMax(age.getMaxval());
+            pacsBillNeoDTO.setAgeNeoDTO(ageNeoDTO);
+        }
+
+
+        Gender gender = pacs.getGender();
+        String gender_val = (gender==null)?"":gender.getName();
+        pacsBillNeoDTO.setGender(gender_val);
+
+
+        Set<ClinicalFinding> clinicalfindings = pacs.getClinicalfindings();
+        for (ClinicalFinding clinicalfinding : clinicalfindings) {
+            RangeNeoDTO rangeNeoDTO = new RangeNeoDTO();
+            String clinicalfinding_val = (clinicalfinding == null) ? "" : clinicalfinding.getName();
+            rangeNeoDTO.setName(clinicalfinding_val);
+
+            if (clinicalfinding.getUnit()!=null) {
+                rangeNeoDTO.setUnit(clinicalfinding.getUnit());
+                rangeNeoDTO.setMin(clinicalfinding.getMinval());
+                rangeNeoDTO.setMax(clinicalfinding.getMaxval());
+            }
+
+//            pacsBillNeoDTO.getClinicfindings().add(clinicalfinding_val);
+        }
+
+        Set<Medicine> conflict_medicines = pacs.getConflict_medicines();
+        for (Medicine medicine : conflict_medicines) {
+            String medicine_val = (medicine==null)?"":medicine.getName();
+            pacsBillNeoDTO.getPrescribe().add(medicine_val);
+        }
+
+        Set<AllergicMed> allergicmeds = pacs.getAllergicmeds();
+        for (AllergicMed allergicmed : allergicmeds) {
+            String allergicmed_val = (allergicmed==null)?"":allergicmed.getName();
+            pacsBillNeoDTO.getAllergicmeds().add(allergicmed_val);
+        }
+
+        Set<Operation> operations = pacs.getOperations();
+        for (Operation operation : operations) {
+            String operation_val = (operation==null)?"":operation.getName();
+            pacsBillNeoDTO.getOperations().add(operation_val);
+        }
+
+        Set<Procedure> procedures = pacs.getProcedures();
+        for (Procedure procedure : procedures) {
+            String procedure_val = (procedure==null)?"":procedure.getName();
+            pacsBillNeoDTO.getProcedures().add(procedure_val);
+        }
+
+        Set<LIS> liss = pacs.getLiss();
+        for (LIS lis : liss) {
+            String lis_val = (lis==null)?"":lis.getName();
+            pacsBillNeoDTO.getLis().add(lis_val);
+        }
+
+        Set<Disease> diseases = pacs.getDiseases();
+        for (Disease disease : diseases) {
+            String disease_val = (disease==null)?"":disease.getName();
+            pacsBillNeoDTO.getDisease().add(disease_val);
+        }
+
+        Set<Group> groups = pacs.getGroups();
+        for (Group group : groups) {
+            String group_val = (group==null)?"":group.getName();
+            pacsBillNeoDTO.getGroup().add(group_val);
+        }
+
+
+        return pacsBillNeoDTO;
+    }
+}
+
+
+
+
+
+

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

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

+ 4 - 4
src/main/java/com/diagbot/rule/AgeRule.java

@@ -1,6 +1,6 @@
 package com.diagbot.rule;
 
-import com.diagbot.dto.AgeNeoDTO;
+import com.diagbot.dto.RangeNeoDTO;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
@@ -20,17 +20,17 @@ public class AgeRule {
      * @param name
      * @return
      */
-    public static BillMsg compareAgeWithBill(AgeNeoDTO ageNeoDTO, WordCrfDTO wordCrfDTO, String name) {
+    public static BillMsg compareAgeWithBill(RangeNeoDTO ageNeoDTO, WordCrfDTO wordCrfDTO, String name) {
         Boolean flag = false;
         if (ageNeoDTO != null && wordCrfDTO.getAge() != null) {
             Integer age = wordCrfDTO.getAge();
-            Integer minAge = ageNeoDTO.getMinage();
+            Integer minAge = ageNeoDTO.getMin();
             if (minAge != null) {
                 if (age < minAge) {
                     flag = true;
                 }
             }
-            Integer maxAge = ageNeoDTO.getMaxage();
+            Integer maxAge = ageNeoDTO.getMax();
             if (maxAge != null) {
                 if (age > minAge) {
                     flag = true;