|
@@ -16,18 +16,22 @@ import java.util.List;
|
|
|
*/
|
|
|
public interface IndicationRepository extends Neo4jRepository<Indication,Long> {
|
|
|
|
|
|
- @Query(value = "match(m)-[r]-(n) \n" +
|
|
|
+ @Query(value = "match(m)-[r]->(n) \n" +
|
|
|
"where 1 = 1 \n" +
|
|
|
- "and labels(m)[0] in $labels \n" +
|
|
|
+ "and (case {labels} is not null and length({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 type(r) contains('禁忌') \n" +
|
|
|
"return id(m) as conceptId,m.name as conceptName,labels(m)[0] as conceptType,\n" +
|
|
|
"id(r) as relationId,type(r) as relationName,\n" +
|
|
|
"id(n) as conditionId,n.name as conditionName,labels(n)[0] as conditionType \n" +
|
|
|
"order by id(r) desc",
|
|
|
- countQuery = "match(m)-[r]-(n) \n" +
|
|
|
+ countQuery = "match(m)-[r]->(n) \n" +
|
|
|
"where 1 = 1 \n" +
|
|
|
- "and labels(m)[0] in $labels \n" +
|
|
|
+ "and (case {labels} is not null and length({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 type(r) contains('禁忌') \n" +
|
|
|
"return count(n)")
|
|
|
- Page<Indication> getPage(@Param("labels") List<String> labels, Pageable pageable);
|
|
|
+ Page<Indication> getPage(@Param("labels") List<String> labels, @Param("conceptName") String conceptName, @Param("conditionName") String conditionName, Pageable pageable);
|
|
|
}
|