|
@@ -1,5 +1,6 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
import com.diagbot.client.PushNewServiceClient;
|
|
|
import com.diagbot.dto.PushBaseDTO;
|
|
|
import com.diagbot.dto.PushDTO;
|
|
@@ -66,14 +67,28 @@ public class PushFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public PushDTO pushFac(PushVO pushVO) {
|
|
|
- String pushVersion = redisUtil.getByKeyAndField(RedisEnum.pushVersion.getName(),
|
|
|
+ // 获取pushMode
|
|
|
+ Integer pushModel = redisUtil.getByKeyAndField(RedisEnum.pushModel.getName(),
|
|
|
RedisEnum.hospitalId_.getName() + pushVO.getHospitalId());
|
|
|
- if (StringUtil.isNotBlank(pushVersion) && "old".equals(pushVersion)) {
|
|
|
- // 使用5.0推送
|
|
|
- return processAggreate(pushVO);
|
|
|
- } else {
|
|
|
- // 使用新版推送
|
|
|
- return pushNewFac(pushVO);
|
|
|
+ switch (pushModel) {
|
|
|
+ case 0: // 使用新版推送
|
|
|
+ return pushNewFac(pushVO, "0");
|
|
|
+ case 1: // 使用5.0推送
|
|
|
+ return processAggreate(pushVO);
|
|
|
+ case 2: // 走科室对应的模型,如果找不到,使用5.0推理
|
|
|
+ List<Item> deptList = pushVO.getDept();
|
|
|
+ String modelType = "0";
|
|
|
+ if (ListUtil.isNotEmpty(deptList)) {
|
|
|
+ modelType = redisUtil.getByKeyAndField(RedisEnum.deptPush.getName(),
|
|
|
+ deptList.get(0).getUniqueName());
|
|
|
+ }
|
|
|
+ if ("0".equals(modelType)) {
|
|
|
+ return processAggreate(pushVO);
|
|
|
+ } else {
|
|
|
+ return pushNewFac(pushVO, modelType);
|
|
|
+ }
|
|
|
+ default: // 默认使用新版推送
|
|
|
+ return pushNewFac(pushVO, "0");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -123,7 +138,7 @@ public class PushFacade {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- public PushDTO pushNewFac(PushVO pushVo) {
|
|
|
+ public PushDTO pushNewFac(PushVO pushVo, String modelType) {
|
|
|
PushDTO pushDTO = new PushDTO();
|
|
|
Map<String, Object> debug = new LinkedHashMap<>();
|
|
|
debug.put("大数据推送地址", pushUrl);
|
|
@@ -149,7 +164,7 @@ public class PushFacade {
|
|
|
try {
|
|
|
Map<String, Object> invokeParams = new HashMap<>();
|
|
|
invokeParams.put("wordCrfDTO", wordCrfDTO);
|
|
|
- invokeParams.put("pushNewVO", generatePushVo(wordCrfDTO));
|
|
|
+ invokeParams.put("pushNewVO", generatePushVo(wordCrfDTO, modelType));
|
|
|
pushDTO = DataFacade.get("pushAll", invokeParams, PushDTO.class);
|
|
|
} catch (Exception e) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推送服务出错" + e.getMessage());
|
|
@@ -257,17 +272,17 @@ public class PushFacade {
|
|
|
* 生成新版推送入参
|
|
|
*
|
|
|
* @param wordCrfDTO
|
|
|
+ * @param modelType 模型类型
|
|
|
* @return
|
|
|
*/
|
|
|
- public PushNewVO generatePushVo(WordCrfDTO wordCrfDTO) {
|
|
|
+ public PushNewVO generatePushVo(WordCrfDTO wordCrfDTO, String modelType) {
|
|
|
PushNewVO pushNewVO = new PushNewVO();
|
|
|
pushNewVO.setChief(wordCrfDTO.getChief());
|
|
|
pushNewVO.setPresent(wordCrfDTO.getSymptom());
|
|
|
pushNewVO.setAge(wordCrfDTO.getAgeNum());
|
|
|
pushNewVO.setSex(wordCrfDTO.getSex());
|
|
|
- String pushType = redisUtil.getByKeyAndField(RedisEnum.hospitalPushType.getName(), String.valueOf(wordCrfDTO.getHospitalId()));
|
|
|
- if (StringUtil.isNotBlank(pushType)) {
|
|
|
- pushNewVO.setHospitalType(pushType);
|
|
|
+ if (StringUtil.isNotBlank(modelType)) {
|
|
|
+ pushNewVO.setHospitalType(modelType);
|
|
|
}
|
|
|
return pushNewVO;
|
|
|
}
|