|
@@ -0,0 +1,64 @@
|
|
|
+package com.github.jfcloud.gene.sample.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.db.Entity;
|
|
|
+import com.github.jfcloud.common.core.util.R;
|
|
|
+import com.github.jfcloud.gene.lis.config.LisDb;
|
|
|
+import com.github.jfcloud.gene.lis.vo.AreaItem;
|
|
|
+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;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Tag(name = "样本送检申请单-血清")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/sample/check/item/serum")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class SampleCheckItemSerumController {
|
|
|
+
|
|
|
+ private final LisDb lisDb;
|
|
|
+
|
|
|
+ @SneakyThrows
|
|
|
+ @Operation(summary = "获取检测指标")
|
|
|
+ @GetMapping("/target")
|
|
|
+ public R<List<DictItem>> getCheckItemTarget(@RequestParam(required = false) String name) {
|
|
|
+ String sql = "select id, name, eng_name, unit from dbo.HT_DICT_ITEM where status=1 and type=0 %s order by id desc";
|
|
|
+ if (StrUtil.isNotBlank(name)) {
|
|
|
+ sql = String.format(sql, "and name like '%" + name + "%'");
|
|
|
+ } else {
|
|
|
+ sql = String.format(sql, "");
|
|
|
+ }
|
|
|
+ List<Entity> entities = lisDb.getDb().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) {
|
|
|
+ String sql = "select id, name, address from dbo.HT_INFO_HSP where status=1 %s order by id desc";
|
|
|
+ if (StrUtil.isNotBlank(name)) {
|
|
|
+ sql = String.format(sql, "and name like '%" + name + "%'");
|
|
|
+ } else {
|
|
|
+ sql = String.format(sql, "");
|
|
|
+ }
|
|
|
+ List<Entity> entities = lisDb.getDb().query(sql);
|
|
|
+ List<AreaItem> dictItems = entities.stream()
|
|
|
+ .map(entity -> entity.toBeanWithCamelCase(new AreaItem()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return R.ok(dictItems);
|
|
|
+ }
|
|
|
+}
|