zhoutg 4 лет назад
Родитель
Сommit
51abdeb79d

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

@@ -28,4 +28,7 @@ public class NodeNeoDTO {
 
     // 取值类型(0:正常取区间,1:取两头)
     private Integer valType = 0;
+
+    // 匹配方式 0:精确匹配,1:包含匹配
+    private int exactMatch = 0;
 }

+ 23 - 14
src/main/java/com/diagbot/rule/CommonRule.java

@@ -40,8 +40,8 @@ public class CommonRule {
     /**
      * 比较界面元素是否在图谱中存在(匹配名称)
      *
-     * @param neoList 图谱结构
-     * @param inputLises 界面元素
+     * @param neoList       图谱结构
+     * @param inputLises    界面元素
      * @param billNeoMaxDTO 开单项名称,开单项标准名称
      * @return
      */
@@ -73,20 +73,27 @@ public class CommonRule {
     /**
      * 比较界面元素是否在图谱中存在(匹配名称)
      *
-     * @param neoList 图谱结构
-     * @param input 界面元素
+     * @param neoList       图谱结构
+     * @param input         界面元素
      * @param billNeoMaxDTO 开单项名称,开单项标准名称
      * @return
      */
     public <T> void compareItemWithBill(List<NodeNeoDTO> neoList, List<T> input, BillNeoMaxDTO billNeoMaxDTO, List<BillMsg> billMsgList, String type) {
         Map<String, String> old_stand = new HashMap<>();
         if (ListUtil.isNotEmpty(neoList) && ListUtil.isNotEmpty(input)) {
-            List<String> neoName = neoList.stream().map(x -> x.getName()).collect(Collectors.toList());
             for (T d : input) {
                 String c = (String) CoreUtil.getFieldValue(d, "uniqueName");
                 String c_name = (String) CoreUtil.getFieldValue(d, "name");
-                if (StringUtils.isNotBlank(c) && neoName.contains(c)) {
-                    old_stand.put(c_name, c);
+                for (NodeNeoDTO nodeNeoDTO : neoList) {
+                    if (nodeNeoDTO.getExactMatch() == 0) { // 精确匹配
+                        if (StringUtils.isNotBlank(c) && c.equals(nodeNeoDTO.getName())) {
+                            old_stand.put(c_name, c);
+                        }
+                    } else { // 模糊匹配
+                        if (StringUtils.isNotBlank(c) && c.contains(nodeNeoDTO.getName())) {
+                            old_stand.put(c_name, c);
+                        }
+                    }
                 }
             }
             if (old_stand.size() > 0) {
@@ -161,7 +168,7 @@ public class CommonRule {
      */
     public <T> void repeat24BillWithType(List<BillMsg> billMsgList, List<T> itemList, String type) {
         if (ListUtil.isEmpty(itemList)) {
-            return ;
+            return;
         }
         Map<String, List<T>> map = EntityUtil.makeEntityListMap(itemList, "name");
         for (String key : map.keySet()) {
@@ -173,8 +180,8 @@ public class CommonRule {
                 Collections.sort(items, new Comparator<T>() {
                     @Override
                     public int compare(T o1, T o2) {
-                        String o1Str = (String)CoreUtil.getFieldValue(o1, "dateValue");
-                        String o2Str = (String)CoreUtil.getFieldValue(o2, "dateValue");
+                        String o1Str = (String) CoreUtil.getFieldValue(o1, "dateValue");
+                        String o2Str = (String) CoreUtil.getFieldValue(o2, "dateValue");
                         if (StringUtil.isBlank(o1Str) || StringUtil.isBlank(o2Str)) {
                             return -1;
                         } else {
@@ -186,7 +193,7 @@ public class CommonRule {
                 // 比较时间是否在24小时内
                 List<Date> dateList = new ArrayList<>();
                 for (T it : items) {
-                    String dateValue = (String)CoreUtil.getFieldValue(it, "dateValue");
+                    String dateValue = (String) CoreUtil.getFieldValue(it, "dateValue");
                     if (StringUtil.isNotBlank(dateValue)) {
                         Date cur = CatalogueUtil.parseStringDate(dateValue);
                         // 如果为null,说明日期格式出错,不比较
@@ -194,8 +201,8 @@ public class CommonRule {
                             if (ListUtil.isNotEmpty(dateList)) {
                                 Date last = dateList.get(dateList.size() - 1);
                                 if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
-                                    String name = (String)CoreUtil.getFieldValue(it, "name");
-                                    String uniqueName = (String)CoreUtil.getFieldValue(it, "uniqueName");
+                                    String name = (String) CoreUtil.getFieldValue(it, "name");
+                                    String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
                                     BillMsg commonBillMsg = MsgUtil.getBillMsg24Repeat(
                                             name, uniqueName, name, type);
                                     billMsgList.add(commonBillMsg);
@@ -215,6 +222,7 @@ public class CommonRule {
 
     /**
      * 高风险药品、手术
+     *
      * @param highRiskNeoDTO
      * @param highRiskList
      */
@@ -226,11 +234,12 @@ public class CommonRule {
 
     /**
      * fa'zha
+     *
      * @param highRiskNeoDTO
      * @param highRiskList
      */
     public void highRiskComplex(NodeNeoDTO nodeNeoDTO, List<BillMsg> highRiskList, HighRiskNeoDTO highRiskNeoDTO) {
-        BillMsg billMsg = MsgUtil.getComplexOperationMsg( nodeNeoDTO.getVal(), highRiskNeoDTO.getName(),nodeNeoDTO.getTermtype());
+        BillMsg billMsg = MsgUtil.getComplexOperationMsg(nodeNeoDTO.getVal(), highRiskNeoDTO.getName(), nodeNeoDTO.getTermtype());
         highRiskList.add(billMsg);
     }
 }