删除报告的逻辑,初始为新的项目

master
wyb 2 years ago
parent 97a0504a5c
commit 986be2f120

@ -1,25 +0,0 @@
<!-- 报告接收 webservice 需要的数据对应下载服务,标签内有 xpath 路径,则取 接收xml中的数据否则取 标签 value值 -->
<REPORT>
<!--住院号-->
<INPATIENT_NO>/Request/Msg/INHOSP_INDEX_NO</INPATIENT_NO>
<!--住院流水号-->
<JZH>/Request/Msg/INHOSP_NO</JZH>
<!--住院次数-->
<ADMISS_TIMES>/Request/Msg/INHOSP_NUM</ADMISS_TIMES>
<!--采集流水号/报告唯一单号-->
<SERIALNUM>/Request/Msg/UNIQUE_FILE</SERIALNUM>
<!--文件标题-->
<FILE_TITLE>/Request/Msg/FILE_NAME</FILE_TITLE>
<!--下载地址-->
<DOWNURL>/Request/Msg/PDF_PATH</DOWNURL>
<!--表单类型 -->
<TABLE_TYPE>/Request/Msg/TABLE_TYPE</TABLE_TYPE>
<!--文件分类 无则取 TABLE_TYPE 在js-table-type中 取文件分类-->
<ASSORT_ID value="123456"> </ASSORT_ID>
<!--采集系统 文件表的source-->
<SYSTEM_FLAG>/Request/Msg/TABLE_TYPE</SYSTEM_FLAG>
<!--采集类型(文件来源 1:采集器2扫描生产软件)-->
<FILESOURCE value="1"> </FILESOURCE>
<!--文件保存位置类型 1:服务器本地2ftp服务器3共享文件夹-->
<FILE_STORAGE_TYPE value="1"> </FILE_STORAGE_TYPE>
</REPORT>

@ -1,5 +0,0 @@
{
"icu": "重症文件分段id",
"sa": "手麻文件分段id",
"other": "其他文件分段id"
}

@ -1,25 +0,0 @@
<!--嘉时软件webservice接收模板-->
<Request>
<Msg>
<!-- 消息ID号-->
<ID>123456</ID>
<!--住院号-->
<INHOSP_INDEX_NO>012345</INHOSP_INDEX_NO>
<!--住院流水号-->
<INHOSP_NO>012345</INHOSP_NO>
<!--住院次数-->
<INHOSP_NUM>2</INHOSP_NUM>
<!--表单类型-->
<TABLE_TYPE>icu</TABLE_TYPE>
<!--提交时间-->
<SUBMIT_TIME>20220303111800</SUBMIT_TIME>
<!--审核时间-->
<PROOF_TIME>20220303111801</PROOF_TIME>
<!-- 文件路径-->
<PDF_PATH>http://192.168.1.108:9012/file/0123_01.pdf</PDF_PATH>
<!--文件名-->
<FILE_NAME>0123_01</FILE_NAME>
<!--文件唯一值-->
<UNIQUE_FILE>AESHASHMD5DEFIND</UNIQUE_FILE>
</Msg>
</Request>

@ -1,11 +0,0 @@
<!--嘉时软件webservice响应模板-->
<Response>
<Result>
<!--响应状态码 0代表成功 500 代表失败-->
<Code>0</Code>
<!--消息id 请求的 /Request/Msg/ID-->
<MsgId>123456</MsgId>
<!--成功消息 / 失败异常消息-->
<Msg>成功!</Msg>
</Result>
</Response>

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>docus-webservice-report</artifactId>
<artifactId>docus-unified-message</artifactId>
<dependencies>
<dependency>

@ -1,24 +0,0 @@
#-- 服务接收报告消息保存数据--#
USE `docus_archivefile`;
CREATE TABLE `af_report_record` (
`task_id` bigint(19) NOT NULL COMMENT 'af_collect_task 主键id',
`inpatient_no` varchar(50) DEFAULT NULL COMMENT '住院号',
`jzh` varchar(50) DEFAULT NULL COMMENT '住院流水号,记账号',
`admiss_times` int(11) DEFAULT NULL COMMENT '住院次数',
`down_url` varchar(2048) DEFAULT NULL COMMENT '下载地址,多个使用| 分隔',
`down_type` int(11) DEFAULT NULL COMMENT '下载路径类型 1:url,2:base64,3:url base64,4:共享文件5本地文件base64',
`state` int(11) DEFAULT NULL COMMENT '状态 0 未开始可用于补偿1 已发送下载',
`serialnum` varchar(200) DEFAULT NULL COMMENT '文件唯一标识',
`sysflag` varchar(50) DEFAULT NULL COMMENT '文件来源 采集系统',
`zd_assort_id` varchar(200) DEFAULT NULL COMMENT '文件分段id',
`create_time` datetime DEFAULT NULL COMMENT '记录创建时间',
`update_time` datetime DEFAULT NULL COMMENT '记录更新时间',
`file_name` varchar(255) DEFAULT NULL COMMENT '文件名称',
`patient_id` varchar(50) DEFAULT NULL COMMENT '病案主键',
PRIMARY KEY (`task_id`),
KEY `idx_af_report_record_patientid` (`patient_id`) USING BTREE,
KEY `idx_af_report_record_inpatient_no` (`inpatient_no`) USING BTREE,
KEY `idx_af_report_record_jzh` (`jzh`) USING BTREE,
KEY `idx_af_report_record_state` (`state`) USING BTREE,
KEY `idx_af_report_record_sysflag` (`sysflag`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件上报接收记录';

@ -1,22 +1,29 @@
package com.docus.server;
import com.docus.server.report.webservice.IReportServer;
import com.docus.server.message.consts.InteractiveMethod;
import com.docus.server.message.service.UnifyMessageService;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import lombok.RequiredArgsConstructor;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.transport.servlet.CXFServlet;
import javax.xml.ws.Endpoint;
@Configuration
@RequiredArgsConstructor
public class CxfConfig {
private final IReportServer reportServer;
private UnifyMessageService unifyMessageService;
@Autowired
@Qualifier(InteractiveMethod.WS)
public void setUnifyMessageService(UnifyMessageService unifyMessageService) {
this.unifyMessageService = unifyMessageService;
}
/**
* ServletbeanNamedispatcherServlet
@ -34,10 +41,10 @@ public class CxfConfig {
}
@Bean
@Qualifier("reportEndPoint")
public Endpoint userEndPoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), reportServer);
endpoint.publish("/api/report");
@Qualifier("unifyEndPoint")
public Endpoint unifyEndPoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), null);
endpoint.publish("/api/unify");
return endpoint;
}
}

@ -0,0 +1,30 @@
package com.docus.server.message.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
*
* @author wyb
*/
@Component
@Getter
@Setter
@ConfigurationProperties(prefix = "docus.url")
public class UrlConfig {
/**
*
*/
private String downUrl;
/**
*
*/
private String compensateTaskUrl;
/**
*
*/
private String getBasicDataUrl;
}

@ -0,0 +1,17 @@
package com.docus.server.message.consts;
/**
*
* @author wyb
*/
public interface InteractiveMethod {
/**
* Http
*/
String HTTP = "HttpUnifyMessageService";
/**
* WebService"
*/
String WS = "WebServiceUnifyMessageService";
}

@ -0,0 +1,35 @@
package com.docus.server.message.controller;
import com.docus.server.message.consts.InteractiveMethod;
import com.docus.server.message.dto.Message;
import com.docus.server.message.service.UnifyMessageService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author wyb
*/
@Api("")
@RestController
@Slf4j
@RequestMapping("/api/message")
public class MessageReceiveController {
private UnifyMessageService unifyMessageService;
@Autowired
@Qualifier(InteractiveMethod.HTTP)
public void setUnifyMessageService(UnifyMessageService unifyMessageService) {
this.unifyMessageService = unifyMessageService;
}
@PostMapping("/receive")
public String receiveMessage(Message message){
return unifyMessageService.receive(message.getMethod(),message.getMessage());
}
}

@ -0,0 +1,14 @@
package com.docus.server.message.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author wyb
*/
@Getter
@Setter
public class Message {
private String method;
private String message;
}

@ -0,0 +1,14 @@
package com.docus.server.message.service;
import javax.jws.WebService;
@WebService
public interface UnifyMessageService {
/**
*
* @param method
* @param message
* @return
*/
String receive(String method,String message);
}

@ -0,0 +1,16 @@
package com.docus.server.message.service.impl;
import com.docus.server.message.consts.InteractiveMethod;
import com.docus.server.message.service.UnifyMessageService;
import org.springframework.stereotype.Service;
/**
* @author wyb
*/
@Service(InteractiveMethod.HTTP)
public class HttpUnifyMessageServiceImpl implements UnifyMessageService {
@Override
public String receive(String method,String message) {
return null;
}
}

@ -0,0 +1,16 @@
package com.docus.server.message.service.impl;
import com.docus.server.message.consts.InteractiveMethod;
import com.docus.server.message.service.UnifyMessageService;
import org.springframework.stereotype.Service;
/**
* @author WYBDEV
*/
@Service(InteractiveMethod.WS)
public class WebServiceUnifyMessageServiceImpl implements UnifyMessageService {
@Override
public String receive(String method,String message) {
return null;
}
}

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

@ -1,4 +1,4 @@
package com.docus.server.report.util;
package com.docus.server.message.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.util.StringUtils;

@ -14,7 +14,7 @@
* this software without specific prior written permission.
* Author: DreamLu (596392912@qq.com)
*/
package com.docus.server.report.util;
package com.docus.server.message.util;
import com.docus.core.util.Exceptions;
import com.docus.core.util.IoUtil;

@ -1,18 +0,0 @@
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 ApplicationBusinessConfig {
@Value("${docus.report.downurl:}")
private String downUrl;
}

@ -1,44 +0,0 @@
package com.docus.server.report.controller;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.report.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author wyb
*
*/
@Slf4j
@Api(tags = "文件上报,补偿控制")
@RestController
@RequestMapping("/report/makeup")
public class ReportDownController {
@Resource
private ReportService reportService;
@ApiOperation(value = "根据任务id补偿报告下载")
@PostMapping("/makeupReportByTaskIds")
public CommonResult<String> makeupReportByTaskIds(@RequestBody List<Long> taskIds){
if (Func.isEmpty(taskIds)) {
return CommonResult.failed("补偿任务id不能为空");
}
try {
reportService.makeupReportByTaskIds(taskIds);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return CommonResult.failed("补偿出现了一点小问题!");
}
return CommonResult.success("补偿成功!");
}
}

@ -1,30 +0,0 @@
package com.docus.server.report.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class ReportDownDto {
@ApiModelProperty(value = "采集器id")
private String collectorid;
@ApiModelProperty(value = "采集器ip")
private String ip;
@ApiModelProperty(value = "分类id")
private String assortid;
@ApiModelProperty(value = "患者信息")
private ReportDownPatientDto patient;
@ApiModelProperty(value = "文件信息")
private List<ReportDownScanFileDto> scanfiles;
@ApiModelProperty(value = "扫描用户代码")
private String scanusercode;
@ApiModelProperty(value = "扫描用户名称")
private String scanusername;
}

@ -1,27 +0,0 @@
package com.docus.server.report.dto;
import com.docus.server.report.entity.AfReportRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReportDownPatientDto {
@ApiModelProperty(value = "记帐号")
private String jzh;
@ApiModelProperty(value = "住院次数,记帐号重复则加这个参数无则Null")
private Integer admisstimes;
@ApiModelProperty(value = "病案主键如有传则使用无则使用jzh")
private String patientid;
@ApiModelProperty(value = "病案号")
private String inpatientno;
@ApiModelProperty(value = "物理存储位置,有则传")
private String storagelocation;
public ReportDownPatientDto(AfReportRecord reportRecord) {
this.patientid = reportRecord.getPatientId();
this.jzh = reportRecord.getJzh();
this.admisstimes = reportRecord.getAdmissTimes();
this.inpatientno = reportRecord.getInpatientNo();
}
}

@ -1,41 +0,0 @@
package com.docus.server.report.dto;
import com.docus.server.report.entity.AfReportRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReportDownScanFileDto {
@ApiModelProperty(value = "任务id(如无效任务id则不更新任务表数据)")
private Long taskid;
@ApiModelProperty(value = "文件标题")
private String filetitle;
@ApiModelProperty(value = "采集类型(文件来源 1:采集器2扫描生产软件)")
private int filesource;
@ApiModelProperty(value = "下载类型(1:服务器本地2ftp服务器3共享文件夹)")
private int filestoragetype;
@ApiModelProperty(value = "文件类型(1:url,2:base64,3:url base64,4:共享文件5本地文件base64)")
private int filetype=1;
@ApiModelProperty(value = "下载地址")
private String downurl;
// @ApiModelProperty(value = "档案信息")
// private String recordid;
@ApiModelProperty(value = "采集流水号")
private String serialnum;
@ApiModelProperty(value = "排序日期")
private String sortdate;
@ApiModelProperty(value = "是否作废 0否 不作废1是 作废")
private int cancel=0;
public ReportDownScanFileDto(AfReportRecord reportRecord) {
this.taskid=reportRecord.getTaskId();
this.filetitle=reportRecord.getFileName();
this.filesource= 1;
this.filestoragetype=1;
this.filetype=reportRecord.getDownType();
this.downurl=reportRecord.getDownUrl();
this.serialnum=reportRecord.getSerialnum();
}
}

@ -1,68 +0,0 @@
package com.docus.server.report.dto;
import lombok.Data;
/**
*
*/
@Data
public class ReportDto {
/**
*
*/
private String inpatientNo;
/**
* /
*/
private String jzh;
/**
*
*/
private Integer admisstimes;
/**
*
*/
private String sysFlag;
/**
*
*/
private String downUrl;
/**
*
*/
private String fileTitle;
/**
* /id
*/
private String serialnum;
/**
* id
*/
private String assortId;
/**
* ( 1:2)
*/
private String fileSource;
/**
* 1:2ftp3
*/
private String filestoragetype;
/**
* id ,
*/
private Long taskId;
/**
*
*/
private String patientId;
/**
* 1:url2:base643:url base644:5base64
*/
private Integer downtype=1;
}

@ -1,79 +0,0 @@
package com.docus.server.report.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author
* @since 2021-05-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "AfCollectTask对象", description = "病案采集任务")
public class AfCollectTask implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id 主键")
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@ApiModelProperty(value = "病案主键")
private String patientId;
@ApiModelProperty(value = "来源 1护理文书2 电子病历3 Pacs检查4心电图5手麻系统6 Lis检验7病案首页8长临医嘱")
private String sysflag;
@ApiModelProperty(value = "开始时间")
private Date startTime;
@ApiModelProperty(value = "结束时间")
private Date endTime;
@ApiModelProperty(value = "任务耗时(毫秒)")
private Long consumingTime;
@ApiModelProperty(value = "-1 等待采集0未开始1:正在采集2采集错误3采集完成")
private String state;
@ApiModelProperty(value = "同步时间")
private Date syncTime;
@ApiModelProperty(value = "最新重新采集时间")
private Date recollectTime;
@ApiModelProperty(value = "最新重新采集人")
private String recollectName;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "报告唯一单号")
private String C1;
@ApiModelProperty(value = "c2")
private String C2;
@ApiModelProperty(value = "记账号")
private String C3;
@ApiModelProperty(value = "c4")
private String C4;
@ApiModelProperty(value = "c6")
private String C6;
@ApiModelProperty(value = "c9")
private String C9;
}

@ -1,103 +0,0 @@
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 lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@Data
public class AfReportRecord implements Serializable {
private static final long serialVersionUID = 1L;
/**
* af_collect_task id
*/
private Long taskId;
/**
*
*/
private String inpatientNo;
/**
*
*/
private String jzh;
/**
*
*/
private Integer admissTimes;
/**
* 使 |
*/
private String downUrl;
/**
* 1:url2:base643:url base644:5base64
*/
private Integer downType;
/**
* 0 1
*/
private Integer state;
/**
* id
*/
private String serialnum;
/**
*
*/
private String sysflag;
/**
* id
*/
private String zdAssortId;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private String fileName;
/**
*
*/
private String patientId;
public AfReportRecord() {
}
public AfReportRecord(ReportDto reportDto){
this.jzh=reportDto.getJzh();
this.admissTimes=reportDto.getAdmisstimes();
this.inpatientNo=reportDto.getInpatientNo();
this.downUrl=reportDto.getDownUrl();
this.sysflag=reportDto.getSysFlag();
this.zdAssortId=reportDto.getAssortId();
this.serialnum=reportDto.getSerialnum();
this.fileName=reportDto.getFileTitle();
this.downType=reportDto.getDowntype();
}
}

@ -1,158 +0,0 @@
package com.docus.server.report.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jiashi
* @since 2021-04-14
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "TBasic对象", description = "病案基本信息")
public class TBasic implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "病案主键")
@TableId(value = "patient_id", type = IdType.ASSIGN_ID)
private String patientId;
@ApiModelProperty(value = "住院次数")
private Integer admissTimes;
@ApiModelProperty(value = "病案号")
private String inpatientNo;
@ApiModelProperty(value = "住院ID号")
private String admissId;
@ApiModelProperty(value = "患者姓名")
private String name;
@ApiModelProperty(value = "盘号")
private String ph;
@ApiModelProperty(value = "性别")
private String sex;
@ApiModelProperty(value = "年龄_岁")
private Integer age;
@ApiModelProperty(value = "年龄_月")
private Integer ageMonth;
@ApiModelProperty(value = "年龄_天")
private Integer ageDay;
@ApiModelProperty(value = "身份证")
private String idCard;
@ApiModelProperty(value = "手机号码")
private String telphone;
@ApiModelProperty(value = "住院日期")
private Date admissDate;
@ApiModelProperty(value = "住院科室")
private String admissDept;
@ApiModelProperty(value = "住院科室名称")
private String admissDeptName;
@ApiModelProperty(value = "出院日期")
private Date disDate;
@ApiModelProperty(value = "出院科室")
private String disDept;
@ApiModelProperty(value = "出院科室名称")
private String disDeptName;
@ApiModelProperty(value = "实际住院天数")
private Integer admissDays;
@ApiModelProperty(value = "主管医生")
private String attending;
@ApiModelProperty(value = "主管医生名称")
private String attendingName;
@ApiModelProperty(value = "主要诊断编码")
private String mainDiagCode;
@ApiModelProperty(value = "主要诊断名称")
private String mainDiagName;
@ApiModelProperty(value = "主要手术编码")
private String mainOperateCode;
@ApiModelProperty(value = "主要手术名称")
private String mainOperateName;
@ApiModelProperty(value = "是否死亡")
private Integer isDead;
@ApiModelProperty(value = "是否作废(01是)")
private Integer isCancel;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "是否归档 1已归档0未归档")
private Integer isArchive;
@ApiModelProperty(value = "归档时间")
private Date archiveTime;
@ApiModelProperty(value = "文件来源 1:af_archive_detail,2:t_scan_assort")
private Integer fileSource;
@ApiModelProperty(value = "完整性描述")
private String integrityDesc;
private String bColumn1;
private String bColumn2;
private String bColumn3;
private String bColumn4;
private String bColumn5;
private Integer bColumn6;
private Integer bColumn7;
private Integer bColumn8;
private Integer bColumn9;
private Integer bColumn10;
@ApiModelProperty(value = "姓名缩写(内部构成)")
private String nameSpell;
@ApiModelProperty(value = "性别名称")
private String sexName;
@ApiModelProperty(value = "记账号")
private String jzh;
}

@ -1,28 +0,0 @@
package com.docus.server.report.event;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;
/**
*
* @author wyb
*/
@Getter
public class ReportDownEvent extends ApplicationEvent {
/**
* id ,
*/
private final Long taskId;
/**
*
* @param source
* @param taskId
*/
public ReportDownEvent(Object source,Long taskId) {
super(source);
this.taskId=taskId;
}
}

@ -1,83 +0,0 @@
package com.docus.server.report.listener;
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.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.entity.AfReportRecord;
import com.docus.server.report.event.ReportDownEvent;
import com.docus.server.report.mapper.AfReportRecordMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class ReportDownListener {
@Resource
private ApplicationBusinessConfig applicationBusinessConfig;
@Resource
private AfReportRecordMapper afReportRecordMapper;
@EventListener
@Async("threadPoolExecutor")
public void reportDown(ReportDownEvent reportDownEvent) {
// 根据任务id获取上报记录信息
AfReportRecord afReportRecord = afReportRecordMapper.getReportRecordInfoByTaskId(reportDownEvent.getTaskId());
// 组织基础信息数据
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(afReportRecord);
// 组织文件数据
List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>(5);
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(afReportRecord);
reportDownScanFileDtos.add(reportDownScanFileDto);
// 组织下载数据,基础信息和文件数据
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setAssortid(afReportRecord.getZdAssortId());
reportDownDto.setCollectorid(afReportRecord.getSysflag());
reportDownDto.setScanusercode("admin");
reportDownDto.setScanusername("admin");
reportDownDto.setPatient(reportDownPatientDto);
reportDownDto.setScanfiles(reportDownScanFileDtos);
// 下面是调用下载服务
String requestParam = Func.toJson(reportDownDto);
try {
log.info("调用下载服务,地址:{} ,参数:{}",applicationBusinessConfig.getDownUrl(),requestParam);
HttpRequest post = HttpUtil.createPost(applicationBusinessConfig.getDownUrl());
post.timeout(5 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");
post.body(requestParam);
HttpResponse response = post.execute();
String respBody = response.body();
log.info("调用下载服务成功,响应参数:{}", respBody);
CommonResult commonResult = Func.readJson(respBody, CommonResult.class);
if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode())) {
// 下载返回了成功更新状态
afReportRecordMapper.updateStateByTaskId(reportDownEvent.getTaskId());
}
} catch (Exception e) {
log.error("调用下载服务失败", e);
}
}
}

@ -1,27 +0,0 @@
package com.docus.server.report.mapper;
import com.docus.server.report.entity.AfCollectTask;
import org.apache.ibatis.annotations.Param;
/**
* mapper
* @author wyb
*
*/
public interface AfCollectTaskMapper {
/**
*
* @param afCollectTask
* @return
*/
int saveTask(@Param("task") AfCollectTask afCollectTask);
/**
*
* @param taskId
* @return
*/
AfCollectTask getTaskById(@Param("id") Long taskId);
}

@ -1,52 +0,0 @@
package com.docus.server.report.mapper;
import com.docus.server.report.entity.AfReportRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @author wyb
*/
public interface AfReportRecordMapper {
/**
*
* @param afReportRecord
* @return
*/
int saveRecord(@Param("reportRecord") AfReportRecord afReportRecord);
/**
*
* @param serialnum
* @param inpatientNo
* @param admisstimes
* @param sysFlag
* @return
*/
AfReportRecord getRecordBySerialnumAndInpatientNoAndSysFlag(@Param("serialnum") String serialnum, @Param("inpatientNo")String inpatientNo,@Param("admisstimes") Integer admisstimes, @Param("sysFlag")String sysFlag);
/**
*
* @param afReportRecord
* @return
*/
int updateRecordByTaskId(@Param("reportRecord")AfReportRecord afReportRecord);
/**
*
* @param taskId id
* @return
*/
int updateStateByTaskId(@Param("taskId") Long taskId);
AfReportRecord getReportRecordInfoByTaskId(@Param("taskId") Long taskId);
/**
* idpatientIdid
* @param taskIds id
* @return patientIdid
*/
List<Long> getHasPatientIdTaskIdsByTaskIds(@Param("taskIds") List<Long> taskIds);
}

@ -1,25 +0,0 @@
package com.docus.server.report.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.server.report.entity.TBasic;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper
* </p>
*
* @author jiashi
* @since 2021-04-14
*/
public interface TBasicMapper{
/**
*
* @param inpatientNo
* @param admissTimes
* @return
*/
String getPatientIdByInpatientNoAndAdminssTimes(@Param("inpatientNo") String inpatientNo,@Param("adminssTimes") Integer admissTimes);
}

@ -1,24 +0,0 @@
package com.docus.server.report.service;
import com.docus.server.report.dto.ReportDto;
import java.util.List;
/**
*
* @author wyb
*/
public interface ReportService {
/**
*
* @param reportDto
*/
void report(ReportDto reportDto);
/**
* id
* @param taskIds id
*/
void makeupReportByTaskIds(List<Long> taskIds) throws Exception;
}

@ -1,119 +0,0 @@
package com.docus.server.report.service.impl;
import com.docus.core.util.Func;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.report.dto.ReportDto;
import com.docus.server.report.entity.AfCollectTask;
import com.docus.server.report.entity.AfReportRecord;
import com.docus.server.report.event.ReportDownEvent;
import com.docus.server.report.mapper.AfCollectTaskMapper;
import com.docus.server.report.mapper.AfReportRecordMapper;
import com.docus.server.report.mapper.TBasicMapper;
import com.docus.server.report.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
*
*
* @author wyb
*/
@Slf4j
@Service
public class ReportServiceImpl implements ReportService {
@Resource
private ApplicationContext applicationContext;
@Resource
private AfCollectTaskMapper collectTaskMapper;
@Resource
private AfReportRecordMapper afReportRecordMapper;
@Resource
private TBasicMapper tBasicMapper;
@Resource
private IdService idService;
@Override
public void report(ReportDto reportDto) {
String patientId = null;
try {
// 如果出现多条出错的情况,还是得保存收到的信息,人工干预处理
patientId = tBasicMapper.getPatientIdByInpatientNoAndAdminssTimes(reportDto.getInpatientNo(), reportDto.getAdmisstimes());
} catch (Exception ex) {
log.error("查询病案主键出错了", ex);
}
// 不验证数据,始终保存收到的信息
AfReportRecord afReportRecord = afReportRecordMapper.getRecordBySerialnumAndInpatientNoAndSysFlag(reportDto.getSerialnum(), reportDto.getInpatientNo(), reportDto.getAdmisstimes(), reportDto.getSysFlag());
if (afReportRecord == null) {
long id = idService.getDateSeq();
afReportRecord = new AfReportRecord(reportDto);
afReportRecord.setTaskId(id);
afReportRecord.setPatientId(patientId);
afReportRecordMapper.saveRecord(afReportRecord);
} else {
// 更新 主要更新 url
afReportRecord.setDownUrl(reportDto.getDownUrl());
afReportRecord.setDownType(reportDto.getDowntype());
afReportRecord.setFileName(reportDto.getFileTitle());
afReportRecord.setPatientId(patientId);
afReportRecordMapper.updateRecordByTaskId(afReportRecord);
}
// 不使用事务,不需要回滚上面的保存
// 根据记录中的任务id查询是否需要新增任务
if (Func.isBlank(patientId)) {
log.warn("病案号:{},住院次数:{} 未找到病案基础数据,暂不进行下载任务!", reportDto.getInpatientNo(), reportDto.getAdmisstimes());
return;
}
// 判断是否需要保存任务
AfCollectTask afCollectTask = collectTaskMapper.getTaskById(afReportRecord.getTaskId());
if (afCollectTask == null) {
afCollectTask = new AfCollectTask();
afCollectTask.setId(afReportRecord.getTaskId());
afCollectTask.setC1(reportDto.getSerialnum());
afCollectTask.setC2(reportDto.getFileTitle());
afCollectTask.setC3(reportDto.getJzh());
afCollectTask.setPatientId(patientId);
afCollectTask.setSysflag(reportDto.getSysFlag());
afCollectTask.setState("0");
afCollectTask.setPatientId(patientId);
collectTaskMapper.saveTask(afCollectTask);
}
// 都成功后发布下载事件
applicationContext.publishEvent(new ReportDownEvent(this, afReportRecord.getTaskId()));
}
@Override
public void makeupReportByTaskIds(List<Long> taskIds) throws Exception {
// 定义一批200查询分批次
final int oneBatchCount = 200;
int startIndex = 0;
int toIndex = oneBatchCount;
boolean loop = true;
do {
// 获取截取下标
if (taskIds.size() <= oneBatchCount) {
toIndex = taskIds.size();
// 最后一批截取
loop = false;
}
// 截取每一批
List<Long> makeupTaskIds = taskIds.subList(startIndex, toIndex);
makeupTaskIds = afReportRecordMapper.getHasPatientIdTaskIdsByTaskIds(makeupTaskIds);
if (Func.isNotEmpty(makeupTaskIds)) {
for (Long taskId : makeupTaskIds) {
// 发布下载事件
applicationContext.publishEvent(new ReportDownEvent(this, taskId));
// 等待防止过快
TimeUnit.MILLISECONDS.sleep(50);
}
}
// 当截取长度小于集合长度,可以进行下次循环截取
} while (loop);
}
}

@ -1,41 +0,0 @@
package com.docus.server.report.util;
import lombok.Data;
/**
* / XML
* @author wyb
*/
@Data
public class JSXMLResult {
private static final String SUCCESS_TEMPLATE="<Response>" +
"<Result>" +
"<Code>0</Code>" +
"<MsgId>%s</MsgId>" +
"<Msg>成功!</Msg>" +
"</Result>" +
"</Response>";
private static final String FAILED_TEMPLATE="<Response>" +
"<Result>" +
"<Code>500</Code>" +
"<MsgId>%s</MsgId>" +
"<Msg>%s</Msg>" +
"</Result>" +
"</Response>";
public static String success(String msgId){
return String.format(SUCCESS_TEMPLATE,msgId);
}
public static String failed(String msgId,String message){
return String.format(FAILED_TEMPLATE,msgId,message);
}
public static void main(String[] args) {
System.out.println(success("100"));
System.out.println(failed("100","随便输出了"));
}
}

@ -1,39 +0,0 @@
package com.docus.server.report.webservice;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* @author Fang Ruichuan
* @date 2022-11-14 19:03
*/
@WebService
public interface IReportServer {
/**
*
* @param saReportMessage
* @return
*/
String pushSAReport(String saReportMessage);
/**
*
* @param icuReportMessage
* @return
*/
String pushICUReport(String icuReportMessage);
/**
* -
* @param inspectionReportMessage -
* @return
*/
String pushAddInspectionReport(String inspectionReportMessage);
/**
* -
* @param inspectionReportMessage -
* @return
*/
String pushUpdateInspectionReport(String inspectionReportMessage);
}

@ -1,529 +0,0 @@
package com.docus.server.report.webservice.impl;
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.service.ReportService;
import com.docus.server.report.util.IdUtil;
import com.docus.server.report.util.JSXMLResult;
import com.docus.server.report.util.TableJsonRead;
import com.docus.server.report.util.XmlUtil;
import com.docus.server.report.webservice.IReportServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.w3c.dom.Node;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author wyb
* @date 20233313:42:36
*/
@Service
@Slf4j
public class SdryReportServerImpl implements IReportServer {
@Resource
private ReportService reportService;
@Override
public String pushSAReport(String saReportMessage) {
// 待做
log.info("收到手麻消息:{}", saReportMessage);
String msgId = "";
try {
XmlUtil xmlUtil = XmlUtil.of(saReportMessage);
Node msgNode = xmlUtil.getNode("/Request/Msg/ID");
msgId = msgNode.getTextContent();
ReportDto reportDto = getReportDtoByJSXML(xmlUtil);
verifyReportDto(reportDto);
reportService.report(reportDto);
return JSXMLResult.success(msgId);
} catch (BaseException baseException) {
log.error(baseException.getMessage(), baseException);
return JSXMLResult.failed(msgId, baseException.getMessage());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return JSXMLResult.failed(msgId, "系统故障!");
}
}
/**
* 使xml
*
* @param xmlUtil xml
* @return
*/
public ReportDto getReportDtoByJSXML(XmlUtil xmlUtil) {
TableJsonRead jsonRead = new TableJsonRead();
JSONObject tableTypeJson = jsonRead.Read("data-config", "js-table-type.json", JSONObject.class);
String jsReportConfigXml = jsonRead.ReadContent("data-config", "js-report-config.xml");
XmlUtil configXmlUtil = XmlUtil.of(jsReportConfigXml);
Node inpatientNoXpathNode = configXmlUtil.getNode("/REPORT/INPATIENT_NO");
String inpatientNoXpath = inpatientNoXpathNode.getTextContent();
Node inpatientNoNode = xmlUtil.getNode(inpatientNoXpath);
String inpatientNo = inpatientNoNode.getTextContent();
Node jzhXpathNode = configXmlUtil.getNode("/REPORT/JZH");
String jzhXpath = jzhXpathNode.getTextContent();
Node jzhNode = xmlUtil.getNode(jzhXpath);
String jzh = jzhNode.getTextContent();
Node admissTimesXpathNode = configXmlUtil.getNode("/REPORT/ADMISS_TIMES");
String admissTimesXpath = admissTimesXpathNode.getTextContent();
Node admissTimesNode = xmlUtil.getNode(admissTimesXpath);
Integer admissTimes = Integer.valueOf(admissTimesNode.getTextContent());
Node serialnumXpathNode = configXmlUtil.getNode("/REPORT/SERIALNUM");
String serialnumXpath = serialnumXpathNode.getTextContent();
Node serialnumNode = xmlUtil.getNode(serialnumXpath);
String serialnum = serialnumNode.getTextContent();
Node fileTitleXpathNode = configXmlUtil.getNode("/REPORT/FILE_TITLE");
String fileTitleXpath = fileTitleXpathNode.getTextContent();
Node fileTitleNode = xmlUtil.getNode(fileTitleXpath);
String fileTitle = fileTitleNode.getTextContent();
Node downUrlXpathNode = configXmlUtil.getNode("/REPORT/DOWNURL");
String downUrlXpath = downUrlXpathNode.getTextContent();
Node downUrlNode = xmlUtil.getNode(downUrlXpath);
String downUrl = downUrlNode.getTextContent();
Node tableTypeXpathNode = configXmlUtil.getNode("/REPORT/TABLE_TYPE");
String tableTypeXpath = tableTypeXpathNode.getTextContent();
Node tableTypeNode = xmlUtil.getNode(tableTypeXpath);
String tableType = tableTypeNode.getTextContent();
Node assortIdXpathNode = configXmlUtil.getNode("/REPORT/ASSORT_ID");
String assortIdXpath = assortIdXpathNode.getTextContent();
String assortId;
if (Func.isBlank(assortIdXpath)) {
// 如果没有配置 取value 属性如果value也未配置 取 tableType 对应的json配置最终方案默认 other 分段
Node assortIdValueNode = assortIdXpathNode.getAttributes().getNamedItem("value");
if (Func.isEmpty(assortIdValueNode)) {
assortId = assortIdValueNode.getNodeValue();
} else {
assortId = tableTypeJson.getString(tableType);
}
if (Func.isBlank(assortId)) {
assortId = tableTypeJson.getString("other");
}
} else {
Node assortIdNode = xmlUtil.getNode(assortIdXpath);
assortId = assortIdNode.getTextContent();
}
Node sysFlagXpathNode = configXmlUtil.getNode("/REPORT/SYSTEM_FLAG");
String sysFlagXpath = sysFlagXpathNode.getTextContent();
Node sysFlagNode = xmlUtil.getNode(sysFlagXpath);
String sysFlag = sysFlagNode.getTextContent();
Node fileSourceXpathNode = configXmlUtil.getNode("/REPORT/FILESOURCE");
String fileSourceXpath = fileSourceXpathNode.getTextContent();
String fileSource;
if (Func.isBlank(fileSourceXpath)) {
Node fileSourceValueNode = fileSourceXpathNode.getAttributes().getNamedItem("value");
if (Func.isEmpty(fileSourceValueNode)) {
fileSource = null;
} else {
fileSource = fileSourceValueNode.getNodeValue();
}
} else {
Node fileSourceNode = xmlUtil.getNode(fileSourceXpath);
fileSource = fileSourceNode.getTextContent();
}
Node fileStorageTypeXpathNode = configXmlUtil.getNode("/REPORT/FILE_STORAGE_TYPE");
String fileStorageTypeXpath = fileStorageTypeXpathNode.getTextContent();
String fileStorageType;
if (Func.isBlank(fileStorageTypeXpath)) {
Node filestoragetypeValueNode = fileStorageTypeXpathNode.getAttributes().getNamedItem("value");
if (Func.isEmpty(filestoragetypeValueNode)) {
fileStorageType = "1";
} else {
fileStorageType = filestoragetypeValueNode.getNodeValue();
}
} else {
Node filestoragetypeNode = xmlUtil.getNode(fileStorageTypeXpath);
fileStorageType = filestoragetypeNode.getTextContent();
}
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(admissTimes);
reportDto.setInpatientNo(inpatientNo);
reportDto.setJzh(jzh);
reportDto.setSerialnum(serialnum);
reportDto.setFileTitle(fileTitle);
reportDto.setDownUrl(downUrl);
reportDto.setAssortId(assortId);
reportDto.setSysFlag(sysFlag);
reportDto.setFileSource(fileSource);
reportDto.setFilestoragetype(fileStorageType);
return reportDto;
}
@Override
public String pushICUReport(String icuReportMessage) {
log.info("收到重症消息:{}", icuReportMessage);
String msgId = "";
try {
XmlUtil xmlUtil = XmlUtil.of(icuReportMessage);
Node msgNode = xmlUtil.getNode("/Request/Msg/ID");
msgId = msgNode.getTextContent();
ReportDto reportDto = getReportDtoByJSXML(xmlUtil);
verifyReportDto(reportDto);
reportService.report(reportDto);
return JSXMLResult.success(msgId);
} catch (BaseException baseException) {
log.error(baseException.getMessage(), baseException);
return JSXMLResult.failed(msgId, baseException.getMessage());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return JSXMLResult.failed(msgId, "系统故障!");
}
}
@Override
public String pushAddInspectionReport(String inspectionReportMessage) {
log.info("收到检查报告新增消息:{}", inspectionReportMessage);
String msgId = "";
String sender = "";
String receiver = "";
try {
XmlUtil xmlUtil = XmlUtil.of(inspectionReportMessage);
msgId = xmlUtil.getNode("/POOR_HIP1008/id/@extension").getNodeValue();
sender = xmlUtil.getNode("/POOR_HIP1008/sender/device/id/item/@extension").getNodeValue();
receiver = xmlUtil.getNode("/POOR_HIP1008/receiver/device/id/item/@extension").getNodeValue();
ReportDto reportDto = getReportDtoByInspectionInsert(xmlUtil);
verifyReportDto(reportDto);
reportService.report(reportDto);
return insertSuccess(msgId, sender, receiver);
} catch (BaseException baseException) {
log.error(baseException.getMessage(), baseException);
return insertFailed(msgId, sender, receiver, baseException.getMessage());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return insertFailed(msgId, sender, receiver, "系统错误!");
}
}
@Override
public String pushUpdateInspectionReport(String inspectionReportMessage) {
log.info("收到检查报告更新消息{}", inspectionReportMessage);
String msgId = "";
String sender = "";
String receiver = "";
try {
XmlUtil xmlUtil = XmlUtil.of(inspectionReportMessage);
msgId = xmlUtil.getNode("/POOR_HIP1009/id/@extension").getNodeValue();
sender = xmlUtil.getNode("/POOR_HIP1009/sender/device/id/item/@extension").getNodeValue();
receiver = xmlUtil.getNode("/POOR_HIP1009/receiver/device/id/item/@extension").getNodeValue();
ReportDto reportDto = getReportDtoByInspectionUpdate(xmlUtil);
verifyReportDto(reportDto);
reportService.report(reportDto);
return updateSuccess(msgId, sender, receiver);
} catch (BaseException baseException) {
log.error(baseException.getMessage(), baseException);
return updateFailed(msgId, sender, receiver, baseException.getMessage());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return updateFailed(msgId, sender, receiver, "系统错误");
}
}
/**
*
*
* @param reportDto
* @throws BaseException
*/
private void verifyReportDto(ReportDto reportDto) throws BaseException {
if (Func.isBlank(reportDto.getInpatientNo())) {
throw new BaseException("住院号不能为空!");
}
if (Func.isEmpty(reportDto.getAdmisstimes()) && Func.isBlank(reportDto.getJzh())) {
throw new BaseException("当住院号与住院次数都为空时,住院流水号/记账号不能为空!");
}
if (Func.isBlank(reportDto.getFileTitle())) {
throw new BaseException("文件名不能为空!");
}
if (Func.isBlank(reportDto.getDownUrl())) {
throw new BaseException("文件下载路径不能为空!");
}
}
public ReportDto getReportDtoByInspectionInsert(XmlUtil inspectionInsertXmlUtil) {
Node inpatientNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.12']/@extension");
String inpatientNo = inpatientNoNode.getNodeValue();
Node admissTimesNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/item[@root='1.2.156.112635.1.2.1.7']/@extension");
Integer admissTimes = Integer.valueOf(admissTimesNode.getNodeValue());
// 检查报告单号标识
Node reportFlagNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.32']/@extension");
String reportFlag = reportFlagNode.getNodeValue();
//电子申请单编号
Node eafNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.24']/@extension");
String eafNo = eafNoNode.getNodeValue();
String serialnum = reportFlag + "@" + eafNo;
Node assortIdNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查类型']/observation/code/@displayName");
String assortId = assortIdNode.getNodeValue();
Node sysFlagNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查类型']/observation/code/@displayName");
String sysFlag = sysFlagNode.getNodeValue();
Node fileTitleNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查报告类型']/observation/code/@displayName");
String fileTitle = fileTitleNode.getNodeValue();
Node downUrlNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告图像']/report/entry[@displayName='检查报告图像URL地址']/observation/value");
String downUrl = downUrlNode.getTextContent();
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(admissTimes);
reportDto.setInpatientNo(inpatientNo);
reportDto.setSerialnum(serialnum);
reportDto.setFileTitle(fileTitle);
reportDto.setDownUrl(downUrl);
reportDto.setAssortId(assortId);
reportDto.setSysFlag(sysFlag);
reportDto.setFileSource("1");
reportDto.setFilestoragetype("1");
return reportDto;
}
public ReportDto getReportDtoByInspectionUpdate(XmlUtil inspectionUpdateXmlUtil) {
Node inpatientNoNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.12']/@extension");
String inpatientNo = inpatientNoNode.getNodeValue();
Node admissTimesNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/recordTarget/patientRole/item[@root='1.2.156.112635.1.2.1.7']/@extension");
Integer admissTimes = Integer.valueOf(admissTimesNode.getNodeValue());
// 检查报告单号标识
Node reportFlagNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.32']/@extension");
String reportFlag = reportFlagNode.getNodeValue();
//电子申请单编号
Node eafNoNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.24']/@extension");
String eafNo = eafNoNode.getNodeValue();
String serialnum = reportFlag + "@" + eafNo;
Node assortIdNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查类型']/observation/code/@displayName");
String assortId = assortIdNode.getNodeValue();
Node sysFlagNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查类型']/observation/code/@displayName");
String sysFlag = sysFlagNode.getNodeValue();
Node fileTitleNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查报告类型']/observation/code/@displayName");
String fileTitle = fileTitleNode.getNodeValue();
Node downUrlNode = inspectionUpdateXmlUtil.getNode("/POOR_HIP1009/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告图像']/report/entry[@displayName='检查报告图像URL地址']/observation/value");
String downUrl = downUrlNode.getTextContent();
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(admissTimes);
reportDto.setInpatientNo(inpatientNo);
reportDto.setSerialnum(serialnum);
reportDto.setFileTitle(fileTitle);
reportDto.setDownUrl(downUrl);
reportDto.setAssortId(assortId);
reportDto.setSysFlag(sysFlag);
reportDto.setFileSource("1");
reportDto.setFilestoragetype("1");
return reportDto;
}
/**
*
*
* @param msgId id
* @param sender
* @param receiver
* @return
*/
public String insertSuccess(String msgId, String sender, String receiver) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/MCCI_IN000002UV01.xsd\" xmlns=\"urn:hl7-org:v3\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\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<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<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"" + msgId + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail typeCode=\"I\">\n" +
"\t\t\t<text>\n" +
"\t\t\t\t<description value=\"成功!\"/>\n" +
"\t\t\t</text>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>\n";
}
/**
*
*
* @param msgId id
* @param sender
* @param receiver
* @return
*/
public String insertFailed(String msgId, String sender, String receiver, String failedMessage) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/MCCI_IN000002UV01.xsd\" xmlns=\"urn:hl7-org:v3\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\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<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<acknowledgement typeCode=\"AE\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"" + msgId + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail typeCode=\"I\">\n" +
"\t\t\t<text>\n" +
"\t\t\t\t<description value=\"" + failedMessage + "\"/>\n" +
"\t\t\t</text>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>\n";
}
/**
*
*
* @param msgId id
* @param sender
* @param receiver
* @return
*/
public String updateSuccess(String msgId, String sender, String receiver) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/MCCI_IN000002UV01.xsd\" xmlns=\"urn:hl7-org:v3\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\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<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<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"" + msgId + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail typeCode=\"I\">\n" +
"\t\t\t<text>\n" +
"\t\t\t\t<description value=\"成功!\"/>\n" +
"\t\t\t</text>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>\n";
}
/**
*
*
* @param msgId id
* @param sender
* @param receiver
* @param failedMessage
* @return
*/
public String updateFailed(String msgId, String sender, String receiver, String failedMessage) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/MCCI_IN000002UV01.xsd\" xmlns=\"urn:hl7-org:v3\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\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<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<acknowledgement typeCode=\"AE\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"" + msgId + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail typeCode=\"I\">\n" +
"\t\t\t<text>\n" +
"\t\t\t\t<description value=\"" + failedMessage + "\"/>\n" +
"\t\t\t</text>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>\n";
}
}

@ -30,7 +30,7 @@ spring:
redis:
host: redis.docus.cn
# password: JSdocus@702
password: JSdocus@702
cloud:
nacos:
discovery:
@ -45,9 +45,14 @@ spring:
docus:
url:
# 采集任务补偿地址
compensate-task-url: http://localhost:9295/api/NoViewCollect/compensateTask
# 下载地址
down-url: http://localhost:9291/api/downplatform/report
dbtype: mysql
report:
downurl: http://localhost:9291/api/downplatform/report
mybatis-plus:
configuration:
@ -64,7 +69,7 @@ xxl:
admin:
addresses: http://job.docus.cn:8180/xxl-job-admin
executor:
appname: docus-webservice-report
appname: docus-unified-message
address:
ip:
port: 19312

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.report.mapper.AfCollectTaskMapper">
<insert id="saveTask">
INSERT INTO `docus_archivefile`.`af_collect_task`(`id`, `patient_id`, `sysflag`,
`state`, `C1`,`C2`, `C3`)
VALUES (#{task.id}, #{task.patientId}, #{task.sysflag}, '0', #{task.C1}, #{task.C2}, #{task.C3});
</insert>
<select id="getTaskById" resultType="com.docus.server.report.entity.AfCollectTask">
select *
from `docus_archivefile`.`af_collect_task`
where `id` = #{id}
</select>
</mapper>

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.report.mapper.AfReportRecordMapper">
<insert id="saveRecord">
INSERT INTO `docus_archivefile`.`af_report_record`(`task_id`, `inpatient_no`, `jzh`, `admiss_times`, `down_url`,
`down_type`, `state`, `serialnum`, `sysflag`, `zd_assort_id`,
`create_time`, `update_time`, `file_name`, `patient_id`)
VALUES (#{reportRecord.taskId}, #{reportRecord.inpatientNo}, #{reportRecord.jzh}, #{reportRecord.admissTimes},
#{reportRecord.downUrl}, #{reportRecord.downType}, 0, #{reportRecord.serialnum},
#{reportRecord.sysflag}, #{reportRecord.zdAssortId}, now(), now(), #{reportRecord.fileName},
#{reportRecord.patientId});
</insert>
<update id="updateRecordByTaskId">
update `docus_archivefile`.`af_report_record`
set `down_url`=#{reportRecord.downUrl},
`down_type`=#{reportRecord.downType},
`state`=0,
`file_name`=#{reportRecord.fileName},
`patient_id`=#{reportRecord.patientId},
`update_time`=now()
where `task_id` = #{reportRecord.taskId}
</update>
<update id="updateStateByTaskId">
update `docus_archivefile`.`af_report_record`
set `state`= 1,
`update_time`=now()
where `task_id` = #{taskId}
</update>
<select id="getRecordBySerialnumAndInpatientNoAndSysFlag"
resultType="com.docus.server.report.entity.AfReportRecord">
select *
from `docus_archivefile`.`af_report_record`
where `inpatient_no` = #{inpatientNo}
and `serialnum` = #{serialnum}
and `sysflag` = #{sysFlag}
and admiss_times = #{admisstimes}
</select>
<select id="getReportRecordInfoByTaskId" resultType="com.docus.server.report.entity.AfReportRecord">
select *
from `docus_archivefile`.`af_report_record`
where `task_id` = #{taskId}
</select>
<select id="getHasPatientIdTaskIdsByTaskIds" resultType="java.lang.Long">
SELECT `task_id`
FROM `docus_archivefile`.`af_report_record`
WHERE `patient_id` IS NOT NULL
AND `patient_id` != ''
AND `task_id` IN
<foreach collection="taskIds" separator="," open="(" close=")" item="taskId">
#{taskId}
</foreach>
</select>
</mapper>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.report.mapper.TBasicMapper">
<select id="getPatientIdByInpatientNoAndAdminssTimes" resultType="java.lang.String">
select `patient_id`
from `docus_medicalrecord`.`t_basic`
where `inpatient_no` = #{inpatientNo}
and `admiss_times` = #{adminssTimes}
</select>
</mapper>
Loading…
Cancel
Save