Browse Source

lis查询机构下的医生进行分页

陈长荣 2 weeks ago
parent
commit
5655f42f44

+ 11 - 4
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/controller/SampleLisController.java

@@ -85,11 +85,11 @@ public class SampleLisController {
 
     @Operation(summary = "获取机构下医生")
     @GetMapping("/dep/doc")
-    public R<List<DeptUserItem>> getLisDeptUser(@RequestParam Integer depId, @RequestParam(required = false) String name) {
-        String sql = "select hbpu.dep_id, hiue.user_id, hiue.name, hiue.email " +
+    public R<Page<DeptUserItem>> getLisDeptUser(@RequestParam Integer depId, @RequestParam(required = false) String name, Page<?> page) {
+        String sql = "select hbpu.dep_id, hiue.user_id, hiue.name, hiue.contact as phone, hiue.email " +
                 "from HT_BAS_DEP_USER hbpu " +
                 "left join HT_INFO_USER_EXTEND hiue on hbpu.USER_ID = hiue.USER_ID " +
-                "where hbpu.STATUS =1 and hbpu.DEP_ID =%d and hiue.JOB_LEVEL =1 "; //JOB_LEVEL=1表示医生
+                "where hbpu.STATUS=1 and hbpu.DEP_ID=%d and hiue.JOB_LEVEL=1 "; //JOB_LEVEL=1表示医生
         sql = String.format(sql, depId);
         if (StrUtil.isNotBlank(name)) {
             sql += "and hiue.name like '%" + name + "%'";
@@ -98,12 +98,19 @@ public class SampleLisController {
         List<Entity> entities = lisDb.query(sql);
         //lis数据库有重复数据,去重,后面的覆盖前面的
         Map<String, Entity> nameMap = entities.stream().collect(Collectors.toMap(entity -> entity.getStr("name"), Function.identity(), (a, b) -> b));
+        if (nameMap.isEmpty()) {
+            return R.ok(new PageDTO<>());
+        }
 
         List<DeptUserItem> items = nameMap.values().stream()
                 .map(entity -> entity.toBeanWithCamelCase(new DeptUserItem()))
                 .sorted(Comparator.comparingLong(DeptUserItem::getUserId))
+                .skip(page.offset())
+                .limit(page.getSize())
                 .collect(Collectors.toList());
-        return R.ok(items);
+        Page<DeptUserItem> pageResult = PageDTO.of(page.getCurrent(), page.getSize(), nameMap.size());
+        pageResult.setRecords(items);
+        return R.ok(pageResult);
     }
 
     @Operation(summary = "获取字典", description = "type说明:LIS_SEX性别 LIS_SAMPLE_TYPE样本类型 LIS_PET_TYPE动物类型 ")

+ 3 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/vo/DeptUserItem.java

@@ -16,6 +16,9 @@ public class DeptUserItem {
     @Schema(description = "名称")
     private String name;
 
+    @Schema(description = "联系方式")
+    private String phone;
+
     @Schema(description = "邮箱")
     private String email;