|
@@ -1,26 +1,20 @@
|
|
|
package com.diagbot.aggregate;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.diagbot.client.CdssCoreClient;
|
|
|
-import com.diagbot.dto.BillMsg;
|
|
|
-import com.diagbot.dto.IndicationDTO;
|
|
|
-import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.ResultInfo;
|
|
|
import com.diagbot.entity.ResultRule;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.facade.MedRuleConvertFacade;
|
|
|
-import com.diagbot.facade.MedSearchDataFacade;
|
|
|
import com.diagbot.facade.RunningInfoFacade;
|
|
|
import com.diagbot.service.ResultInfoService;
|
|
|
import com.diagbot.service.ResultRuleService;
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
-import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
-import com.diagbot.util.RespDTOUtil;
|
|
|
-import com.diagbot.vo.IndicationPushVO;
|
|
|
import com.diagbot.vo.RuleTestVO;
|
|
|
import com.diagbot.vo.RunningInfoVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
import io.github.lvyahui8.spring.annotation.DataConsumer;
|
|
|
import io.github.lvyahui8.spring.annotation.DataProvider;
|
|
|
import io.github.lvyahui8.spring.annotation.InvokeParameter;
|
|
@@ -31,6 +25,7 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -43,8 +38,6 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
@Slf4j
|
|
|
public class RuleTestAggregate {
|
|
|
- @Autowired
|
|
|
- private CdssCoreClient cdssCoreClient;
|
|
|
@Autowired
|
|
|
@Qualifier("resultRuleServiceImpl")
|
|
|
private ResultRuleService resultRuleService;
|
|
@@ -56,7 +49,7 @@ public class RuleTestAggregate {
|
|
|
@Autowired
|
|
|
private MedRuleConvertFacade medRuleConvertFacade;
|
|
|
@Autowired
|
|
|
- private MedSearchDataFacade medSearchDataFacade;
|
|
|
+ private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
|
|
|
|
|
|
@DataProvider("ruleTest")
|
|
|
public Boolean ruleTest(
|
|
@@ -231,7 +224,6 @@ public class RuleTestAggregate {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 开单合理性远程调用接口
|
|
|
*
|
|
@@ -244,101 +236,48 @@ public class RuleTestAggregate {
|
|
|
if (ListUtil.isEmpty(list)) {
|
|
|
return retList;
|
|
|
}
|
|
|
+
|
|
|
Map<Long, List<ResultRule>> ruleMap = list
|
|
|
.stream()
|
|
|
.collect(Collectors.groupingBy(ResultRule::getRuleOrderNo));
|
|
|
- for (Map.Entry<Long, List<ResultRule>> entry : ruleMap.entrySet()) {
|
|
|
-
|
|
|
- if (entry.getValue().get(0).getSuccess() != null
|
|
|
- && entry.getValue().get(0).getSuccess().equals(0)) {
|
|
|
- retList.addAll(entry.getValue());
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- Integer ruleType = entry.getValue().get(0).getRuleType();
|
|
|
- IndicationPushVO indicationPushVO = medSearchDataFacade.createBillVO(entry.getValue(),hospitalId);
|
|
|
-
|
|
|
- //入参
|
|
|
- entry.getValue().forEach(result -> {
|
|
|
- result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
|
- });
|
|
|
-
|
|
|
- RespDTO<IndicationDTO> respDTO = cdssCoreClient.indication(indicationPushVO);
|
|
|
- if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
- IndicationDTO data = respDTO.data;
|
|
|
- //出参
|
|
|
- entry.getValue().forEach(result -> {
|
|
|
- result.setOutputParams(FastJsonUtils.getBeanToJson(respDTO.data));
|
|
|
- });
|
|
|
- List<BillMsg> msgList = Lists.newLinkedList();
|
|
|
- switch (ruleType) {
|
|
|
- case 1:
|
|
|
- case 6:
|
|
|
- msgList = data.getBillMsgList();
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- msgList = data.getHighRiskList();
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- msgList = data.getCriticalValList();
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- case 5:
|
|
|
- msgList = data.getOtherList();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (ListUtil.isEmpty(msgList)) {
|
|
|
- entry.getValue().forEach(result -> {
|
|
|
- result.setSuccess(0);
|
|
|
- result.setMessage("提醒信息未出现");
|
|
|
- retList.add(result);
|
|
|
- });
|
|
|
- continue;
|
|
|
- }
|
|
|
|
|
|
- Boolean success = false;
|
|
|
- for (BillMsg msg : msgList) {
|
|
|
- if (!msg.getMsg().equals(entry.getValue().get(0).getExpectedOutput())) {
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- success = true;
|
|
|
- }
|
|
|
- for (ResultRule result : entry.getValue()) {
|
|
|
- ResultRule saveResult = new ResultRule();
|
|
|
- BeanUtil.copyProperties(result, saveResult);
|
|
|
- saveResult.setOutput(msg.getMsg());
|
|
|
- if (saveResult.getOutput().equals(saveResult.getExpectedOutput())) {
|
|
|
- saveResult.setSuccess(1);
|
|
|
- } else {
|
|
|
- saveResult.setSuccess(0);
|
|
|
- saveResult.setMessage("提示内容与预期不符");
|
|
|
- }
|
|
|
- retList.add(saveResult);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!success) {
|
|
|
- for (ResultRule result : entry.getValue()) {
|
|
|
- Integer count = 1;
|
|
|
- result.setSuccess(0);
|
|
|
- result.setMessage(result.getMessage() + "提示内容("
|
|
|
- + (count++) + "、"
|
|
|
- + msgList.stream().map(i -> i.getMsg()).collect(Collectors.joining(";" + (count++) + "、"))
|
|
|
- + ")与预期不符");
|
|
|
- retList.add(result);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (ResultRule result : entry.getValue()) {
|
|
|
- result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
|
- result.setSuccess(0);
|
|
|
- result.setMessage("远程调用推理接口失败");
|
|
|
- retList.add(result);
|
|
|
+ List<ResultRule> threadList1 = Lists.newLinkedList();
|
|
|
+ List<ResultRule> threadList2 = Lists.newLinkedList();
|
|
|
+ List<ResultRule> threadList3 = Lists.newLinkedList();
|
|
|
+ List<ResultRule> threadList4 = Lists.newLinkedList();
|
|
|
+
|
|
|
+ if (ruleMap.size() >= 100) {
|
|
|
+ Integer averageNum = ruleMap.size() / 4;
|
|
|
+ Integer count = 0;
|
|
|
+ for (Map.Entry<Long, List<ResultRule>> entry : ruleMap.entrySet()) {
|
|
|
+ count++;
|
|
|
+ if (count < averageNum) {
|
|
|
+ threadList1.addAll(entry.getValue());
|
|
|
+ } else if (count >= averageNum && count < averageNum * 2) {
|
|
|
+ threadList2.addAll(entry.getValue());
|
|
|
+ } else if (count >= averageNum * 2 && count < averageNum * 3) {
|
|
|
+ threadList3.addAll(entry.getValue());
|
|
|
+ } else if (count >= averageNum * 3) {
|
|
|
+ threadList4.addAll(entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ threadList1.addAll(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
+ invokeParams.put("threadList1", threadList1);
|
|
|
+ invokeParams.put("threadList2", threadList2);
|
|
|
+ invokeParams.put("threadList3", threadList3);
|
|
|
+ invokeParams.put("threadList4", threadList4);
|
|
|
+ invokeParams.put("hospitalId", hospitalId);
|
|
|
+ retList
|
|
|
+ = dataBeanAggregateQueryFacade.get("callIndication", invokeParams, List.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
|
|
|
}
|
|
|
+
|
|
|
return retList;
|
|
|
}
|
|
|
|