检查、检验报告查询

3.2.4.44
wyb 2 years ago
parent c1882a0d86
commit 7353172636

@ -37,4 +37,11 @@ public interface TBasicMapper{
Integer updateExtend(@Param("tBasicExtend") TBasicExtend tBasicExtend);
List<TBasic> selectBasicListByAdmissDate(@Param("admissStartDate")String admissStartDate,@Param("admissEndDate") String admissEndDate,@Param("offset") int offset,@Param("size") int size);
/**
*
* @param patientId
* @return
*/
String getSdRyIndexByPatientId(@Param("patientId")String patientId);
}

@ -7,7 +7,7 @@ import javax.jws.WebService;
* @date 2022-11-14 19:03
*/
@WebService
@WebService(targetNamespace = "http://impl.webservice.collection.server.docus.com/")
public interface ReceiveServer {
/**
*

@ -0,0 +1,73 @@
package com.docus.server.report.client;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 使JaxWsDynamicClientFactory webservice
* @author wyb
*/
public class JaxWsDynamicClient {
private static final JaxWsDynamicClientFactory CLIENT_FACTORY = JaxWsDynamicClientFactory.newInstance();
private static final Map<String, Client> CLIENT_MAP=new ConcurrentHashMap<>();
private static final Logger logger= LoggerFactory.getLogger(JaxWsDynamicClient.class);
public static String send(String wsdlUrl,String namespaceUri,String operationName,Object[] params){
try {
Client client = getClient(wsdlUrl);
Object[] result;
if (namespaceUri == null || namespaceUri.isEmpty()) {
result = client.invoke(operationName, params);
} else {
QName qName = new QName(namespaceUri, operationName);
result = client.invoke(qName, params);
}
if (result == null || result[0] == null) {
return null;
}
return String.valueOf(result[0]);
} catch (Exception ex) {
logger.error("wsdlUrl" + wsdlUrl + " operationName" + operationName + "params:" + Arrays.toString(params) + " 调用失败了!", ex);
return null;
}
}
public static Client getClient(String wsdlUrl){
if(CLIENT_MAP.get(wsdlUrl)==null){
synchronized (JaxWsDynamicClient.class){
if(CLIENT_MAP.get(wsdlUrl)==null){
Client client = CLIENT_FACTORY.createClient(wsdlUrl);
setClientParam(client);
CLIENT_MAP.put(wsdlUrl,client);
}
}
}
return CLIENT_MAP.get(wsdlUrl);
}
private static void setClientParam(Client client) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(30000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(30000);
HTTPConduit clientConduit = (HTTPConduit) client.getConduit();
clientConduit.setClient(httpClientPolicy);
}
public static void main(String[] args) {
String[] param={"111"};
System.out.println(send("http://127.0.0.1:9311/webservice/api?wsdl","http://impl.webservice.collection.server.docus.com/", "pushUpdateInspectionReport", param));
}
}

@ -0,0 +1,40 @@
package com.docus.server.report.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
*
* @author wyb
*/
@Component
@Getter
@Setter
public class SdRyReportQueryConfig {
@Value("${sdry.report-index-query.wsdl-addr:}")
private String queryReportIndexWsdlAddr;
@Value("${sdry.report-index-query.namespace-uri:}")
private String queryReportIndexWsdlNamespaceUri;
@Value("${sdry.report-index-query.operationName:}")
private String queryReportIndexWsdlOperationName;
@Value("${sdry.report-query-url.lis.url:}")
private String reportQueryLisUrl;
@Value("${sdry.report-query-url.lis.assortId:}")
private String reportQueryLisAssortId;
@Value("${sdry.report-query-url.lis.action:}")
private String reportQueryLisAction;
@Value("${sdry.report-query-url.lis.accessKey:}")
private String reportQueryLisAccessKey;
@Value("${sdry.report-query-url.inspect.url:}")
private String reportQueryInspectUrl;
@Value("${sdry.report-query-url.inspect.assortId:}")
private String reportQueryInspectAssortId;
@Value("${sdry.report-query-url.inspect.action:}")
private String reportQueryInspectAction;
@Value("${sdry.report-query-url.inspect.accessKey:}")
private String reportQueryInspectAccessKey;
}

@ -0,0 +1,4 @@
package com.docus.server.report.dto;
public class SdRyLisReportRequest {
}

@ -0,0 +1,4 @@
package com.docus.server.report.dto;
public class SdRyLisReportResponse {
}

@ -6,7 +6,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
@ -26,8 +25,8 @@ public class AfJobTime implements Serializable {
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "最新刷新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "最新刷新时间 格式 yyyy-MM-dd HH:mm:ss")
private String updateTime;
@ApiModelProperty(value = "调度类型。")
private String jobType;
@ -35,7 +34,7 @@ public class AfJobTime implements Serializable {
public AfJobTime() {
}
public AfJobTime(Long id, LocalDateTime updateTime, String jobType) {
public AfJobTime(Long id, String updateTime, String jobType) {
this.id = id;
this.updateTime = updateTime;
this.jobType = jobType;

@ -1,22 +1,37 @@
package com.docus.server.report.job;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.collection.entity.TBasic;
import com.docus.server.collection.mapper.TBasicMapper;
import com.docus.server.report.client.JaxWsDynamicClient;
import com.docus.server.report.config.SdRyReportQueryConfig;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.entity.AfJobTime;
import com.docus.server.report.entity.AfReportRecord;
import com.docus.server.report.mapper.AfJobTimeMapper;
import com.docus.server.report.mapper.AfReportRecordMapper;
import com.docus.server.report.service.ReportService;
import com.docus.server.report.util.IdUtil;
import com.docus.server.report.util.XmlUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.annotation.Resource;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -37,66 +52,502 @@ public class ReportJob {
private AfJobTimeMapper afJobTimeMapper;
@Resource
private IdService idService;
@Resource
private SdRyReportQueryConfig sdRyReportQueryConfig;
/**
* 3
* Lis 3
*/
@XxlJob("LisReportQueryJob")
public void lisReportQueryJob() {
@XxlJob("SdRyLisReportQueryJob")
public void sdRyLisReportQueryJob() {
// 顺德人医 Lis 检验报告查询
final String jobType="SDryLisReport";
final String jobType = "SdRyLisReport";
LocalDateTime now = LocalDateTime.now();
log.info("检验报告报告查询 任务开始了");
AfJobTime afJobTime=afJobTimeMapper.getAfJobTimeByJobType(jobType);
log.info("LIS检验报告报告查询 任务开始了");
// 定义查基础数据 入院时间 开始结束
String queryBasicAdmissStartDate="1801-01-01 00:00:00";
if (afJobTime != null && afJobTime.getUpdateTime() != null) {
LocalDateTime updateTime = afJobTime.getUpdateTime();
queryBasicAdmissStartDate = updateTime.toString();
AfJobTime afJobTime= getJobTimeByJobType(jobType);
String queryBasicAdmissStartDate =afJobTime.getUpdateTime();
String queryBasicAdmissEndDate = now.toString();
// 查询基础数据定义 分页
int offset = 0;
int pageSize = 50;
boolean loopCondition = true;
try {
do {
List<TBasic> basicList = tBasicMapper.selectBasicListByAdmissDate(queryBasicAdmissStartDate, queryBasicAdmissEndDate, offset, pageSize);
if (Func.isEmpty(basicList)) {
break;
}
if (basicList.size() < pageSize) {
loopCondition = false;
}
for (TBasic tBasic : basicList) {
List<ReportDto> reportDtoList = getLisReportList(tBasic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 LIS 检验报告!", tBasic.getPatientId());
continue;
}
reportDtoList.forEach(reportDto -> {
reportService.report(reportDto);
});
}
offset += pageSize;
} while (loopCondition);
} catch (Exception ex) {
log.error("LIS检验报告报告查询 出错啦!", ex);
}
String queryBasicAdmissEndDate=now.toString();
afJobTime.setUpdateTime(now.toString());
refreshTime(afJobTime);
log.info("LIS检验报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", "");
}
/**
* 3
*/
@XxlJob("SdRyInspectReportQueryJob")
public void sdRyInspectReportQueryJob() {
// 顺德人医 检查报告查询
final String jobType = "SdRyInspectReport";
LocalDateTime now = LocalDateTime.now();
log.info("检查报告报告查询 任务开始了");
// 定义查基础数据 入院时间 开始结束
AfJobTime afJobTime= getJobTimeByJobType(jobType);
String queryBasicAdmissStartDate =afJobTime.getUpdateTime();
String queryBasicAdmissEndDate = now.toString();
// 查询基础数据定义 分页
int offset=0;
int size=50;
int offset = 0;
int pageSize = 50;
boolean loopCondition = true;
try {
do {
List<TBasic> basicList = tBasicMapper.selectBasicListByAdmissDate(queryBasicAdmissStartDate,queryBasicAdmissEndDate,offset,size);
if(Func.isEmpty(basicList)){
log.warn("未查询到 入院时间 {} - {} 基础数据",queryBasicAdmissStartDate,queryBasicAdmissEndDate);
List<TBasic> basicList = tBasicMapper.selectBasicListByAdmissDate(queryBasicAdmissStartDate, queryBasicAdmissEndDate, offset, pageSize);
if (Func.isEmpty(basicList)) {
break;
}
if (basicList.size() < pageSize) {
loopCondition = false;
}
for (TBasic tBasic : basicList) {
List<ReportDto> reportDtoList= getLisReportList(tBasic);
if(reportDtoList==null || reportDtoList.isEmpty()){
log.warn("病案主键 patientId {} 未查询 LIS 检验报告!",tBasic.getPatientId());
List<ReportDto> reportDtoList = getInspectReportList(tBasic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 检查报告!", tBasic.getPatientId());
continue;
}
reportDtoList.forEach(reportDto -> {
reportService.report(reportDto);
});
}
offset+=size;
}while (true);
offset += pageSize;
} while (loopCondition);
} catch (Exception ex) {
log.error("检查报告报告查询 出错啦!", ex);
}
afJobTime.setUpdateTime(now.toString());
refreshTime(afJobTime);
log.info("检查报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", "");
}
private List<ReportDto> getInspectReportList(TBasic tBasic) {
// 根据基础信息查顺德报告业务系统索引,查 交叉索引
List<String> sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId());
if (sdRyReportPatientIds.isEmpty()) {
log.warn("patientId{} 未查询到检查报告患者交叉索引", tBasic.getPatientId());
return new ArrayList<>();
}
List<ReportDto> reportDtoList = new ArrayList<>();
// 根据交叉索引查询报告
for (String sdRyReportPatientId : sdRyReportPatientIds) {
List<ReportDto> reportDtoList2 = getInspectReportDtoListBySdRyReportPatientId(sdRyReportPatientId, tBasic);
reportDtoList.addAll(reportDtoList2);
}
return reportDtoList;
}
private List<ReportDto> getInspectReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
try {
List<ReportDto> reportDtos = new ArrayList<>();
int pageNum=1;
final int pageSize=10;
boolean loopCondition=true;
do {
String requestParam = organizationQuerySdRyInspectReportParam(sdRyReportPatientId, tBasic,pageNum,pageSize);
String url = organizationQuerySdRyInspectReportUrl(sdRyReportQueryConfig.getReportQueryInspectUrl());
log.info("查询检查报告请求地址:{} ,请求body参数:{}", url, requestParam);
String respBody= this.sendPost(url,requestParam);
log.info("查询检查报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList=parseQuerySdRyInspectReport(respBody,tBasic);
if(reportDtoList.isEmpty()){
break;
}
if(reportDtoList.size()<pageSize){
loopCondition=false;
}
reportDtos.addAll(reportDtoList);
pageNum++;
}while (loopCondition);
return reportDtos;
} catch (Exception ex) {
log.error("检验报告报告查询 出错啦!",ex);
log.error("查询检查报告出错啦!", ex);
return new ArrayList<>();
}
}
private String organizationQuerySdRyInspectReportUrl(String reportQueryLisUrl) {
return reportQueryLisUrl + "/query?uuid=" + IdUtil.standardUUID() +
"&action=" + sdRyReportQueryConfig.getReportQueryInspectAction() +
"&accessKey=" + sdRyReportQueryConfig.getReportQueryInspectAccessKey()
+ "&creationTime=" + Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
}
private String organizationQuerySdRyInspectReportParam(String sdRyReportPatientId, TBasic tBasic, int pageNum, int pageSize) {
boolean isPage = true;
String orgCode="4560886379";
Date admissDate = tBasic.getAdmissDate();
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";
if (afJobTime == null) {
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);
return Func.toJson(map);
}
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))){
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)){
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)){
for (JSONObject reportObject : reportObjectList) {
// 检查报告号
String examReportSn =String.valueOf( reportObject.get("EXAM_REPORT_SN"));
// 申请单号
String requestSn = String.valueOf(reportObject.get("REQUEST_SN"));
// pdf地址
String pdfUrl = String.valueOf(reportObject.get("FILE_PATH"));
// 报告名称
String reportName = String.valueOf(reportObject.get("REPORT_NAME"));
// 系统修改
String updateBy = String.valueOf(reportObject.get("UPDATEBY"));
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(tBasic.getAdmissTimes());
reportDto.setInpatientNo(tBasic.getInpatientNo());
// 确定报告唯一 报告单号+申请单号
reportDto.setSerialnum(examReportSn+requestSn);
reportDto.setFileTitle(reportName);
reportDto.setDownUrl(pdfUrl);
reportDto.setAssortId(sdRyReportQueryConfig.getReportQueryInspectAssortId());
reportDto.setSysFlag(updateBy);
reportDto.setFileSource("1");
reportDto.setFilestoragetype("1");
reportDtoList.add(reportDto);
}
}
}
return reportDtoList;
}catch (Exception ex){
log.error(ex.getMessage(),ex);
return new ArrayList<>();
}
}
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();
}
/**
* job
* @param jobType job
* @return job 1801-01-01 00:00:00
*/
private AfJobTime getJobTimeByJobType(String jobType){
AfJobTime afJobTime = afJobTimeMapper.getAfJobTimeByJobType(jobType);
// 定义查基础数据 入院时间 开始结束
String startTime = "1801-01-01 00:00:00";
if (afJobTime ==null) {
afJobTime = new AfJobTime();
afJobTime.setJobType(jobType);
afJobTime.setUpdateTime(startTime);
}
afJobTime.setUpdateTime(now);
refreshTime(afJobTime);
log.info("检验报告报告查询 任务结束了,本次查询出院时间段 {} - {}","","");
if(Func.isBlank(afJobTime.getUpdateTime())){
afJobTime.setUpdateTime(startTime);
}
return afJobTime;
}
private List<ReportDto> getLisReportList(TBasic tBasic) {
// TODO wyb 未完成! 2023-4-4 18:06:26
return null;
// 根据基础信息查顺德报告业务系统索引,查 交叉索引
List<String> sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId());
if (sdRyReportPatientIds.isEmpty()) {
log.warn("patientId{} 未查询到Lis检验报告患者交叉索引", tBasic.getPatientId());
return new ArrayList<>();
}
List<ReportDto> reportDtoList = new ArrayList<>();
// 根据交叉索引查询报告
for (String sdRyReportPatientId : sdRyReportPatientIds) {
List<ReportDto> reportDtoList2 = getLisReportDtoListBySdRyReportPatientId(sdRyReportPatientId, tBasic);
reportDtoList.addAll(reportDtoList2);
}
return reportDtoList;
}
private List<ReportDto> getLisReportDtoListBySdRyReportPatientId(String sdRyReportPatientId, TBasic tBasic) {
try {
List<ReportDto> reportDtos = new ArrayList<>();
int pageNum=1;
final int pageSize=10;
boolean loopCondition=true;
do {
String requestParam = organizationQuerySdRyLisReportParam(sdRyReportPatientId, tBasic,pageNum,pageSize);
String url = organizationQuerySdRyLisReportUrl(sdRyReportQueryConfig.getReportQueryLisUrl());
log.info("查询Lis报告请求地址{} ,请求body参数:{}", url, requestParam);
HttpRequest post = HttpUtil.createPost(url);
post.timeout(60 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");
post.body(requestParam);
HttpResponse response = post.execute();
String respBody = response.body();
log.info("查询Lis报告请求成功,响应参数:{}", respBody);
List<ReportDto> reportDtoList=parseQuerySdRyLisReport(respBody,tBasic);
if(reportDtoList.isEmpty()){
break;
}
if(reportDtoList.size()<pageSize){
loopCondition=false;
}
reportDtos.addAll(reportDtoList);
pageNum++;
}while (loopCondition);
return reportDtos;
} catch (Exception ex) {
log.error("查询Lis报告出错啦", ex);
return new ArrayList<>();
}
}
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))){
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)){
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)){
for (JSONObject reportObject : reportObjectList) {
// 检验报告号
String labReportSn =String.valueOf( reportObject.get("LAB_REPORT_SN"));
// 申请单号
String requestSn = String.valueOf(reportObject.get("REQUEST_SN"));
// pdf地址
String pdfUrl = String.valueOf(reportObject.get("PDF_URL"));
// 报告名称
String reportTypeName = String.valueOf(reportObject.get("REPORT_TYPE_NAME"));
// 系统修改
String updateBy = String.valueOf(reportObject.get("UPDATEBY"));
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(tBasic.getAdmissTimes());
reportDto.setInpatientNo(tBasic.getInpatientNo());
// 确定报告唯一 报告单号+申请单号
reportDto.setSerialnum(labReportSn+requestSn);
reportDto.setFileTitle(reportTypeName);
reportDto.setDownUrl(pdfUrl);
reportDto.setAssortId(sdRyReportQueryConfig.getReportQueryLisAssortId());
reportDto.setSysFlag(updateBy);
reportDto.setFileSource("1");
reportDto.setFilestoragetype("1");
reportDtoList.add(reportDto);
}
}
}
return reportDtoList;
}catch (Exception ex){
log.error(ex.getMessage(),ex);
return new ArrayList<>();
}
}
private String organizationQuerySdRyLisReportUrl(String reportQueryLisUrl) {
return reportQueryLisUrl + "/query?uuid=" + IdUtil.standardUUID() +
"&action=" + sdRyReportQueryConfig.getReportQueryLisAction() +
"&accessKey=" + sdRyReportQueryConfig.getReportQueryLisAccessKey()
+ "&creationTime=" + Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
}
private String organizationQuerySdRyLisReportParam(String sdRyReportPatientId, TBasic tBasic, int pageNum, int pageSize) {
boolean isPage = true;
String orgCode="4560886379";
Date admissDate = tBasic.getAdmissDate();
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";
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);
return Func.toJson(map);
}
/**
*
*
* @param patientId
* @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 = {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<>();
}
return parseQuerySdRyReportIndex(result);
}
/**
*
*
* @param sDryIndex
* @return
*/
private String organizationQuerySdRyReportIndexParam(String sDryIndex) {
sDryIndex = sDryIndex.toLowerCase()
.replace("m", "")
.replace("z", "");
String receiver = "Orion-001";
String sender = "PaperlessManagementMRIS-001";
String now = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<PRPA_HIP1179 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/PRPA_IN201306UV02.xsd\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + now + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"PRPA_IHIP1179\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.1\" extension=\"" + receiver + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.2\" extension=\"" + sender + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<controlActProcess classCode=\"CACT\" moodCode=\"EVN\">\n" +
"\t\t<code code=\"empiIndexQuery\">\n" +
"\t\t\t<displayName value=\"交叉索引查询\"/>\n" +
"\t\t</code>\n" +
"\t\t<queryByParameter>\n" +
"\t\t\t<!-- 查询条件type类型 value值 -->\n" +
"\t\t\t<!--type 1:患者id 2:身份证 3::电子健康码-->\n" +
"\t\t\t<queryParam type=\"1\" value=\"" + sDryIndex + "\"/>\n" +
"\t\t\t<!--1:门诊 3:住院-->\n" +
"\t\t\t<visitType type=\"1\"/>\n" +
"\t\t</queryByParameter>\n" +
"\t</controlActProcess>\n" +
"</PRPA_HIP1179>\n";
}
private static List<String> parseQuerySdRyReportIndex(String result) {
try {
XmlUtil xmlUtil = XmlUtil.of(result);
NodeList nodeList = xmlUtil.getNodeList("/PRPA_HIP1179/controlActProcess/subject/empiIndex/patientIds/patientId");
int nodeListLength = nodeList.getLength();
ArrayList<String> patientIds = new ArrayList<>();
if (nodeListLength > 0) {
for (int i = 0; i < nodeListLength; i++) {
Node node = nodeList.item(i);
String patientId = node.getTextContent();
if (Func.isNotBlank(patientId)) {
patientIds.add(patientId);
}
}
}
return patientIds;
} catch (Exception ex) {
log.error("顺德人医解析患者交叉索引失败。", ex);
return new ArrayList<>();
}
}
private void refreshTime(AfJobTime afJobTime) {
if (afJobTime.getId() == null) {
afJobTime.setId(idService.getDateSeq());

@ -41,6 +41,29 @@ spring:
shared-configs:
- comm.${spring.cloud.nacos.config.file-extension}
sdry:
# 顺德人医查询检查、检验报告之前查患者交叉索引的wsdl配置
report-index-query:
wsdl-addr: http://127.0.0.1:9311/webservice/api?wsdl
namespace-uri: http://impl.webservice.collection.server.docus.com/
operationName: pushUpdateInspectionReport
# 顺德人医查询检查、检验报告的地址配置
report-query-url:
# lis检验报告地址 和文件分段
lis:
url: http://127.0.0.1:9311/report/makeup/lisReport
assortId: lis
action: 1
accessKey: 1
# 检查报告地址
inspect:
url: http://127.0.0.1:9311/report/makeup/lisReport
assortId: inspect
action: 1
accessKey: 1
docus:
dbtype: mysql

@ -15,8 +15,8 @@
</update>
<select id="getAfJobTimeByJobType" resultType="com.docus.server.report.entity.AfJobTime">
select id,update_time as updateTime,job_type as jobType
from af_job_time
select id, DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%s') as updateTime,job_type as jobType
from `docus_archivefile`.`af_job_time`
where job_type= #{jobType}
</select>
</mapper>

@ -110,4 +110,9 @@
limit #{offset}
, #{size}
</select>
<select id="getSdRyIndexByPatientId" resultType="java.lang.String">
select sdry_index
from `docus_medicalrecord`.`t_basic_extend`
where patient_id=#{patientId}
</select>
</mapper>

Loading…
Cancel
Save