ソースを参照

Merge branch 'dev/orderRuleAndIndex20210127' into dev/neo2mysql20210120

# Conflicts:
#	src/main/resources/application-dev.yml
#	src/main/resources/application-local.yml
#	src/main/resources/application-pre.yml
#	src/main/resources/application-pro.yml
#	src/main/resources/application-test.yml
gaodm 4 年 前
コミット
0eaf52eea5

+ 4 - 0
src/main/java/com/diagbot/aggregate/IndicationTestAggregate.java

@@ -77,6 +77,10 @@ public class IndicationTestAggregate {
         Map<String, Object> otherTransfusionMap = testFacade.testOtherTipTransfusion(file, new TestLineVO());
         map.put("【其他值提醒_输血】",otherTransfusionMap);
 
+        file = testFacade.getMulFileByPath(mapPath.get("【检查结果与项目重复开立规则】"));
+        Map<String, Object> pacsOrderNeedlessMap = testFacade.testPacsOrderNeedlessProcess(file, new TestLineVO());
+        map.put("【检查结果与项目重复开立规则】",pacsOrderNeedlessMap);
+
         return map;
     }
 

+ 5 - 0
src/main/java/com/diagbot/dto/BillNeoMaxDTO.java

@@ -22,6 +22,9 @@ public class BillNeoMaxDTO {
 
     // 类型
     private String type;
+
+    // 日期
+    private String dateValue;
     /****************扩展数据结束******************/
 
     // 禁忌性别
@@ -69,4 +72,6 @@ public class BillNeoMaxDTO {
     // 互斥开单辅助检查
     private List<NodeNeoDTO> pacsOrder = new ArrayList<>();
 
+    // 无需重复辅检开单项
+    private List<NodeNeoDTO> needlessPacsOrder = new ArrayList<>();
 }

+ 3 - 0
src/main/java/com/diagbot/dto/NodeNeoDTO.java

@@ -23,6 +23,9 @@ public class NodeNeoDTO {
     // 名称
     private String name;
 
+    // 正则规则
+    private String regex;
+
     // 类型
     private String termtype;
 

+ 3 - 0
src/main/java/com/diagbot/dto/PacsBillNeoDTO.java

@@ -54,4 +54,7 @@ public class PacsBillNeoDTO {
     // 禁用辅助检查描述
     private List<NodeNeoDTO> pacsDesc = new ArrayList<>();
 
+    // 无需重复辅检开单项
+    private List<NodeNeoDTO> needlessPacsOrder = new ArrayList<>();
+
 }

+ 20 - 0
src/main/java/com/diagbot/entity/node/NeedlessOrder.java

@@ -0,0 +1,20 @@
+package com.diagbot.entity.node;
+
+import com.diagbot.entity.node.base.BaseNode;
+import com.diagbot.entity.relationship.PacsNameNeedlessItem;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.NodeEntity;
+import org.neo4j.ogm.annotation.Relationship;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Setter
+@Getter
+@NodeEntity(label = "无需重复开单项")
+public class NeedlessOrder extends BaseNode  {
+
+	@Relationship(type = "辅助检查名称无需重复开单项", direction = Relationship.INCOMING)
+	private Set<PacsNameNeedlessItem> pacsNameNeedlessItems = new HashSet<>();
+}

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

@@ -58,6 +58,9 @@ public class PacsName extends BaseNode  {
 	@Relationship(type = "辅助检查名称禁忌开单项互斥", direction = Relationship.OUTGOING)
 	private Set<PacsNameBillConflictItem> pacsNameBillConflictItems = new HashSet<>();
 
+	@Relationship(type = "辅助检查名称无需重复开单项", direction = Relationship.OUTGOING)
+	private Set<PacsNameNeedlessItem> pacsNameNeedlessItems = new HashSet<>();
+
 //	@Relationship(type = "辅助检查名称开单互斥辅助检查名称", direction = Relationship.OUTGOING)
 //	private Set<PacsNamePacsName> conflictPacsName_out = new HashSet<>();
 //

+ 3 - 1
src/main/java/com/diagbot/entity/node/PacsSubName.java

@@ -1,6 +1,5 @@
 package com.diagbot.entity.node;
 
-import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.entity.node.base.BaseNode;
 import com.diagbot.entity.relationship.*;
 import lombok.Getter;
@@ -52,4 +51,7 @@ public class PacsSubName extends BaseNode  {
 	@Relationship(type = "辅助检查名称包含辅助检查子项目名称", direction = Relationship.INCOMING)
 	private Set<PacsNamePacsSubName> pacsNamePacsSubNames = new HashSet<>();
 
+	@Relationship(type = "辅助检查子项目名称无需重复开单项", direction = Relationship.OUTGOING)
+	private Set<PacsNameSubNeedlessItem> pacsNameSubNeedlessItems = new HashSet<>();
+
 }

+ 21 - 0
src/main/java/com/diagbot/entity/relationship/PacsNameNeedlessItem.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity.relationship;
+
+import com.diagbot.entity.node.NeedlessOrder;
+import com.diagbot.entity.node.PacsName;
+import com.diagbot.entity.relationship.base.BaseRelation;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.EndNode;
+import org.neo4j.ogm.annotation.RelationshipEntity;
+import org.neo4j.ogm.annotation.StartNode;
+
+@Getter
+@Setter
+@RelationshipEntity(type = "辅助检查名称无需重复开单项")
+public class PacsNameNeedlessItem extends BaseRelation {
+    @StartNode
+    private PacsName pacsName;
+
+    @EndNode
+    private NeedlessOrder needlessOrder;
+}

+ 21 - 0
src/main/java/com/diagbot/entity/relationship/PacsNameSubNeedlessItem.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity.relationship;
+
+import com.diagbot.entity.node.NeedlessOrder;
+import com.diagbot.entity.node.PacsSubName;
+import com.diagbot.entity.relationship.base.BaseRelation;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.EndNode;
+import org.neo4j.ogm.annotation.RelationshipEntity;
+import org.neo4j.ogm.annotation.StartNode;
+
+@Getter
+@Setter
+@RelationshipEntity(type = "辅助检查子项目名称无需重复开单项")
+public class PacsNameSubNeedlessItem extends BaseRelation {
+    @StartNode
+    private PacsSubName pacsName;
+
+    @EndNode
+    private NeedlessOrder needlessOrder;
+}

+ 44 - 0
src/main/java/com/diagbot/facade/TestFacade.java

@@ -1034,6 +1034,49 @@ public class TestFacade {
         return map;
     }
 
+    /**
+     * 检查结果与项目重复开立规则测试API
+     *
+     * @param file
+     */
+    public Map<String, Object> testPacsOrderNeedlessProcess(MultipartFile file, TestLineVO testLineVO) {
+        long start = System.currentTimeMillis();
+        List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
+        List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
+        for (TestIndicationVO bean : data) {
+            if (StringUtil.isNotEmpty(testLineVO.getIdNum()) && !testLineVO.getIdNum().equals(bean.getIdNum())) {
+                continue;
+            }
+            IndicationPushVO indicationPushVO = new IndicationPushVO();
+            indicationPushVO.setRuleType("2");
+            indicationPushVO.setIdNum(bean.getIdNum());
+            if (StringUtil.isNotBlank(bean.getPacsOrderName())) {
+                List<Pacs> pacsOrder = new ArrayList<>();
+                Pacs pacsBean = new Pacs();
+                pacsBean.setName(bean.getPacsOrderName());
+                pacsBean.setUniqueName(bean.getPacsOrderName());
+                pacsBean.setDateValue("2021-01-28 00:00:00");
+                pacsOrder.add(pacsBean);
+                indicationPushVO.setPacsOrder(pacsOrder);
+            }
+
+            List<Pacs> pacsList = new ArrayList<>();
+            Pacs pacsBean = new Pacs();
+            pacsBean.setName(bean.getPacsOrderName());
+            pacsBean.setUniqueName(bean.getPacsOrderName());
+            pacsBean.setResult(bean.getRuleContent());
+            pacsBean.setDateValue("2021-01-27 00:00:00");
+            pacsList.add(pacsBean);
+            indicationPushVO.setPacs(pacsList);
+            indicationPushVOList.add(indicationPushVO);
+        }
+
+        Map<String, Object> map = getDebugMap(indicationPushVOList, "2", start);
+        return map;
+    }
+
+
+
     /**
      * 提示方法
      *
@@ -1175,6 +1218,7 @@ public class TestFacade {
         mapPath.put("【高危手术整合】", path + File.separator + "【高危手术整合】.xlsx");
         mapPath.put("【开单合理性】", path + File.separator + "【开单合理性】.xlsx");
         mapPath.put("【开单合理性_输血】", path + File.separator + "【开单合理性_输血】.xlsx");
+        mapPath.put("【检查结果与项目重复开立规则】", path + File.separator + "【检查结果与项目重复开立规则】.xlsx");
         paramMap.put("mapPath", mapPath);
 
         try {

+ 27 - 0
src/main/java/com/diagbot/process/BillProcess.java

@@ -1,6 +1,7 @@
 package com.diagbot.process;
 
 import com.diagbot.biz.push.entity.Item;
+import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.BillNeoMaxDTO;
@@ -27,6 +28,7 @@ import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -159,6 +161,28 @@ public class BillProcess {
             System.out.println(billNeoMaxDTO);
             billNeoMaxDTOList.add(billNeoMaxDTO);
         }
+
+        // 辅检开单项时间赋值,用于规则【无需重复开单项】
+        // 由于mark之前返回的billNeoDTOList没有时间字段,就用辅检开单的原始数据name和uniqueName两个字段相同时
+        // 进行赋值。可能会存在多个相同的开单项,时间需要分别赋值:处理方式是时间只用一次,刚好可以对上
+        if (ListUtil.isNotEmpty(billNeoMaxDTOList) && ListUtil.isNotEmpty(wordCrfDTO.getPacsOrder())) {
+            List<Integer> useList = new ArrayList<>();
+            for (int i = 0; i < billNeoMaxDTOList.size(); i++) {
+                BillNeoMaxDTO billNeoMaxDTO = billNeoMaxDTOList.get(i);
+                for (int j = 0; j < wordCrfDTO.getPacsOrder().size(); j++) {
+                    Pacs pacs = wordCrfDTO.getPacsOrder().get(j);
+                    if (StringUtil.isNotBlank(pacs.getName()) && StringUtil.isNotBlank(pacs.getUniqueName())
+                            && pacs.getName().equals(billNeoMaxDTO.getOrderName())
+                            && pacs.getUniqueName().equals(billNeoMaxDTO.getOrderStandName())) {
+                        if (!useList.contains(j)) { // 判断使用标识
+                            billNeoMaxDTO.setDateValue(pacs.getDateValue());
+                            useList.add(j);
+                            break;
+                        }
+                    }
+                }
+            }
+        }
         processRule(billNeoMaxDTOList, wordCrfDTO, res);
     }
 
@@ -241,6 +265,9 @@ public class BillProcess {
 
             // 禁忌医疗器械及物品
             medEquRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.medEqu.getName());
+
+            // 无需重复开单项
+            commonRule.needlessRepeatOrder(wordCrfDTO, bill, billMsgList);
         }
 
         // 24小时重复开单项

+ 2 - 0
src/main/java/com/diagbot/repository/NodeInfo.java

@@ -20,4 +20,6 @@ public class NodeInfo {
     String typeval;
     // 匹配类型
     Integer matchtype;
+    // 正则规则
+    private String regex = "";
 }

+ 14 - 31
src/main/java/com/diagbot/repository/PacsNameNode.java

@@ -5,42 +5,12 @@ import com.diagbot.dto.PacsBillNeoDTO;
 import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.*;
 import com.diagbot.entity.relationship.*;
-import com.diagbot.entity.relationship.base.BaseRelation;
-import com.diagbot.entity.node.Allergen;
-import com.diagbot.entity.node.BillConflictItem;
-import com.diagbot.entity.node.ClinicalFinding;
-import com.diagbot.entity.node.ConflictDevice;
-import com.diagbot.entity.node.Disease;
-import com.diagbot.entity.node.Gender;
-import com.diagbot.entity.node.Group;
-import com.diagbot.entity.node.Lis;
-import com.diagbot.entity.node.MedAllergen;
-import com.diagbot.entity.node.OralMedicine;
-import com.diagbot.entity.node.PacsDescribe;
-import com.diagbot.entity.node.PacsName;
-import com.diagbot.entity.node.Vital;
-import com.diagbot.entity.relationship.PacsNameAllergen;
-import com.diagbot.entity.relationship.PacsNameBillConflictItem;
-import com.diagbot.entity.relationship.PacsNameClinicalFinding;
-import com.diagbot.entity.relationship.PacsNameConflictDevice;
-import com.diagbot.entity.relationship.PacsNameDisease;
-import com.diagbot.entity.relationship.PacsNameGender;
-import com.diagbot.entity.relationship.PacsNameGroup;
-import com.diagbot.entity.relationship.PacsNameLis;
-import com.diagbot.entity.relationship.PacsNameMedAllergen;
-import com.diagbot.entity.relationship.PacsNameOralMedicine;
-import com.diagbot.entity.relationship.PacsNamePacsDescribe;
-import com.diagbot.entity.relationship.PacsNameVital;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Component
@@ -78,6 +48,19 @@ public class PacsNameNode {
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
         NodeInfo nodeInfo;
 
+        Set<PacsNameNeedlessItem> pacsNameNeedlessItems = pacs.getPacsNameNeedlessItems();
+        for (PacsNameNeedlessItem pacsNameNeedlessItem : pacsNameNeedlessItems) {
+            if (NeoUtil.isExist(pacsNameNeedlessItem)) {
+                if (NeoUtil.isExist(pacsNameNeedlessItem.getNeedlessOrder())) {
+                    nodeInfo = new NodeInfo();
+                    nodeInfo.setName(pacsNameNeedlessItem.getNeedlessOrder().getName());
+                    nodeInfo.setRegex(pacsNameNeedlessItem.getNeedlessOrder().getName());
+                    pacsBillNeoDTO.getNeedlessPacsOrder().add(NeoUtil.updateNodeInfo(nodeInfo));
+                }
+            }
+        }
+
+
 
         PacsNameGender pacsNamegender = pacs.getPacsNameGender();
         if (NeoUtil.isExist(pacsNamegender)) {

+ 13 - 23
src/main/java/com/diagbot/repository/PacsSubNameNode.java

@@ -2,29 +2,8 @@ package com.diagbot.repository;
 
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
-import com.diagbot.entity.node.Allergen;
-import com.diagbot.entity.node.ClinicalFinding;
-import com.diagbot.entity.node.ConflictDevice;
-import com.diagbot.entity.node.Disease;
-import com.diagbot.entity.node.Gender;
-import com.diagbot.entity.node.Group;
-import com.diagbot.entity.node.Lis;
-import com.diagbot.entity.node.MedAllergen;
-import com.diagbot.entity.node.OralMedicine;
-import com.diagbot.entity.node.PacsDescribe;
-import com.diagbot.entity.node.PacsSubName;
-import com.diagbot.entity.node.Vital;
-import com.diagbot.entity.relationship.PacsSubNameAllergen;
-import com.diagbot.entity.relationship.PacsSubNameClinicalFinding;
-import com.diagbot.entity.relationship.PacsSubNameConflictDevice;
-import com.diagbot.entity.relationship.PacsSubNameDisease;
-import com.diagbot.entity.relationship.PacsSubNameGender;
-import com.diagbot.entity.relationship.PacsSubNameGroup;
-import com.diagbot.entity.relationship.PacsSubNameLis;
-import com.diagbot.entity.relationship.PacsSubNameMedAllergen;
-import com.diagbot.entity.relationship.PacsSubNameOralMedicine;
-import com.diagbot.entity.relationship.PacsSubNamePacsDescribe;
-import com.diagbot.entity.relationship.PacsSubNameVital;
+import com.diagbot.entity.node.*;
+import com.diagbot.entity.relationship.*;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,6 +49,17 @@ public class PacsSubNameNode {
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
         NodeInfo nodeInfo;
 
+        Set<PacsNameSubNeedlessItem> pacsNameNeedlessItems = pacs.getPacsNameSubNeedlessItems();
+        for (PacsNameSubNeedlessItem pacsNameNeedlessItem : pacsNameNeedlessItems) {
+            if (NeoUtil.isExist(pacsNameNeedlessItem)) {
+                if (NeoUtil.isExist(pacsNameNeedlessItem.getNeedlessOrder())) {
+                    nodeInfo = new NodeInfo();
+                    nodeInfo.setName(pacsNameNeedlessItem.getNeedlessOrder().getName());
+                    nodeInfo.setRegex(pacsNameNeedlessItem.getNeedlessOrder().getName());
+                    pacsBillNeoDTO.getNeedlessPacsOrder().add(NeoUtil.updateNodeInfo(nodeInfo));
+                }
+            }
+        }
 
         PacsSubNameGender pacsSubNameGender = pacs.getPacsSubNameGender();
         if (NeoUtil.isExist(pacsSubNameGender)) {

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

@@ -25,14 +25,28 @@ public interface YiBaoDiseaseNameRepository extends Neo4jRepository<YiBaoDisease
             "AND (toLower(n.`name`) = toLower($name)  OR  toLower(n.`拼音编码`) = toLower($pycode))\n" +
             "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
             "UNION\n" +
+            "MATCH (n:`医保疾病名称`)-[r:`医保疾病名称相关医保ICD-10代码`]-(m:医保ICD_10代码) WHERE n.`静态知识标识` = $isKL \n" +
+            "AND toLower(m.`name`) = toLower($name)\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
+            "UNION\n" +
             "MATCH (n:`医保疾病名称`) WHERE n.`静态知识标识` = $isKL \n" +
             "AND (toLower(n.`name`) STARTS WITH toLower($name) OR toLower(n.`拼音编码`) STARTS WITH toLower($pycode))\n" +
             "WITH n SKIP 0 LIMIT $size\n" +
             "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
             "UNION \n" +
+            "MATCH (n:`医保疾病名称`)-[r:`医保疾病名称相关医保ICD-10代码`]-(m:医保ICD_10代码) WHERE n.`静态知识标识` = $isKL \n" +
+            "AND toLower(m.`name`) STARTS WITH toLower($name) \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
+            "UNION \n" +
             "MATCH (n:`医保疾病名称`) WHERE n.`静态知识标识` = $isKL  \n" +
             "AND (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode))  \n" +
             "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n"+
+            "UNION \n" +
+            "MATCH (n:`医保疾病名称`)-[r:`医保疾病名称相关医保ICD-10代码`]-(m:医保ICD_10代码) WHERE n.`静态知识标识` = $isKL \n" +
+            "AND toLower(m.`name`) CONTAINS toLower($name)   \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
             "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
     List<YiBaoDiseaseName> staticKnowledgeIndex(@Param("isKL") Integer isKL, @Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
 

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

@@ -28,6 +28,8 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 /**
@@ -109,6 +111,95 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 无需重复开单项
+     *
+     * @param wordCrfDTO
+     * @param billNeoMaxDTO
+     * @param billMsgList
+     */
+    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, BillNeoMaxDTO billNeoMaxDTO, List<BillMsg> billMsgList) {
+        List<NodeNeoDTO> needlessPacsOrder = billNeoMaxDTO.getNeedlessPacsOrder();
+        String orderStandName = billNeoMaxDTO.getOrderStandName();
+        for (NodeNeoDTO nodeNeoDTO : needlessPacsOrder) {
+            Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
+            List<Pacs> pacsList = map.get(orderStandName);
+            if (ListUtil.isNotEmpty(pacsList)) {
+                sortByProperty(pacsList, "dateValue");
+                Pacs pacs = pacsList.get(pacsList.size() - 1);
+                String result = pacs.getResult();
+                if (StringUtil.isNotBlank(result) && StringUtil.isNotBlank(nodeNeoDTO.getRegex())
+                        && getRegexRes(result, nodeNeoDTO.getRegex())) {
+                    String dateValue = pacs.getDateValue(); // 结果日期
+                    String orderDateValue = billNeoMaxDTO.getDateValue(); // 开单项日期
+                    if (StringUtil.isNotBlank(dateValue) && StringUtil.isNotBlank(orderDateValue)) {
+                        Date dateValueDate = CatalogueUtil.parseStringDate(dateValue);
+                        Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
+                        if (dateValueDate != null && orderDateValueDate != null) {
+                            if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7)) {
+                                BillMsg commonBillMsg = MsgUtil.getNeedlessRepeatOrderMsg(
+                                        billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
+                                        pacs.getName(), billNeoMaxDTO.getType());
+                                billMsgList.add(commonBillMsg);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 是否有符合的数据(公共方法)
+     *
+     * @param content 文本内容
+     * @param regex   表达式
+     * @return
+     */
+    public Boolean getRegexRes(String content, String regex) {
+        // 是否有符合的数据
+        try {
+            if (StringUtil.isBlank(content) || StringUtil.isBlank(regex)) {
+                return false;
+            }
+            Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
+            Matcher matcher = pattern.matcher(content);
+            if (matcher.find()) {
+                return true;
+            }
+        } catch (Exception e) {
+            return false;
+        }
+        return false;
+    }
+
+    /**
+     * 根据指定字段按照字符串排序
+     *
+     * @param tList
+     * @param property
+     * @param <T>
+     */
+    public <T> void sortByProperty(List<T> tList, String property) {
+        if (ListUtil.isNotEmpty(tList) && tList.size() > 1) {
+            // items 按照时间排序
+            Collections.sort(tList, new Comparator<T>() {
+                @Override
+                public int compare(T o1, T o2) {
+                    String o1Str = (String) CoreUtil.getFieldValue(o1, property);
+                    String o2Str = (String) CoreUtil.getFieldValue(o2, property);
+                    if (StringUtil.isBlank(o1Str)) {
+                        return -1;
+                    }
+                    if (StringUtil.isBlank(o2Str)) {
+                        return 1;
+                    }
+                    return o1Str.compareTo(o2Str);
+                }
+            });
+        }
+    }
+
     /**
      * 24小时重复开单总入口
      *
@@ -206,7 +297,7 @@ public class CommonRule {
                                 if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
                                     String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
-                                    BillMsg commonBillMsg = MsgUtil.getBillMsg24Repeat(
+                                    BillMsg commonBillMsg = MsgUtil.getBill24RepeatMsg(
                                             name, uniqueName, name, type);
                                     billMsgList.add(commonBillMsg);
                                     break;
@@ -285,4 +376,29 @@ public class CommonRule {
         return drugAllergyAll;
     }
 
+    public static void main(String[] args) {
+        List<Pacs> pacsList = new ArrayList<>();
+        Pacs pacs = new Pacs();
+        pacs.setName("d1");
+        pacs.setDateValue("2020-01-01");
+        pacsList.add(pacs);
+
+        Pacs pacs1 = new Pacs();
+        pacs1.setName("d2");
+        pacs1.setDateValue("2020-01-07");
+        pacsList.add(pacs1);
+
+        Pacs pacs3 = new Pacs();
+        pacs3.setName("d3");
+        pacs3.setDateValue("2020-01-09");
+        pacsList.add(pacs3);
+        CommonRule commonRule = new CommonRule();
+        commonRule.sortByProperty(pacsList, "dateValue");
+        for (Pacs bean : pacsList) {
+            System.out.println(bean.getName());
+        }
+
+
+    }
+
 }

+ 22 - 1
src/main/java/com/diagbot/util/MsgUtil.java

@@ -190,7 +190,7 @@ public class MsgUtil {
      * @param type 类型
      * @return
      */
-    public static BillMsg getBillMsg24Repeat(String orderName, String orderStandName, String content, String type) {
+    public static BillMsg getBill24RepeatMsg(String orderName, String orderStandName, String content, String type) {
         BillMsg billMsg = new BillMsg();
         String msg = String.format("%s重复开立", orderName);
         billMsg.setMsg(msg);
@@ -201,6 +201,27 @@ public class MsgUtil {
         return billMsg;
     }
 
+    /**
+     * 无需重复辅检开单项
+     *
+     * @param orderName 原开单项
+     * @param orderStandName 标准开单项
+     * @param content 匹配内容
+     * @param type 类型
+     * @return
+     */
+    public static BillMsg getNeedlessRepeatOrderMsg(String orderName, String orderStandName, String content, String type) {
+        BillMsg billMsg = new BillMsg();
+        String msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
+        billMsg.setMsg(msg);
+        billMsg.setOrderName(orderName);
+        billMsg.setOrderStandName(orderStandName);
+        billMsg.setContent(content);
+        billMsg.setType(type);
+        return billMsg;
+    }
+
+
     /**
      * 开单合理性禁忌医疗器械及物品提示信息
      *

+ 2 - 2
src/main/java/com/diagbot/util/NeoUtil.java

@@ -3,7 +3,6 @@ package com.diagbot.util;
 import com.alibaba.fastjson.JSONObject;
 import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.dto.PushBaseDTO;
-import com.diagbot.entity.node.Vital;
 import com.diagbot.entity.node.YiBaoDiseaseName;
 import com.diagbot.entity.node.base.BaseNode;
 import com.diagbot.entity.relationship.YiBaoDiseaseNameLisBigName;
@@ -14,7 +13,6 @@ import com.diagbot.entity.relationship.base.BaseRelation;
 import com.diagbot.model.entity.PD;
 import com.diagbot.repository.Constants;
 import com.diagbot.repository.NodeInfo;
-import com.diagbot.repository.datautil;
 import org.apache.commons.lang3.StringUtils;
 
 import java.math.BigDecimal;
@@ -33,6 +31,8 @@ public class NeoUtil {
 //        name = datautil.removekey(name, Constants.conflict);
         nodeNeoDTO.setName(name);
 
+        nodeNeoDTO.setRegex(nodeInfo.getRegex());
+
         BigDecimal min = nodeInfo.getMinval();
         if (null!=min) {
             nodeNeoDTO.setMin(min);

+ 4 - 0
src/main/java/com/diagbot/vo/TestIndicationVO.java

@@ -248,4 +248,8 @@ public class TestIndicationVO implements Serializable {
 
     @Excel(name="状态")
     private String status;
+    @Excel(name="辅助检查名称")
+    private String pacsOrderName;
+    @Excel(name="正常规则")
+    private String ruleContent;
 }

+ 8 - 0
src/main/java/com/diagbot/web/TestController.java

@@ -146,6 +146,14 @@ public class TestController {
         return RespDTO.onSuc(testFacade.testHighRiskProcess(file, testLineVO));
     }
 
+    @ApiOperation(value = "检查结果与项目重复开立规则测试API[zhoutg]",
+            notes = "idNum:指定行测试<br>" +
+                    "sheetIndex:sheet的下标,默认为0,表示第一个sheet")
+    @PostMapping("/testPacsOrderNeedlessProcess")
+    public RespDTO<Map<String, Object>> testPacsOrderNeedlessProcess(@RequestParam("file") MultipartFile file, TestLineVO testLineVO) {
+        return RespDTO.onSuc(testFacade.testPacsOrderNeedlessProcess(file, testLineVO));
+    }
+
     @ApiOperation(value = "批量测试[zhoutg]", notes = "参数:目录所在路径,示例:D:\\newSVN\\2020新版CDSS\\05.其他资料\\数据")
     @PostMapping("/testAll")
     public RespDTO<Map<String, Object>> testAll(TestAllVO testAllVO) {