|
@@ -3,6 +3,7 @@ package com.diagbot.repository;
|
|
|
import com.diagbot.entity.node.BillConcept;
|
|
|
import com.diagbot.entity.node.BillCondition;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
+import com.diagbot.entity.node.BillItemDetail;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.neo4j.annotation.Query;
|
|
@@ -16,7 +17,7 @@ import java.util.List;
|
|
|
* @Author:zhaops
|
|
|
* @time: 2020/11/17 13:26
|
|
|
*/
|
|
|
-public interface BillManRepository extends Neo4jRepository<BillItem,Long> {
|
|
|
+public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long> {
|
|
|
|
|
|
@Query(value = "match(m)-[r]->(n) \n" +
|
|
|
"where 1 = 1 \n" +
|
|
@@ -65,21 +66,21 @@ public interface BillManRepository extends Neo4jRepository<BillItem,Long> {
|
|
|
"WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode)) \n" +
|
|
|
"AND labels(n)[0] in {labels} \n" +
|
|
|
"AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
|
|
|
- "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel \n" +
|
|
|
+ "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 " +
|
|
|
"AND labels(n)[0] in {labels} \n" +
|
|
|
"AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
|
|
|
"WITH n SKIP 0 LIMIT $size \n" +
|
|
|
- "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel \n" +
|
|
|
+ "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" +
|
|
|
"AND labels(n)[0] in {labels} \n" +
|
|
|
"AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
|
|
|
"WITH n SKIP 0 LIMIT $size \n" +
|
|
|
- "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel \n")
|
|
|
+ "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")
|
|
|
List<BillCondition> conditionIndex(@Param("labels") List<String> labels,
|
|
|
@Param("notInIds") List<Long> notInIds,
|
|
|
@Param("name") String name,
|
|
@@ -113,4 +114,75 @@ public interface BillManRepository extends Neo4jRepository<BillItem,Long> {
|
|
|
@Param("name") String name,
|
|
|
@Param("pycode") String pycode,
|
|
|
@Param("size") Integer size);
|
|
|
+
|
|
|
+ @Query("MATCH (m)-[r]->(n) \n" +
|
|
|
+ "where m.name={conceptName} \n" +
|
|
|
+ "and n.name={conditionName}\n" +
|
|
|
+ "and type(r) ={relationType} \n" +
|
|
|
+ "and {conceptLabel} in labels(m)\n" +
|
|
|
+ "and {conditionLabel} in labels(n)\n" +
|
|
|
+ "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")
|
|
|
+ BillCondition isExistCondition(@Param("conceptName") String conceptName,
|
|
|
+ @Param("conceptLabel") String conceptLabel,
|
|
|
+ @Param("relationType") String relationType,
|
|
|
+ @Param("conditionName") String conditionName,
|
|
|
+ @Param("conditionLabel") String conditionLabel);
|
|
|
+
|
|
|
+ @Query("MATCH (m)-[r]->(n) \n" +
|
|
|
+ "where id(r) ={relationId} \n" +
|
|
|
+ "RETURN id(m) as conceptId,\n" +
|
|
|
+ "m.name as conceptName,\n" +
|
|
|
+ "labels(m)[0] as conceptLabel,\n" +
|
|
|
+ "m.状态 as conceptStatus,\n" +
|
|
|
+ "r.规则类型 as ruleType,\n" +
|
|
|
+ "id(r) as relationId,\n" +
|
|
|
+ "type(r) as relationName,\n" +
|
|
|
+ "r.状态 as relationStatus,\n" +
|
|
|
+ "id(n) as conditionId,\n" +
|
|
|
+ "n.name as conditionName,\n" +
|
|
|
+ "labels(n)[0] as conditionLabel,\n" +
|
|
|
+ "n.最小值 as conditionMinValue,\n" +
|
|
|
+ "n.最大值 as conditionMaxValue,\n" +
|
|
|
+ "n.单位 as conditionUnit,\n" +
|
|
|
+ "n.范围 as conditionRange,\n" +
|
|
|
+ "n.状态 as conditionStatus")
|
|
|
+ BillItem getRecordByRelationId(@Param("relationId") Long relationId);
|
|
|
+
|
|
|
+ @Query("MATCH (m)-[r]->(n) \n" +
|
|
|
+ "where m.name ={conceptName} \n" +
|
|
|
+ "and n.name={conditionName} \n" +
|
|
|
+ "and type(r) ={relationType} \n" +
|
|
|
+ "RETURN id(m) as conceptId,\n" +
|
|
|
+ "m.name as conceptName,\n" +
|
|
|
+ "labels(m)[0] as conceptLabel,\n" +
|
|
|
+ "m.状态 as conceptStatus,\n" +
|
|
|
+ "r.规则类型 as ruleType,\n" +
|
|
|
+ "id(r) as relationId,\n" +
|
|
|
+ "type(r) as relationName,\n" +
|
|
|
+ "r.状态 as relationStatus,\n" +
|
|
|
+ "id(n) as conditionId,\n" +
|
|
|
+ "n.name as conditionName,\n" +
|
|
|
+ "labels(n)[0] as conditionLabel,\n" +
|
|
|
+ "n.最小值 as conditionMinValue,\n" +
|
|
|
+ "n.最大值 as conditionMaxValue,\n" +
|
|
|
+ "n.单位 as conditionUnit,\n" +
|
|
|
+ "n.范围 as conditionRange,\n" +
|
|
|
+ "n.状态 as conditionStatus")
|
|
|
+ BillItem isExistRelation(@Param("conceptName") String conceptName,
|
|
|
+ @Param("conditionName") String conditionName,
|
|
|
+ @Param("relationType") String relationType);
|
|
|
+
|
|
|
+ @Query("match (m),(n) \n" +
|
|
|
+ "where {conceptLabel} in labels(m) and {conditionLabel} in labels(n)\n" +
|
|
|
+ "and m.name={conceptName} \n" +
|
|
|
+ "and n.name={conditionName}\n" +
|
|
|
+ "create (m)-[r:{relationType}]->(n) \n" +
|
|
|
+ "set r.规则类型={ruleType},r.状态=1 \n" +
|
|
|
+ "return id(r)")
|
|
|
+ Long createRelation(@Param("conceptName") String conceptName,
|
|
|
+ @Param("conceptLabel") String conceptLabel,
|
|
|
+ @Param("conditionName") String conditionName,
|
|
|
+ @Param("conditionLabel") String conditionLabel,
|
|
|
+ @Param("relationType") String relationType,
|
|
|
+ @Param("ruleType") String ruleType);
|
|
|
}
|