|
@@ -0,0 +1,105 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.client.CdssCoreClient;
|
|
|
+import com.diagbot.dto.IndicationDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.TestcaseInfo;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.impl.TestcaseInfoServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.GsonUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.IndicationPushVO;
|
|
|
+import com.diagbot.vo.SearchData;
|
|
|
+import com.diagbot.vo.TestcaseInfoVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @author: gaodm
|
|
|
+ * @time: 2020/9/27 17:16
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class TestcaseInfoFacade extends TestcaseInfoServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("testcaseInfoServiceImpl")
|
|
|
+ private TestcaseInfoServiceImpl testcaseInfoService;
|
|
|
+ @Autowired
|
|
|
+ private CdssCoreClient cdssCoreClient;
|
|
|
+ @Autowired
|
|
|
+ private AssembleFacade assembleFacade;
|
|
|
+
|
|
|
+ public Boolean testcaseProcess(TestcaseInfoVO testcaseInfoVO) {
|
|
|
+ List<TestcaseInfo> testcaseInfoList
|
|
|
+ = testcaseInfoService.list(
|
|
|
+ new QueryWrapper<TestcaseInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq((null != testcaseInfoVO && null != testcaseInfoVO.getHospitalId()),
|
|
|
+ "hospital_id", testcaseInfoVO.getHospitalId())
|
|
|
+ );
|
|
|
+ if (ListUtil.isEmpty(testcaseInfoList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
+ } else {
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ for (TestcaseInfo testcaseInfo : testcaseInfoList) {
|
|
|
+ if (StringUtil.isNotBlank(testcaseInfo.getInput())) {
|
|
|
+ if (StringUtil.isBlank(testcaseInfo.getPotentialResult())) {
|
|
|
+ testcaseInfo.setRemark("预想结果为空");
|
|
|
+ testcaseInfo.setGmtModified(now);
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ //开单提醒
|
|
|
+ if (testcaseInfo.getType().equals(1)) {
|
|
|
+ IndicationPushVO indicationPushVO
|
|
|
+ = GsonUtil.toObject(testcaseInfo.getInput(), IndicationPushVO.class);
|
|
|
+ SearchData searchData = new SearchData();
|
|
|
+ BeanUtil.copyProperties(indicationPushVO, searchData);
|
|
|
+ //入参映射
|
|
|
+ searchData = assembleFacade.assembleData(searchData);
|
|
|
+ BeanUtil.copyProperties(searchData, indicationPushVO);
|
|
|
+ RespDTO<IndicationDTO> resp = cdssCoreClient.indication(indicationPushVO);
|
|
|
+ if (null != resp) {
|
|
|
+ testcaseInfo.setRemark("");
|
|
|
+ testcaseInfo.setGmtModified(now);
|
|
|
+ testcaseInfo.setOutput(GsonUtil.toJson(resp.data));
|
|
|
+ Integer pass = 0;
|
|
|
+ if (GsonUtil.toJson(resp.data).indexOf(testcaseInfo.getPotentialResult()) > 0) {
|
|
|
+ pass = 1;
|
|
|
+ }else {
|
|
|
+ testcaseInfo.setRemark("与预想结果不一样");
|
|
|
+ }
|
|
|
+ testcaseInfo.setPass(pass);
|
|
|
+ } else {
|
|
|
+ testcaseInfo.setRemark("输出为空");
|
|
|
+ testcaseInfo.setGmtModified(now);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ } else if (testcaseInfo.getType().equals(2)) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ testcaseInfo.setRemark("类型在范围外");
|
|
|
+ testcaseInfo.setGmtModified(now);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ testcaseInfo.setRemark("入参为空");
|
|
|
+ testcaseInfo.setGmtModified(now);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ testcaseInfoService.updateBatchById(testcaseInfoList);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|