|
|
|
@ -65,8 +65,8 @@ public class ReportJob {
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
log.info("LIS检验报告报告查询 任务开始了");
|
|
|
|
|
// 定义查基础数据 入院时间 开始结束
|
|
|
|
|
AfJobTime afJobTime= getJobTimeByJobType(jobType);
|
|
|
|
|
String queryBasicAdmissStartDate =afJobTime.getUpdateTime();
|
|
|
|
|
AfJobTime afJobTime = getJobTimeByJobType(jobType);
|
|
|
|
|
String queryBasicAdmissStartDate = afJobTime.getUpdateTime();
|
|
|
|
|
String queryBasicAdmissEndDate = now.toString();
|
|
|
|
|
// 查询基础数据定义 分页
|
|
|
|
|
int offset = 0;
|
|
|
|
@ -113,8 +113,8 @@ public class ReportJob {
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
log.info("检查报告报告查询 任务开始了");
|
|
|
|
|
// 定义查基础数据 入院时间 开始结束
|
|
|
|
|
AfJobTime afJobTime= getJobTimeByJobType(jobType);
|
|
|
|
|
String queryBasicAdmissStartDate =afJobTime.getUpdateTime();
|
|
|
|
|
AfJobTime afJobTime = getJobTimeByJobType(jobType);
|
|
|
|
|
String queryBasicAdmissStartDate = afJobTime.getUpdateTime();
|
|
|
|
|
String queryBasicAdmissEndDate = now.toString();
|
|
|
|
|
// 查询基础数据定义 分页
|
|
|
|
|
int offset = 0;
|
|
|
|
@ -169,25 +169,25 @@ public class ReportJob {
|
|
|
|
|
private List<ReportDto> getInspectReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
|
|
|
|
|
try {
|
|
|
|
|
List<ReportDto> reportDtos = new ArrayList<>();
|
|
|
|
|
int pageNum=1;
|
|
|
|
|
final int pageSize=10;
|
|
|
|
|
boolean loopCondition=true;
|
|
|
|
|
int pageNum = 1;
|
|
|
|
|
final int pageSize = 5;
|
|
|
|
|
boolean loopCondition = true;
|
|
|
|
|
do {
|
|
|
|
|
String requestParam = organizationQuerySdRyInspectReportParam(sdRyReportPatientId, tBasic,pageNum,pageSize);
|
|
|
|
|
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 = this.sendPost(url, requestParam);
|
|
|
|
|
log.info("查询检查报告请求成功,响应参数:{}", respBody);
|
|
|
|
|
List<ReportDto> reportDtoList=parseQuerySdRyInspectReport(respBody,tBasic);
|
|
|
|
|
if(reportDtoList.isEmpty()){
|
|
|
|
|
List<ReportDto> reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic);
|
|
|
|
|
if (reportDtoList.isEmpty()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(reportDtoList.size()<pageSize){
|
|
|
|
|
loopCondition=false;
|
|
|
|
|
if (reportDtoList.size() < pageSize) {
|
|
|
|
|
loopCondition = false;
|
|
|
|
|
}
|
|
|
|
|
reportDtos.addAll(reportDtoList);
|
|
|
|
|
pageNum++;
|
|
|
|
|
}while (loopCondition);
|
|
|
|
|
} while (loopCondition);
|
|
|
|
|
return reportDtos;
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("查询检查报告出错啦!", ex);
|
|
|
|
@ -205,51 +205,52 @@ public class ReportJob {
|
|
|
|
|
|
|
|
|
|
private String organizationQuerySdRyInspectReportParam(String sdRyReportPatientId, TBasic tBasic, int pageNum, int pageSize) {
|
|
|
|
|
boolean isPage = true;
|
|
|
|
|
String orgCode="4560886379";
|
|
|
|
|
String orgCode = "4560886379";
|
|
|
|
|
Date admissDate = tBasic.getAdmissDate();
|
|
|
|
|
if(admissDate==null){
|
|
|
|
|
throw new BaseException("patientId:"+tBasic.getPatientId()+"的入院时间为空");
|
|
|
|
|
if (admissDate == null) {
|
|
|
|
|
throw new BaseException("patientId:" + tBasic.getPatientId() + "的入院时间为空");
|
|
|
|
|
}
|
|
|
|
|
Instant instant = admissDate.toInstant();
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
LocalDate admissLocalDate = instant.atZone(zoneId).toLocalDate();
|
|
|
|
|
LocalDate endTimeLocalDate = admissLocalDate.plusDays(1);
|
|
|
|
|
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);
|
|
|
|
|
String startTime=startTimeLocalDate+" 00:00:00";
|
|
|
|
|
String endTime=endTimeLocalDate+" 00:00:00";
|
|
|
|
|
String startTime = startTimeLocalDate + " 00:00:00";
|
|
|
|
|
String endTime = endTimeLocalDate + " 00:00:00";
|
|
|
|
|
|
|
|
|
|
HashMap<Object, Object> map = new HashMap<>(7);
|
|
|
|
|
map.put("isPage",isPage);
|
|
|
|
|
map.put("pageNo",pageNum);
|
|
|
|
|
map.put("pageSize",pageSize);
|
|
|
|
|
map.put("OrgCode",orgCode);
|
|
|
|
|
map.put("StartTime",startTime);
|
|
|
|
|
map.put("EndTime",endTime);
|
|
|
|
|
map.put("PatientId",sdRyReportPatientId);
|
|
|
|
|
map.put("isPage", isPage);
|
|
|
|
|
map.put("pageNo", pageNum);
|
|
|
|
|
map.put("pageSize", pageSize);
|
|
|
|
|
map.put("OrgCode", orgCode);
|
|
|
|
|
map.put("StartTime", startTime);
|
|
|
|
|
map.put("EndTime", endTime);
|
|
|
|
|
map.put("PatientId", sdRyReportPatientId);
|
|
|
|
|
map.put("PatentTypeCode", "1");
|
|
|
|
|
return Func.toJson(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<ReportDto> parseQuerySdRyInspectReport(String respBody, TBasic tBasic) {
|
|
|
|
|
private List<ReportDto> parseQuerySdRyInspectReport(String respBody, TBasic tBasic) {
|
|
|
|
|
JSONObject jsonObject = Func.readJson(respBody, JSONObject.class);
|
|
|
|
|
Object resultCode = jsonObject.get("ResultCode");
|
|
|
|
|
String successCode="0";
|
|
|
|
|
if(!successCode.equals(String.valueOf(resultCode))){
|
|
|
|
|
String successCode = "0";
|
|
|
|
|
if (!successCode.equals(String.valueOf(resultCode))) {
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Object data = jsonObject.get("data");
|
|
|
|
|
String dataJsonStr = Func.toJson(data);
|
|
|
|
|
// 是否是json object ,因为返回的如果是 [] ,则不会识别为jsonObject
|
|
|
|
|
List<ReportDto> reportDtoList = new ArrayList<>();
|
|
|
|
|
if( Func.isJsonObject(dataJsonStr)){
|
|
|
|
|
List<ReportDto> reportDtoList = new ArrayList<>();
|
|
|
|
|
if (Func.isJsonObject(dataJsonStr)) {
|
|
|
|
|
JSONObject dataJsonObject = Func.readJson(dataJsonStr, JSONObject.class);
|
|
|
|
|
Object result = dataJsonObject.get("result");
|
|
|
|
|
String resultJsonStr = Func.toJson(result);
|
|
|
|
|
List<JSONObject> reportObjectList = Func.parseJsonArray(resultJsonStr, JSONObject.class);
|
|
|
|
|
if(Func.isNotEmpty(reportObjectList)){
|
|
|
|
|
if (Func.isNotEmpty(reportObjectList)) {
|
|
|
|
|
for (JSONObject reportObject : reportObjectList) {
|
|
|
|
|
// 检查报告号
|
|
|
|
|
String examReportSn =String.valueOf( reportObject.get("EXAM_REPORT_SN"));
|
|
|
|
|
String examReportSn = String.valueOf(reportObject.get("EXAM_REPORT_SN"));
|
|
|
|
|
// 申请单号
|
|
|
|
|
String requestSn = String.valueOf(reportObject.get("REQUEST_SN"));
|
|
|
|
|
// pdf地址
|
|
|
|
@ -263,7 +264,7 @@ public class ReportJob {
|
|
|
|
|
reportDto.setAdmisstimes(tBasic.getAdmissTimes());
|
|
|
|
|
reportDto.setInpatientNo(tBasic.getInpatientNo());
|
|
|
|
|
// 确定报告唯一 报告单号+申请单号
|
|
|
|
|
reportDto.setSerialnum(examReportSn+requestSn);
|
|
|
|
|
reportDto.setSerialnum(examReportSn + requestSn);
|
|
|
|
|
reportDto.setFileTitle(reportName);
|
|
|
|
|
reportDto.setDownUrl(pdfUrl);
|
|
|
|
|
reportDto.setAssortId(sdRyReportQueryConfig.getReportQueryInspectAssortId());
|
|
|
|
@ -275,36 +276,37 @@ public class ReportJob {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return reportDtoList;
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
log.error(ex.getMessage(),ex);
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String sendPost(String url,String body){
|
|
|
|
|
private String sendPost(String url, String body) {
|
|
|
|
|
HttpRequest post = HttpUtil.createPost(url);
|
|
|
|
|
post.timeout(60 * 1000);
|
|
|
|
|
post.header("Content-Type", "application/json; charset=utf-8");
|
|
|
|
|
post.body(body);
|
|
|
|
|
HttpResponse response = post.execute();
|
|
|
|
|
return response.body();
|
|
|
|
|
return response.body();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询job需要的开始时间
|
|
|
|
|
*
|
|
|
|
|
* @param jobType job类型
|
|
|
|
|
* @return job需要的开始时间,未查到 默认 1801-01-01 00:00:00
|
|
|
|
|
*/
|
|
|
|
|
private AfJobTime getJobTimeByJobType(String jobType){
|
|
|
|
|
private AfJobTime getJobTimeByJobType(String jobType) {
|
|
|
|
|
AfJobTime afJobTime = afJobTimeMapper.getAfJobTimeByJobType(jobType);
|
|
|
|
|
// 定义查基础数据 入院时间 开始结束
|
|
|
|
|
String startTime = "1801-01-01 00:00:00";
|
|
|
|
|
if (afJobTime ==null) {
|
|
|
|
|
if (afJobTime == null) {
|
|
|
|
|
afJobTime = new AfJobTime();
|
|
|
|
|
afJobTime.setJobType(jobType);
|
|
|
|
|
afJobTime.setUpdateTime(startTime);
|
|
|
|
|
}
|
|
|
|
|
if(Func.isBlank(afJobTime.getUpdateTime())){
|
|
|
|
|
if (Func.isBlank(afJobTime.getUpdateTime())) {
|
|
|
|
|
afJobTime.setUpdateTime(startTime);
|
|
|
|
|
}
|
|
|
|
|
return afJobTime;
|
|
|
|
@ -330,11 +332,11 @@ public class ReportJob {
|
|
|
|
|
private List<ReportDto> getLisReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
|
|
|
|
|
try {
|
|
|
|
|
List<ReportDto> reportDtos = new ArrayList<>();
|
|
|
|
|
int pageNum=1;
|
|
|
|
|
final int pageSize=10;
|
|
|
|
|
boolean loopCondition=true;
|
|
|
|
|
int pageNum = 1;
|
|
|
|
|
final int pageSize = 5;
|
|
|
|
|
boolean loopCondition = true;
|
|
|
|
|
do {
|
|
|
|
|
String requestParam = organizationQuerySdRyLisReportParam(sdRyReportPatientId, tBasic,pageNum,pageSize);
|
|
|
|
|
String requestParam = organizationQuerySdRyLisReportParam(sdRyReportPatientId, tBasic, pageNum, pageSize);
|
|
|
|
|
String url = organizationQuerySdRyLisReportUrl(sdRyReportQueryConfig.getReportQueryLisUrl());
|
|
|
|
|
log.info("查询Lis报告请求地址:{} ,请求body参数:{}", url, requestParam);
|
|
|
|
|
HttpRequest post = HttpUtil.createPost(url);
|
|
|
|
@ -344,16 +346,16 @@ public class ReportJob {
|
|
|
|
|
HttpResponse response = post.execute();
|
|
|
|
|
String respBody = response.body();
|
|
|
|
|
log.info("查询Lis报告请求成功,响应参数:{}", respBody);
|
|
|
|
|
List<ReportDto> reportDtoList=parseQuerySdRyLisReport(respBody,tBasic);
|
|
|
|
|
if(reportDtoList.isEmpty()){
|
|
|
|
|
List<ReportDto> reportDtoList = parseQuerySdRyLisReport(respBody, tBasic);
|
|
|
|
|
if (reportDtoList.isEmpty()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(reportDtoList.size()<pageSize){
|
|
|
|
|
loopCondition=false;
|
|
|
|
|
if (reportDtoList.size() < pageSize) {
|
|
|
|
|
loopCondition = false;
|
|
|
|
|
}
|
|
|
|
|
reportDtos.addAll(reportDtoList);
|
|
|
|
|
pageNum++;
|
|
|
|
|
}while (loopCondition);
|
|
|
|
|
} while (loopCondition);
|
|
|
|
|
return reportDtos;
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("查询Lis报告出错啦!", ex);
|
|
|
|
@ -361,27 +363,27 @@ public class ReportJob {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<ReportDto> parseQuerySdRyLisReport(String respBody, TBasic tBasic) {
|
|
|
|
|
private List<ReportDto> parseQuerySdRyLisReport(String respBody, TBasic tBasic) {
|
|
|
|
|
JSONObject jsonObject = Func.readJson(respBody, JSONObject.class);
|
|
|
|
|
Object resultCode = jsonObject.get("ResultCode");
|
|
|
|
|
String successCode="0";
|
|
|
|
|
if(!successCode.equals(String.valueOf(resultCode))){
|
|
|
|
|
String successCode = "0";
|
|
|
|
|
if (!successCode.equals(String.valueOf(resultCode))) {
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Object data = jsonObject.get("data");
|
|
|
|
|
String dataJsonStr = Func.toJson(data);
|
|
|
|
|
// 是否是json object ,因为返回的如果是 [] ,则不会识别为jsonObject
|
|
|
|
|
List<ReportDto> reportDtoList = new ArrayList<>();
|
|
|
|
|
if( Func.isJsonObject(dataJsonStr)){
|
|
|
|
|
List<ReportDto> reportDtoList = new ArrayList<>();
|
|
|
|
|
if (Func.isJsonObject(dataJsonStr)) {
|
|
|
|
|
JSONObject dataJsonObject = Func.readJson(dataJsonStr, JSONObject.class);
|
|
|
|
|
Object result = dataJsonObject.get("result");
|
|
|
|
|
String resultJsonStr = Func.toJson(result);
|
|
|
|
|
List<JSONObject> reportObjectList = Func.parseJsonArray(resultJsonStr, JSONObject.class);
|
|
|
|
|
if(Func.isNotEmpty(reportObjectList)){
|
|
|
|
|
if (Func.isNotEmpty(reportObjectList)) {
|
|
|
|
|
for (JSONObject reportObject : reportObjectList) {
|
|
|
|
|
// 检验报告号
|
|
|
|
|
String labReportSn =String.valueOf( reportObject.get("LAB_REPORT_SN"));
|
|
|
|
|
String labReportSn = String.valueOf(reportObject.get("LAB_REPORT_SN"));
|
|
|
|
|
// 申请单号
|
|
|
|
|
String requestSn = String.valueOf(reportObject.get("REQUEST_SN"));
|
|
|
|
|
// pdf地址
|
|
|
|
@ -395,7 +397,7 @@ public class ReportJob {
|
|
|
|
|
reportDto.setAdmisstimes(tBasic.getAdmissTimes());
|
|
|
|
|
reportDto.setInpatientNo(tBasic.getInpatientNo());
|
|
|
|
|
// 确定报告唯一 报告单号+申请单号
|
|
|
|
|
reportDto.setSerialnum(labReportSn+requestSn);
|
|
|
|
|
reportDto.setSerialnum(labReportSn + requestSn);
|
|
|
|
|
reportDto.setFileTitle(reportTypeName);
|
|
|
|
|
reportDto.setDownUrl(pdfUrl);
|
|
|
|
|
reportDto.setAssortId(sdRyReportQueryConfig.getReportQueryLisAssortId());
|
|
|
|
@ -407,9 +409,9 @@ public class ReportJob {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return reportDtoList;
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
log.error(ex.getMessage(),ex);
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -423,27 +425,28 @@ public class ReportJob {
|
|
|
|
|
|
|
|
|
|
private String organizationQuerySdRyLisReportParam(String sdRyReportPatientId, TBasic tBasic, int pageNum, int pageSize) {
|
|
|
|
|
boolean isPage = true;
|
|
|
|
|
String orgCode="4560886379";
|
|
|
|
|
String orgCode = "4560886379";
|
|
|
|
|
Date admissDate = tBasic.getAdmissDate();
|
|
|
|
|
if(admissDate==null){
|
|
|
|
|
throw new BaseException("patientId:"+tBasic.getPatientId()+"的入院时间为空");
|
|
|
|
|
if (admissDate == null) {
|
|
|
|
|
throw new BaseException("patientId:" + tBasic.getPatientId() + "的入院时间为空");
|
|
|
|
|
}
|
|
|
|
|
Instant instant = admissDate.toInstant();
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
LocalDate admissLocalDate = instant.atZone(zoneId).toLocalDate();
|
|
|
|
|
LocalDate endTimeLocalDate = admissLocalDate.plusDays(1);
|
|
|
|
|
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);
|
|
|
|
|
String startTime=startTimeLocalDate+" 00:00:00";
|
|
|
|
|
String endTime=endTimeLocalDate+" 00:00:00";
|
|
|
|
|
String startTime = startTimeLocalDate + " 00:00:00";
|
|
|
|
|
String endTime = endTimeLocalDate + " 00:00:00";
|
|
|
|
|
|
|
|
|
|
HashMap<Object, Object> map = new HashMap<>(7);
|
|
|
|
|
map.put("isPage",isPage);
|
|
|
|
|
map.put("pageNo",pageNum);
|
|
|
|
|
map.put("pageSize",pageSize);
|
|
|
|
|
map.put("OrgCode",orgCode);
|
|
|
|
|
map.put("StartTime",startTime);
|
|
|
|
|
map.put("EndTime",endTime);
|
|
|
|
|
map.put("PatientId",sdRyReportPatientId);
|
|
|
|
|
map.put("isPage", isPage);
|
|
|
|
|
map.put("pageNo", pageNum);
|
|
|
|
|
map.put("pageSize", pageSize);
|
|
|
|
|
map.put("OrgCode", orgCode);
|
|
|
|
|
map.put("StartTime", startTime);
|
|
|
|
|
map.put("EndTime", endTime);
|
|
|
|
|
map.put("PatientId", sdRyReportPatientId);
|
|
|
|
|
map.put("PatentTypeCode", "1");
|
|
|
|
|
return Func.toJson(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -460,11 +463,11 @@ public class ReportJob {
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
String param = organizationQuerySdRyReportIndexParam(sDryIndex);
|
|
|
|
|
String[] params = {param};
|
|
|
|
|
|
|
|
|
|
String namespaceUri = sdRyReportQueryConfig.getQueryReportIndexWsdlNamespaceUri();
|
|
|
|
|
String wsdlAddr = sdRyReportQueryConfig.getQueryReportIndexWsdlAddr();
|
|
|
|
|
String operationName = sdRyReportQueryConfig.getQueryReportIndexWsdlOperationName();
|
|
|
|
|
String result = JaxWsDynamicClient.send(wsdlAddr, namespaceUri, operationName, params);
|
|
|
|
|
String result = JaxWsDynamicClient.send(wsdlAddr, namespaceUri, operationName, param);
|
|
|
|
|
log.info("查询顺德人医患者交叉索引数据,返回值:{}", result);
|
|
|
|
|
if (result == null) {
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|