Browse Source

开单合理性维护-分页查询

zhaops 4 years ago
parent
commit
aee242cbc4

+ 7 - 1
src/main/java/com/diagbot/facade/IndicationManFacade.java

@@ -19,9 +19,15 @@ public class IndicationManFacade {
     @Autowired
     IndicationRepository indicationRepository;
 
+    /**
+     * 获取开单合理项列表
+     *
+     * @param indicationPageVO
+     * @return
+     */
     public Page<Indication> getPage(IndicationPageVO indicationPageVO) {
         Pageable pageable = PageRequest.of(indicationPageVO.getNumber(), indicationPageVO.getSize());
-        Page<Indication> page = indicationRepository.getPage(indicationPageVO.getLabels(), pageable);
+        Page<Indication> page = indicationRepository.getPage(indicationPageVO.getLabels(), indicationPageVO.getConceptName(), indicationPageVO.getConditionName(), pageable);
         return page;
     }
 }

+ 9 - 5
src/main/java/com/diagbot/repository/IndicationRepository.java

@@ -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);
 }

+ 2 - 2
src/main/java/com/diagbot/vo/IndicationPageVO.java

@@ -13,8 +13,8 @@ import java.util.List;
 @Getter
 @Setter
 public class IndicationPageVO {
-    private int number;
-    private int size;
+    private int number = 0;
+    private int size = 10;
     private List<String> labels;
     private String conceptName;
     private String conditionName;

+ 6 - 2
src/main/java/com/diagbot/web/IndicationManController.java

@@ -26,8 +26,12 @@ public class IndicationManController {
     @Autowired
     IndicationManFacade indicationManFacade;
 
-    @ApiOperation(value = "获取列表[zhaops]",
-            notes = "")
+    @ApiOperation(value = "获取开单合理项列表[zhaops]",
+            notes = "number:页码<br>" +
+                    "size:每页条目数<br>" +
+                    "labels:术语类型(多选)<br>" +
+                    "conceptName:术语名称(模糊匹配)<br>" +
+                    "conditionName:条件明细(模糊匹配)<br>")
     @PostMapping("/getPage")
     public RespDTO<Indication> getPage(@RequestBody IndicationPageVO indicationPageVO) {
         Page<Indication> data = indicationManFacade.getPage(indicationPageVO);