Prechádzať zdrojové kódy

Merge branch 'dev/msgMr' into develop

zhoutg 4 rokov pred
rodič
commit
d6860ccac6

+ 2 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -124,6 +124,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/sys/disclaimerInfo/getDisclaimerInfo").permitAll()
                 .antMatchers("/sys/mr/createMr").permitAll()
                 .antMatchers("/sys/mr/getMr").permitAll()
+                .antMatchers("/sys/mr/getIndicationMr").permitAll()
                 .antMatchers("/sys/plan/getSysPlanInfoDatas").permitAll()
                 .antMatchers("/sys/mrqc/analyze_run").permitAll()
                 .antMatchers("/sys/tokenPermission/delPermission").permitAll()
@@ -131,6 +132,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/sys/push/push").permitAll()
                 .antMatchers("/sys/push/pushApi").permitAll()
                 .antMatchers("/sys/push/indicationPush").permitAll()
+                .antMatchers("/sys/push/indicationExtPush").permitAll()
                 .antMatchers("/sys/push/pushPlan").permitAll()
                 .antMatchers("/demo/templateInfo/updateByIdUsNames").permitAll()
                 .antMatchers("/demo/templateInfo/saveTemplateInfo").permitAll()

+ 2 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -167,6 +167,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/sys/disclaimerInfo/getDisclaimerInfo", request)
                 || matchers("/sys/mr/createMr", request)
                 || matchers("/sys/mr/getMr", request)
+                || matchers("/sys/mr/getIndicationMr", request)
                 || matchers("/sys/plan/getSysPlanInfoDatas", request)
                 || matchers("/sys/mrqc/analyze_run", request)
                 || matchers("/sys/tokenPermission/delPermission", request)
@@ -174,6 +175,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/sys/push/push", request)
                 || matchers("/sys/push/pushApi", request)
                 || matchers("/sys/push/indicationPush", request)
+                || matchers("/sys/push/indicationExtPush", request)
                 || matchers("/sys/push/pushPlan", request)
                 || matchers("/demo/templateInfo/updateByIdUsNames", request)
                 || matchers("/demo/templateInfo/saveTemplateInfo", request)

+ 37 - 0
src/main/java/com/diagbot/facade/MrFacade.java

@@ -1,8 +1,15 @@
 package com.diagbot.facade;
 
+import com.diagbot.dto.IndicationDTO;
+import com.diagbot.idc.VisibleIdCreater;
 import com.diagbot.service.impl.MrServiceImpl;
+import com.diagbot.util.RedisUtil;
+import com.diagbot.vo.MrVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * @Description: 病历保存到redis装饰层
  * @author: gaodm
@@ -10,4 +17,34 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class MrFacade extends MrServiceImpl {
+
+    @Autowired
+    RedisUtil redisUtil;
+    @Autowired
+    VisibleIdCreater visibleIdCreater;
+
+    private static final String MSGMR = "msgMr::";
+
+    /**
+     * 创建提醒类结果
+     *
+     * @param indicationDTO
+     * @return
+     */
+    public String createIndicationMr(IndicationDTO indicationDTO) {
+        String mrId = visibleIdCreater.getNextId(9).toString();
+        redisUtil.setEx(MSGMR + mrId, indicationDTO, 15, TimeUnit.MINUTES);
+        return mrId;
+    }
+
+    /**
+     * 获取提醒类结果
+     *
+     * @param mrVO
+     * @return
+     */
+    public IndicationDTO getIndicationMr(MrVO mrVO) {
+        String mrId = MSGMR + mrVO.getMrId();
+        return redisUtil.get(mrId);
+    }
 }

+ 18 - 0
src/main/java/com/diagbot/facade/PushFacade.java

@@ -21,6 +21,7 @@ import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.SearchData;
 import com.google.common.collect.Lists;
+import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -47,6 +48,8 @@ public class PushFacade {
     private ConceptInfoFacade conceptInfoFacade;
     @Autowired
     private DictionaryFacade dictionaryFacade;
+    @Autowired
+    MrFacade mrFacade;
 
     /**
      * 基础推理-症状、查体、化验、辅检、诊断
@@ -101,6 +104,21 @@ public class PushFacade {
         return indicationDTO;
     }
 
+    /**
+     * 提示信息相关推理-危急值、开单合理项、药品禁忌等
+     *
+     * @param indicationPushVO
+     */
+    public String indicationExtPush(IndicationPushVO indicationPushVO) {
+        IndicationDTO indicationDTO = indicationPush(indicationPushVO);
+        if (indicationDTO != null) {
+            if (ListUtil.isNotEmpty(indicationDTO.getBillMsgList()) || ListUtil.isNotEmpty(indicationDTO.getHighRiskList())
+                    || ListUtil.isNotEmpty(indicationDTO.getCriticalValList()) || ListUtil.isNotEmpty(indicationDTO.getOtherList()))
+            return mrFacade.createIndicationMr(indicationDTO);
+        }
+        return "";
+    }
+
     /**
      * 推理持续检验检查计划
      *

+ 280 - 0
src/main/java/com/diagbot/util/RedisUtil.java

@@ -0,0 +1,280 @@
+package com.diagbot.util;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @description: redis工具类
+ * @author: zhoutg
+ * @time: 2020/8/11 19:52
+ */
+@Component
+public class RedisUtil {
+
+    @Autowired
+    @Qualifier("redisTemplateForMr")
+    RedisTemplate redisTemplate;
+
+    /**
+     * 根据指定key获取value
+     *
+     * @param key 键
+     */
+    public <T> T get(String key) {
+        return (T) redisTemplate.opsForValue().get(key);
+    }
+
+    /**
+     * 根据指定key设置obj
+     *
+     * @param key
+     * @param obj
+     */
+    public void set(String key, Object obj) {
+        redisTemplate.opsForValue().set(key, obj);
+    }
+
+    /**
+     * 批量获取
+     *
+     * @param keys
+     * @return
+     */
+    public <T> List<T> multiGet(Collection<String> keys) {
+        return redisTemplate.opsForValue().multiGet(keys);
+    }
+
+    /**
+     * 批量设置
+     *
+     * @param map
+     * @return
+     */
+    public void multiSet(Map<String, Object> map) {
+        redisTemplate.opsForValue().multiSet(map);
+    }
+
+    /**
+     * 更新指定的数据
+     *
+     * @param key
+     * @param str
+     */
+    public void updateValue(String key, String str) {
+        redisTemplate.opsForValue().set(key, str);
+    }
+
+    /**
+     * 删除key
+     *
+     * @param key
+     */
+    public void delete(String key) {
+        redisTemplate.delete(key);
+    }
+
+    /**
+     * 批量删除key
+     *
+     * @param keys
+     */
+    public void delete(Collection<String> keys) {
+        redisTemplate.delete(keys);
+    }
+
+    /**
+     * 根据前缀删除key
+     *
+     * @param prex
+     */
+    public void deleteByPrex(String prex) {
+        prex = prex + "**";
+        Set<String> keys = getKeyList(prex);
+        if (CollectionUtils.isNotEmpty(keys)) {
+            redisTemplate.delete(keys);
+        }
+    }
+
+    /**
+     * 根据正则key获取value列表
+     *
+     * @param pattern 键
+     */
+    public <T> List<T> getByRegex(String pattern) {
+        Set<String> keys = getKeyList(pattern);
+        return multiGet(keys);
+    }
+
+    /**
+     * 查找匹配的key
+     *
+     * @param pattern
+     * @return
+     */
+    public Set<String> getKeyList(String pattern) {
+        return redisTemplate.keys(pattern);
+    }
+
+    /**
+     * 序列化key
+     *
+     * @param key
+     * @return
+     */
+    public byte[] dump(String key) {
+        return redisTemplate.dump(key);
+    }
+
+    /**
+     * 是否存在key
+     *
+     * @param key
+     * @return
+     */
+    public Boolean hasKey(String key) {
+        return redisTemplate.hasKey(key);
+    }
+
+    /**
+     * 设置过期时间
+     *
+     * @param key
+     * @param timeout
+     * @param unit
+     * @return
+     */
+    public Boolean expire(String key, long timeout, TimeUnit unit) {
+        return redisTemplate.expire(key, timeout, unit);
+    }
+
+    /**
+     * 设置过期时间
+     *
+     * @param key
+     * @param date
+     * @return
+     */
+    public Boolean expireAt(String key, Date date) {
+        return redisTemplate.expireAt(key, date);
+    }
+
+    /**
+     * 移除 key 的过期时间,key 将持久保持
+     *
+     * @param key
+     * @return
+     */
+    public Boolean persist(String key) {
+        return redisTemplate.persist(key);
+    }
+
+    /**
+     * 返回 key 的剩余的过期时间
+     *
+     * @param key
+     * @param unit
+     * @return
+     */
+    public Long getExpire(String key, TimeUnit unit) {
+        return redisTemplate.getExpire(key, unit);
+    }
+
+    /**
+     * 返回 key 的剩余的过期时间
+     *
+     * @param key
+     * @return
+     */
+    public Long getExpire(String key) {
+        return redisTemplate.getExpire(key);
+    }
+
+    /**
+     * 修改 key 的名称
+     *
+     * @param oldKey
+     * @param newKey
+     */
+    public void rename(String oldKey, String newKey) {
+        redisTemplate.rename(oldKey, newKey);
+    }
+
+    /**
+     * 仅当 newkey 不存在时,将 oldKey 改名为 newkey
+     *
+     * @param oldKey
+     * @param newKey
+     * @return
+     */
+    public Boolean renameIfAbsent(String oldKey, String newKey) {
+        return redisTemplate.renameIfAbsent(oldKey, newKey);
+    }
+
+    /**
+     * 设置指定 key 的值
+     *
+     * @param key
+     * @param value
+     */
+    public void set(String key, String value) {
+        redisTemplate.opsForValue().set(key, value);
+    }
+
+    /**
+     * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
+     *
+     * @param key
+     * @param value
+     * @param timeout 过期时间
+     * @param unit    时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
+     *                秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
+     */
+    public void setEx(String key, Object value, long timeout, TimeUnit unit) {
+        redisTemplate.opsForValue().set(key, value, timeout, unit);
+    }
+
+    /**
+     * 只有在 key 不存在时设置 key 的值
+     *
+     * @param key
+     * @param value
+     * @return 之前已经存在返回false, 不存在返回true
+     */
+    public boolean setIfAbsent(String key, String value) {
+        return redisTemplate.opsForValue().setIfAbsent(key, value);
+    }
+
+    /**
+     * map集合的形式添加键值对
+     *
+     * @param key
+     * @param map
+     */
+    public void putHashMap(String key, Map<String, Object> map) {
+        if (MapUtils.isNotEmpty(map)) {
+            redisTemplate.opsForHash().putAll(key, map);
+        }
+    }
+
+    /**
+     * 获取集合中指定field的内容
+     * @param key
+     * @param field
+     * @param <T>
+     * @return
+     */
+    public <T> T getByKeyAndField(String key, String field) {
+        return (T)redisTemplate.opsForHash().get(key, field);
+    }
+}

+ 9 - 0
src/main/java/com/diagbot/web/MrController.java

@@ -1,6 +1,7 @@
 package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MrFacade;
 import com.diagbot.vo.MrVO;
@@ -44,4 +45,12 @@ public class MrController {
 	public RespDTO<PushJoinVO> getMr(@RequestBody @Valid MrVO mrVO) {
 		return RespDTO.onSuc(mrFacade.getMr(mrVO.getMrId()));
 	}
+
+	@ApiOperation(value = "获取提醒类结果 :[by:zhoutg]",
+			notes = "mrId: 病历编号,必填<br>")
+	@PostMapping("/getIndicationMr")
+	@SysLogger("getIndicationMr")
+	public RespDTO<IndicationDTO> getIndicationMr(@RequestBody @Valid MrVO mrVO) {
+		return RespDTO.onSuc(mrFacade.getIndicationMr(mrVO));
+	}
 }

+ 7 - 0
src/main/java/com/diagbot/web/PushController.java

@@ -68,6 +68,13 @@ public class PushController {
         return RespDTO.onSuc(data);
     }
 
+    @ApiOperation(value = "开单合理项推理扩展接口[by:zhoutg]", notes = "ruleType(1:危急值提醒,2:开单合理项,3:高危药品、手术,4:其他提醒)")
+    @PostMapping("/indicationExtPush")
+    @SysLogger("indicationExtPush")
+    @TokenAuth
+    public RespDTO<String> indicationExtPush(@RequestBody @Valid IndicationPushVO indicationPushVO) {
+        return RespDTO.onSuc(pushFacade.indicationExtPush(indicationPushVO));
+    }
 
     @ApiOperation(value = "推送持续检验检查计划API[zhaops]", notes = "operationName:随访手术")
     @PostMapping("/pushPlan")

+ 1 - 1
src/main/resources/application-dev.yml

@@ -158,7 +158,7 @@ mybatis-plus:
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}

+ 1 - 1
src/main/resources/application-local.yml

@@ -158,7 +158,7 @@ mybatis-plus:
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}

+ 1 - 1
src/main/resources/application-pre.yml

@@ -158,7 +158,7 @@ mybatis-plus:
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}

+ 1 - 1
src/main/resources/application-pro.yml

@@ -158,7 +158,7 @@ mybatis-plus:
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}

+ 1 - 1
src/main/resources/application-test.yml

@@ -158,7 +158,7 @@ mybatis-plus:
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}