فهرست منبع

诊断标签打标

zhoutg 6 سال پیش
والد
کامیت
f619cfa544

+ 54 - 0
icss-service/src/main/java/com/diagbot/dto/ScaleContentDTO.java

@@ -0,0 +1,54 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 量表内容
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-03-11
+ */
+@Getter
+@Setter
+public class ScaleContentDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+
+    /**
+     * 量表标签id
+     */
+    private Long scaleId;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 0:文本,1:大数据接口填充
+     */
+    private Integer type;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 57 - 0
icss-service/src/main/java/com/diagbot/entity/ScaleContent.java

@@ -0,0 +1,57 @@
+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;
+
+/**
+ * <p>
+ * 量表内容表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-03-11
+ */
+@TableName("icss_scale_content")
+@Getter
+@Setter
+public class ScaleContent implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 量表标签id
+     */
+    private Long scaleId;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 0:文本,1:大数据接口填充
+     */
+    private Integer type;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 51 - 0
icss-service/src/main/java/com/diagbot/enums/ScaleTypeEnum.java

@@ -0,0 +1,51 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * 
+ * @author zhoutg
+ * @Description: 诊断类型
+ * @date 2018年11月21日 下午2:31:42
+ */
+public enum ScaleTypeEnum implements KeyedNamed {
+    TEXT(0, "文本"),
+    PUSH(1, "推理");
+
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    ScaleTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ScaleTypeEnum getEnum(Integer key) {
+        for (ScaleTypeEnum item : ScaleTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        ScaleTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

+ 41 - 0
icss-service/src/main/java/com/diagbot/facade/ScaleContentFacade.java

@@ -0,0 +1,41 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.ScaleContent;
+import com.diagbot.enums.ScaleTypeEnum;
+import com.diagbot.service.impl.ScaleContentServiceImpl;
+import com.diagbot.vo.PushVO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description: 量表内容
+ * @author: zhoutg
+ * @time: 2018/11/19 13:19
+ */
+@Component
+public class ScaleContentFacade extends ScaleContentServiceImpl {
+
+    /**
+     * 返回诊断量表列表
+     *
+     * @return
+     */
+    public List<ScaleContent> getContent(PushVO pushVO) {
+        //获取内容列表
+        List<ScaleContent> data = this.list(new QueryWrapper<ScaleContent>()
+                .eq("scale_id", pushVO.getScaleId())
+                .orderByAsc("order_no"));
+
+        //看需是否要调用大数据
+        for(ScaleContent scaleContent : data) {
+            if(ScaleTypeEnum.PUSH.getKey() == scaleContent.getType()) {
+                //TODO 调用推理
+                scaleContent.setContent("大数据json字符串");
+                break;
+            }
+        }
+        return data;
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.ScaleContent;
+
+/**
+ * <p>
+ * 量表内容表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-03-11
+ */
+public interface ScaleContentMapper extends BaseMapper<ScaleContent> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.ScaleContent;
+
+/**
+ * <p>
+ * 量表内容表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-03-11
+ */
+public interface ScaleContentService extends IService<ScaleContent> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.ScaleContent;
+import com.diagbot.mapper.ScaleContentMapper;
+import com.diagbot.service.ScaleContentService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 量表内容表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-03-11
+ */
+@Service
+public class ScaleContentServiceImpl extends ServiceImpl<ScaleContentMapper, ScaleContent> implements ScaleContentService {
+
+}

+ 2 - 0
icss-service/src/main/java/com/diagbot/vo/PushVO.java

@@ -29,4 +29,6 @@ public class PushVO {
     private String past;
     private String other;
     private Long diseaseId;
+    private String scaleName; //量表名称
+    private Long scaleId;  //量表id
 }

+ 18 - 3
icss-service/src/main/java/com/diagbot/web/DisScaleController.java

@@ -3,8 +3,11 @@ package com.diagbot.web;
 
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.ScaleContent;
 import com.diagbot.facade.DisScaleFacade;
+import com.diagbot.facade.ScaleContentFacade;
 import com.diagbot.vo.DisScaleVO;
+import com.diagbot.vo.PushVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,18 +27,30 @@ import java.util.List;
  * @since 2019-03-11
  */
 @RestController
-@RequestMapping("/disScale")
+@RequestMapping("/scale")
 @Api(value = "诊断量表API", tags = { "诊断量表API" })
 public class DisScaleController {
 
     @Autowired
     DisScaleFacade disScaleFacade;
 
+    @Autowired
+    ScaleContentFacade scaleContentFacade;
+
     @ApiOperation(value = "返回诊断量表列表[by:zhoutg]",
             notes = "")
-    @PostMapping("/getDisScale")
-    public RespDTO<List<DisScaleDTO>> getDisType(@RequestBody DisScaleVO scaleVO) {
+    @PostMapping("/getList")
+    public RespDTO<List<DisScaleDTO>> getList(@RequestBody DisScaleVO scaleVO) {
         List<DisScaleDTO> data = disScaleFacade.getDisScaleFac(scaleVO.getDisId());
         return RespDTO.onSuc(data);
     }
+
+
+    @ApiOperation(value = "获取量表内容[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getContent")
+    public RespDTO<List<ScaleContent>> getContent(@RequestBody PushVO pushVO) {
+        List<ScaleContent> data = scaleContentFacade.getContent(pushVO);
+        return RespDTO.onSuc(data);
+    }
 }

+ 15 - 0
icss-service/src/main/resources/mapper/ScaleContentMapper.xml

@@ -0,0 +1,15 @@
+<?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.ScaleContentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ScaleContent">
+        <id column="id" property="id" />
+        <result column="scale_id" property="scaleId" />
+        <result column="content" property="content" />
+        <result column="type" property="type" />
+        <result column="order_no" property="orderNo" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 1 - 1
icss-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -56,7 +56,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
         strategy.setTablePrefix(new String[] { "icss_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "icss_dis_scale" }); // 需要生成的表
+        strategy.setInclude(new String[] { "icss_scale_content" }); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);