Преглед изворни кода

LIS系统查询专业组、仪器、机构

陈长荣 пре 3 недеља
родитељ
комит
acb1fb6816

+ 1 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/config/LisDb.java

@@ -31,6 +31,7 @@ public class LisDb {
         if (dataSource == null) {
             throw new RuntimeException("LIS数据库未配置");
         }
+        log.info("LIS查询:{}", sql);
         return Db.use(dataSource).query(sql);
     }
 }

+ 29 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/constants/LisDictType.java

@@ -0,0 +1,29 @@
+package com.github.jfcloud.gene.lis.constants;
+
+/**
+ * LIS字典类型
+ */
+public enum LisDictType {
+    LIS_SEX(1002, "性别"),
+    LIS_SAMPLE_TYPE(1038, "标本类型"),
+    LIS_PET_TYPE(1193, "宠物类型"),
+
+    ;
+
+    LisDictType(int classNo, String className) {
+        this.classNo = classNo;
+        this.className = className;
+    }
+
+    private final int classNo;
+
+    private final String className;
+
+    public int getClassNo() {
+        return classNo;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+}

+ 0 - 133
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/dto/QuarantineOrderRequest.java

@@ -1,133 +0,0 @@
-package com.github.jfcloud.gene.lis.dto;
-
-import lombok.Data;
-
-/**
- * 检疫商品订单记录请求参数
- */
-@Data
-public class QuarantineOrderRequest {
-
-    /**
-     * 请求机构id
-     */
-    private String clientId;
-
-    /**
-     * 订单业务唯一键(请求方订单业务id唯一标识)
-     */
-    private String businessId;
-
-    /**
-     * 订单名称
-     */
-    private String orderName;
-
-    /**
-     * 下单人名称(下单用户名称)
-     */
-    private String orderingUserName;
-
-    /**
-     * 用户下单时间yyyy-MM-dd HH:mm:ss
-     */
-    private String orderingTime;
-
-    /**
-     * 检测类型1 商品,2检疫项
-     */
-    private Integer checkType;
-
-    /**
-     * 商品编号,取自检疫商品数据的productSn
-     */
-    private String productId;
-
-    /**
-     * 商品名称,取自检疫商品数据的productName
-     */
-    private String productName;
-
-    /**
-     * 宠物基础信息
-     */
-    private PetBaseInfoDTO petBaseInfoDTO;
-
-
-    /**
-     * 宠物基础信息DTO
-     */
-    @Data
-    public static class PetBaseInfoDTO {
-
-        /**
-         * 宠物id 唯一标识
-         */
-        private String petId;
-
-        /**
-         * 宠物类型Code,取自字典:goods_detection_type
-         */
-        private Integer goodsDetectionType;
-
-        /**
-         * 宠物品种Code,调用动物品种列表接口获取
-         */
-        private String petTypeCode;
-
-        /**
-         * 宠物名称
-         */
-        private String petName;
-
-        /**
-         * 宠物主名称
-         */
-        private String petOwnerName;
-
-        /**
-         * 宠物主联系电话
-         */
-        private String petOwnerPhone;
-
-        /**
-         * 宠物性别 1公 2母
-         */
-        private Integer petGender;
-
-        /**
-         * 宠物年龄--年
-         */
-        private Integer ageYear;
-
-        /**
-         * 宠物年龄--月
-         */
-        private Integer ageMonth;
-
-        /**
-         * 是否绝育 0未绝育 1已绝育
-         */
-        private Integer neutered;
-
-        /**
-         * 疫苗情况
-         */
-        private String vaccineDescription;
-
-        /**
-         * 驱虫情况说明
-         */
-        private String insecticideDescription;
-
-        /**
-         * 既往病史说明
-         */
-        private String diseaseDescription;
-
-        /**
-         * 既往用药史说明
-         */
-        private String medicineDescription;
-    }
-}

+ 0 - 20
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/dto/QuarantineOrderResponse.java

@@ -1,20 +0,0 @@
-package com.github.jfcloud.gene.lis.dto;
-
-import lombok.Data;
-
-/**
- * 检疫商品订单记录响应参数
- */
-@Data
-public class QuarantineOrderResponse {
-
-    /**
-     * 订单编号(系统唯一)
-     */
-    private String quarantineOrderKey;
-
-    /**
-     * 订单业务唯一键(请求方订单业务id唯一标识)
-     */
-    private String businessId;
-}

+ 21 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/vo/CheckItem.java

@@ -0,0 +1,21 @@
+package com.github.jfcloud.gene.lis.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "检验项目")
+@Data
+public class CheckItem {
+
+    @Schema(description = "id")
+    private Long id;
+
+    @Schema(description = "名称")
+    private String name;
+
+    @Schema(description = "英文名称")
+    private String engName;
+
+    @Schema(description = "单位")
+    private String unit;
+}

+ 4 - 4
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/vo/AreaItem.java → jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/vo/DeptItem.java

@@ -3,9 +3,9 @@ package com.github.jfcloud.gene.lis.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
-@Schema(description = "检验项目")
+@Schema(description = "机构")
 @Data
-public class AreaItem {
+public class DeptItem {
 
     @Schema(description = "id")
     private Long id;
@@ -13,7 +13,7 @@ public class AreaItem {
     @Schema(description = "名称")
     private String name;
 
-    @Schema(description = "地址")
-    private String address;
+    @Schema(description = "科室类型")
+    private String depType;
 
 }

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

@@ -0,0 +1,22 @@
+package com.github.jfcloud.gene.lis.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "机构用户")
+@Data
+public class DeptUserItem {
+
+    @Schema(description = "机构id")
+    private Long deptId;
+
+    @Schema(description = "用户id")
+    private Long userId;
+
+    @Schema(description = "名称")
+    private String name;
+
+    @Schema(description = "邮箱")
+    private String email;
+
+}

+ 4 - 8
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/lis/vo/DictItem.java

@@ -1,21 +1,17 @@
 package com.github.jfcloud.gene.lis.vo;
 
 import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 
-@Schema(description = "检验项目")
+@AllArgsConstructor
+@Schema(description = "字典项")
 @Data
 public class DictItem {
 
     @Schema(description = "id")
-    private Long id;
+    private Integer id;
 
     @Schema(description = "名称")
     private String name;
-
-    @Schema(description = "英文名称")
-    private String engName;
-
-    @Schema(description = "单位")
-    private String unit;
 }

+ 80 - 11
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/sample/controller/SampleCheckItemSerumController.java

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