diff --git a/src/main/java/com/docus/server/CxfConfig.java b/src/main/java/com/docus/server/CxfConfig.java index c7ffbae..7eb075a 100644 --- a/src/main/java/com/docus/server/CxfConfig.java +++ b/src/main/java/com/docus/server/CxfConfig.java @@ -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; + } + /** * 注入Servlet,注意beanName不能为dispatcherServlet @@ -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; + } } diff --git a/src/main/java/com/docus/server/message/dto/ReportFile.java b/src/main/java/com/docus/server/message/dto/ReportFile.java deleted file mode 100644 index 225cc94..0000000 --- a/src/main/java/com/docus/server/message/dto/ReportFile.java +++ /dev/null @@ -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; - -} diff --git a/src/main/java/com/docus/server/message/feign/dto/ReportFile.java b/src/main/java/com/docus/server/message/feign/dto/ReportFile.java new file mode 100644 index 0000000..50c976a --- /dev/null +++ b/src/main/java/com/docus/server/message/feign/dto/ReportFile.java @@ -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; + /** + * 报告来源:HIS、LIS、ECG ... + */ + private String source; + /** + * 报告分类code + */ + private String fileModule; + /** + * 报告分类名称,例如:病案首页、护理记录、病程记录 ... + */ + private String fileModuleName; + /** + * 是否作废,1则作废文件 + */ + private Integer cancel; + /** + * 文件上传路径类型,1:http 、2:base64、5:本地base64文件、-1:本地文件 + */ + private Integer filePathType; + /** + * http地址、文件base64 + */ + 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); + } +} diff --git a/src/main/java/com/docus/server/message/feign/service/DownloadPlatformService.java b/src/main/java/com/docus/server/message/feign/service/DownloadPlatformService.java new file mode 100644 index 0000000..9d558c3 --- /dev/null +++ b/src/main/java/com/docus/server/message/feign/service/DownloadPlatformService.java @@ -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 reportFile(@RequestBody ReportFile reportFile); +} diff --git a/src/main/java/com/docus/server/message/service/ReportFileMessageService.java b/src/main/java/com/docus/server/message/service/ReportFileMessageService.java new file mode 100644 index 0000000..661b6d3 --- /dev/null +++ b/src/main/java/com/docus/server/message/service/ReportFileMessageService.java @@ -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 { + /** + * json格式或者xml格式 + * + * json + * reportFile的JSON字符串 + * + * + * 或者 + * + * + * xml + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + String commonFile(String message); +} diff --git a/src/main/java/com/docus/server/message/service/ReportFileMessageServiceImpl.java b/src/main/java/com/docus/server/message/service/ReportFileMessageServiceImpl.java new file mode 100644 index 0000000..d54c562 --- /dev/null +++ b/src/main/java/com/docus/server/message/service/ReportFileMessageServiceImpl.java @@ -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 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 "" + + "0" + + "上传成功" + + ""; + } + + private String error(String message) { + return "" + + "500" + + "" + message + "" + + ""; + } +} diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index caf653d..0c2cdfc 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -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