|
@@ -1,7 +1,5 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.diagbot.client.CdssCoreClient;
|
|
import com.diagbot.client.CdssCoreClient;
|
|
import com.diagbot.dto.BillMsg;
|
|
import com.diagbot.dto.BillMsg;
|
|
@@ -17,27 +15,36 @@ import com.diagbot.entity.ResultCritical;
|
|
import com.diagbot.entity.ResultHighriskDrug;
|
|
import com.diagbot.entity.ResultHighriskDrug;
|
|
import com.diagbot.entity.ResultHighriskOperation;
|
|
import com.diagbot.entity.ResultHighriskOperation;
|
|
import com.diagbot.entity.ResultInfo;
|
|
import com.diagbot.entity.ResultInfo;
|
|
|
|
+import com.diagbot.entity.ResultOtherLis;
|
|
import com.diagbot.entity.TransfusionConfig;
|
|
import com.diagbot.entity.TransfusionConfig;
|
|
import com.diagbot.entity.node.BillItem;
|
|
import com.diagbot.entity.node.BillItem;
|
|
import com.diagbot.entity.node.LisCritical;
|
|
import com.diagbot.entity.node.LisCritical;
|
|
|
|
+import com.diagbot.entity.node.LisRemind;
|
|
import com.diagbot.entity.node.MedRegName;
|
|
import com.diagbot.entity.node.MedRegName;
|
|
import com.diagbot.entity.node.PacsCritical;
|
|
import com.diagbot.entity.node.PacsCritical;
|
|
|
|
+import com.diagbot.entity.node.PacsRemind;
|
|
import com.diagbot.entity.node.TransfusionRemind;
|
|
import com.diagbot.entity.node.TransfusionRemind;
|
|
|
|
+import com.diagbot.entity.node.TransfusionSuggest;
|
|
import com.diagbot.entity.node.YiBaoOperationName;
|
|
import com.diagbot.entity.node.YiBaoOperationName;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
+import com.diagbot.enums.NeoEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
import com.diagbot.enums.TypeEnum;
|
|
import com.diagbot.enums.TypeEnum;
|
|
import com.diagbot.repository.BillManRepository;
|
|
import com.diagbot.repository.BillManRepository;
|
|
import com.diagbot.repository.LisCriticalRepository;
|
|
import com.diagbot.repository.LisCriticalRepository;
|
|
|
|
+import com.diagbot.repository.LisRemindRepository;
|
|
import com.diagbot.repository.MedRegNameRepository;
|
|
import com.diagbot.repository.MedRegNameRepository;
|
|
import com.diagbot.repository.PacsCriticalRepository;
|
|
import com.diagbot.repository.PacsCriticalRepository;
|
|
|
|
+import com.diagbot.repository.PacsRemindRepository;
|
|
import com.diagbot.repository.TransfusionRemindRepository;
|
|
import com.diagbot.repository.TransfusionRemindRepository;
|
|
|
|
+import com.diagbot.repository.TransfusionSuggestRepository;
|
|
import com.diagbot.repository.YiBaoOperationNameRepository;
|
|
import com.diagbot.repository.YiBaoOperationNameRepository;
|
|
import com.diagbot.service.ResultBillService;
|
|
import com.diagbot.service.ResultBillService;
|
|
import com.diagbot.service.ResultCriticalService;
|
|
import com.diagbot.service.ResultCriticalService;
|
|
import com.diagbot.service.ResultHighriskDrugService;
|
|
import com.diagbot.service.ResultHighriskDrugService;
|
|
import com.diagbot.service.ResultHighriskOperationService;
|
|
import com.diagbot.service.ResultHighriskOperationService;
|
|
import com.diagbot.service.ResultInfoService;
|
|
import com.diagbot.service.ResultInfoService;
|
|
|
|
+import com.diagbot.service.ResultOtherLisService;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.ExcelUtils;
|
|
import com.diagbot.util.ExcelUtils;
|
|
import com.diagbot.util.FastJsonUtils;
|
|
import com.diagbot.util.FastJsonUtils;
|
|
@@ -49,6 +56,7 @@ import com.diagbot.vo.CriticalRuleVO;
|
|
import com.diagbot.vo.HighriskRuleVO;
|
|
import com.diagbot.vo.HighriskRuleVO;
|
|
import com.diagbot.vo.HospitalIdVO;
|
|
import com.diagbot.vo.HospitalIdVO;
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
|
|
+import com.diagbot.vo.OtherRuleVO;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
@@ -85,6 +93,9 @@ public class RuleTestFacade {
|
|
@Autowired
|
|
@Autowired
|
|
@Qualifier("resultHighriskOperationServiceImpl")
|
|
@Qualifier("resultHighriskOperationServiceImpl")
|
|
private ResultHighriskOperationService resultHighriskOperationService;
|
|
private ResultHighriskOperationService resultHighriskOperationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier("resultOtherLisServiceImpl")
|
|
|
|
+ private ResultOtherLisService resultOtherLisService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -112,6 +123,12 @@ public class RuleTestFacade {
|
|
private MedRegNameRepository medRegNameRepository;
|
|
private MedRegNameRepository medRegNameRepository;
|
|
@Autowired
|
|
@Autowired
|
|
private YiBaoOperationNameRepository yiBaoOperationNameRepository;
|
|
private YiBaoOperationNameRepository yiBaoOperationNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LisRemindRepository lisRemindRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PacsRemindRepository pacsRemindRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TransfusionSuggestRepository transfusionSuggestRepository;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private UnUsedMappingFacade unUsedMappingFacade;
|
|
private UnUsedMappingFacade unUsedMappingFacade;
|
|
@@ -254,6 +271,49 @@ public class RuleTestFacade {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 其他值提醒-化验
|
|
|
|
+ *
|
|
|
|
+ * @param otherRuleVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean otherLisRuleTest(OtherRuleVO otherRuleVO) {
|
|
|
|
+ Long hospitalId = otherRuleVO.getHospitalId();
|
|
|
|
+ List<LisRemind> items = lisRemindRepository.findByStatus(1);
|
|
|
|
+ //生成测试规则
|
|
|
|
+ List<ResultOtherLis> resultList = ruleConvertFacade.otherRuleConvert_lis(items, hospitalId);
|
|
|
|
+ //远程调用推理
|
|
|
|
+ List<ResultOtherLis> saveList = callOther_lis(resultList, hospitalId);
|
|
|
|
+ //保存测试结果
|
|
|
|
+ saveResultOther_lis(saveList, otherRuleVO);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 其他值提醒-辅检
|
|
|
|
+ *
|
|
|
|
+ * @param otherRuleVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean otherPacsRuleTest(OtherRuleVO otherRuleVO) {
|
|
|
|
+ Long hospitalId = otherRuleVO.getHospitalId();
|
|
|
|
+ List<PacsRemind> items = pacsRemindRepository.findByStatus(1);
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 其他值提醒-输血
|
|
|
|
+ *
|
|
|
|
+ * @param otherRuleVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean otherTransfusionRuleTest(OtherRuleVO otherRuleVO) {
|
|
|
|
+ Long hospitalId = otherRuleVO.getHospitalId();
|
|
|
|
+ List<TransfusionSuggest> items = transfusionSuggestRepository.findByStatus(1);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 数据导出
|
|
* 数据导出
|
|
@@ -338,7 +398,7 @@ public class RuleTestFacade {
|
|
retList.add(resultBill);
|
|
retList.add(resultBill);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- IndicationPushVO indicationPushVO = searchDataFacade.creatBillVO(resultBill);
|
|
|
|
|
|
+ IndicationPushVO indicationPushVO = searchDataFacade.createBillVO(resultBill);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
|
|
|
|
resultBill.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
resultBill.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
@@ -392,7 +452,7 @@ public class RuleTestFacade {
|
|
retList.add(result);
|
|
retList.add(result);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- IndicationPushVO indicationPushVO = searchDataFacade.creatCriticalVO(result);
|
|
|
|
|
|
+ IndicationPushVO indicationPushVO = searchDataFacade.createCriticalVO(result);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
|
|
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
@@ -446,7 +506,7 @@ public class RuleTestFacade {
|
|
retList.add(result);
|
|
retList.add(result);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- IndicationPushVO indicationPushVO = searchDataFacade.creatHighriskVO_drug(result);
|
|
|
|
|
|
+ IndicationPushVO indicationPushVO = searchDataFacade.createHighriskVO_drug(result);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
|
|
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
@@ -500,7 +560,7 @@ public class RuleTestFacade {
|
|
retList.add(result);
|
|
retList.add(result);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- IndicationPushVO indicationPushVO = searchDataFacade.creatHighriskVO_operation(result);
|
|
|
|
|
|
+ IndicationPushVO indicationPushVO = searchDataFacade.createHighriskVO_operation(result);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
indicationPushVO.setHospitalId(hospitalId);
|
|
|
|
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
@@ -536,6 +596,66 @@ public class RuleTestFacade {
|
|
return retList;
|
|
return retList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 其他值提醒(化验)远程调用接口
|
|
|
|
+ *
|
|
|
|
+ * @param list
|
|
|
|
+ * @param hospitalId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<ResultOtherLis> callOther_lis(List<ResultOtherLis> list, Long hospitalId) {
|
|
|
|
+ List<ResultOtherLis> retList = Lists.newLinkedList();
|
|
|
|
+ if (ListUtil.isEmpty(list)) {
|
|
|
|
+ return retList;
|
|
|
|
+ }
|
|
|
|
+ for (ResultOtherLis result : list) {
|
|
|
|
+ if (result.getSuccess() != null
|
|
|
|
+ && result.getSuccess().equals(0)) {
|
|
|
|
+ retList.add(result);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ IndicationPushVO indicationPushVO = searchDataFacade.createOther_lis(result);
|
|
|
|
+ indicationPushVO.setHospitalId(hospitalId);
|
|
|
|
+
|
|
|
|
+ result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
|
|
|
|
+
|
|
|
|
+ RespDTO<IndicationDTO> respDTO = cdssCoreClient.indication(indicationPushVO);
|
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
|
+ IndicationDTO data = respDTO.data;
|
|
|
|
+ List<BillMsg> billMsgList = data.getOtherList();
|
|
|
|
+ if (ListUtil.isEmpty(billMsgList)) {
|
|
|
|
+ result.setSuccess(0);
|
|
|
|
+ result.setMessage("其他值未提醒");
|
|
|
|
+ retList.add(result);
|
|
|
|
+ } else {
|
|
|
|
+ for (BillMsg billMsg : billMsgList) {
|
|
|
|
+ if (!(StringUtil.isNotBlank(billMsg.getType())
|
|
|
|
+ && (billMsg.getType().equals(TypeEnum.drug.getName())
|
|
|
|
+ || billMsg.getType().equals(TypeEnum.disease.getName())
|
|
|
|
+ || billMsg.getType().equals(NeoEnum.group.getName())))) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ ResultOtherLis saveResult = new ResultOtherLis();
|
|
|
|
+ BeanUtil.copyProperties(result, saveResult);
|
|
|
|
+ saveResult.setOutput(billMsg.getMsg());
|
|
|
|
+ if (saveResult.getOutput().equals(saveResult.getExpectedOutput())) {
|
|
|
|
+ saveResult.setSuccess(1);
|
|
|
|
+ } else {
|
|
|
|
+ saveResult.setSuccess(0);
|
|
|
|
+ saveResult.setMessage("提示内容与预期不符");
|
|
|
|
+ }
|
|
|
|
+ retList.add(saveResult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ result.setSuccess(0);
|
|
|
|
+ result.setMessage("远程调用推理接口失败");
|
|
|
|
+ retList.add(result);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return retList;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 保存开单合理性测试结果
|
|
* 保存开单合理性测试结果
|
|
*
|
|
*
|
|
@@ -709,4 +829,47 @@ public class RuleTestFacade {
|
|
resultHighriskOperationService.saveOrUpdateBatch(list);
|
|
resultHighriskOperationService.saveOrUpdateBatch(list);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存其他值提醒(化验)测试结果
|
|
|
|
+ *
|
|
|
|
+ * @param list
|
|
|
|
+ * @param otherRuleVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean saveResultOther_lis(List<ResultOtherLis> list, OtherRuleVO otherRuleVO) {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ Integer totleNum = list.size();
|
|
|
|
+ Integer successNum = list.stream().filter(i -> i.getSuccess().equals(1)).collect(Collectors.toList()).size();
|
|
|
|
+ Integer failedNum = list.stream().filter(i -> i.getSuccess().equals(0)).collect(Collectors.toList()).size();
|
|
|
|
+ QueryWrapper<ResultInfo> resultInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ resultInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("hospital_id", otherRuleVO.getHospitalId())
|
|
|
|
+ .eq("case_id", otherRuleVO.getCaseId());
|
|
|
|
+ ResultInfo resultInfo = resultInfoService.getOne(resultInfoQueryWrapper, false);
|
|
|
|
+ if (resultInfo == null) {
|
|
|
|
+ resultInfo = new ResultInfo();
|
|
|
|
+ resultInfo.setHospitalId(otherRuleVO.getHospitalId());
|
|
|
|
+ resultInfo.setCaseId(otherRuleVO.getCaseId());
|
|
|
|
+ resultInfo.setGmtCreate(now);
|
|
|
|
+ }
|
|
|
|
+ resultInfo.setGmtModified(now);
|
|
|
|
+ resultInfo.setRuleNum(totleNum);
|
|
|
|
+ resultInfo.setRuleSuccessNum(successNum);
|
|
|
|
+ resultInfo.setRuleFailedNum(failedNum);
|
|
|
|
+ resultInfoService.saveOrUpdate(resultInfo);
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ResultOtherLis> resultOtherLisnQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ resultOtherLisnQueryWrapper.eq("result_id", resultInfo.getId());
|
|
|
|
+ resultOtherLisService.remove(resultOtherLisnQueryWrapper);
|
|
|
|
+
|
|
|
|
+ for (ResultOtherLis result : list) {
|
|
|
|
+ result.setGmtCreate(now);
|
|
|
|
+ result.setGmtModified(now);
|
|
|
|
+ result.setResultId(resultInfo.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ resultOtherLisService.saveOrUpdateBatch(list);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|