Ver código fonte

血清送检申请单区域列表和检测指标列表

陈长荣 2 semanas atrás
pai
commit
428db72c20

+ 7 - 2
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/config/LisDb.java

@@ -1,11 +1,15 @@
 package com.github.jfcloud.gene.lis.config;
 
 import cn.hutool.db.Db;
+import cn.hutool.db.Entity;
 import cn.hutool.db.ds.simple.SimpleDataSource;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 @Slf4j
 @Component
 public class LisDb {
@@ -22,10 +26,11 @@ public class LisDb {
         dataSource = new SimpleDataSource(lisDbProperty.getUrl(), lisDbProperty.getUsername(), lisDbProperty.getPassword());
     }
 
-    public Db getDb() {
+    @SneakyThrows
+    public List<Entity> query (String sql) {
         if (dataSource == null) {
             throw new RuntimeException("LIS数据库未配置");
         }
-        return Db.use(dataSource);
+        return Db.use(dataSource).query(sql);
     }
 }

+ 2 - 5
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/sample/controller/SampleCheckItemSerumController.java

@@ -9,7 +9,6 @@ import com.github.jfcloud.gene.lis.vo.DictItem;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -28,7 +27,6 @@ public class SampleCheckItemSerumController {
 
     private final LisDb lisDb;
 
-    @SneakyThrows
     @Operation(summary = "获取检测指标")
     @GetMapping("/target")
     public R<List<DictItem>> getCheckItemTarget(@RequestParam(required = false) String name) {
@@ -38,14 +36,13 @@ public class SampleCheckItemSerumController {
         } else {
             sql = String.format(sql, "");
         }
-        List<Entity> entities = lisDb.getDb().query(sql);
+        List<Entity> entities = lisDb.query(sql);
         List<DictItem> dictItems = entities.stream()
                 .map(entity -> entity.toBeanWithCamelCase(new DictItem()))
                 .collect(Collectors.toList());
         return R.ok(dictItems);
     }
 
-    @SneakyThrows
     @Operation(summary = "获取区域")
     @GetMapping("/area")
     public R<List<AreaItem>> getCheckItemArea(@RequestParam(required = false) String name) {
@@ -55,7 +52,7 @@ public class SampleCheckItemSerumController {
         } else {
             sql = String.format(sql, "");
         }
-        List<Entity> entities = lisDb.getDb().query(sql);
+        List<Entity> entities = lisDb.query(sql);
         List<AreaItem> dictItems = entities.stream()
                 .map(entity -> entity.toBeanWithCamelCase(new AreaItem()))
                 .collect(Collectors.toList());

+ 0 - 6
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/sample/vo/SampleCheckOrderVo.java

@@ -73,12 +73,6 @@ public class SampleCheckOrderVo {
     @Schema(description = "样本送检人姓名")
     private String sendUserName;
 
-    @Schema(description = "样本送检机构id")
-    private Long sendOrgId;
-
-    @Schema(description = "样本送检机构")
-    private String sendOrgName;
-
     /**
      * 样本接收人
      */

+ 4 - 1
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/sample/vo/SampleCheckSerumVo.java

@@ -73,8 +73,11 @@ public class SampleCheckSerumVo {
     @Schema(description = "样本送检人姓名")
     private String sendUserName;
 
+    @Schema(description = "样本送检机构id")
+    private Long sendOrgId;
+
     @Schema(description = "样本送检机构")
-    private String sendOrg;
+    private String sendOrgName;
 
     /**
      * 样本接收人