Browse Source

诊断依据

zhoutg 4 năm trước cách đây
mục cha
commit
040eb6ad3f

+ 0 - 2
src/main/java/com/diagbot/enums/BaseDiagnoseTypeEnum.java

@@ -2,14 +2,12 @@ package com.diagbot.enums;
 
 import com.diagbot.core.KeyedNamed;
 import lombok.Setter;
-import org.springframework.stereotype.Component;
 
 /**
  * @author zhoutg
  * @Description: 类型枚举
  * @date 2018年10月11日 下午3:33:22
  */
-@Component
 public enum BaseDiagnoseTypeEnum implements KeyedNamed {
 
     equals(1, "等于术语本身"),

+ 78 - 5
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -14,6 +14,7 @@ import com.diagbot.model.ai.AIAnalyze;
 import com.diagbot.model.entity.BodyPart;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Modification;
+import com.diagbot.model.entity.Operation;
 import com.diagbot.model.entity.Pacs;
 import com.diagbot.model.entity.Vital;
 import com.diagbot.model.label.ChiefLabel;
@@ -71,7 +72,6 @@ public class CommonFacade {
 
     //组装好的label
     public WordCrfDTO crf_process(SearchData searchData) {
-
         AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
         WordCrfDTO wordCrfDTO = new WordCrfDTO();
         wordCrfDTO.setHospitalId(searchData.getHospitalId());
@@ -268,8 +268,8 @@ public class CommonFacade {
         VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
 
         // 【症状回填】
-//        CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
-//        CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
+        CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
+        CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
 
         // 【诊断回填】
         // 1、主诉诊断
@@ -370,7 +370,7 @@ public class CommonFacade {
                 chiefSymptom = chiefLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z -> z.getStandName()).collect(Collectors.toList());
                 List<Symptom> cjiefClinicals = chiefLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
                 {
-                    String name_sy = z.getBodyPart() == null? z.getStandName() : z.getBodyPart().getName()+z.getStandName();
+                    String name_sy = z.getBodyPart() == null ? z.getStandName() : z.getBodyPart().getName() + z.getStandName();
                     Symptom symptom = new Symptom();
                     symptom.setName(name_sy);
                     return symptom;
@@ -403,7 +403,7 @@ public class CommonFacade {
                 List<Symptom> presentClinicals = presentLabel.getClinicals().stream()
                         .filter(x -> x.getNegative() == null).map(z ->
                         {
-                            String name_sy = z.getBodyPart() == null? z.getStandName() : z.getBodyPart().getName()+z.getStandName();
+                            String name_sy = z.getBodyPart() == null ? z.getStandName() : z.getBodyPart().getName() + z.getStandName();
                             Symptom symptom = new Symptom();
                             symptom.setName(name_sy);
                             return symptom;
@@ -709,5 +709,78 @@ public class CommonFacade {
         }
         return ruleExtDTO;
     }
+
+    /**
+     * 获取【手术数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Operation> getOperationSource(WordCrfDTO wordCrfDTO) {
+        List<Operation> operationSource = new ArrayList<>();
+        List<Item> operation = wordCrfDTO.getOperation();
+        List<Operation> operationsItem = new ArrayList<>();
+        for (Item item : operation) {
+            Operation operaData = new Operation();
+            operaData.setName(item.getName());
+            operaData.setStandName(item.getUniqueName());
+            operationsItem.add(operaData);
+        }
+        CoreUtil.addList(operationSource, wordCrfDTO.getChiefLabel().getOperations()); // 主诉手术
+        CoreUtil.addList(operationSource, wordCrfDTO.getPresentLabel().getOperations()); // 现病史手术
+        CoreUtil.addList(operationSource, wordCrfDTO.getPastLabel().getOperations()); // 既往史手术
+        CoreUtil.addList(operationSource, operationsItem); // 结构化手术
+        return operationSource;
+    }
+
+    /**
+     * 获取【药品过敏数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDrugAllergySource(WordCrfDTO wordCrfDTO) {
+        List<Item> drugAllergyAll = new ArrayList<>();
+        CoreUtil.addAllConvert(drugAllergyAll, wordCrfDTO.getPastLabel().getAllergyMedicines()); // 既往史过敏药品
+        return drugAllergyAll;
+    }
+
+    /**
+     * 获取【临床表现数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Clinical> getClinicalSource(WordCrfDTO wordCrfDTO) {
+        List<Clinical> clinicSource = new ArrayList<>();
+        CoreUtil.addList(clinicSource, wordCrfDTO.getChiefLabel().getClinicals()); // 主诉临床表现
+        CoreUtil.addList(clinicSource, wordCrfDTO.getPresentLabel().getClinicals()); // 现病史临床表现
+        return clinicSource;
+    }
+
+    /**
+     * 获取【诊断数据源】(只留阳性诊断)
+     *
+     * @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;
+    }
 }
 

+ 2 - 5
src/main/java/com/diagbot/facade/IndicationFacade.java

@@ -5,7 +5,6 @@ import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.rule.CommonRule;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.IndicationPushVO;
@@ -38,8 +37,6 @@ public class IndicationFacade {
     @Autowired
     StandConvertServiceClient standConvertServiceClient;
     @Autowired
-    CommonRule commonRule;
-    @Autowired
     KlRegularConfigFacade klRegularConfigFacade;
 
     private static final Map<String, List<String>> methodMap;
@@ -100,8 +97,8 @@ public class IndicationFacade {
         wordCrfDTO = klRegularConfigFacade.getRegularConfigs(wordCrfDTO, indicationPushVO);
         //正则匹配结束
         // 合并【数据来源】
-        wordCrfDTO.setDiagSource(commonRule.getDiseaseSource(wordCrfDTO));
-        wordCrfDTO.setDrugSource(commonRule.getDrugSource(wordCrfDTO));
+        wordCrfDTO.setDiagSource(commonFacade.getDiseaseSource(wordCrfDTO));
+        wordCrfDTO.setDrugSource(commonFacade.getDrugSource(wordCrfDTO));
 
         try {
             Map<String, Object> invokeParams = new HashMap<>();

+ 21 - 47
src/main/java/com/diagbot/process/BillProcess.java

@@ -16,10 +16,6 @@ import com.diagbot.facade.CommonFacade;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Operation;
-import com.diagbot.model.label.ChiefLabel;
-import com.diagbot.model.label.PacsLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
 import com.diagbot.rule.AgeRule;
 import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.DrugRule;
@@ -30,12 +26,10 @@ import com.diagbot.rule.PacsRule;
 import com.diagbot.rule.SexRule;
 import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
-import com.diagbot.util.CoreUtil;
 import com.diagbot.vo.RuleVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
@@ -75,6 +69,25 @@ public class BillProcess {
     public void processRule(List<RuleVO> ruleVOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
         List<BillMsg> billMsgList = indicationDTO.getBillMsgList();
         Set<String> set = new LinkedHashSet<>();    // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+        /**---------------------------数据统一处理开始--------------------------------- */
+        // 【过敏药品数据来源】
+        List<Item> allergyMedicines = commonFacade.getDrugAllergySource(wordCrfDTO);
+
+        // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
+        List<Item> medicineAll = wordCrfDTO.getDrugSource();
+
+        // 【诊断数据来源】
+        List<Item> diags = wordCrfDTO.getDiagSource();
+
+        // 【辅检结果数据来源】
+        List<Item> pacsDescList = wordCrfDTO.getPacsLabel().getRes();
+
+        // 【手术数据来源】
+        List<Operation> operationsSource = commonFacade.getOperationSource(wordCrfDTO);
+
+        // 【临床表现数据来源】(主诉、现病史)
+        List<Clinical> clinicals = commonFacade.getClinicalSource(wordCrfDTO);
+        /**---------------------------数据统一处理结束--------------------------------- */
         for (RuleVO ruleVO : ruleVOList) {
             /** 1、获取开单项相关数据 */
             RuleExtDTO ruleExtDTO = commonFacade.getRuleData(ruleVO);
@@ -86,46 +99,7 @@ public class BillProcess {
             RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
             BeanUtil.copyProperties(ruleExtDTO, ruleSimpleDTO);
 
-            /**---------------------------3、数据统一处理开始--------------------------------- */
-            ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
-            PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
-            PastLabel pastLabel = wordCrfDTO.getPastLabel();
-
-            // 【过敏药品数据来源】
-            List<Item> allergyMedicines = commonRule.getDrugAllergySource(wordCrfDTO);
-
-            // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
-            List<Item> medicineAll = wordCrfDTO.getDrugSource();
-
-            // 【诊断数据来源】
-            List<Item> diags = wordCrfDTO.getDiagSource();
-
-            // 【辅检结果数据来源】
-            PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
-            List<Item> pacsDescList = pacsLabel.getRes();
-
-            // 【手术数据来源】
-            List<Operation> operations_all = new ArrayList<>();
-            List<Item> operation = wordCrfDTO.getOperation();
-            List<Operation> operationsItem = new ArrayList<>();
-            for (Item item : operation) {
-                Operation operaData = new Operation();
-                operaData.setName(item.getName());
-                operaData.setStandName(item.getUniqueName());
-                operationsItem.add(operaData);
-            }
-            CoreUtil.addList(operations_all, chiefLabel.getOperations()); // 主诉手术
-            CoreUtil.addList(operations_all, presentLabel.getOperations()); // 现病史手术
-            CoreUtil.addList(operations_all, pastLabel.getOperations()); // 既往史手术
-            CoreUtil.addList(operations_all, operationsItem); // 结构化手术
-
-            // 【临床表现数据来源】(主诉、现病史)
-            List<Clinical> clinicals = new ArrayList<>();
-            CoreUtil.addList(clinicals, chiefLabel.getClinicals()); // 主诉临床表现
-            CoreUtil.addList(clinicals, presentLabel.getClinicals()); // 现病史临床表现
-            /**---------------------------数据统一处理结束--------------------------------- */
-
-            /** 4、规则处理 */
+            /** 3、规则处理 */
             List<RuleConditionDTO> ruleConditionDTOList = ruleExtDTO.getRuleConditionDTOList();
             for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
                 List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
@@ -162,7 +136,7 @@ public class BillProcess {
                                         commonRule.compareNameWithBill(clinicals, ruleBaseDTO, billMsgList, ConEnum.clinicfindings.getName(), ruleSimpleDTO);
                                         break;
                                     case Operation: // 手术(既往史、现病史、医嘱手术)
-                                        commonRule.compareNameWithBill(operations_all, ruleBaseDTO, billMsgList, ConEnum.operations.getName(), ruleSimpleDTO);
+                                        commonRule.compareNameWithBill(operationsSource, ruleBaseDTO, billMsgList, ConEnum.operations.getName(), ruleSimpleDTO);
                                         break;
                                     case Medicine:
                                     case MedChemClass:

+ 4 - 32
src/main/java/com/diagbot/process/PushProcess.java

@@ -30,17 +30,12 @@ import com.diagbot.facade.KlRelationFacade;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.facade.TranLisConfigIcssFacade;
 import com.diagbot.model.entity.Clinical;
-import com.diagbot.model.entity.Operation;
-import com.diagbot.model.label.ChiefLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
 import com.diagbot.rule.AgeRule;
 import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.GroupRule;
 import com.diagbot.rule.LisRule;
 import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
-import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
 import com.diagbot.vo.DiagnoseVO;
@@ -396,33 +391,8 @@ public class PushProcess {
         List<Long> baseIdList = new ArrayList<>();
 
         /**---------------------------数据统一处理开始--------------------------------- */
-        ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
-        PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
-        PastLabel pastLabel = wordCrfDTO.getPastLabel();
-        // 【过敏药品数据来源】
-        List<Item> allergyMedicines = commonRule.getDrugAllergySource(wordCrfDTO);
-        // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
-        List<Item> medicineAll = wordCrfDTO.getDrugSource();
-        // 【诊断数据来源】
-        List<Item> diags = wordCrfDTO.getDiagSource();
-        // 【手术数据来源】
-        List<Operation> operations_all = new ArrayList<>();
-        List<Item> operation = wordCrfDTO.getOperation();
-        List<Operation> operationsItem = new ArrayList<>();
-        for (Item item : operation) {
-            Operation operaData = new Operation();
-            operaData.setName(item.getName());
-            operaData.setStandName(item.getUniqueName());
-            operationsItem.add(operaData);
-        }
-        CoreUtil.addList(operations_all, chiefLabel.getOperations()); // 主诉手术
-        CoreUtil.addList(operations_all, presentLabel.getOperations()); // 现病史手术
-        CoreUtil.addList(operations_all, pastLabel.getOperations()); // 既往史手术
-        CoreUtil.addList(operations_all, operationsItem); // 结构化手术
         // 【临床表现数据来源】(主诉、现病史)
-        List<Clinical> clinicals = new ArrayList<>();
-        CoreUtil.addList(clinicals, chiefLabel.getClinicals()); // 主诉临床表现
-        CoreUtil.addList(clinicals, presentLabel.getClinicals()); // 现病史临床表现
+        List<Clinical> clinicals = commonFacade.getClinicalSource(wordCrfDTO);
         /**---------------------------数据统一处理结束--------------------------------- */
 
         // TODO 规则处理
@@ -438,9 +408,11 @@ public class PushProcess {
                             break;
                         case VitalResult: // 体格检查结果
                             break;
-                        case Disease: // 疾病
+                        case Disease: // 疾病【病史】
+                            commonRule.compareNameWithPush(wordCrfDTO.getPastLabel().getDiags(), ruleBaseDTO, baseIdList, baseIds);
                             break;
                         case Group: // 人群
+                            groupRule.push(wordCrfDTO, ruleBaseDTO, baseIdList, baseIds);
                             break;
                         case PacsResult: // 辅助检查结果
                             commonRule.compareItemWithPush(wordCrfDTO.getPacsLabel().getRes(), ruleBaseDTO, baseIdList, baseIds);

+ 1 - 36
src/main/java/com/diagbot/rule/CommonRule.java

@@ -432,44 +432,9 @@ public class CommonRule {
         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;
-    }
+
 
     public static void main(String[] args) {
         List<Pacs> pacsList = new ArrayList<>();

+ 16 - 1
src/main/java/com/diagbot/rule/GroupRule.java

@@ -39,7 +39,7 @@ public class GroupRule {
      */
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Map map = rule(wordCrfDTO, ruleBaseDTO);
-        if ((Boolean)map.get("flag")) {
+        if (CoreUtil.getMapFlag(map)) {
             BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                     ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
                     ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
@@ -47,6 +47,21 @@ public class GroupRule {
         }
     }
 
+    /**
+     * 人群推送
+     *
+     * @param wordCrfDTO
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        Map map = rule(wordCrfDTO, ruleBaseDTO);
+        if (CoreUtil.getMapFlag(map)) {
+            CoreUtil.addSplitString(baseIdList, ids);
+        }
+    }
+
     /**
      * 人群规则判断
      *