zhoutg hace 4 años
padre
commit
d6ed728812

+ 7 - 22
src/main/java/com/diagbot/process/BillProcess.java

@@ -10,7 +10,6 @@ import com.diagbot.enums.NeoEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.model.entity.Clinical;
-import com.diagbot.model.entity.Medicine;
 import com.diagbot.model.entity.Operation;
 import com.diagbot.model.label.ChiefLabel;
 import com.diagbot.model.label.PacsLabel;
@@ -28,7 +27,6 @@ import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.vo.Drug;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -170,27 +168,14 @@ public class BillProcess {
         PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
         PastLabel pastLabel = wordCrfDTO.getPastLabel();
 
+        // 【过敏药品数据来源】
+        List<Item> allergyMedicines = commonRule.getDrugAllergySource(wordCrfDTO);
+
         // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
-        List<Medicine> allergyAll = new ArrayList<>();
-        List<Medicine> allergyDrug = new ArrayList<>();
-        List<Drug> drug = wordCrfDTO.getDrug();
-        for (Item item : drug) {
-            Medicine operaData = new Medicine();
-            operaData.setName(item.getName());
-            operaData.setStandName(item.getUniqueName());
-            allergyDrug.add(operaData);
-        }
-        CoreUtil.addList(allergyAll, chiefLabel.getMedicines()); // 主诉药品
-        CoreUtil.addList(allergyAll,  presentLabel.getMedicines()); // 现病史药品
-        CoreUtil.addList(allergyAll, pastLabel.getMedicines());  // 既往史药品
-        CoreUtil.addList(allergyAll, allergyDrug);  // 结构化药品
+        List<Item> medicineAll = commonRule.getDrugSource(wordCrfDTO);
 
         // 【诊断数据来源】
-        List<Item> diags = new ArrayList<>();
-        CoreUtil.addList(diags, wordCrfDTO.getDiag()); // 结构化诊断
-        CoreUtil.addAllDiag(diags, wordCrfDTO.getChiefLabel().getDiags());// 主诉诊断
-        CoreUtil.addAllDiag(diags, wordCrfDTO.getPresentLabel().getDiags()); // 现病史诊断
-        CoreUtil.addAllDiag(diags, wordCrfDTO.getPastLabel().getDiags()); // 既往史诊断
+        List<Item> diags = commonRule.getDiseaseSource(wordCrfDTO);
 
         // 【辅检结果数据来源】
         PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
@@ -243,10 +228,10 @@ public class BillProcess {
             commonRule.compareNameWithBill(bill.getOperations(), operations_all, bill, billMsgList, NeoEnum.operations.getName());
 
             // 禁忌过敏药品(既往史)
-            drugRule.bill(bill.getAllergicmeds(), pastLabel.getAllergyMedicines(), bill, billMsgList, NeoEnum.allergicmeds.getName());
+            drugRule.bill(bill.getAllergicmeds(), allergyMedicines, bill, billMsgList, NeoEnum.allergicmeds.getName());
 
             // 服用药品(主诉、现病史、既往史、结构化药品)
-            drugRule.bill(bill.getOralmeds(), allergyAll, bill, billMsgList, NeoEnum.oralmeds.getName());
+            drugRule.bill(bill.getOralmeds(), medicineAll, bill, billMsgList, NeoEnum.oralmeds.getName());
 
             // 禁忌人群
             groupRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.group.getName());

+ 6 - 2
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -10,6 +10,7 @@ import com.diagbot.dto.OtherTipTransfusionNeoDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.NeoEnum;
 import com.diagbot.enums.TypeEnum;
+import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.GroupRule;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
@@ -32,8 +33,11 @@ import java.util.stream.Collectors;
  */
 @Component
 public class OtherTipProcess {
+
     @Autowired
     GroupRule groupRule;
+    @Autowired
+    CommonRule commonRule;
 
     /**
      * 处理业务——化验
@@ -51,9 +55,9 @@ public class OtherTipProcess {
                 for (NodeNeoDTO nodeNeoDTO : factor) {
                     Map map = new LinkedHashMap();
                     if (TypeEnum.disease.getName().equals(nodeNeoDTO.getTermtype())) { // 诊断
-                        map = CoreUtil.compareNameWithNode(nodeNeoDTO, wordCrfDTO.getDiag());
+                        map = CoreUtil.compareNameWithNode(nodeNeoDTO, commonRule.getDiseaseSource(wordCrfDTO));
                     } else if (TypeEnum.drug.getName().equals(nodeNeoDTO.getTermtype())) { // 药品
-                        map = CoreUtil.compareNameWithNode(nodeNeoDTO, wordCrfDTO.getDrug());
+                        map = CoreUtil.compareNameWithNode(nodeNeoDTO, commonRule.getDrugSource(wordCrfDTO));
                     } else if (NeoEnum.group.getName().equals(nodeNeoDTO.getTermtype())) { // "禁忌人群"
                         map = groupRule.gravidityRule(wordCrfDTO);
                     }

+ 41 - 0
src/main/java/com/diagbot/rule/CommonRule.java

@@ -1,5 +1,6 @@
 package com.diagbot.rule;
 
+import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.BillNeoMaxDTO;
@@ -243,4 +244,44 @@ public class CommonRule {
         BillMsg billMsg = MsgUtil.getComplexOperationMsg(nodeNeoDTO.getVal(), highRiskNeoDTO.getName(), nodeNeoDTO.getTermtype());
         highRiskList.add(billMsg);
     }
+
+    /**
+     * 返回诊断数据源(只留阳性诊断)
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDiseaseSource(WordCrfDTO wordCrfDTO) {
+        List<Item> diags = new ArrayList<>();
+        CoreUtil.addList(diags, wordCrfDTO.getDiag()); // 结构化诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getChiefLabel().getDiags());// 主诉诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getPresentLabel().getDiags()); // 现病史诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getPastLabel().getDiags()); // 既往史诊断
+        return diags;
+    }
+
+    /**
+     * 返回药品数据源
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDrugSource(WordCrfDTO wordCrfDTO) {
+        List<Item> drugAll = new ArrayList<>();
+        CoreUtil.addList(drugAll, wordCrfDTO.getDrug());
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getChiefLabel().getMedicines()); // 主诉药品
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPresentLabel().getMedicines());// 现病史药品
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPastLabel().getMedicines()); // 既往史药品
+        return drugAll;
+    }
+
+    /**
+     * 返回药品过敏数据源
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDrugAllergySource(WordCrfDTO wordCrfDTO) {
+        List<Item> drugAllergyAll = new ArrayList<>();
+        CoreUtil.addAllConvert(drugAllergyAll, wordCrfDTO.getPastLabel().getAllergyMedicines()); // 既往史过敏药品
+        return drugAllergyAll;
+    }
+
 }

+ 4 - 8
src/main/java/com/diagbot/rule/DrugRule.java

@@ -4,7 +4,6 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.BillNeoMaxDTO;
 import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.enums.RedisEnum;
-import com.diagbot.model.entity.Negative;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.MsgUtil;
@@ -53,13 +52,10 @@ public class DrugRule {
                 }
             }
             for (T d : inputList) {
-                Negative val = (Negative) CoreUtil.getFieldValue(d, "negative");
-                if (val == null) {
-                    String standName = (String) CoreUtil.getFieldValue(d, "standName");
-                    String name = (String) CoreUtil.getFieldValue(d, "name");
-                    if (StringUtils.isNotBlank(standName) && allDrug.contains(standName)) {
-                        old_stand.put(name, standName);
-                    }
+                String uniqueName = (String) CoreUtil.getFieldValue(d, "uniqueName");
+                String name = (String) CoreUtil.getFieldValue(d, "name");
+                if (StringUtils.isNotBlank(uniqueName) && allDrug.contains(uniqueName)) {
+                    old_stand.put(name, uniqueName);
                 }
             }
             if (old_stand.size() > 0) {

+ 15 - 14
src/main/java/com/diagbot/util/CoreUtil.java

@@ -4,7 +4,7 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.model.entity.Clinical;
-import com.diagbot.model.entity.Diag;
+import com.diagbot.model.entity.Negative;
 import com.diagbot.model.entity.Usual;
 import com.diagbot.model.entity.Vital;
 import com.diagbot.model.label.VitalLabel;
@@ -785,13 +785,13 @@ public class CoreUtil {
     }
 
     /**
-     * 添加所有的Item
+     * 获取所有阳性【T】,转成Item结构,放入列表
      *
      * @param source
-     * @param diagList
+     * @param convertList
      */
-    public static void addAllDiag(List<Item> source, List<Diag> diagList) {
-        List<Item> other = diagConvertItem(diagList);
+    public static <T> void addAllConvert(List<Item> source, List<T> convertList) {
+        List<Item> other = convertItem(convertList);
         if (ListUtil.isEmpty(other)) {
             return ;
         }
@@ -802,19 +802,20 @@ public class CoreUtil {
     }
 
     /**
-     * 将Diag转成Item类型
+     * 将T(包含“negative”,“name”,“standName”字段)转成Item类型
      *
-     * @param diagList
+     * @param convertList
      * @return
      */
-    public static List<Item> diagConvertItem(List<Diag> diagList) {
+    public static <T> List<Item> convertItem(List<T> convertList) {
         List<Item> itemList = new ArrayList<>();
-        if (ListUtil.isNotEmpty(diagList)) {
-            for (Diag diag : diagList) {
-                if (diag.getNegative() == null) {
+        if (ListUtil.isNotEmpty(convertList)) {
+            for (T t : convertList) {
+                Negative negative = (Negative)CoreUtil.getFieldValue(t, "negative");
+                if (negative == null) {
                     Item item = new Item();
-                    item.setName(diag.getName());
-                    item.setUniqueName(diag.getStandName());
+                    item.setName((String)CoreUtil.getFieldValue(t, "name"));
+                    item.setUniqueName((String)CoreUtil.getFieldValue(t, "standName"));
                     itemList.add(item);
                 }
             }
@@ -842,7 +843,7 @@ public class CoreUtil {
      * @param addList
      * @param <T>
      */
-    public static <T> void addList(List<T> source, List<T> addList) {
+    public static <T> void addList(List<T> source, List<? extends T> addList) {
         if (source == null) {
             return ;
         }