瀏覽代碼

添加字典返回内容

zhoutg 5 年之前
父節點
當前提交
98a63b1e52

+ 88 - 0
icss-service/src/main/java/com/diagbot/entity/DictionaryInfo.java

@@ -0,0 +1,88 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * icss字典表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@TableName("icss_dictionary_info")
+@Getter
+@Setter
+public class DictionaryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 分组(值自定义)
+     */
+    private Long groupType;
+
+    /**
+     * 内容
+     */
+    private String name;
+
+    /**
+     * 值
+     */
+    private String val;
+
+    /**
+     * 返回类型(0: 都返回,1:后台维护返回 2:icss界面返回)
+     */
+    private Integer returnType;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 34 - 0
icss-service/src/main/java/com/diagbot/facade/DictionaryFacade.java

@@ -0,0 +1,34 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.DictionaryInfoServiceImpl;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class DictionaryFacade extends DictionaryInfoServiceImpl {
+
+    /**
+     * 返回字典信息
+     *
+     * @return
+     */
+    public Map<Long, List<DictionaryInfo>> getList() {
+        List<DictionaryInfo> list = this.list(new QueryWrapper<DictionaryInfo>()
+                .in("return_type", ListUtil.arrayToList(new Long[] { 0L, 2L }))
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("group_type", "order_no"));
+        return EntityUtil.makeEntityListMap(list, "groupType");
+    }
+}

+ 2 - 1
icss-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -174,12 +174,13 @@ public class RetrievalFacade {
         if (null == types) {
             types = new ArrayList<>();
         }
-        if (ListUtil.isEmpty(types)) {
+        if (ListUtil.isEmpty(types) || types.contains(0)) { // 空或者0,搜索全部
             // 添加标签类型
             typeList.add(ConceptTypeEnum.Symptom.getKey());
             typeList.add(ConceptTypeEnum.Lis.getKey());
 
             // 添加词库搜索类型
+            types.clear();
             types.add(StaticSearchTypeEnum.DIAGNOSIS.getKey());
             types.add(StaticSearchTypeEnum.DRUGS.getKey());
             types.add(StaticSearchTypeEnum.SYMPTOM.getKey());

+ 16 - 0
icss-service/src/main/java/com/diagbot/mapper/DictionaryInfoMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.DictionaryInfo;
+
+/**
+ * <p>
+ * icss字典表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+public interface DictionaryInfoMapper extends BaseMapper<DictionaryInfo> {
+
+}

+ 16 - 0
icss-service/src/main/java/com/diagbot/service/DictionaryInfoService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.DictionaryInfo;
+
+/**
+ * <p>
+ * icss字典表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+public interface DictionaryInfoService extends IService<DictionaryInfo> {
+
+}

+ 20 - 0
icss-service/src/main/java/com/diagbot/service/impl/DictionaryInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.mapper.DictionaryInfoMapper;
+import com.diagbot.service.DictionaryInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * icss字典表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@Service
+public class DictionaryInfoServiceImpl extends ServiceImpl<DictionaryInfoMapper, DictionaryInfo> implements DictionaryInfoService {
+
+}

+ 45 - 0
icss-service/src/main/java/com/diagbot/web/DictionaryInfoController.java

@@ -0,0 +1,45 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.facade.DictionaryFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * icss字典表 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@RequestMapping("/dictionaryInfo")
+@RestController
+@SuppressWarnings("unchecked")
+@Api(value = "字典信息", tags = { "字典信息" })
+public class DictionaryInfoController {
+
+
+    @Autowired
+    DictionaryFacade dictionaryFacade;
+
+    @ApiOperation(value = "返回字典信息[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getList")
+    @SysLogger("getList")
+    @Transactional
+    public RespDTO<Map<Long, List<DictionaryInfo>>> getList() {
+        Map<Long, List<DictionaryInfo>> data = dictionaryFacade.getList();
+        return RespDTO.onSuc(data);
+    }
+}

+ 21 - 0
icss-service/src/main/resources/mapper/DictionaryInfoMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.DictionaryInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.DictionaryInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="group_type" property="groupType" />
+        <result column="name" property="name" />
+        <result column="val" property="val" />
+        <result column="return_type" property="returnType" />
+        <result column="order_no" property="orderNo" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>