添加调用时间间隔

3.2.4.44
wyb 2 years ago
parent ea0ee50bcc
commit 6d7e2217f9

@ -19,6 +19,8 @@ public class SdRyReportQueryConfig {
private String queryReportIndexWsdlNamespaceUri; private String queryReportIndexWsdlNamespaceUri;
@Value("${sdry.report-index-query.operationName:}") @Value("${sdry.report-index-query.operationName:}")
private String queryReportIndexWsdlOperationName; private String queryReportIndexWsdlOperationName;
@Value("${sdry.report-index-query.interval:1000}")
private int queryReportIndexInterval;
@Value("${sdry.report-query-url.lis.url:}") @Value("${sdry.report-query-url.lis.url:}")
private String reportQueryLisUrl; private String reportQueryLisUrl;
@ -28,6 +30,8 @@ public class SdRyReportQueryConfig {
private String reportQueryLisAction; private String reportQueryLisAction;
@Value("${sdry.report-query-url.lis.accessKey:}") @Value("${sdry.report-query-url.lis.accessKey:}")
private String reportQueryLisAccessKey; private String reportQueryLisAccessKey;
@Value("${sdry.report-query-url.lis.interval:1000}")
private int reportQueryLisInterval;
@Value("${sdry.report-query-url.inspect.url:}") @Value("${sdry.report-query-url.inspect.url:}")
private String reportQueryInspectUrl; private String reportQueryInspectUrl;
@ -37,4 +41,6 @@ public class SdRyReportQueryConfig {
private String reportQueryInspectAction; private String reportQueryInspectAction;
@Value("${sdry.report-query-url.inspect.accessKey:}") @Value("${sdry.report-query-url.inspect.accessKey:}")
private String reportQueryInspectAccessKey; 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.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; 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; import java.util.stream.Collectors;
/** /**
@ -67,7 +70,7 @@ public class ReportJob {
final String jobType = "SdRyLisReport"; final String jobType = "SdRyLisReport";
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
// 等待基础数据入库时间 // 等待基础数据入库时间
now=now.plusMinutes(-10); now = now.plusMinutes(-10);
log.info("LIS检验报告报告查询 任务开始了"); log.info("LIS检验报告报告查询 任务开始了");
// 定义查基础数据 根据基础数据的创建时间 // 定义查基础数据 根据基础数据的创建时间
AfJobTime afJobTime = getJobTimeByJobType(jobType); AfJobTime afJobTime = getJobTimeByJobType(jobType);
@ -122,7 +125,7 @@ public class ReportJob {
final String jobType = "SdRyInspectReport"; final String jobType = "SdRyInspectReport";
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
// 等待基础数据入库时间 // 等待基础数据入库时间
now=now.plusMinutes(-10); now = now.plusMinutes(-10);
log.info("检查报告报告查询 任务开始了"); log.info("检查报告报告查询 任务开始了");
// 定义查基础数据 更新时间 开始结束 // 定义查基础数据 更新时间 开始结束
AfJobTime afJobTime = getJobTimeByJobType(jobType); AfJobTime afJobTime = getJobTimeByJobType(jobType);
@ -166,6 +169,8 @@ public class ReportJob {
} }
} }
private static Lock inspectReportLock = new ReentrantLock();
private List<ReportDto> getInspectReportList(TBasic tBasic) { private List<ReportDto> getInspectReportList(TBasic tBasic) {
// 根据基础信息查顺德报告业务系统索引,查 交叉索引 // 根据基础信息查顺德报告业务系统索引,查 交叉索引
List<String> sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId()); List<String> sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId());
@ -192,7 +197,16 @@ public class ReportJob {
String requestParam = organizationQuerySdRyInspectReportParam(sdRyReportPatientId, tBasic, pageNum, pageSize); String requestParam = organizationQuerySdRyInspectReportParam(sdRyReportPatientId, tBasic, pageNum, pageSize);
String url = organizationQuerySdRyInspectReportUrl(sdRyReportQueryConfig.getReportQueryInspectUrl()); String url = organizationQuerySdRyInspectReportUrl(sdRyReportQueryConfig.getReportQueryInspectUrl());
log.info("查询检查报告请求地址:{} ,请求body参数:{}", url, requestParam); 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); log.info("查询检查报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic); List<ReportDto> reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic);
if (reportDtoList.isEmpty()) { if (reportDtoList.isEmpty()) {
@ -345,6 +359,8 @@ public class ReportJob {
return reportDtoList; return reportDtoList;
} }
private static Lock lisReportLock = new ReentrantLock();
private List<ReportDto> getLisReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) { private List<ReportDto> getLisReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
try { try {
List<ReportDto> reportDtos = new ArrayList<>(); List<ReportDto> reportDtos = new ArrayList<>();
@ -360,7 +376,17 @@ public class ReportJob {
post.header("Content-Type", "application/json; charset=utf-8"); post.header("Content-Type", "application/json; charset=utf-8");
post.body(requestParam); post.body(requestParam);
HttpResponse response = post.execute(); 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); log.info("查询Lis报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList = parseQuerySdRyLisReport(respBody, tBasic); List<ReportDto> reportDtoList = parseQuerySdRyLisReport(respBody, tBasic);
if (reportDtoList.isEmpty()) { if (reportDtoList.isEmpty()) {
@ -466,6 +492,8 @@ public class ReportJob {
return Func.toJson(map); return Func.toJson(map);
} }
private static Lock indexQueryLock = new ReentrantLock();
/** /**
* *
* *
@ -473,22 +501,31 @@ public class ReportJob {
* @return * @return
*/ */
private List<String> getSdRyReportPatientIds(String patientId) { private List<String> getSdRyReportPatientIds(String patientId) {
String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId); indexQueryLock.lock();
if (Func.isBlank(sDryIndex)) { try {
log.warn("patientId:{} 未关联到第三方索引", patientId); String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId);
return new ArrayList<>(); if (Func.isBlank(sDryIndex)) {
} log.warn("patientId:{} 未关联到第三方索引", patientId);
String param = organizationQuerySdRyReportIndexParam(sDryIndex); return new ArrayList<>();
String[] params={"HIP1179",param}; }
String namespaceUri = sdRyReportQueryConfig.getQueryReportIndexWsdlNamespaceUri(); String param = organizationQuerySdRyReportIndexParam(sDryIndex);
String wsdlAddr = sdRyReportQueryConfig.getQueryReportIndexWsdlAddr(); String[] params = {"HIP1179", param};
String operationName = sdRyReportQueryConfig.getQueryReportIndexWsdlOperationName(); String namespaceUri = sdRyReportQueryConfig.getQueryReportIndexWsdlNamespaceUri();
String result = JaxWsDynamicClient.send(wsdlAddr, namespaceUri, operationName, params); String wsdlAddr = sdRyReportQueryConfig.getQueryReportIndexWsdlAddr();
log.info("查询顺德人医患者交叉索引数据,返回值:{}", result); String operationName = sdRyReportQueryConfig.getQueryReportIndexWsdlOperationName();
if (result == null) { 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<>(); 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 wsdl-addr: http://127.0.0.1:9311/webservice/api?wsdl
namespace-uri: http://impl.webservice.collection.server.docus.com/ namespace-uri: http://impl.webservice.collection.server.docus.com/
operationName: querySdJxIndexTest operationName: querySdJxIndexTest
interval: 1000
# operationName: querySdJxIndexNoResultTest # operationName: querySdJxIndexNoResultTest
# 顺德人医查询检查、检验报告的地址配置 # 顺德人医查询检查、检验报告的地址配置
report-query-url: report-query-url:
@ -58,12 +59,14 @@ sdry:
assortId: lis assortId: lis
action: lisac action: lisac
accessKey: lisaskey accessKey: lisaskey
interval: 1000
# 检查报告地址 # 检查报告地址
inspect: inspect:
url: http://127.0.0.1:9311/report/makeup/inspectTest url: http://127.0.0.1:9311/report/makeup/inspectTest
assortId: inspect assortId: inspect
action: inspectac action: inspectac
accessKey: inspectaskey accessKey: inspectaskey
interval: 1000

Loading…
Cancel
Save