顺德人医报告 api

3.2.4.44
wyb 2 years ago
parent 6556a69f84
commit 71f9683f5b

@ -2,5 +2,8 @@
"icu": "重症文件分段id",
"sa": "手麻文件分段id",
"examination": "检验报告文件分段id",
"BL-001": "病理文件分段id",
"CS-001": "超声文件分段id",
"petct": "petct文件分段id",
"other": "其他文件分段id"
}

@ -0,0 +1,13 @@
{
"url":"http:/192.168.5.55:8090/PacsService.wsdl",
"interval": 1000,
"namespaceUri":"com.docus",
"operationName":"Service",
"functionName":"ReportServerDll.GetPdfReport",
"functionType":"",
"caller":"外面的配置",
"licenseInfo":{
"caller":"里面的调用",
"license":"令牌**************"
}
}

@ -0,0 +1,22 @@
package com.docus.server.report.api;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.report.api.dto.ReportDownDto;
/**
*
*
* @author jiashi
*/
public interface DownPlatformService {
/**
*
*
* @param reportDownDto
* @return
*/
CommonResult report(ReportDownDto reportDownDto);
}

@ -0,0 +1,26 @@
package com.docus.server.report.api;
import java.util.List;
/**
*
*
* @author wyb
*/
public interface ShunDePeopleService {
/**
*
*
* @param sdRyIndex
* @return
*/
List<String> getSdRyReportPatientIds(String sdRyIndex);
/**
* PACSPDFPDFBASE64
* @param examNo
* @param reportNo
* @return pdfBase64
*/
String getBase64PdfFromPacs(String examNo,String reportNo);
}

@ -0,0 +1,21 @@
package com.docus.server.report.api;
import com.docus.server.report.api.dto.ReportDownTwoDto;
/**
*
*
* @author wyb
*/
public interface TaskDistributeService {
/**
* -
*
* @param collectorId
* @return
*/
ReportDownTwoDto getNoviewTaskByCollectorId(String collectorId);
}

@ -1,4 +1,4 @@
package com.docus.server.report.dto;
package com.docus.server.report.api.dto;
import io.swagger.annotations.ApiModelProperty;

@ -1,4 +1,4 @@
package com.docus.server.report.dto;
package com.docus.server.report.api.dto;
import com.docus.server.report.entity.AfReportRecord;
import io.swagger.annotations.ApiModelProperty;

@ -1,4 +1,4 @@
package com.docus.server.report.dto;
package com.docus.server.report.api.dto;
import com.docus.server.report.entity.AfReportRecord;
import io.swagger.annotations.ApiModelProperty;

@ -1,4 +1,4 @@
package com.docus.server.report.noviwtask.dto;
package com.docus.server.report.api.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;

@ -1,4 +1,4 @@
package com.docus.server.report.dto;
package com.docus.server.report.api.dto;
import lombok.Data;

@ -1,4 +1,4 @@
package com.docus.server.report.noviwtask.dto;
package com.docus.server.report.api.dto;
import io.swagger.annotations.ApiModelProperty;

@ -1,4 +1,4 @@
package com.docus.server.report.noviwtask.dto;
package com.docus.server.report.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -1,4 +1,4 @@
package com.docus.server.report.noviwtask.dto;
package com.docus.server.report.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -0,0 +1,120 @@
package com.docus.server.report.api.dto;
public class SdPacsServerConfig {
private String url;
private String namespaceUri;
private String operationName;
private String functionName;
private String functionType;
private String caller;
private LicenseInfo licenseInfo;
private int interval;
@Override
public String toString() {
return "SdPacsServerConfig{" +
"url='" + url + '\'' +
", namespaceUri='" + namespaceUri + '\'' +
", operationName='" + operationName + '\'' +
", functionName='" + functionName + '\'' +
", functionType='" + functionType + '\'' +
", caller='" + caller + '\'' +
", licenseInfo=" + licenseInfo +
", interval=" + interval +
'}';
}
public int getInterval() {
return interval;
}
public void setInterval(int interval) {
this.interval = interval;
}
public String getOperationName() {
return operationName;
}
public void setOperationName(String operationName) {
this.operationName = operationName;
}
public String getNamespaceUri() {
return namespaceUri;
}
public void setNamespaceUri(String namespaceUri) {
this.namespaceUri = namespaceUri;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getFunctionName() {
return functionName;
}
public void setFunctionName(String functionName) {
this.functionName = functionName;
}
public String getFunctionType() {
return functionType;
}
public void setFunctionType(String functionType) {
this.functionType = functionType;
}
public String getCaller() {
return caller;
}
public void setCaller(String caller) {
this.caller = caller;
}
public LicenseInfo getLicenseInfo() {
return licenseInfo;
}
public void setLicenseInfo(LicenseInfo licenseInfo) {
this.licenseInfo = licenseInfo;
}
public static class LicenseInfo {
private String caller;
private String license;
public String getCaller() {
return caller;
}
public void setCaller(String caller) {
this.caller = caller;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
@Override
public String toString() {
return "LicenseInfo{" +
"caller='" + caller + '\'' +
", license='" + license + '\'' +
'}';
}
}
}

@ -0,0 +1,69 @@
package com.docus.server.report.api.impl;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.report.api.DownPlatformService;
import com.docus.server.report.api.dto.ReportDownDto;
import com.docus.server.report.config.ApplicationBusinessConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
*
*
* @author jiashi
*/
@Component
@Slf4j
public class DownPlatformServiceImpl implements DownPlatformService {
@Resource
private ApplicationBusinessConfig applicationBusinessConfig;
@Override
public CommonResult report(ReportDownDto reportDownDto) {
String downUrl = applicationBusinessConfig.getDownUrl();
if (Func.isBlank(downUrl)) {
log.warn("文件上报地址未配置!");
return null;
}
String requestId = Func.randomUUID();
String requestParam = Func.toJson(reportDownDto);
try {
log.info("[{}]调用下载服务,地址:{} ,参数:{}", requestId, downUrl, requestParam);
String respBody = post(downUrl, requestParam);
log.info("[{}]调用下载服务成功,响应参数:{}", requestId, respBody);
return Func.readJson(respBody, CommonResult.class);
} catch (Exception ex) {
log.error("[" + requestId + "]调用下载服务失败" + ex.getMessage(), ex);
return CommonResult.failed(ex.getMessage());
}
}
/**
*
*/
private final static Lock REPORT_LOCK = new ReentrantLock();
public String post(String url, String body) {
REPORT_LOCK.lock();
try {
HttpRequest post = HttpUtil.createPost(url);
post.setConnectionTimeout(5 * 1000);
post.setReadTimeout(60 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");
post.body(body);
HttpResponse response = post.execute();
return response.body();
}finally {
REPORT_LOCK.unlock();
}
}
}

@ -0,0 +1,208 @@
package com.docus.server.report.api.impl;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.server.report.api.ShunDePeopleService;
import com.docus.server.report.api.dto.SdPacsServerConfig;
import com.docus.server.report.client.JaxWsDynamicClient;
import com.docus.server.report.config.SdRyReportQueryConfig;
import com.docus.server.report.util.IdUtil;
import com.docus.server.report.util.TableJsonRead;
import com.docus.server.report.util.XmlUtil;
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.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class ShunDePeopleServiceImpl implements ShunDePeopleService {
private static final Lock INDEX_LOCK = new ReentrantLock();
private static final Lock PACS_PDF_LOCK = new ReentrantLock();
@Resource
private SdRyReportQueryConfig sdRyReportQueryConfig;
public static void main(String[] args) {
ShunDePeopleServiceImpl shunDePeopleService = new ShunDePeopleServiceImpl();
String base64PdfFromPacs = shunDePeopleService.getBase64PdfFromPacs("121", "1");
System.out.println(base64PdfFromPacs);
}
@Override
public List<String> getSdRyReportPatientIds(String sdRyIndex) {
List<String> indexes = new ArrayList<>();
try {
String zyParam = organizationQuerySdRyReportIndexParam(sdRyIndex, 3);
String mzParam = organizationQuerySdRyReportIndexParam(sdRyIndex, 1);
String[] zyParams = {"HIP1179", zyParam};
String[] mzParams = {"HIP1179", mzParam};
List<String> zyIndex = getIndex(zyParams);
indexes.addAll(zyIndex);
List<String> mzIndex = getIndex(mzParams);
indexes.addAll(mzIndex);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
return indexes;
}
@Override
public String getBase64PdfFromPacs(String examNo, String reportNo) {
TableJsonRead jsonRead = new TableJsonRead();
SdPacsServerConfig config = jsonRead.Read("data-config", "sdry-pacs-server.json", SdPacsServerConfig.class);
String url = config.getUrl();
String namespaceUri = config.getNamespaceUri();
String operationName = config.getOperationName();
String functionType = config.getFunctionType();
String functionName = config.getFunctionName();
String caller = config.getCaller();
int interval = config.getInterval();
String inputString = getPdfReportBase64InputString(examNo, reportNo, config);
// 参数1FunctionName此参数用于区分不同的场景具体看每个场景说明
// 参数2InputString请求消息串看具体场景说明
// 参数3FunctionType传空暂未启用
// 参数4Caller服务调用者名称由PACS提供验证令牌时
String[] param = {functionName, inputString, functionType, caller};
PACS_PDF_LOCK.lock();
try {
String result = JaxWsDynamicClient.send(url, namespaceUri, operationName, param);
if (interval > 0) {
TimeUnit.MILLISECONDS.sleep(interval);
}
return result;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
} finally {
PACS_PDF_LOCK.unlock();
}
}
private String getPdfReportBase64InputString(String examNo, String reportNo, SdPacsServerConfig config) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!-- PDF报告请求消息 -->\n" +
"<QueryInfo>\n" +
"<!-- 调用系统 -->\n" +
"\t<LicenseInfo>\n" +
"\t\t<!-- 调用系统 -->\n" +
"\t\t<Caller>" + config.getLicenseInfo().getCaller() + "</Caller>\n" +
"\t\t<!-- 调用令牌由PACS提供 -->\n" +
"\t\t<License>" + config.getLicenseInfo().getLicense() + "</License>\n" +
"\t</LicenseInfo>\n" +
"\t<!-- 检查流水号 -->\n" +
"\t<ExamNo>" + examNo + "</ExamNo>\n" +
"\t<!-- 报告序号 -->\n" +
"\t<ReportNo>" + reportNo + "</ReportNo>\n" +
"</QueryInfo>";
}
private List<String> getIndex(String[] params) {
INDEX_LOCK.lock();
try {
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 {
INDEX_LOCK.unlock();
}
}
private 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<>();
}
}
/**
*
*
* @param sDryIndex
* @param type 1: 3:
* @return
*/
private String organizationQuerySdRyReportIndexParam(String sDryIndex, int type) {
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=\"" + type + "\"/>\n" +
"\t\t</queryByParameter>\n" +
"\t</controlActProcess>\n" +
"</PRPA_HIP1179>\n";
}
}

@ -1,11 +1,12 @@
package com.docus.server.report.noviwtask;
package com.docus.server.report.api.impl;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.report.api.TaskDistributeService;
import com.docus.server.report.api.dto.ReportDownTwoDto;
import com.docus.server.report.config.ApplicationBusinessConfig;
import com.docus.server.report.noviwtask.dto.ReportDownTwoDto;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -14,16 +15,20 @@ import javax.annotation.Resource;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class NoViewTaskService {
public class TaskDistributeServiceImpl implements TaskDistributeService {
@Resource
private ApplicationBusinessConfig applicationBusinessConfig;
public ReportDownTwoDto getTaskByCollectorId(String collectorId){
@Override
public ReportDownTwoDto getNoviewTaskByCollectorId(String collectorId) {
String getTaskUrl = applicationBusinessConfig.getGetTaskUrl();
if(Func.isBlank(getTaskUrl)){
if (Func.isBlank(getTaskUrl)) {
log.warn("获取任务信息地址未配置!");
return null;
}
@ -31,7 +36,7 @@ public class NoViewTaskService {
String result = HttpUtil.get(getTaskUrl);
CommonResult<ReportDownTwoDto> reportDownTwoDtoCommonResult = Func.readJson(result, new TypeReference<CommonResult<ReportDownTwoDto>>() {
});
if(reportDownTwoDtoCommonResult==null || reportDownTwoDtoCommonResult.getCode().equals(ResultCode.FAILED.getCode()) || reportDownTwoDtoCommonResult.getData()==null){
if (reportDownTwoDtoCommonResult == null || reportDownTwoDtoCommonResult.getCode().equals(ResultCode.FAILED.getCode()) || reportDownTwoDtoCommonResult.getData() == null) {
log.warn("未查询到任务数据!");
return null;
}

@ -6,7 +6,7 @@ import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.collection.entity.TBasic;
import com.docus.server.collection.mapper.TBasicMapper;
import com.docus.server.report.job.ReportJob;
import com.docus.server.report.noviwtask.NoViewTaskService;
import com.docus.server.report.api.TaskDistributeService;
import com.docus.server.report.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -32,37 +32,37 @@ public class ReportDownController {
private TBasicMapper tBasicMapper;
@Resource
ReportJob reportJob;
@Resource
private NoViewTaskService noViewTaskService;
@Resource
private TaskDistributeService taskDistributeService;
@ApiOperation(value = "获取任务测试")
@PostMapping("/getTaskTest")
public CommonResult<Object> getTaskTest(@RequestParam("collectorId") String collectorId){
return CommonResult.success(noViewTaskService.getTaskByCollectorId(collectorId));
public CommonResult<Object> getTaskTest(@RequestParam("collectorId") String collectorId) {
return CommonResult.success(taskDistributeService.getNoviewTaskByCollectorId(collectorId));
}
@ApiOperation(value = " lis 检验 采集 job 测试")
@GetMapping("/sdRyLisCollectJob")
public CommonResult<String> sdRyLisCollectJob(){
public CommonResult<String> sdRyLisCollectJob() {
reportJob.sdRyLisCollectJob();
return CommonResult.success("成功");
}
@ApiOperation(value = " inspect 检查 采集 job 测试")
@GetMapping("/sdRyInspectCollectJob")
public CommonResult<String> sdRyInspectCollectJob(){
public CommonResult<String> sdRyInspectCollectJob() {
reportJob.sdRyInspectCollectJob();
return CommonResult.success("成功");
}
@ApiOperation(value = " inspectReport 根据病案主键补偿")
@PostMapping("/inspectReportMakeup")
public CommonResult<String> inspectReportMakeup(@RequestBody List<String> patientIds){
if(Func.isEmpty(patientIds)){
public CommonResult<String> inspectReportMakeup(@RequestBody List<String> patientIds) {
if (Func.isEmpty(patientIds)) {
return CommonResult.failed("病案主键不能为空!");
}
List<TBasic> tBasics =tBasicMapper.selectBasicListByPatientIds(patientIds);
if(Func.isEmpty(tBasics)){
List<TBasic> tBasics = tBasicMapper.selectBasicListByPatientIds(patientIds);
if (Func.isEmpty(tBasics)) {
return CommonResult.failed("未查询到病案基础数据!");
}
reportJob.queryInspectReport(tBasics);
@ -71,12 +71,12 @@ private NoViewTaskService noViewTaskService;
@ApiOperation(value = "lisReport 根据病案主键补偿")
@PostMapping("/lisReportMakeup")
public CommonResult<String> lisReportMakeup(@RequestBody List<String> patientIds){
if(Func.isEmpty(patientIds)){
public CommonResult<String> lisReportMakeup(@RequestBody List<String> patientIds) {
if (Func.isEmpty(patientIds)) {
return CommonResult.failed("病案主键不能为空!");
}
List<TBasic> tBasics =tBasicMapper.selectBasicListByPatientIds(patientIds);
if(Func.isEmpty(tBasics)){
List<TBasic> tBasics = tBasicMapper.selectBasicListByPatientIds(patientIds);
if (Func.isEmpty(tBasics)) {
return CommonResult.failed("未查询到病案基础数据!");
}
reportJob.queryLisReport(tBasics);
@ -86,7 +86,7 @@ private NoViewTaskService noViewTaskService;
@ApiOperation(value = "根据任务id补偿报告下载(接收推送的报告)")
@PostMapping("/makeupReportByTaskIds")
public CommonResult<String> makeupReportByTaskIds(@RequestBody List<Long> taskIds){
public CommonResult<String> makeupReportByTaskIds(@RequestBody List<Long> taskIds) {
if (Func.isEmpty(taskIds)) {
return CommonResult.failed("补偿任务id不能为空");
}
@ -100,36 +100,35 @@ private NoViewTaskService noViewTaskService;
}
@ApiOperation(value = "report lis job 测试",hidden = true)
@ApiOperation(value = "report lis job 测试", hidden = true)
@PostMapping("/lisreportJobTest")
public CommonResult<String> LisreportJobTest(){
public CommonResult<String> LisreportJobTest() {
reportJob.sdRyLisReportQueryJob();
return CommonResult.success("成功");
}
@ApiOperation(value = "report inspect job 测试",hidden = true)
@ApiOperation(value = "report inspect job 测试", hidden = true)
@PostMapping("/inspectReportJobTest")
public CommonResult<String> inspectReportJobTest(){
public CommonResult<String> inspectReportJobTest() {
reportJob.sdRyInspectReportQueryJob();
return CommonResult.success("成功");
}
@ApiOperation(value = "inspect检查报告测试地址",hidden = true)
@ApiOperation(value = "inspect检查报告测试地址", hidden = true)
@PostMapping("/inspectTest/query")
public JSONObject inspectTest(@RequestParam("uuid") String uuid,
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String,Object> map){
System.out.println("请求的参数为 uuid"+uuid);
System.out.println("请求的参数为 action"+action);
System.out.println("请求的参数为 accessKey"+accessKey);
System.out.println("请求的参数为 creationTime"+creationTime);
System.out.println("请求的参数为 body"+map);
String result="{\n" +
@RequestBody Map<String, Object> map) {
System.out.println("请求的参数为 uuid" + uuid);
System.out.println("请求的参数为 action" + action);
System.out.println("请求的参数为 accessKey" + accessKey);
System.out.println("请求的参数为 creationTime" + creationTime);
System.out.println("请求的参数为 body" + map);
String result = "{\n" +
"\"compcode\": \"INSPECT_REPORTQuery\",\n" +
"\"compname\": \"检查报告查询服务\",\n" +
"\"count\": 2,\n" +
@ -281,25 +280,25 @@ private NoViewTaskService noViewTaskService;
"\"ResultCode\": \"0\"\n" +
"}";
return Func.readJson(result,JSONObject.class);
return Func.readJson(result, JSONObject.class);
}
@ApiOperation(value = "inspect检查报告测试地址 ",hidden = true)
@ApiOperation(value = "inspect检查报告测试地址 ", hidden = true)
@PostMapping("/inspectTestNoResult/query")
public JSONObject inspectTestNoResult(@RequestParam("uuid") String uuid,
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String,Object> map){
System.out.println("请求的参数为 uuid"+uuid);
System.out.println("请求的参数为 action"+action);
System.out.println("请求的参数为 accessKey"+accessKey);
System.out.println("请求的参数为 creationTime"+creationTime);
System.out.println("请求的参数为 body"+map);
String result="{\n" +
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String, Object> map) {
System.out.println("请求的参数为 uuid" + uuid);
System.out.println("请求的参数为 action" + action);
System.out.println("请求的参数为 accessKey" + accessKey);
System.out.println("请求的参数为 creationTime" + creationTime);
System.out.println("请求的参数为 body" + map);
String result = "{\n" +
"\"compcode\": \"INSPECT_REPORTQuery\",\n" +
"\"compname\": \"检查报告查询服务\",\n" +
"\"count\": 0,\n" +
@ -308,26 +307,25 @@ private NoViewTaskService noViewTaskService;
"\"ResultCode\": \"0\"\n" +
"}";
return Func.readJson(result,JSONObject.class);
return Func.readJson(result, JSONObject.class);
}
@ApiOperation(value = "lis检验报告测试地址" ,hidden = true)
@ApiOperation(value = "lis检验报告测试地址", hidden = true)
@PostMapping("/lisTest/query")
public JSONObject lisTest(@RequestParam("uuid") String uuid,
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String,Object> map){
System.out.println("请求的参数为 uuid"+uuid);
System.out.println("请求的参数为 action"+action);
System.out.println("请求的参数为 accessKey"+accessKey);
System.out.println("请求的参数为 creationTime"+creationTime);
System.out.println("请求的参数为 body"+map);
String result="{\n" +
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String, Object> map) {
System.out.println("请求的参数为 uuid" + uuid);
System.out.println("请求的参数为 action" + action);
System.out.println("请求的参数为 accessKey" + accessKey);
System.out.println("请求的参数为 creationTime" + creationTime);
System.out.println("请求的参数为 body" + map);
String result = "{\n" +
"\"compcode\": \"LIS_REPORTQuery\",\n" +
"\"compname\": \"检验报告查询服务\",\n" +
"\"count\": 4,\n" +
@ -437,27 +435,25 @@ private NoViewTaskService noViewTaskService;
"\"ResultCode\": \"0\"\n" +
"}";
return Func.readJson(result,JSONObject.class);
return Func.readJson(result, JSONObject.class);
}
@ApiOperation(value = "lis检验报告测试地址",hidden = true)
@ApiOperation(value = "lis检验报告测试地址", hidden = true)
@PostMapping("/lisTestNoResult/query")
public JSONObject lisTestNoResult(@RequestParam("uuid") String uuid,
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String,Object> map){
System.out.println("请求的参数为 uuid"+uuid);
System.out.println("请求的参数为 action"+action);
System.out.println("请求的参数为 accessKey"+accessKey);
System.out.println("请求的参数为 creationTime"+creationTime);
System.out.println("请求的参数为 body"+map);
String result="{\n" +
@RequestParam("action") String action,
@RequestParam("accessKey") String accessKey,
@RequestParam("creationTime") String creationTime,
@RequestBody Map<String, Object> map) {
System.out.println("请求的参数为 uuid" + uuid);
System.out.println("请求的参数为 action" + action);
System.out.println("请求的参数为 accessKey" + accessKey);
System.out.println("请求的参数为 creationTime" + creationTime);
System.out.println("请求的参数为 body" + map);
String result = "{\n" +
"\"compcode\": \"ObtainInpatientInformation\",\n" +
"\"compname\": \"获取患者住院信息(移动护理定制)\",\n" +
"\"count\": 0,\n" +
@ -466,7 +462,7 @@ private NoViewTaskService noViewTaskService;
"\"ResultCode\": \"0\"\n" +
"}";
return Func.readJson(result,JSONObject.class);
return Func.readJson(result, JSONObject.class);
}

@ -1,8 +1,6 @@
package com.docus.server.report.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.api.dto.ReportDto;
import lombok.Data;
import java.io.Serializable;

@ -1,6 +1,6 @@
package com.docus.server.report.event;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.api.dto.ReportDto;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;

@ -10,23 +10,20 @@ 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.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.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.noviwtask.NoViewTaskService;
import com.docus.server.report.noviwtask.dto.ReportDownTwoDto;
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;
@ -60,12 +57,14 @@ public class ReportJob {
@Resource
private SdRyReportQueryConfig sdRyReportQueryConfig;
@Resource
private NoViewTaskService noViewTaskService;
private TaskDistributeService taskDistributeService;
@Resource
private ShunDePeopleService shunDePeopleService;
@XxlJob("SdRyLisCollectJob")
public void sdRyLisCollectJob() {
String reportQueryLisCollectorId = sdRyReportQueryConfig.getReportQueryLisCollectorId();
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryLisCollectorId);
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoviewTaskByCollectorId(reportQueryLisCollectorId);
if (reportDownTwoDto == null) {
return;
}
@ -90,7 +89,7 @@ public class ReportJob {
@XxlJob("SdRyInspectCollectJob")
public void sdRyInspectCollectJob() {
String reportQueryInspectCollectorId = sdRyReportQueryConfig.getReportQueryInspectCollectorId();
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryInspectCollectorId);
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoviewTaskByCollectorId(reportQueryInspectCollectorId);
if (reportDownTwoDto == null) {
return;
}
@ -568,7 +567,7 @@ public class ReportJob {
return Func.toJson(map);
}
private static Lock indexQueryLock = new ReentrantLock();
/**
*
@ -577,107 +576,20 @@ public class ReportJob {
* @return
*/
private List<String> getSdRyReportPatientIds(String patientId) {
indexQueryLock.lock();
try {
String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId);
if (Func.isBlank(sDryIndex)) {
log.warn("patientId:{} 未关联到第三方索引", patientId);
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);
return shunDePeopleService.getSdRyReportPatientIds(sDryIndex);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
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) {

@ -4,14 +4,13 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.report.config.ApplicationBusinessConfig;
import com.docus.server.report.dto.ReportDownDto;
import com.docus.server.report.dto.ReportDownPatientDto;
import com.docus.server.report.dto.ReportDownScanFileDto;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.api.DownPlatformService;
import com.docus.server.report.api.dto.ReportDownDto;
import com.docus.server.report.api.dto.ReportDownPatientDto;
import com.docus.server.report.api.dto.ReportDownScanFileDto;
import com.docus.server.report.api.dto.ReportDto;
import com.docus.server.report.entity.AfReportRecord;
import com.docus.server.report.event.TaskConsumptionReportDownEvent;
import com.docus.server.report.event.ThreePartyPushReportDownEvent;
@ -29,8 +28,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
*
@ -41,7 +38,7 @@ import java.util.concurrent.locks.ReentrantLock;
@Slf4j
public class ReportDownListener {
@Resource
private ApplicationBusinessConfig applicationBusinessConfig;
private DownPlatformService downPlatformService;
@Resource
private AfReportRecordMapper afReportRecordMapper;
@ -70,19 +67,10 @@ public class ReportDownListener {
reportDownDto.setScanfiles(reportDownScanFileDtos);
// 下面是调用下载服务
String requestParam = Func.toJson(reportDownDto);
try {
log.info("调用下载服务,地址:{} ,参数:{}",applicationBusinessConfig.getDownUrl(),requestParam);
String respBody = post(applicationBusinessConfig.getDownUrl(),requestParam);
log.info("调用下载服务成功,响应参数:{}", respBody);
CommonResult commonResult = Func.readJson(respBody, CommonResult.class);
if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode())) {
// 下载返回了成功更新状态
afReportRecordMapper.updateStateByTaskId(threePartyPushReportDownEvent.getTaskId());
}
} catch (Exception e) {
log.error("调用下载服务失败", e);
CommonResult result = downPlatformService.report(reportDownDto);
if (ResultCode.SUCCESS.getCode().equals(result.getCode())) {
// 下载返回了成功更新状态
afReportRecordMapper.updateStateByTaskId(threePartyPushReportDownEvent.getTaskId());
}
}
@ -110,30 +98,10 @@ public class ReportDownListener {
reportDownDto.setScanfiles(reportDownScanFileDtos);
// 下面是调用下载服务
String requestParam = Func.toJson(reportDownDto);
try {
log.info("调用下载服务,地址:{} ,参数:{}",applicationBusinessConfig.getDownUrl(),requestParam);
String respBody = post(applicationBusinessConfig.getDownUrl(),requestParam);
log.info("调用下载服务成功,响应参数:{}", respBody);
} catch (Exception e) {
log.error("调用下载服务失败", e);
}
downPlatformService.report(reportDownDto);
}
private final static Lock HTTP_POST_LOCK=new ReentrantLock();
public String post(String url,String body){
HTTP_POST_LOCK.lock();
try {
HttpRequest post = HttpUtil.createPost(url);
post.timeout(5 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");
post.body(body);
HttpResponse response = post.execute();
return response.body();
}finally {
HTTP_POST_LOCK.unlock();
}
}
public static void main(String[] args) throws IOException {
BASE64Encoder encoder = new BASE64Encoder();

@ -1,6 +1,6 @@
package com.docus.server.report.service;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.api.dto.ReportDto;
import java.util.List;

@ -3,7 +3,7 @@ package com.docus.server.report.service.impl;
import com.docus.core.util.Func;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.collection.mapper.TBasicMapper;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.api.dto.ReportDto;
import com.docus.server.report.entity.AfCollectTask;
import com.docus.server.report.entity.AfReportRecord;
import com.docus.server.report.event.TaskConsumptionReportDownEvent;

@ -4,7 +4,7 @@ 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.server.report.dto.ReportDto;
import com.docus.server.report.api.dto.ReportDto;
import com.docus.server.report.service.ReportService;
import com.docus.server.report.util.IdUtil;
import com.docus.server.report.util.JSXMLResult;

Loading…
Cancel
Save