|
@@ -4,7 +4,10 @@ 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.constants.LisDictType;
|
|
|
+import com.github.jfcloud.gene.lis.vo.CheckItem;
|
|
|
+import com.github.jfcloud.gene.lis.vo.DeptItem;
|
|
|
+import com.github.jfcloud.gene.lis.vo.DeptUserItem;
|
|
|
import com.github.jfcloud.gene.lis.vo.DictItem;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -15,7 +18,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
@@ -29,7 +35,7 @@ public class SampleCheckItemSerumController {
|
|
|
|
|
|
@Operation(summary = "获取检测指标")
|
|
|
@GetMapping("/target")
|
|
|
- public R<List<DictItem>> getCheckItemTarget(@RequestParam(required = false) String name) {
|
|
|
+ public R<List<CheckItem>> getLisItem(@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 + "%'");
|
|
@@ -37,24 +43,87 @@ public class SampleCheckItemSerumController {
|
|
|
sql = String.format(sql, "");
|
|
|
}
|
|
|
List<Entity> entities = lisDb.query(sql);
|
|
|
- List<DictItem> dictItems = entities.stream()
|
|
|
- .map(entity -> entity.toBeanWithCamelCase(new DictItem()))
|
|
|
+ List<CheckItem> checkItems = entities.stream()
|
|
|
+ .map(entity -> entity.toBeanWithCamelCase(new CheckItem()))
|
|
|
.collect(Collectors.toList());
|
|
|
- return R.ok(dictItems);
|
|
|
+ return R.ok(checkItems);
|
|
|
}
|
|
|
|
|
|
- @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";
|
|
|
+ @Operation(summary = "获取机构")
|
|
|
+ @GetMapping("/dept")
|
|
|
+ public R<List<DeptItem>> getLisDept(@RequestParam(required = false) String name) {
|
|
|
+ String sql = "select dep.id, dep.name, dict.sub_class_name as dep_name from dbo.HT_INFO_DEP dep " +
|
|
|
+ "left join dbo.HT_BAS_DICT dict on dep.dep_type = dict.sub_class_no and dict.class_no = 1154 " +
|
|
|
+ "where dep.status=1 %s order by dep.id desc";
|
|
|
if (StrUtil.isNotBlank(name)) {
|
|
|
sql = String.format(sql, "and name like '%" + name + "%'");
|
|
|
} else {
|
|
|
sql = String.format(sql, "");
|
|
|
}
|
|
|
List<Entity> entities = lisDb.query(sql);
|
|
|
- List<AreaItem> dictItems = entities.stream()
|
|
|
- .map(entity -> entity.toBeanWithCamelCase(new AreaItem()))
|
|
|
+ List<DeptItem> dictItems = entities.stream()
|
|
|
+ .map(entity -> entity.toBeanWithCamelCase(new DeptItem()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return R.ok(dictItems);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取机构下医生")
|
|
|
+ @GetMapping("/dept/doc")
|
|
|
+ public R<List<DeptUserItem>> getLisDeptUser(@RequestParam Integer deptId, @RequestParam(required = false) String name) {
|
|
|
+ String sql = "select hbpu.dep_id as dept_id, hiue.user_id, hiue.name, 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表示医生
|
|
|
+ sql = String.format(sql, deptId);
|
|
|
+ if (StrUtil.isNotBlank(name)) {
|
|
|
+ sql += "and hiue.name like '%" + name + "%'";
|
|
|
+ }
|
|
|
+
|
|
|
+ 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));
|
|
|
+
|
|
|
+ List<DeptUserItem> items = nameMap.values().stream()
|
|
|
+ .map(entity -> entity.toBeanWithCamelCase(new DeptUserItem()))
|
|
|
+ .sorted(Comparator.comparingLong(DeptUserItem::getUserId))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return R.ok(items);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取字典", description = "type说明:LIS_SEX性别 LIS_SAMPLE_TYPE样本类型 LIS_PET_TYPE动物类型 ")
|
|
|
+ @GetMapping("/dict")
|
|
|
+ public R<List<DictItem>> getLisDict(@RequestParam String type) {
|
|
|
+ String sql = "select sub_class_no, sub_class_name from dbo.HT_BAS_DICT where class_no=%s and status=1 ";
|
|
|
+ sql = String.format(sql, LisDictType.valueOf(type).getClassNo());
|
|
|
+
|
|
|
+ List<Entity> entities = lisDb.query(sql);
|
|
|
+ List<DictItem> dictItems = entities.stream()
|
|
|
+ .map(entity -> new DictItem(entity.getInt("sub_class_no"), entity.getStr("sub_class_name")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return R.ok(dictItems);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取专业组")
|
|
|
+ @GetMapping("/professionalGroup")
|
|
|
+ public R<List<DictItem>> getLisGroup() {
|
|
|
+ String sql = "select id, name from dbo.HT_INFO_PROF where status=1 order by id asc";
|
|
|
+ List<Entity> entities = lisDb.query(sql);
|
|
|
+ List<DictItem> dictItems = entities.stream()
|
|
|
+ .map(entity -> new DictItem(entity.getInt("id"), entity.getStr("name")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return R.ok(dictItems);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取仪器", description = "profId专业组id")
|
|
|
+ @GetMapping("/machine")
|
|
|
+ public R<List<DictItem>> getLisInstrument(@RequestParam Integer profId) {
|
|
|
+ String sql = "select m.id, m.name from dbo.HT_BAS_PROF_MACHINE pm " +
|
|
|
+ "left join dbo.HT_INFO_MACHINE m on pm.MACHINE_ID = m.ID " +
|
|
|
+ "where pm.PROF_ID=%d and m.status=1 order by m.id asc";
|
|
|
+ sql = String.format(sql, profId);
|
|
|
+ List<Entity> entities = lisDb.query(sql);
|
|
|
+ List<DictItem> dictItems = entities.stream()
|
|
|
+ .map(entity -> new DictItem(entity.getInt("id"), entity.getStr("name")))
|
|
|
.collect(Collectors.toList());
|
|
|
return R.ok(dictItems);
|
|
|
}
|