浏览代码

开单合理项维护

zhaops 4 年之前
父节点
当前提交
57495a7945

+ 5 - 4
src/main/java/com/diagbot/facade/BillManFacade.java

@@ -130,10 +130,11 @@ public class BillManFacade {
 
         if(ListUtil.isNotEmpty(page.getContent())) {
             for (BillItem record : page.getContent()) {
-                int index = record.getConditionName().indexOf("禁忌");
+                /*int index = record.getConditionName().indexOf("禁忌");
                 if (index > 0) {
                     record.setConditionName(record.getConditionName().substring(index + 2));
-                }
+                }*/
+                record.setRuleName(record.getConditionName() + "开单" + record.getConceptName());
             }
         }
         return page;
@@ -263,10 +264,10 @@ public class BillManFacade {
                 billCondition.setRange(0);
             }
 
-            int index = billCondition.getName().indexOf("禁忌");
+            /*int index = billCondition.getName().indexOf("禁忌");
             if (index > 0) {
                 billCondition.setName(billCondition.getName().substring(index + 2));
-            }
+            }*/
 
             if (dicTypeConvertMap.containsKey(billItem.getConceptLabel())
                     && dicIndicationManTypeMap.containsKey(dicTypeConvertMap.get(billItem.getConceptLabel()))) {

+ 41 - 8
src/main/java/com/diagbot/repository/BillManRepository.java

@@ -22,14 +22,24 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
     @Query(value = "match(m)-[r]->(n) \n" +
             "where 1 = 1 \n" +
             "and (m:实验室检查套餐名 or m:辅助检查名称 or m:辅助检查子项目名称 or m:医保手术和操作名称 or m:药品注册名) \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             //"and (case {labels} is not null and size({labels})>0 when true then labels(m)[0] in {labels} else 1 = 1 end ) \n" +
             "and (case {conceptName} is not null and {conceptName} <> '' when true then m.name contains {conceptName} else 1 = 1 end ) \n" +
-            "and (case {conditionName} is not null and {conditionName} <> '' when true then n.name contains {conditionName} else 1 = 1 end ) \n" +
+            "and (case {conditionName} is not null and {conditionName} <> '' when true then " +
+            "(case  \n" +
+            "when exists(n.禁忌人群指标) then toLower(n.禁忌人群指标) contains toLower({conditionName}) \n" +
+            "when exists(n.实验室检查指标) then toLower(n.实验室检查指标) contains toLower({conditionName}) \n" +
+            "when exists(n.体征指标) then toLower(n.体征指标) contains toLower({conditionName}) \n" +
+            "else toLower(n.`name`) contains toLower({conditionName}) \n" +
+            "end ) \n" +
+            "else 1 = 1 " +
+            "end ) \n" +
             "and (case {relationStatus} is not null and {relationStatus} <> '' when true then r.状态 = {relationStatus} else 1 = 1 end ) \n" +
             "and type(r) contains('禁忌') \n" +
             "and m.状态=1 \n" +
             "and n.状态=1 \n" +
-            "return n.name + '开单' + m.name as ruleName, r.规则类型 as ruleType,\n" +
+            "return " +
+            "r.规则类型 as ruleType,\n" +
             "case labels(m)[0] " +
             "when '实验室检查套餐名' then 1 " +
             "when '辅助检查名称' then 2 " +
@@ -39,14 +49,31 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "end as type," +
             "id(m) as conceptId,m.name as conceptName,labels(m)[0] as conceptType,\n" +
             "id(r) as relationId,type(r) as relationName,r.状态 as relationStatus, \n" +
-            "id(n) as conditionId,n.name as conditionName,labels(n)[0] as conditionType  \n" +
+            "id(n) as conditionId," +
+            //"n.name as conditionName," +
+            "(case \n" +
+            "when exists(n.禁忌人群指标) then n.禁忌人群指标 \n" +
+            "when exists(n.实验室检查指标) then n.实验室检查指标 \n" +
+            "when exists(n.体征指标) then n.体征指标 \n" +
+            "else n.name \n" +
+            "end ) as conditionName,\n" +
+            "labels(n)[0] as conditionType  \n" +
             "order by id(r) desc",
             countQuery = "match(m)-[r]->(n) \n" +
                     "where 1 = 1 \n" +
                     "and (m:实验室检查套餐名 or m:辅助检查名称 or m:辅助检查子项目名称 or m:医保手术和操作名称 or m:药品注册名) \n" +
+                    "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
                     //"and (case {labels} is not null and size({labels})>0 when true then labels(m)[0] in {labels} else 1 = 1 end ) \n" +
                     "and (case {conceptName} is not null and {conceptName} <> '' when true then m.name contains {conceptName} else 1 = 1 end ) \n" +
-                    "and (case {conditionName} is not null and {conditionName} <> '' when true then n.name contains {conditionName} else 1 = 1 end ) \n" +
+                    "and (case {conditionName} is not null and {conditionName} <> '' when true then " +
+                    "(case  \n" +
+                    "when exists(n.禁忌人群指标) then toLower(n.禁忌人群指标) contains toLower({conditionName}) \n" +
+                    "when exists(n.实验室检查指标) then toLower(n.实验室检查指标) contains toLower({conditionName}) \n" +
+                    "when exists(n.体征指标) then toLower(n.体征指标) contains toLower({conditionName}) \n" +
+                    "else toLower(n.`name`) contains toLower({conditionName}) \n" +
+                    "end ) \n" +
+                    "else 1 = 1 " +
+                    "end ) \n" +
                     "and (case {relationStatus} is not null and {relationStatus} <> '' when true then r.状态 = {relationStatus} else 1 = 1 end ) \n" +
                     "and type(r) contains('禁忌') \n" +
                     "and m.状态=1 \n" +
@@ -65,7 +92,7 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
     List<String> getRelationTypes(@Param("conceptLabel") String conceptLabel);
 
     @Query("MATCH (n) \n" +
-            "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode))  \n" +
+            "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode)) \n" +
             //"AND labels(n)[0] in {labels}  \n" +
             "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
@@ -73,7 +100,7 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n" +
             "union \n" +
             "MATCH (n) \n " +
-            "WHERE (toLower(n.`name`) starts with toLower($name) OR toLower(n.`拼音编码`) starts with toLower($pycode)) \n " +
+            "WHERE (toLower(n.`name`) starts with toLower($name) OR toLower(n.`拼音编码`) starts with toLower($pycode)) \n" +
             //"AND labels(n)[0] in {labels}  \n" +
             "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
@@ -82,7 +109,7 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n" +
             "union \n" +
             "MATCH (n) \n" +
-            "WHERE (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode))  \n" +
+            "WHERE (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode)) \n" +
             //"AND labels(n)[0] in {labels}  \n" +
             "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
@@ -147,7 +174,13 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "type(r) as relationName,\n" +
             "r.状态 as relationStatus,\n" +
             "id(n) as conditionId,\n" +
-            " n.name as conditionName," +
+            //" n.name as conditionName," +
+            "(case  \n" +
+            "when exists(n.禁忌人群指标) then n.禁忌人群指标 \n" +
+            "when exists(n.实验室检查指标) then n.实验室检查指标 \n" +
+            "when exists(n.体征指标) then n.体征指标 \n" +
+            "else n.name \n" +
+            "end ) as conditionName,\n" +
             "labels(n)[0] as conditionLabel,\n" +
             "n.最小值 as conditionMinValue,\n" +
             "n.最大值 as conditionMaxValue,\n" +