feat: 添加报告推送webservice接口

master
wyb 3 months ago
parent 8c7ba9aa68
commit 28a28d9d0d

@ -2,6 +2,7 @@ package com.docus.server;
import com.docus.server.message.consts.HospitalWsMethod;
import com.docus.server.message.service.FsSyWebServiceUnifyMessageService;
import com.docus.server.message.service.ReportFileMessageService;
import com.docus.server.message.service.SdWebServiceUnifyMessageService;
import com.docus.server.message.service.UnifyMessageService;
import org.apache.cxf.Bus;
@ -25,6 +26,8 @@ public class CxfConfig {
private FsSyWebServiceUnifyMessageService fsSyWebServiceUnifyMessageService;
private ReportFileMessageService reportFileMessageService;
@Autowired
public void setFsSyWebServiceUnifyMessageService(FsSyWebServiceUnifyMessageService fsSyWebServiceUnifyMessageService) {
this.fsSyWebServiceUnifyMessageService = fsSyWebServiceUnifyMessageService;
@ -41,6 +44,11 @@ public class CxfConfig {
this.sdWebServiceUnifyMessageService = sdWebServiceUnifyMessageService;
}
@Autowired
public void setReportFileMessageService(ReportFileMessageService reportFileMessageService) {
this.reportFileMessageService = reportFileMessageService;
}
/**
* ServletbeanNamedispatcherServlet
@ -82,4 +90,12 @@ public class CxfConfig {
endpoint.publish("/WS_RECORD_SUBMIT");
return endpoint;
}
@Bean
@Qualifier("reportFileEndPoint")
public Endpoint reportFileEndPoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), reportFileMessageService);
endpoint.publish("/reportFile");
return endpoint;
}
}

@ -1,26 +0,0 @@
package com.docus.server.message.dto;
/**
* @author YongBin Wen
* @date 2025/9/1 0001 9:45
*/
public class ReportFile {
private String zyh;
private Integer zycs;
private String jzh;
private String fileId;
private String fileName;
private String fileType;
private String fileAfTime;
private String fileTime;
private String fileUpdateTime;
private String source;
private String fileModule;
private String fileModuleName;
private Integer cancel;
private Integer filePathType;
private String filePath;
}

@ -0,0 +1,98 @@
package com.docus.server.message.feign.dto;
import com.alibaba.fastjson.JSON;
import lombok.Data;
/**
*
* @date 2026/1/7 10:02
* @author YongBin Wen
*/
@Data
public class ReportFile {
/**
*
*/
private String zyh;
/**
*
*/
private Integer zycs;
/**
*
*/
private String jzh;
/**
* id
*/
private String fileId;
/**
* xx ...
*/
private String fileName;
/**
*
*/
private String fileType;
/**
*
*/
private String fileAfTime;
/**
*
*/
private String fileTime;
/**
*
*/
private String fileUpdateTime;
/**
* HISLISECG ...
*/
private String source;
/**
* code
*/
private String fileModule;
/**
* ...
*/
private String fileModuleName;
/**
* 1
*/
private Integer cancel;
/**
* 1:http 2base645base64-1
*/
private Integer filePathType;
/**
* httpbase64
*/
private String filePath;
public String toLogString() {
ReportFile logObj = new ReportFile();
logObj.setZyh(zyh);
logObj.setZycs(zycs);
logObj.setJzh(jzh);
logObj.setFileId(fileId);
logObj.setFileName(fileName);
logObj.setFileType(fileType);
logObj.setFileAfTime(fileAfTime);
logObj.setFileTime(fileTime);
logObj.setFileUpdateTime(fileUpdateTime);
logObj.setSource(source);
logObj.setCancel(cancel);
logObj.setFilePathType(filePathType);
logObj.setFilePath(filePath);
if (filePathType.equals(2)) {
String l = filePath.substring(0, 16);
String r = filePath.substring(filePath.length() - 10);
logObj.setFilePath(l + "..." + r);
}
logObj.setFileModule(fileModule);
logObj.setFileModuleName(fileModuleName);
return JSON.toJSONString(logObj);
}
}

@ -0,0 +1,23 @@
package com.docus.server.message.feign.service;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.message.feign.dto.ReportFile;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* @author wyb
*/
@FeignClient(url = "${docus.url.downplatform}",name = "downplatform")
public interface DownloadPlatformService {
/**
*,
* @param reportFile
* @return
*/
@RequestMapping(value = "/hospital/common//reportFile",method = RequestMethod.POST)
CommonResult<String> reportFile(@RequestBody ReportFile reportFile);
}

@ -0,0 +1,44 @@
package com.docus.server.message.service;
import javax.jws.WebService;
/**
*
* @author YongBin Wen
* @date 2026/1/7 9:06
*/
@WebService
public interface ReportFileMessageService {
/**
* jsonxml
* <Request>
* <Format>json</Format>
* <ReportFile>reportFileJSON</ReportFile>
* </Request>
*
*
*
*<Request>
* <Format>xml</Format>
* <ReportFile>
* <zyh></zyh>
* <zycs></zycs>
* <jzh></jzh>
* <fileId></fileId>
* <fileName></fileName>
* <fileType></fileType>
* <fileAfTime></fileAfTime>
* <fileTime></fileTime>
* <fileUpdateTime></fileUpdateTime>
* <source></source>
* <fileModule></fileModule>
* <fileModuleName></fileModuleName>
* <cancel></cancel>
* <filePathType></filePathType>
* <filePath></filePath>
* </ReportFile>
*</Request>
*
*/
String commonFile(String message);
}

@ -0,0 +1,195 @@
package com.docus.server.message.service;
import com.alibaba.fastjson.JSON;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.message.feign.dto.ReportFile;
import com.docus.server.message.feign.service.DownloadPlatformService;
import com.docus.server.message.util.XmlUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.w3c.dom.Node;
/**
*
* @author YongBin Wen
* @date 2026/1/7 9:06
*/
@Service
@Slf4j
public class ReportFileMessageServiceImpl implements ReportFileMessageService {
private DownloadPlatformService downloadPlatformService;
@Autowired
public void setDownloadPlatformService(DownloadPlatformService downloadPlatformService) {
this.downloadPlatformService = downloadPlatformService;
}
@Override
public String commonFile(String message) {
try {
ReportFile reportFile = convertReportFile(message);
log.info("接收报告消息:{}", reportFile.toLogString());
CommonResult<String> commonResult = downloadPlatformService.reportFile(reportFile);
if (commonResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
return success();
}
return error(commonResult.getMsg());
} catch (BaseException e) {
log.error("接收报告消息处理出错!{}", e.getMessage(), e);
return error(e.getMessage());
} catch (Exception e) {
log.error("接收报告消息处理出错,消息内容:{}", message);
log.error("接收报告消息处理出错!{}", e.getMessage(), e);
return error("系统错误!");
}
}
private ReportFile convertReportFile(String message) {
XmlUtil xmlUtil = XmlUtil.of(message);
Node formatNode = xmlUtil.getNode("/Request/Format");
if (formatNode == null) {
throw new BaseException("Format节点为空");
}
Node reportFileNode = xmlUtil.getNode("/Request/ReportFile");
if (reportFileNode == null) {
throw new BaseException("ReportFile节点为空");
}
String format = formatNode.getTextContent();
if (!"xml".equalsIgnoreCase(format)
&& !"json".equalsIgnoreCase(format)) {
throw new BaseException("Format节点内容为XML或者JSON");
}
if ("json".equalsIgnoreCase(format)) {
String reportFileJsonContent = reportFileNode.getTextContent();
return JSON.parseObject(reportFileJsonContent, ReportFile.class);
} else {
String zyh = null;
Integer zycs = null;
String jzh = null;
String fileId = null;
String fileName = null;
String fileType = null;
String fileAfTime = null;
String fileTime = null;
String fileUpdateTime = null;
String source = null;
String fileModule = null;
String fileModuleName = null;
int cancel = 0;
Integer filePathType = null;
String filePath = null;
Node zyhNode = xmlUtil.getNode("/Request/ReportFile/zyh");
if (zyhNode != null) {
zyh = zyhNode.getTextContent();
}
Node zycsNode = xmlUtil.getNode("/Request/ReportFile/zycs");
if (zycsNode != null) {
String zycsStr = zycsNode.getTextContent();
if (Func.isNotBlank(zycsStr)) {
zycs = Integer.parseInt(zycsStr);
}
}
Node jzhNode = xmlUtil.getNode("/Request/ReportFile/jzh");
if (jzhNode != null) {
jzh = jzhNode.getTextContent();
}
Node fileIdNode = xmlUtil.getNode("/Request/ReportFile/fileId");
if (fileIdNode != null) {
fileId = fileIdNode.getTextContent();
}
Node fileNameNode = xmlUtil.getNode("/Request/ReportFile/fileName");
if (fileNameNode != null) {
fileName = fileNameNode.getTextContent();
}
Node fileTypeNode = xmlUtil.getNode("/Request/ReportFile/fileType");
if (fileTypeNode != null) {
fileType = fileTypeNode.getTextContent();
}
Node fileAftimeNode = xmlUtil.getNode("/Request/ReportFile/fileAfTime");
if (fileAftimeNode != null) {
fileAfTime = fileAftimeNode.getTextContent();
}
Node fileTimeNode = xmlUtil.getNode("/Request/ReportFile/fileTime");
if (fileTimeNode != null) {
fileTime = fileTimeNode.getTextContent();
}
Node fileUpdateTimeNode = xmlUtil.getNode("/Request/ReportFile/fileUpdateTime");
if (fileUpdateTimeNode != null) {
fileUpdateTime = fileUpdateTimeNode.getTextContent();
}
Node sourceNode = xmlUtil.getNode("/Request/ReportFile/source");
if (sourceNode != null) {
source = sourceNode.getTextContent();
}
Node fileModuleNode = xmlUtil.getNode("/Request/ReportFile/fileModule");
if (fileModuleNode != null) {
fileModule = fileModuleNode.getTextContent();
}
Node fileModuleNameNode = xmlUtil.getNode("/Request/ReportFile/fileModuleName");
if (fileModuleNameNode != null) {
fileModuleName = fileModuleNameNode.getTextContent();
}
Node cancelNode = xmlUtil.getNode("/Request/ReportFile/cancel");
if (cancelNode != null) {
String cancelStr = cancelNode.getTextContent();
if (Func.isNotBlank(cancelStr)) {
cancel = Integer.parseInt(cancelStr);
}
}
Node filePathTypeNode = xmlUtil.getNode("/Request/ReportFile/filePathType");
if (filePathTypeNode != null) {
String filePathTypeStr = filePathTypeNode.getTextContent();
if (Func.isNotBlank(filePathTypeStr)) {
filePathType = Integer.parseInt(filePathTypeStr);
}
}
Node filePathNode = xmlUtil.getNode("/Request/ReportFile/filePath");
if (filePathNode != null) {
filePath = filePathNode.getTextContent();
}
ReportFile reportFile = new ReportFile();
reportFile.setZycs(zycs);
reportFile.setZyh(zyh);
reportFile.setJzh(jzh);
reportFile.setFileId(fileId);
reportFile.setFileName(fileName);
reportFile.setFileType(fileType);
reportFile.setFileAfTime(fileAfTime);
reportFile.setFileTime(fileTime);
reportFile.setFileUpdateTime(fileUpdateTime);
reportFile.setSource(source);
reportFile.setFileModule(fileModule);
reportFile.setFileModuleName(fileModuleName);
reportFile.setCancel(cancel);
reportFile.setFilePathType(filePathType);
reportFile.setFilePath(filePath);
return reportFile;
}
}
private String success() {
return "<Response>" +
"<Code>0</Code>" +
"<Msg>上传成功</Msg>" +
"</Response>";
}
private String error(String message) {
return "<Response>" +
"<Code>500</Code>" +
"<Msg>" + message + "</Msg>" +
"</Response>";
}
}

@ -105,6 +105,7 @@ docus:
# 下载地址
down-url: http://localhost:9291/api/downplatform/report
medicalrecord: http://192.168.16.85:9102
downplatform: http://localhost:9291
dbtype: mysql

Loading…
Cancel
Save