添加调用时间间隔

3.2.4.44
wyb 2 years ago
parent ea0ee50bcc
commit 6d7e2217f9

@ -19,6 +19,8 @@ public class SdRyReportQueryConfig {
private String queryReportIndexWsdlNamespaceUri;
@Value("${sdry.report-index-query.operationName:}")
private String queryReportIndexWsdlOperationName;
@Value("${sdry.report-index-query.interval:1000}")
private int queryReportIndexInterval;
@Value("${sdry.report-query-url.lis.url:}")
private String reportQueryLisUrl;
@ -28,6 +30,8 @@ public class SdRyReportQueryConfig {
private String reportQueryLisAction;
@Value("${sdry.report-query-url.lis.accessKey:}")
private String reportQueryLisAccessKey;
@Value("${sdry.report-query-url.lis.interval:1000}")
private int reportQueryLisInterval;
@Value("${sdry.report-query-url.inspect.url:}")
private String reportQueryInspectUrl;
@ -37,4 +41,6 @@ public class SdRyReportQueryConfig {
private String reportQueryInspectAction;
@Value("${sdry.report-query-url.inspect.accessKey:}")
private String reportQueryInspectAccessKey;
@Value("${sdry.report-query-url.inspect.interval:1000}")
private int reportQueryInspectInterval;
}

@ -35,6 +35,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
@ -67,7 +70,7 @@ public class ReportJob {
final String jobType = "SdRyLisReport";
LocalDateTime now = LocalDateTime.now();
// 等待基础数据入库时间
now=now.plusMinutes(-10);
now = now.plusMinutes(-10);
log.info("LIS检验报告报告查询 任务开始了");
// 定义查基础数据 根据基础数据的创建时间
AfJobTime afJobTime = getJobTimeByJobType(jobType);
@ -122,7 +125,7 @@ public class ReportJob {
final String jobType = "SdRyInspectReport";
LocalDateTime now = LocalDateTime.now();
// 等待基础数据入库时间
now=now.plusMinutes(-10);
now = now.plusMinutes(-10);
log.info("检查报告报告查询 任务开始了");
// 定义查基础数据 更新时间 开始结束
AfJobTime afJobTime = getJobTimeByJobType(jobType);
@ -166,6 +169,8 @@ public class ReportJob {
}
}
private static Lock inspectReportLock = new ReentrantLock();
private List<ReportDto> getInspectReportList(TBasic tBasic) {
// 根据基础信息查顺德报告业务系统索引,查 交叉索引
List<String> sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId());
@ -192,7 +197,16 @@ public class ReportJob {
String requestParam = organizationQuerySdRyInspectReportParam(sdRyReportPatientId, tBasic, pageNum, pageSize);
String url = organizationQuerySdRyInspectReportUrl(sdRyReportQueryConfig.getReportQueryInspectUrl());
log.info("查询检查报告请求地址:{} ,请求body参数:{}", url, requestParam);
String respBody = this.sendPost(url, requestParam);
String respBody = "";
inspectReportLock.lock();
try {
respBody = this.sendPost(url, requestParam);
TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getReportQueryInspectInterval());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
} finally {
inspectReportLock.unlock();
}
log.info("查询检查报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic);
if (reportDtoList.isEmpty()) {
@ -345,6 +359,8 @@ public class ReportJob {
return reportDtoList;
}
private static Lock lisReportLock = new ReentrantLock();
private List<ReportDto> getLisReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
try {
List<ReportDto> reportDtos = new ArrayList<>();
@ -360,7 +376,17 @@ public class ReportJob {
post.header("Content-Type", "application/json; charset=utf-8");
post.body(requestParam);
HttpResponse response = post.execute();
String respBody = response.body();
String respBody = "";
lisReportLock.lock();
try {
respBody = response.body();
TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getReportQueryLisInterval());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
} finally {
lisReportLock.unlock();
}
log.info("查询Lis报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList = parseQuerySdRyLisReport(respBody, tBasic);
if (reportDtoList.isEmpty()) {
@ -466,6 +492,8 @@ public class ReportJob {
return Func.toJson(map);
}
private static Lock indexQueryLock = new ReentrantLock();
/**
*
*
@ -473,22 +501,31 @@ public class ReportJob {
* @return
*/
private List<String> getSdRyReportPatientIds(String patientId) {
String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId);
if (Func.isBlank(sDryIndex)) {
log.warn("patientId:{} 未关联到第三方索引", patientId);
return new ArrayList<>();
}
String param = organizationQuerySdRyReportIndexParam(sDryIndex);
String[] params={"HIP1179",param};
String namespaceUri = sdRyReportQueryConfig.getQueryReportIndexWsdlNamespaceUri();
String wsdlAddr = sdRyReportQueryConfig.getQueryReportIndexWsdlAddr();
String operationName = sdRyReportQueryConfig.getQueryReportIndexWsdlOperationName();
String result = JaxWsDynamicClient.send(wsdlAddr, namespaceUri, operationName, params);
log.info("查询顺德人医患者交叉索引数据,返回值:{}", result);
if (result == null) {
indexQueryLock.lock();
try {
String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId);
if (Func.isBlank(sDryIndex)) {
log.warn("patientId:{} 未关联到第三方索引", patientId);
return new ArrayList<>();
}
String param = organizationQuerySdRyReportIndexParam(sDryIndex);
String[] params = {"HIP1179", param};
String namespaceUri = sdRyReportQueryConfig.getQueryReportIndexWsdlNamespaceUri();
String wsdlAddr = sdRyReportQueryConfig.getQueryReportIndexWsdlAddr();
String operationName = sdRyReportQueryConfig.getQueryReportIndexWsdlOperationName();
String result = JaxWsDynamicClient.send(wsdlAddr, namespaceUri, operationName, params);
log.info("查询顺德人医患者交叉索引数据,返回值:{}", result);
if (result == null) {
return new ArrayList<>();
}
TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getQueryReportIndexInterval());
return parseQuerySdRyReportIndex(result);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return new ArrayList<>();
} finally {
indexQueryLock.unlock();
}
return parseQuerySdRyReportIndex(result);
}
/**

@ -49,6 +49,7 @@ sdry:
wsdl-addr: http://127.0.0.1:9311/webservice/api?wsdl
namespace-uri: http://impl.webservice.collection.server.docus.com/
operationName: querySdJxIndexTest
interval: 1000
# operationName: querySdJxIndexNoResultTest
# 顺德人医查询检查、检验报告的地址配置
report-query-url:
@ -58,12 +59,14 @@ sdry:
assortId: lis
action: lisac
accessKey: lisaskey
interval: 1000
# 检查报告地址
inspect:
url: http://127.0.0.1:9311/report/makeup/inspectTest
assortId: inspect
action: inspectac
accessKey: inspectaskey
interval: 1000

Loading…
Cancel
Save