添加调用时间间隔

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;
/** /**
@ -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,6 +501,8 @@ public class ReportJob {
* @return * @return
*/ */
private List<String> getSdRyReportPatientIds(String patientId) { private List<String> getSdRyReportPatientIds(String patientId) {
indexQueryLock.lock();
try {
String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId); String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId);
if (Func.isBlank(sDryIndex)) { if (Func.isBlank(sDryIndex)) {
log.warn("patientId:{} 未关联到第三方索引", patientId); log.warn("patientId:{} 未关联到第三方索引", patientId);
@ -488,7 +518,14 @@ public class ReportJob {
if (result == null) { if (result == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getQueryReportIndexInterval());
return parseQuerySdRyReportIndex(result); return parseQuerySdRyReportIndex(result);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return new ArrayList<>();
} finally {
indexQueryLock.unlock();
}
} }
/** /**

@ -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