Browse Source

Merge remote-tracking branch 'origin/dev/icss' into dev/icss

wangyu 6 years ago
parent
commit
6b51c054d2

+ 30 - 0
icss-service/src/main/java/com/diagbot/dto/ModuleInfoDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 模型表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Getter
+@Setter
+@TableName("icss_module_info")
+public class ModuleInfoDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Long id; //主键
+    private String name;//名称
+    private String format;//模板格式
+    private String copyFormat;//复制内容
+    private String remark;
+
+}

+ 6 - 3
icss-service/src/main/java/com/diagbot/dto/QuestionDTO.java

@@ -24,15 +24,18 @@ public class QuestionDTO {
     private Integer controlType; //控件类型
     private Integer subType; //子类型
     private String tagType; //标签标识(0:单项  1:组合项 2:填充项)
-    private String addLine; //添加换行符(0:不换行,1:换行)
     private String labelPrefix; //前置内容
     private String labelSuffix; //后置内容
     private BigDecimal minValue; //最小值
     private BigDecimal maxValue; //最大值
+    private Integer position;    //显示位置(0:在标签后,1:在标签前)
+    private Integer formPosition;  //填写单显示位置(0:左, 1:上)
+    private Integer textGenerate;    //显示位置(0:在标签后,1:在标签前)
+    private Integer symptomType; //主症状和伴随症状对应的question类型
+    private Integer exclusionType; //互斥类型
     private String judgeType; //判断类型(0:本身异常;1:本身正常;2:数字范围;3:计算公式;9:无需判断)
-    private String copyType;//是否显示 + (0:不显示 1 :显示)
+    private String copyType;//是否复制
     private List<QuestionDetail> questionDetailList = new ArrayList<>(); //标签明细表
     private List<QuestionDTO> questionMapping = new ArrayList<>();     //下级标签
-//    private List<QuestionDTO> questionRelationList = new ArrayList<>(); //同级标签
     private String remark;//备注
 }

+ 11 - 0
icss-service/src/main/java/com/diagbot/entity/ModuleInfo.java

@@ -60,6 +60,17 @@ public class ModuleInfo implements Serializable {
      */
     private String name;
 
+    /**
+     * 模板格式
+     */
+    private String format;
+
+
+    /**
+     * 复制内容
+     */
+    private String copyFormat;
+
     /**
      * 备注
      */

+ 0 - 5
icss-service/src/main/java/com/diagbot/entity/QuestionDetail.java

@@ -56,11 +56,6 @@ public class QuestionDetail implements Serializable {
      */
     private String defaultSelect;
 
-    /**
-     * 换行符(0:不换行, 1: 换行符)
-     */
-    private String addLine;
-
     /**
      * 备注
      */

+ 6 - 4
icss-service/src/main/java/com/diagbot/entity/QuestionInfo.java

@@ -73,10 +73,6 @@ public class QuestionInfo implements Serializable {
      */
     private String tagType;
 
-    /**
-     * 添加换行符(0:不换行,1:换行)
-     */
-    private String addLine;
 
     /**
      * 前置内容
@@ -109,6 +105,12 @@ public class QuestionInfo implements Serializable {
      */
     private String copyType;
 
+
+    /**
+     * 文本生成规则
+     */
+    private Integer textGenerate;
+
     /**
      * 备注
      */

+ 24 - 0
icss-service/src/main/java/com/diagbot/entity/wrapper/QuestionInfoWrapper.java

@@ -0,0 +1,24 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.entity.QuestionInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 标签扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-15
+ */
+@Getter
+@Setter
+public class QuestionInfoWrapper extends QuestionInfo {
+
+    private Integer position; //显示位置
+    private Integer exclusionType; //互斥类型
+    private Integer symptomType; //主症状和伴随症状对应的question类型
+    private Integer formPosition; //填写单显示位置
+
+}

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

@@ -0,0 +1,34 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.ModuleInfoDTO;
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.ModuleInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description: 模型业务层
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class ModuleFacade extends ModuleInfoServiceImpl {
+
+
+    /**
+     * 返回所有的模型结构
+     *
+     * @return 模型结构
+     */
+    public List<ModuleInfoDTO> getAll() {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<ModuleInfo> list =  this.list(queryWrapper);
+        return BeanUtil.listCopyTo(list, ModuleInfoDTO.class);
+    }
+
+}

+ 22 - 15
icss-service/src/main/java/com/diagbot/facade/PushFacade.java

@@ -19,14 +19,8 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.QuestionVO;
-import com.diagbot.web.DeptInfoController;
-import com.google.common.collect.Lists;
-import com.sun.corba.se.impl.ior.OldJIDLObjectKeyTemplate;
-import com.sun.xml.internal.ws.config.metro.dev.FeatureReader;
-import org.aspectj.weaver.patterns.TypePatternQuestions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -59,8 +53,7 @@ public class PushFacade {
      * @param pushVO
      * @return
      */
-    public PushDTO push(PushVO pushVO) {
-        PushDTO pushDTO = new PushDTO();
+    public ResponseData pushAI(PushVO pushVO) {
         SearchData searchData = new SearchData();
         searchData.setAge(pushVO.getAge());
         searchData.setSymptom(pushVO.getSymptom());
@@ -82,19 +75,33 @@ public class PushFacade {
             default:
                 throw new CommonException(CommonErrorCode.PARAM_ERROR, "性别参数错误");
         }
-        String featureType = pushVO.getFeatureType();
-        String[] featureTypes = featureType.split(",|,");
-        Set<String> featureTypeSet = new HashSet(Arrays.asList(featureTypes));
 
         searchData.setFeatureType(pushVO.getFeatureType());
         searchData.setSysCode("1");
         searchData.setLength(10);
 
         Response<ResponseData> res = aiServiceClient.bayesPageData(searchData);
-        List<FeatureRate> symptom = res.getData().getSymptom();
-        List<FeatureRate> dis = res.getData().getDis();
-        List<FeatureRate> pacs = res.getData().getPacs();
-        List<FeatureRate> labs = res.getData().getLabs();
+        return res.getData();
+    }
+
+    /**
+     * 内部推理
+     *
+     * @param pushVO
+     * @return
+     */
+    public PushDTO pushInner(PushVO pushVO) {
+        PushDTO pushDTO = new PushDTO();
+        ResponseData data = pushAI(pushVO);
+
+        String featureType = pushVO.getFeatureType();
+        String[] featureTypes = featureType.split(",|,");
+        Set<String> featureTypeSet = new HashSet(Arrays.asList(featureTypes));
+
+        List<FeatureRate> symptom = data.getSymptom();
+        List<FeatureRate> dis = data.getDis();
+        List<FeatureRate> pacs = data.getPacs();
+        List<FeatureRate> labs = data.getLabs();
 
         Map<String, Object> symptomMap = list2Map(symptom);
         Map<String, Object> vitalMap = new HashMap<>();

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

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.dto.QuestionDTO;
 import com.diagbot.entity.QuestionDetail;
 import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 import com.diagbot.enums.ControlTypeEnum;
 import com.diagbot.service.impl.QuestionInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
@@ -56,7 +57,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
 //        res.setQuestionRelationList(questionRelationDTO);
 
         //获取子标签
-        List<QuestionInfo> questionMapping = this.getByQuestionMapping(paramMap);
+        List<QuestionInfoWrapper> questionMapping = this.getByQuestionMapping(paramMap);
         List<QuestionDTO> sonQuestionList = BeanUtil.listCopyTo(questionMapping, QuestionDTO.class);
         res.setQuestionMapping(sonQuestionList);
         //获取子标签的明细项

+ 2 - 1
icss-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java

@@ -2,6 +2,7 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 
 import java.util.List;
 import java.util.Map;
@@ -30,7 +31,7 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
      * @param map 参数
      * @return
      */
-    public List<QuestionInfo> getByQuestionMapping(Map map);
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
 
     /**
      *  根据questionRelation获取标签信息

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

@@ -2,6 +2,7 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 
 import java.util.List;
 import java.util.Map;
@@ -29,7 +30,7 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
      * @param map 参数
      * @return
      */
-    public List<QuestionInfo> getByQuestionMapping(Map map);
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
 
 
     /**

+ 3 - 2
icss-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java

@@ -1,9 +1,10 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.QuestionInfo;
+import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 import com.diagbot.mapper.QuestionInfoMapper;
 import com.diagbot.service.QuestionInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -26,7 +27,7 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     }
 
     @Override
-    public List<QuestionInfo> getByQuestionMapping(Map map) {
+    public List<QuestionInfoWrapper> getByQuestionMapping(Map map) {
         return baseMapper.getByQuestionMapping(map);
     }
 

+ 21 - 2
icss-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -1,9 +1,17 @@
 package com.diagbot.web;
 
 
+import com.diagbot.dto.ModuleInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.ModuleFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import org.springframework.stereotype.Controller;
+import java.util.List;
 
 /**
  * <p>
@@ -13,8 +21,19 @@ import org.springframework.stereotype.Controller;
  * @author zhoutg
  * @since 2018-11-15
  */
-@Controller
+@RestController
 @RequestMapping("/moduleInfo")
+@Api(value = "模型相关API", tags = { "模型相关API" })
 public class ModuleInfoController {
 
+    @Autowired
+    ModuleFacade moduleFacade;
+
+    @ApiOperation(value = "返回所有的模型数据[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getAll")
+    public RespDTO<List<ModuleInfoDTO>> getAll() {
+        List<ModuleInfoDTO> data = moduleFacade.getAll();
+        return RespDTO.onSuc(data);
+    }
 }

+ 16 - 4
icss-service/src/main/java/com/diagbot/web/PushController.java

@@ -1,6 +1,7 @@
 package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.client.bean.ResponseData;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.PushFacade;
@@ -24,14 +25,25 @@ import javax.validation.Valid;
 @RequestMapping("/push")
 @Api(value = "推理相关API", tags = { "推理相关API" })
 public class PushController {
+
     @Autowired
     PushFacade pushFacade;
+
     @ApiOperation(value = "推理接口[by:zhaops]",
             notes = "age: 年龄(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>")
-    @PostMapping("/push")
-    @SysLogger("push")
-    public RespDTO<PushDTO> push(@RequestBody @Valid PushVO pushVO) {
-        return RespDTO.onSuc(pushFacade.push(pushVO));
+    @PostMapping("/push_inner")
+    @SysLogger("push_inner")
+    public RespDTO<PushDTO> pushInner(@RequestBody @Valid PushVO pushVO) {
+        return RespDTO.onSuc(pushFacade.pushInner(pushVO));
+    }
+
+    @ApiOperation(value = "推理接口(直接返回大数据推理结果)[by:zhaops]",
+            notes = "age: 年龄(必填)<br>" +
+                    "sex:性别,1:男,2:女(必填)<br>")
+    @PostMapping("/push_ai")
+    @SysLogger("push_ai")
+    public RespDTO<ResponseData> pushAI(@RequestBody @Valid PushVO pushVO) {
+        return RespDTO.onSuc(pushFacade.pushAI(pushVO));
     }
 }

+ 0 - 1
icss-service/src/main/resources/mapper/QuestionDetailMapper.xml

@@ -11,7 +11,6 @@
         <result column="question_id" property="questionId" />
         <result column="order_no" property="orderNo" />
         <result column="default_select" property="defaultSelect" />
-        <result column="add_line" property="addLine" />
         <result column="remark" property="remark" />
     </resultMap>
 

+ 3 - 3
icss-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -11,10 +11,10 @@
         <result column="age_begin" property="ageBegin" />
         <result column="age_end" property="ageEnd" />
         <result column="type" property="type" />
+        <result column="text_generate" property="textGenerate" />
         <result column="control_type" property="controlType" />
         <result column="sub_type" property="subType" />
         <result column="tag_type" property="tagType" />
-        <result column="add_line" property="addLine" />
         <result column="label_prefix" property="labelPrefix" />
         <result column="label_suffix" property="labelSuffix" />
         <result column="min_value" property="minValue" />
@@ -37,8 +37,8 @@
     </select>
 
 
-    <select id="getByQuestionMapping" parameterType="java.util.Map" resultMap="BaseResultMap">
-        select t.* from icss_question_info t, icss_question_mapping m
+    <select id="getByQuestionMapping" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.QuestionInfoWrapper">
+        select t.*, m.position, m.form_position , m.exclusion_type, m.symptom_type from icss_question_info t, icss_question_mapping m
         where t.is_deleted = 'N' and m.is_deleted = 'N' and m.son_question = t.id
         and m.parent_question = #{id}
         <if test="sexType != null">

+ 14 - 35
icssman-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -13,6 +13,7 @@ import com.diagbot.vo.IntroduceVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Arrays;
 import java.util.Date;
 import java.util.Map;
 
@@ -50,10 +51,9 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
         //明细信息不更新,每次都删除重新插入
         //删除已有明细,物理删除
         if (!(introduceInfo.getId() == null)) {
-            UpdateWrapper<IntroduceDetail> detailUpdateWrapper = new UpdateWrapper<>();
-            detailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
-                    eq("introduce_id", introduceInfo.getId());
-            introduceDetailFacade.remove(detailUpdateWrapper);
+            QueryWrapper<IntroduceDetail> detailQueryWrapper = new QueryWrapper<>();
+            detailQueryWrapper.eq("introduce_id", introduceInfo.getId());
+            introduceDetailFacade.remove(detailQueryWrapper);
         }
         //新增明细,清空id
         for (IntroduceDetail detail : introduceVO.getDetailList()) {
@@ -68,53 +68,32 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
     }
 
     /**
-     * 单条删除提示信息
+     * 单条删除提示信息 物理删除
      *
      * @param id
      * @return
      */
     public Boolean deleteRecord(Long id) {
         //删除明细
-        UpdateWrapper<IntroduceDetail> introduceDetailUpdateWrapper = new UpdateWrapper<>();
-        introduceDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
-                eq("introduce_id", id).
-                set("is_deleted", IsDeleteEnum.Y.getKey()).
-                set("gmt_modified", new Date()).
-                set("modifier", UserUtils.getCurrentPrincipleID());
-        introduceDetailFacade.update(new IntroduceDetail(), introduceDetailUpdateWrapper);
-
-        UpdateWrapper<IntroduceInfo> introduceInfoUpdateWrapper = new UpdateWrapper<>();
-        introduceInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
-                eq("id", id).
-                set("is_deleted", IsDeleteEnum.Y.getKey()).
-                set("gmt_modified", new Date()).
-                set("modifier", UserUtils.getCurrentPrincipleID());
-        this.update(new IntroduceInfo(), introduceInfoUpdateWrapper);
+        QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
+        introduceDetailQueryWrapper.eq("introduce_id", id);
+        introduceDetailFacade.remove(introduceDetailQueryWrapper);
+        this.removeById(id);
         return true;
     }
 
     /**
-     * 批量删除提示信息
+     * 批量删除提示信息 物理删除
      *
      * @param ids
      * @return
      */
     public Boolean deleteRecords(Long[] ids) {
         //删除明细
-        UpdateWrapper<IntroduceDetail> introduceDetailUpdateWrapper = new UpdateWrapper<>();
-        introduceDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
-                in("introduce_id", ids).
-                set("is_deleted", IsDeleteEnum.Y.getKey()).
-                set("gmt_modified", new Date()).
-                set("modifier", UserUtils.getCurrentPrincipleID());
-        introduceDetailFacade.update(new IntroduceDetail(), introduceDetailUpdateWrapper);
-        UpdateWrapper<IntroduceInfo> introduceInfoUpdateWrapper = new UpdateWrapper<>();
-        introduceInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
-                in("id", ids).
-                set("is_deleted", IsDeleteEnum.Y.getKey()).
-                set("gmt_modified", new Date()).
-                set("modifier", UserUtils.getCurrentPrincipleID());
-        this.update(new IntroduceInfo(), introduceInfoUpdateWrapper);
+        QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
+        introduceDetailQueryWrapper.in("introduce_id", ids);
+        introduceDetailFacade.remove(introduceDetailQueryWrapper);
+        this.removeByIds(Arrays.asList(ids));
         return true;
     }