|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|