|
|
@ -10,23 +10,20 @@ import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
import com.docus.server.collection.entity.TBasic;
|
|
|
|
import com.docus.server.collection.entity.TBasic;
|
|
|
|
import com.docus.server.collection.mapper.TBasicMapper;
|
|
|
|
import com.docus.server.collection.mapper.TBasicMapper;
|
|
|
|
import com.docus.server.report.client.JaxWsDynamicClient;
|
|
|
|
import com.docus.server.report.api.ShunDePeopleService;
|
|
|
|
|
|
|
|
import com.docus.server.report.api.TaskDistributeService;
|
|
|
|
|
|
|
|
import com.docus.server.report.api.dto.ReportDownTwoDto;
|
|
|
|
|
|
|
|
import com.docus.server.report.api.dto.ReportDto;
|
|
|
|
import com.docus.server.report.config.SdRyReportQueryConfig;
|
|
|
|
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.AfJobTime;
|
|
|
|
import com.docus.server.report.entity.AfReportRecord;
|
|
|
|
import com.docus.server.report.entity.AfReportRecord;
|
|
|
|
import com.docus.server.report.mapper.AfJobTimeMapper;
|
|
|
|
import com.docus.server.report.mapper.AfJobTimeMapper;
|
|
|
|
import com.docus.server.report.mapper.AfReportRecordMapper;
|
|
|
|
import com.docus.server.report.mapper.AfReportRecordMapper;
|
|
|
|
import com.docus.server.report.noviwtask.NoViewTaskService;
|
|
|
|
|
|
|
|
import com.docus.server.report.noviwtask.dto.ReportDownTwoDto;
|
|
|
|
|
|
|
|
import com.docus.server.report.service.ReportService;
|
|
|
|
import com.docus.server.report.service.ReportService;
|
|
|
|
import com.docus.server.report.util.IdUtil;
|
|
|
|
import com.docus.server.report.util.IdUtil;
|
|
|
|
import com.docus.server.report.util.XmlUtil;
|
|
|
|
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.w3c.dom.Node;
|
|
|
|
|
|
|
|
import org.w3c.dom.NodeList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.time.Instant;
|
|
|
|
import java.time.Instant;
|
|
|
@ -60,12 +57,14 @@ public class ReportJob {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private SdRyReportQueryConfig sdRyReportQueryConfig;
|
|
|
|
private SdRyReportQueryConfig sdRyReportQueryConfig;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private NoViewTaskService noViewTaskService;
|
|
|
|
private TaskDistributeService taskDistributeService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ShunDePeopleService shunDePeopleService;
|
|
|
|
|
|
|
|
|
|
|
|
@XxlJob("SdRyLisCollectJob")
|
|
|
|
@XxlJob("SdRyLisCollectJob")
|
|
|
|
public void sdRyLisCollectJob() {
|
|
|
|
public void sdRyLisCollectJob() {
|
|
|
|
String reportQueryLisCollectorId = sdRyReportQueryConfig.getReportQueryLisCollectorId();
|
|
|
|
String reportQueryLisCollectorId = sdRyReportQueryConfig.getReportQueryLisCollectorId();
|
|
|
|
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryLisCollectorId);
|
|
|
|
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoviewTaskByCollectorId(reportQueryLisCollectorId);
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -90,7 +89,7 @@ public class ReportJob {
|
|
|
|
@XxlJob("SdRyInspectCollectJob")
|
|
|
|
@XxlJob("SdRyInspectCollectJob")
|
|
|
|
public void sdRyInspectCollectJob() {
|
|
|
|
public void sdRyInspectCollectJob() {
|
|
|
|
String reportQueryInspectCollectorId = sdRyReportQueryConfig.getReportQueryInspectCollectorId();
|
|
|
|
String reportQueryInspectCollectorId = sdRyReportQueryConfig.getReportQueryInspectCollectorId();
|
|
|
|
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryInspectCollectorId);
|
|
|
|
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoviewTaskByCollectorId(reportQueryInspectCollectorId);
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -568,7 +567,7 @@ public class ReportJob {
|
|
|
|
return Func.toJson(map);
|
|
|
|
return Func.toJson(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Lock indexQueryLock = new ReentrantLock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据归档病案主键查询报告交叉索引
|
|
|
|
* 根据归档病案主键查询报告交叉索引
|
|
|
@ -577,107 +576,20 @@ public class ReportJob {
|
|
|
|
* @return 报告交叉索引
|
|
|
|
* @return 报告交叉索引
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<String> getSdRyReportPatientIds(String patientId) {
|
|
|
|
private List<String> getSdRyReportPatientIds(String patientId) {
|
|
|
|
indexQueryLock.lock();
|
|
|
|
|
|
|
|
try {
|
|
|
|
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);
|
|
|
|
return new ArrayList<>();
|
|
|
|
return new ArrayList<>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String param = organizationQuerySdRyReportIndexParam(sDryIndex);
|
|
|
|
return shunDePeopleService.getSdRyReportPatientIds(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) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
return new ArrayList<>();
|
|
|
|
return new ArrayList<>();
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
indexQueryLock.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 组织顺德人医查询交叉索引的请求参数
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @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=\"3\"/>\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) {
|
|
|
|
private void refreshTime(AfJobTime afJobTime) {
|
|
|
|