master
zengwh 2 years ago
commit 532cfec2dd

4
.gitignore vendored

@ -0,0 +1,4 @@
/.idea/
/target/
/out/
*.iml

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ann</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- CXF webservice -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.5</version>
</dependency>
<!-- CXF webservice -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- 导入Mysql数据库链接jar包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.4</version>
</dependency>
<!--解析xpath-->
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1-beta-11</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--sqlserver驱动 -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 获取拼音首拼 -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<!--引入quartz定时框架-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<finalName>LISInterface</finalName>
</build>
</project>

@ -0,0 +1,13 @@
package com.ann.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

@ -0,0 +1,13 @@
package com.ann.demo;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoApplication.class);
}
}

@ -0,0 +1,46 @@
package com.ann.demo.controller;
import lombok.Data;
/**
* @Author: LeiJiaXin
* @Date: 2019/8/1 9:57
*/
public class InterfaceForm {
private String url;
private String content;
private String parameter;
private String interfaceName;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getParameter() {
return parameter;
}
public void setParameter(String parameter) {
this.parameter = parameter;
}
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
}

@ -0,0 +1,64 @@
package com.ann.demo.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ann.demo.entity.constant.AliasName;
import com.ann.demo.entity.constant.InterfaceName;
import com.ann.demo.entity.filing.MessageSubordinate;
import com.ann.demo.entity.filing.dto.MessageDto;
import com.ann.demo.entity.filing.dto.PatientMainDto;
import com.ann.demo.service.AnalysisService;
import com.ann.demo.utils.XMLUtils;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
import java.util.Objects;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/11 18:47
*/
@Controller
@RequestMapping("/")
public class TestController {
@Autowired
AnalysisService analysisService;
@RequestMapping("/demo")
public String aa() {
return "demo";
}
/*@ResponseBody*/
@RequestMapping("/haha")
public String cc(InterfaceForm interfaceForm) {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(interfaceForm.getUrl());
Object[] objects = new Object[0];
try {
// invoke("方法名",参数1,参数2,参数3....);
if (Objects.equals(interfaceForm.getInterfaceName(), "ReceiveDict") ||
Objects.equals(interfaceForm.getInterfaceName(), "InpSummary") ||
Objects.equals(interfaceForm.getInterfaceName(), "handNumbnessReport") ||
Objects.equals(interfaceForm.getInterfaceName(), InterfaceName.ICU_REPORT) ||
Objects.equals(interfaceForm.getInterfaceName(), InterfaceName.BLOODAPPLY_REPORT) ||
Objects.equals(interfaceForm.getInterfaceName(), InterfaceName.DOCTOR_DATA) ||
Objects.equals(interfaceForm.getInterfaceName(), InterfaceName.NURSE_DATA)) {
objects = client.invoke(interfaceForm.getInterfaceName(), interfaceForm.getContent());
} else {
objects = client.invoke(interfaceForm.getInterfaceName(), interfaceForm.getParameter(), interfaceForm.getContent());
}
System.out.println(objects[0]);
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:/demo";
}
}

@ -0,0 +1,18 @@
package com.ann.demo.controller;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/**
* @Author: LeiJiaXin
* @Date: 2019/8/1 9:30
*/
@Configuration
public class UsingStaticController extends WebMvcConfigurationSupport {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
}

@ -0,0 +1,112 @@
package com.ann.demo.entity.constant;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
* @Date 2019/6/12
* @Created by ljx
*/
public class AliasName {
// public static final String USER = "用户字典";
//
// public static final String DEPARTMENT = "科室字典";
//
// // 超声报告
// public static final String ULTRASONIC_REPORT = "57";
//
// // 病理检查报告单
// public static final String PATHOLOGY_REPORT = "52";
//
// // 放射诊断报告单 54
// public static final String RADIATION_REPORT = "54";
//
// // 心电图报告单 59
// public static final String EKG_REPORT = "59";
//
// // 入院记录
// public static final String ADMISSION_RECORD = "9";
//
// // 出院记录
// public static final String DISCHARGE_RECORD = "113";
//
// // 转科记录
// public static final String TRANSFER_RECORD = "114";
//
// // 取消入院
// public static final String CANCELLATION_DISCHARGE = "115";
//
// // 手麻
// public static final String HANDNUMBNESS_REPORT = "117";
//
// // ICU报告
// public static final String ICU_REPORT = "121";
//
// // 其他类型 目前来说 是手麻系统的其他三个
// public static final String OTHER = "18";
//
// // 检查申请单
// public static final String PARAMETER_EXAMAPPLY = "119";
//
// // 输血单
// public static final String BLOODAPPLY_REPORT = "120";
//
// // PET/CT报告单
// public static final String PETCT_REPORT = "60";
// 检验申请单
public static final String PARAMETER_INSPECTIONAPPLY = "118";
// 检验申请单
public static final String PARAMETER_VERIFICATIONINSPECTIONAPPLY = "130";
// 检验报告
public static final String INSPECTION_REPORT = "10";
//
// // 扫描文件
// public static final String SCANNING_FILE = "30";
//
// // 护理、医生
// public static final Map<String, String> DOCTOR_MAP;
// public static final Map<String, String> NURSE_MAP;
//
// // 病案首页
// public static final String MEDICAL_RECORD_HOMEPAGE = "3";
//
//
// static {
// DOCTOR_MAP = new HashMap<String, String>();
// DOCTOR_MAP.put("入院记录", "9");
// DOCTOR_MAP.put("病程记录", "11");
// DOCTOR_MAP.put("术前文书", "12");
// DOCTOR_MAP.put("手术资料", "13");
// DOCTOR_MAP.put("讨论记录", "14");
// DOCTOR_MAP.put("会诊记录", "15");
// DOCTOR_MAP.put("出院记录", "113");
// DOCTOR_MAP.put("死亡记录", "17");
// DOCTOR_MAP.put("VTE文书", "23");
// DOCTOR_MAP.put("其他记录", "18");
// DOCTOR_MAP.put("医护共用", "19");
// DOCTOR_MAP.put("知情同意", "20");
// DOCTOR_MAP.put("疾病危重", "21");
// DOCTOR_MAP.put("VTE记录", "22");
// DOCTOR_MAP.put("病案首页", "3");
// DOCTOR_MAP.put("病历文书", "");
//
// NURSE_MAP = new HashMap<String, String>();
// NURSE_MAP.put("首次护理记录", "7");
// NURSE_MAP.put("护理文书", "6");
// NURSE_MAP.put("专科单护理", "24");
// NURSE_MAP.put("知情文件", "8");
// NURSE_MAP.put("体温单", "5");
// NURSE_MAP.put("护理记录", "2");
// NURSE_MAP.put("评估单", "4");
// NURSE_MAP.put("病历护理文书", "");
// }
}

@ -0,0 +1,125 @@
package com.ann.demo.entity.constant;
/**
* @Description
* @Date 2019/7/10 9:46
* @Created by ljx
*/
public class InterfaceName {
/**
* ReceiveDict
*/
public static final String RECEIVE_DICT = "his系统";
/**
* V3
*/
public static final String HIP_MESSAGE_SERVER = "HIPMessageServer";
/**
*
*/
public static final String PARAMETER_REPORT = "ExamReportBackRequest";
/**
*
*/
public static final String ULTRASOUND_REPORT = "超声系统";
/**
*
*/
public static final String EKG_REPORT = "心电图系统";
/**
*
*/
public static final String PATHOLOGY_REPORT = "病理系统";
/**
*
*/
public static final String RADIATION_REPORT = "PACS系统";
/**
* petct
*/
public static final String PET_REPORT = "核医学系统";
/**
*
*/
public static final String PARAMETER_ADMISSION = "InPatientAddRequest";
/**
*
*/
public static final String PARAMETER_DISCHARGE = "PatientOutRequest";
/**
*
*/
public static final String PARAMETER_TRANSFER = "InpatientTransferRequest";
/**
*
*/
public static final String PARAMETER_CANCELLATION_DISCHARGE = "CalPatientRequest";
/**
*
*/
public static final String PARAMETER_EXAMAPPLY = "ExamApplyRequest";
/**
*
*/
public static final String INP_SUMMARY = "InpSummary";
/**
*
*/
public static final String HANDNUMBNESS_REPORT = "手麻系统";
/**
* ICU
*/
public static final String ICU_REPORT = "重症监护归档";
/**
*
*/
public static final String BLOODAPPLY_REPORT = "输血系统";
/**
*
*/
public static final String DOCTOR_DATA = "DoctorData";
/**
* 2
*/
public static final String NURSE_DATA = "NurseData";
/**
* lis
*/
public static final String INSPECTION_REPORT = "LIS系统";
public static final String INSPECTION_REPORT_NAME = "LisSendReportBack";
/**
*
* ScanningFile
*/
public static final String SCANNING_FILE = "扫描系统";
/**
* 2019-12-23
*
*/
public static final String PARAMETER_INSPECTIONAPPLY = "InspectionApplyRequest";
/**
* 2020-2-28
*
*/
public static final String PARAMETER_VERIFICATIONINSPECTIONAPPLY = "VerificationInspectionApplyRequest";
}

@ -0,0 +1,121 @@
package com.ann.demo.entity.constant;
import lombok.Data;
@Data
public class WebserviceId {
/**
* V3
*/
public static final String HIP_MESSAGE_SERVER = "HIPMessageServer";
/**
*
*/
public static final String PARAMETER_REPORT = "1";
/**
*
*/
public static final String PARAMETER_EXAMAPPLY = "2";
/**
* 2019-10-21
*
*/
public static final String PARAMETER_EXAMAPPLYSTATECHANGE = "3";
/**
* 2020-3-3
*
*/
public static final String PARAMETER_VERIFICATIONEXAMAPPLY = "4";
/**
*
*/
public static final String PARAMETER_ADMISSION = "5";
/**
*
*/
public static final String PARAMETER_DISCHARGE = "6";
/**
*
*/
public static final String PARAMETER_TRANSFER = "7";
/**
*
*/
public static final String PARAMETER_CANCELLATION_DISCHARGE = "8";
/**
*
*/
public static final String PARAMETER_PATIENT_UPDATE = "9";
/**
* lis
*/
public static final String INSPECTION_REPORT_NAME = "10";
/**
* 2019-12-23
*
*/
public static final String PARAMETER_INSPECTIONAPPLY = "11";
/**
* 2020-2-28
*
*/
public static final String PARAMETER_VERIFICATIONINSPECTIONAPPLY = "12";
/**
*
*/
public static final String DOCTOR_DATA = "13";
/**
* 2
*/
public static final String NURSE_DATA = "14";
/**
*
*/
public static final String INP_SUMMARY = "15";
/**
*
*/
public static final String HANDNUMBNESS_REPORT = "16";
/**
* ICU
*/
public static final String ICU_REPORT = "17";
/**
*
*/
public static final String BLOODAPPLY_REPORT = "18";
/**
* ReceiveDict
*/
public static final String RECEIVE_DICT = "19";
/**
* 20200609
*/
public static final String BED_MANAGER = "20";
/**
* 20200609
*/
public static final String DIE_MEDICAL_ADVICE = "21";
}

@ -0,0 +1,184 @@
package com.ann.demo.entity.filing;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
/**
* @Description ArchiveMaster
* @Date 2019/7/9 10:07
* @Created by ljx
*/
@Entity
@Table
public class ArchiveDetail {
@Id
private String id;
private String pdfPath;
// -----------------------绑定关系
@Column(name = "masterid")
private String masterID;
@Column(name = "uploaddatetime")
private Date upLoadDateTime;
@Column(name = "assortid")
private String assortID;
private String source;
@Column(name = "subassort")
private String subAssort;
private String title;
private String flag = "0";
private String sys;
private Integer pageNumber = 1;
/**
*
* 2019-9-4
*/
private String applyId;
// 2020-12-28 新增报告单号
private String checkReportId;
//2021-11-11新增报告单号不敢与原有checkReportId雷同
@Column(name = "filecontext")
private String fileContext;
public ArchiveDetail() {
}
// 普通下载
public ArchiveDetail(String id,String masterID, Date upLoadDateTime, String assortID, String source, String applyId, String title,String fileContext) {
this.id = id;
this.masterID = masterID;
this.upLoadDateTime = upLoadDateTime;
this.assortID = assortID;
this.source = source;
this.applyId = applyId;
this.title = title;
this.fileContext = fileContext;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPdfPath() {
return pdfPath;
}
public void setPdfPath(String pdfPath) {
this.pdfPath = pdfPath;
}
public String getMasterID() {
return masterID;
}
public void setMasterID(String masterID) {
this.masterID = masterID;
}
public Date getUpLoadDateTime() {
return upLoadDateTime;
}
public void setUpLoadDateTime(Date upLoadDateTime) {
this.upLoadDateTime = upLoadDateTime;
}
public String getAssortID() {
return assortID;
}
public void setAssortID(String assortID) {
this.assortID = assortID;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getSubAssort() {
return subAssort;
}
public void setSubAssort(String subAssort) {
this.subAssort = subAssort;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getSys() {
return sys;
}
public void setSys(String sys) {
this.sys = sys;
}
public Integer getPageNumber() {
return pageNumber;
}
public void setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
}
public String getApplyId() {
return applyId;
}
public void setApplyId(String applyId) {
this.applyId = applyId;
}
public String getCheckReportId() {
return checkReportId;
}
public void setCheckReportId(String checkReportId) {
this.checkReportId = checkReportId;
}
public String getFileContext() {
return fileContext;
}
public void setFileContext(String fileContext) {
this.fileContext = fileContext;
}
}

@ -0,0 +1,118 @@
package com.ann.demo.entity.filing;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
/**
* @Description
* @Date 2019/7/9 16:33
* @Created by ljx
*/
@Table
@Entity
public class MessageSubordinate {
/**
* Id
*/
@Id
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@GeneratedValue(generator = "system-uuid")
private String id;
/**
* Id
*/
private String messageId;
/**
*
*/
private String patientMain;
/**
* Json
*/
@Lob
private String contentJson;
/**
* 2019-8-16
*
*/
private Integer runs = 0;
/**
* 0 1 2
*/
private Integer status = 0;
private String remark;
public MessageSubordinate(String messageId, String patientMain, String contentJson) {
this.messageId = messageId;
this.patientMain = patientMain;
this.contentJson = contentJson;
}
public MessageSubordinate() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public String getPatientMain() {
return patientMain;
}
public void setPatientMain(String patientMain) {
this.patientMain = patientMain;
}
public String getContentJson() {
return contentJson;
}
public void setContentJson(String contentJson) {
this.contentJson = contentJson;
}
public Integer getRuns() {
return runs;
}
public void setRuns(Integer runs) {
this.runs = runs;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -0,0 +1,197 @@
package com.ann.demo.entity.filing.dto;
import lombok.Data;
import java.util.Date;
/**
* @Description
* @Date 2019/7/9 16:50
* @Created by ljx
*/
public class MessageDto<T> {
private String entity;
private T object;
private Date xmlCreateTime;
private String type;
private String inpNo;
private String visitId;
private String propertiesPath;
private String reportAddress;
// 2019-7-26 新增报告单号 考虑会传多次报告 但地址一样
private String checkReportId;
/**
*
*/
private String addFlag;
/**
*
* 2019-9-4
*/
private String applyId;
// 2019-9-16 新增来源
private String source;
// 2019-9-20 电子病历 新增子类 比如病历文书>知情同意
private String subType;
// 2020-4-20 报告标题
private String detailType;
// 2021-5-26 新增检验外送报告标识 ,如果是检验外送 默认传广州金域
private String deliveryFlag;
// 2023-09-04 新增检验外送的报告条码
private String barCode;
public MessageDto() {
}
public MessageDto(String entity, T object, String type, String propertiesPath, String source) {
this.entity = entity;
this.object = object;
this.type = type;
this.propertiesPath = propertiesPath;
this.source = source;
}
public void setEntity(String entity) {
this.entity = entity;
}
public void setObject(T object) {
this.object = object;
}
public void setXmlCreateTime(Date xmlCreateTime) {
this.xmlCreateTime = xmlCreateTime;
}
public void setType(String type) {
this.type = type;
}
public void setInpNo(String inpNo) {
this.inpNo = inpNo;
}
public void setVisitId(String visitId) {
this.visitId = visitId;
}
public void setPropertiesPath(String propertiesPath) {
this.propertiesPath = propertiesPath;
}
public void setReportAddress(String reportAddress) {
this.reportAddress = reportAddress;
}
public void setCheckReportId(String checkReportId) {
this.checkReportId = checkReportId;
}
public void setAddFlag(String addFlag) {
this.addFlag = addFlag;
}
public void setApplyId(String applyId) {
this.applyId = applyId;
}
public void setSource(String source) {
this.source = source;
}
public void setSubType(String subType) {
this.subType = subType;
}
public void setDetailType(String detailType) {
this.detailType = detailType;
}
public void setDeliveryFlag(String deliveryFlag) {
this.deliveryFlag = deliveryFlag;
}
public String getEntity() {
return entity;
}
public T getObject() {
return object;
}
public Date getXmlCreateTime() {
return xmlCreateTime;
}
public String getType() {
return type;
}
public String getInpNo() {
return inpNo;
}
public String getVisitId() {
return visitId;
}
public String getPropertiesPath() {
return propertiesPath;
}
public String getReportAddress() {
return reportAddress;
}
public String getCheckReportId() {
return checkReportId;
}
public String getAddFlag() {
return addFlag;
}
public String getApplyId() {
return applyId;
}
public String getSource() {
return source;
}
public String getSubType() {
return subType;
}
public String getDetailType() {
return detailType;
}
public String getDeliveryFlag() {
return deliveryFlag;
}
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode;
}
}

@ -0,0 +1,81 @@
package com.ann.demo.entity.filing.dto;
import lombok.Data;
/**
* @Description
* @Date 2019/7/9 16:36
* @Created by ljx
*/
public class PatientMainDto {
/**
*
*/
private String inpNo;
/**
*
*/
private String visitId;
/**
* 1
*/
private String extendedField1;
/**
* 2
*/
private String extendedField2;
/**
* 3
*/
private String extendedField3;
public PatientMainDto(String inpNo, String visitId) {
this.inpNo = inpNo;
this.visitId = visitId;
}
public String getInpNo() {
return inpNo;
}
public void setInpNo(String inpNo) {
this.inpNo = inpNo;
}
public String getVisitId() {
return visitId;
}
public void setVisitId(String visitId) {
this.visitId = visitId;
}
public String getExtendedField1() {
return extendedField1;
}
public void setExtendedField1(String extendedField1) {
this.extendedField1 = extendedField1;
}
public String getExtendedField2() {
return extendedField2;
}
public void setExtendedField2(String extendedField2) {
this.extendedField2 = extendedField2;
}
public String getExtendedField3() {
return extendedField3;
}
public void setExtendedField3(String extendedField3) {
this.extendedField3 = extendedField3;
}
}

@ -0,0 +1,154 @@
package com.ann.demo.entity.interfaceEntity;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
*
*
* @Author: LeiJiaXin
* @Date: 2019/8/22 15:42
*/
@Table
@Entity
public class ExamApply {
@Id
private String applyId;
private Date xmlCreateTime;
private String inpNo;
private String visitId;
private String patientId;
private Date authorReportTime;
private String result;
private Integer isValid = 0;
/**
*
*/
private String reportType;
/**
* 2019-10-21 HIS E F
*/
private String isOpenHis = "E";
/**
* 2019-10-21 LIS E F his
*/
private String isOpenOther = "E";
/**
*
* */
private String name;
public String getApplyId() {
return applyId;
}
public void setApplyId(String applyId) {
this.applyId = applyId;
}
public Date getXmlCreateTime() {
return xmlCreateTime;
}
public void setXmlCreateTime(Date xmlCreateTime) {
this.xmlCreateTime = xmlCreateTime;
}
public String getInpNo() {
return inpNo;
}
public void setInpNo(String inpNo) {
this.inpNo = inpNo;
}
public String getVisitId() {
return visitId;
}
public void setVisitId(String visitId) {
this.visitId = visitId;
}
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId;
}
public Date getAuthorReportTime() {
return authorReportTime;
}
public void setAuthorReportTime(Date authorReportTime) {
this.authorReportTime = authorReportTime;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public String getIsOpenHis() {
return isOpenHis;
}
public void setIsOpenHis(String isOpenHis) {
this.isOpenHis = isOpenHis;
}
public String getIsOpenOther() {
return isOpenOther;
}
public void setIsOpenOther(String isOpenOther) {
this.isOpenOther = isOpenOther;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,242 @@
package com.ann.demo.entity.interfaceEntity;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
/**
* @Description
* @Date 2019/6/17 10:27
* @Created by ljx
*/
@Table
@Entity
public class MessageLog {
@Id
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@GeneratedValue(generator = "system-uuid")
private String id;
@Lob
/**
*
* */
private String inputContent;
/**
*
*/
@Lob
private String outContent;
/**
*
*/
private String type;
/**
*
*/
private String remark;
/**
* 0 1
*/
private Integer result;
/**
* json
*/
@Lob
private String outJson;
/**
*
*/
private String interfaceName;
/**
* xml
*/
private Date xmlCreateTime;
/**
*
*/
private Long executionTime;
/**
*
*/
private Date endTime;
/**
*
*/
private Date createTime;
/**
* xml
*/
private Long xmlExecutionTime;
/*
* 2020-3-20 masterId
* */
private String masterId;
/*
* 2020-3-20 webserviceInfo
* */
private String webserviceInfo;
// ---------------------------时间怎么变成了毫秒数
public MessageLog(String inputContent, String interfaceName, Date createTime,String webserviceInfo) {
this.inputContent = inputContent;
this.interfaceName = interfaceName;
this.createTime = createTime;
this.webserviceInfo = webserviceInfo;
}
public MessageLog() {
}
public void setValue(String masterId,String outContent, Integer result, String outJson, Date xmlCreateTime, Long executionTime, Date endTime, String type,String remark) {
this.masterId = masterId;
this.outContent = outContent;
this.result = result;
this.outJson = outJson;
this.xmlCreateTime = xmlCreateTime;
this.executionTime = executionTime;
this.endTime = endTime;
this.type = type;
this.remark = remark;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getInputContent() {
return inputContent;
}
public void setInputContent(String inputContent) {
this.inputContent = inputContent;
}
public String getOutContent() {
return outContent;
}
public void setOutContent(String outContent) {
this.outContent = outContent;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
public String getOutJson() {
return outJson;
}
public void setOutJson(String outJson) {
this.outJson = outJson;
}
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public Date getXmlCreateTime() {
return xmlCreateTime;
}
public void setXmlCreateTime(Date xmlCreateTime) {
this.xmlCreateTime = xmlCreateTime;
}
public Long getExecutionTime() {
return executionTime;
}
public void setExecutionTime(Long executionTime) {
this.executionTime = executionTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getXmlExecutionTime() {
return xmlExecutionTime;
}
public void setXmlExecutionTime(Long xmlExecutionTime) {
this.xmlExecutionTime = xmlExecutionTime;
}
public String getMasterId() {
return masterId;
}
public void setMasterId(String masterId) {
this.masterId = masterId;
}
public String getWebserviceInfo() {
return webserviceInfo;
}
public void setWebserviceInfo(String webserviceInfo) {
this.webserviceInfo = webserviceInfo;
}
}

@ -0,0 +1,192 @@
package com.ann.demo.entity.interfaceEntity;
import lombok.Data;
/**
* @Description
* @Date 2019/6/24 21:58
* @Created by ljx
*/
public class UltrasonicReport {
/*
*
* */
private String id;
/*
*
* */
private String inpNo;
/*
*
* */
private String checkReportId;
/**
*
*/
private String applyId;
/**
*
*/
private String visitId;
/**
*
*/
private String name;
/*检查报告医师(文档创作者)*/
/**
*
*/
private String authorReportTime;
/**
*
*/
private String assignedAuthorId;
/**
*
*/
private String assignedPersonName;
/* 审核医师签名 */
/**
* Id
*/
private String examineId;
/**
*
*/
private String examineAssignedPersonName;
/**
*
*/
private String reportAddress;
@Override
public String toString() {
return "UltrasonicReport{" +
"id='" + id + '\'' +
", inpNo='" + inpNo + '\'' +
", checkReportId='" + checkReportId + '\'' +
", applyId='" + applyId + '\'' +
", visitId='" + visitId + '\'' +
", name='" + name + '\'' +
", authorReportTime='" + authorReportTime + '\'' +
", assignedAuthorId='" + assignedAuthorId + '\'' +
", assignedPersonName='" + assignedPersonName + '\'' +
", examineId='" + examineId + '\'' +
", examineAssignedPersonName='" + examineAssignedPersonName + '\'' +
'}';
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getInpNo() {
return inpNo;
}
public void setInpNo(String inpNo) {
this.inpNo = inpNo;
}
public String getCheckReportId() {
return checkReportId;
}
public void setCheckReportId(String checkReportId) {
this.checkReportId = checkReportId;
}
public String getApplyId() {
return applyId;
}
public void setApplyId(String applyId) {
this.applyId = applyId;
}
public String getVisitId() {
return visitId;
}
public void setVisitId(String visitId) {
this.visitId = visitId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthorReportTime() {
return authorReportTime;
}
public void setAuthorReportTime(String authorReportTime) {
this.authorReportTime = authorReportTime;
}
public String getAssignedAuthorId() {
return assignedAuthorId;
}
public void setAssignedAuthorId(String assignedAuthorId) {
this.assignedAuthorId = assignedAuthorId;
}
public String getAssignedPersonName() {
return assignedPersonName;
}
public void setAssignedPersonName(String assignedPersonName) {
this.assignedPersonName = assignedPersonName;
}
public String getExamineId() {
return examineId;
}
public void setExamineId(String examineId) {
this.examineId = examineId;
}
public String getExamineAssignedPersonName() {
return examineAssignedPersonName;
}
public void setExamineAssignedPersonName(String examineAssignedPersonName) {
this.examineAssignedPersonName = examineAssignedPersonName;
}
public String getReportAddress() {
return reportAddress;
}
public void setReportAddress(String reportAddress) {
this.reportAddress = reportAddress;
}
}

@ -0,0 +1,46 @@
package com.ann.demo.entity.interfaceEntity;
import lombok.Data;
public class WebServiceInfo {
private String interfaceName;
private String[] param;
private String url;
public WebServiceInfo() {
}
public WebServiceInfo(String interfaceName, String[] param, String url) {
this.interfaceName = interfaceName;
this.param = param;
this.url = url;
}
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public String[] getParam() {
return param;
}
public void setParam(String[] param) {
this.param = param;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

@ -0,0 +1,13 @@
package com.ann.demo.interfaces;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface HomepageDictionary {
@WebMethod
String HIPMessageServer(@WebParam(name = "action") String action, @WebParam(name = "message") String message);
}

@ -0,0 +1,59 @@
package com.ann.demo.interfaces.config;
import com.ann.demo.interfaces.HomepageDictionary;
import com.ann.demo.interfaces.impl.HomepageDictionaryImpl;
import com.ann.demo.service.WebServiceDemo;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
/**
* @Author: LeiJiaXin
* @Date: 2019/6/11 17:13
*/
@Slf4j
@Configuration
public class WebServiceConfig {
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
@Autowired
private WebServiceDemo webServiceDemo;
@Autowired
private Bus bus;
@Value("${server.port}")
private String port;
private static final String path = "/api";
//把实现类交给spring管理
@Bean
public HomepageDictionary homepageDictionary() {
return new HomepageDictionaryImpl();
}
@Bean
public Endpoint endpoint() {
System.out.println("-----------------------LIS已发布-------------------------");
EndpointImpl endpoint = new EndpointImpl(springBus(), homepageDictionary());
endpoint.publish("HomepageDictionary");
return endpoint;
}
@Bean
public Endpoint userServiceEndpoint() {
EndpointImpl userEndpoint = new EndpointImpl(bus, webServiceDemo);
userEndpoint.publish(path);
System.out.println("在线的wsdl:http://localhost:"+port+"/services"+path+"?wsdl");
log.info("在线的wsdl:http://localhost:"+port+"/services{}?wsdl",path);
return userEndpoint;
}
}

@ -0,0 +1,58 @@
package com.ann.demo.interfaces.impl;
import com.ann.demo.entity.constant.InterfaceName;
import com.ann.demo.entity.constant.WebserviceId;
import com.ann.demo.entity.interfaceEntity.*;
import com.ann.demo.interfaces.HomepageDictionary;
import com.ann.demo.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.jws.WebService;
/**
* @Author: LeiJiaXin
* @Date: 2019/6/11 17:01
*/
@WebService(serviceName = "HomepageDictionary", // 与接口中指定的name一致
targetNamespace = "http://interfaces.demo.ann.com/", // 与接口中的命名空间一致,一般是接口的包名倒
endpointInterface = "com.ann.demo.interfaces.HomepageDictionary"// 接口地址
)
public class HomepageDictionaryImpl implements HomepageDictionary {
private static final Logger logger = LoggerFactory.getLogger(HomepageDictionaryImpl.class);
@Autowired
private AnalysisService analysisService;
@Override
public String HIPMessageServer(String action, String message) {
String result = "";
try{
if (action != null && message != null && !(message.equals("") && action.equals(""))) {
switch (action) {
case InterfaceName.INSPECTION_REPORT_NAME:
// 检验报告
result = analysisService.getHIPMessageServerResult(message, UltrasonicReport.class, InterfaceName.INSPECTION_REPORT, WebserviceId.INSPECTION_REPORT_NAME);
break;
case InterfaceName.PARAMETER_INSPECTIONAPPLY:
// 检验申请单
result = analysisService.getHIPMessageServerResult(message, ExamApply.class, InterfaceName.PARAMETER_INSPECTIONAPPLY, WebserviceId.PARAMETER_INSPECTIONAPPLY);
break;
case InterfaceName.PARAMETER_VERIFICATIONINSPECTIONAPPLY:
// 检体核收
result = analysisService.getHIPMessageServerResult(message, ExamApply.class, InterfaceName.PARAMETER_VERIFICATIONINSPECTIONAPPLY, WebserviceId.PARAMETER_VERIFICATIONINSPECTIONAPPLY);
break;
}
}
}catch (Exception e){
logger.error("当前参数:{},报错信息:{}",action,e.getMessage());
return result;
}
return result;
}
}

@ -0,0 +1,30 @@
package com.ann.demo.repository;
import com.ann.demo.entity.filing.ArchiveDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/12 9:10
*/
@Repository
public interface ArchiveDetailRepository extends JpaRepository<ArchiveDetail, String> {
// // or Source = 'DoctorData' or AssortID = '117' or AssortID = '10' or AssortID = '60' or AssortID = '57' or AssortID = '52' or AssortID = '54' or AssortID = '59'
// @Query("select o from ArchiveDetail o ")
// public List<ArchiveDetail> findAllHaha();
@Query("select count (o) from ArchiveDetail o where o.masterID = ?1 and o.assortID = ?2 and o.source=?3 and (o.applyId = ?4 and o.applyId is not null) and o.flag = 0 and FileContext = ?5")
Integer countByMasterIDAndAssortIDAndSourceAndApplyId(String masterId, String AssortID, String source, String applyId,String FileContext);
@Query("select count (o) from ArchiveDetail o where o.masterID = ?1 and o.assortID = ?2 and o.source=?3 and (o.checkReportId = ?4 and o.checkReportId is not null) and o.flag = 0")
Integer countByMasterIDAndAssortIDAndSourceAndCheckReportId(String masterId, String AssortID, String source, String CheckReportId);
public ArchiveDetail findByMasterIDAndAssortIDAndSourceAndApplyIdAndFlagAndFileContext(String masterId, String AssortID, String source, String applyId, String flag,String FileContext);
public ArchiveDetail findByMasterIDAndAssortIDAndSourceAndCheckReportIdAndFlag(String masterId, String AssortID, String source, String checkReportId, String flag);
}

@ -0,0 +1,27 @@
package com.ann.demo.repository;
import com.ann.demo.entity.interfaceEntity.ExamApply;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author: LeiJiaXin
* @Date: 2019/8/22 16:22
*/
@Repository
public interface ExamApplyRepository extends JpaRepository<ExamApply, String> {
@Transactional
@Modifying(clearAutomatically = true)
@Query(value = "update Exam_Apply set is_Valid = 1 where apply_Id = ?1 and is_Valid = 0 ",nativeQuery = true)
public int updateExamApplyIsValidById(String applyId);
@Query("select count(o) from ExamApply o where o.applyId = ?1 and o.isValid = 0")
public Integer countExamApply(String applyId);
public ExamApply findByApplyIdAndIsValidAndIsOpenHisAndIsOpenOther(String applyId,Integer flag,String isOpenHis,String isOpenOther);
}

@ -0,0 +1,27 @@
package com.ann.demo.repository;
import com.ann.demo.entity.interfaceEntity.MessageLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Description
* @Date 2019/6/17 11:34
* @Created by ljx
*/
@Repository
public interface MessageRepository extends JpaRepository<MessageLog, Integer> {
public Integer countByInputContentAndInterfaceName(String inputContent, String interfaceName);
// 2019-12-26 15:58:36.107 2019-12-11 10:29:36.107
@Query("select o from MessageLog o where o.createTime > '2019-12-11 10:29:36.107' and o.endTime is null ")
public List<MessageLog> findAllHaha();
@Query(nativeQuery = true,value = " select id from archive_master where (inp_No = ?1 ) and (visit_id = ?2 ) and archiveState <> '作废' and is_valid = 0")
public String getArchiveMasterId(String inpNo,String visitId);
}

@ -0,0 +1,16 @@
package com.ann.demo.repository;
import com.ann.demo.entity.filing.MessageSubordinate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Date 2019/7/9 16:44
* @Created by ljx
*/
@Repository
public interface MessageSubordinateRepository extends JpaRepository<MessageSubordinate, String> {
public Integer countByPatientMainAndContentJson(String patientMain, String contentJson);
}

@ -0,0 +1,196 @@
package com.ann.demo.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ann.demo.entity.constant.AliasName;
import com.ann.demo.entity.constant.InterfaceName;
import com.ann.demo.entity.filing.MessageSubordinate;
import com.ann.demo.entity.filing.dto.MessageDto;
import com.ann.demo.entity.filing.dto.PatientMainDto;
import com.ann.demo.entity.filing.ArchiveDetail;
import com.ann.demo.entity.interfaceEntity.ExamApply;
import com.ann.demo.entity.interfaceEntity.MessageLog;
import com.ann.demo.utils.FileUtils;
import com.ann.demo.utils.PdfUtils;
import com.ann.demo.utils.XMLUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.io.File;
import java.util.Date;
import java.util.Objects;
import java.util.UUID;
/**
*
*
* @Author: LeiJiaXin
* @Date: 2019/8/20 16:29
*/
@Component
public class AnalysisService {
static final Logger logger = LoggerFactory.getLogger(AnalysisService.class);
@Autowired
MessageService messageService;
@Autowired
MessageSubordinateService messageSubordinateService;
@Autowired
ExamApplyService examApplyService;
@Autowired
ArchiveDetailService archiveDetailService;
/**
* 2019-7-8
* @Param xmlStr
* @Param tClass
* @Param parameter
* xml
*/
public String getHIPMessageServerResult(String message, Class tClass, String parameter,String webserviceId) throws Exception{
String outContent = "失败", typeCodeValue = "AE";
ArchiveDetail archiveDetail = null;
try {
long startTime = System.currentTimeMillis();
long endTime = 0;
String textContent = "成功啦~", type = "", patientMainStr = "", textContentTemp = null, archiveMasterId = null;
Date xmlCreateTime = null;
Integer result = 2;
MessageLog messageLog = new MessageLog(message, InterfaceName.HIP_MESSAGE_SERVER, new Date(), webserviceId);
messageService.save(messageLog);
MessageDto messageDto = XMLUtils.xpathToBean(message, tClass, parameter);
if (messageDto != null) {
archiveMasterId = messageService.getArchiveMasterId(messageDto.getInpNo(), messageDto.getVisitId());
if (archiveMasterId != null) {
if (Objects.equals(messageDto.getEntity(), ExamApply.class.getName())) { // 申请单
ExamApply examApply = JSON.parseObject(messageDto.getObject().toString(), ExamApply.class);
textContentTemp = changeApply(examApply, parameter);
}
//检验外送报告 单独处理
if((!ObjectUtils.isEmpty(messageDto.getDeliveryFlag()) )&&
Objects.equals(messageDto.getDeliveryFlag(),"广州金域")){
// 直接下载并生成文件到detail
//System.out.println(messageDto.getReportAddress());
UUID uuid = UUID.randomUUID();
File pdfFile = FileUtils.createFile("pdfs", messageDto.getInpNo(), messageDto.getVisitId(), uuid.toString(), null);
if(PdfUtils.base64StringToPDF(messageDto.getReportAddress(),pdfFile)){
// 查询库中是否存在 如果存在就更新
archiveDetail = archiveDetailService.isExit(archiveMasterId, messageDto.getType(), messageDto.getSource(), messageDto.getApplyId(),messageDto.getCheckReportId());
if (archiveDetail == null) {
archiveDetail = new ArchiveDetail(uuid.toString(),archiveMasterId, new Date(), messageDto.getType(), messageDto.getSource(), messageDto.getApplyId(),
messageDto.getDetailType(),messageDto.getCheckReportId());
archiveDetail.setPdfPath(pdfFile.getAbsolutePath());
archiveDetailService.save(archiveDetail);
}else{
archiveDetail.setPdfPath(pdfFile.getAbsolutePath());
archiveDetailService.save(archiveDetail);
}
}else{
textContentTemp = "加密字节流转换pdf失败";
}
// 替换消息的pdf节点
String tempMessage = XMLUtils.replaceXpath(message, pdfFile.getAbsolutePath());
if(!ObjectUtils.isEmpty(tempMessage)){
//System.out.println(tempMessage);
message = tempMessage;
messageLog.setInputContent(message);
outContent = XMLUtils.generateV3XmlStr("AA", "成功啦~");
endTime = System.currentTimeMillis();
messageLog.setValue(archiveMasterId, outContent, 1, messageDto == null ? "" : JSON.toJSONString(messageDto), messageDto.getXmlCreateTime(), (endTime - startTime), new Date(), messageDto.getType(), textContent);
messageService.save(messageLog);
return outContent;
}else{
textContentTemp = "替换消息的pdf节点出错";
}
}
if (textContentTemp != null) {
textContent = textContentTemp;
} else {
// 构建消息从属表
patientMainStr = JSON.toJSONString(new PatientMainDto(messageDto.getInpNo(), messageDto.getVisitId()), SerializerFeature.WriteMapNullValue);
xmlCreateTime = messageDto.getXmlCreateTime();
type = messageDto.getType();
typeCodeValue = "AA";
result = 1;
}
} else {
textContent = "没有入院信息";
}
} else {
textContent = "传过来的消息无法解析";
}
outContent = XMLUtils.generateV3XmlStr(typeCodeValue, textContent);
if (outContent != null) {
endTime = System.currentTimeMillis();
messageLog.setValue(archiveMasterId, outContent, result, messageDto == null ? "" : JSON.toJSONString(messageDto), xmlCreateTime, (endTime - startTime), new Date(), type, textContent);
messageService.save(messageLog);
if (Objects.equals(typeCodeValue, "AA") && Objects.equals(type, AliasName.INSPECTION_REPORT)) {
messageSubordinateService.save(new MessageSubordinate(messageLog.getId(), patientMainStr, JSON.toJSONString(messageLog)));
}
}
}catch (Exception e){
// 报错删掉患者报告详情信息
if (archiveDetail != null) {
if (archiveDetail.getId() != null) {
archiveDetailService.delete(archiveDetail.getId());
}
}
// 生成一个临时文件
logger.error("消息出错,请检查消息内容,错误详情:{},消息所在位置:{}",e.getMessage(),FileUtils.createFile(InterfaceName.HIP_MESSAGE_SERVER,parameter,message));
return outContent;
}
return outContent;
}
private String changeApply(ExamApply examApply,String interfaceName) throws Exception{
String textContent = null;
ExamApply examApplyTemp = examApplyService.findExamApply(examApply.getApplyId());
//1 先判断检验申请单是否存在 存在做以下操作
if(examApplyTemp != null){
if (Objects.equals(examApply.getResult(), "delete")) {
// 1.2 判断是否是删除
if (!examApplyService.updateExamApplyIsValid(examApplyTemp.getApplyId())) {
textContent = "申请单删除失败了";
}
}else if(Objects.equals(interfaceName,InterfaceName.PARAMETER_INSPECTIONAPPLY)){
// 1.3 如果是检验申请单状态变更设置IsOpenHIS
if (Objects.equals(examApply.getIsOpenHis(), "F")) {
examApplyTemp.setIsValid(1);
examApplyTemp.setIsOpenHis("F");
examApplyService.save(examApplyTemp);
}
}else if(Objects.equals(interfaceName,InterfaceName.PARAMETER_VERIFICATIONINSPECTIONAPPLY)){
// 1.4 如果是检验申请单检体验收设置IsOpenLIS
if (Objects.equals(examApply.getIsOpenOther(), "F")) {
examApplyTemp.setIsValid(1);
examApplyTemp.setIsOpenOther("F");
examApplyService.save(examApplyTemp);
}
}else {
// 1.5 如果存在,又不做任何操作,返回已存在
textContent = "该申请单已存在";
}
}else{
// 2 如果不存在,那就判断是否是新增,否则该申请单不存在
if (Objects.equals(examApply.getResult(), "new") && Objects.equals(interfaceName,InterfaceName.PARAMETER_INSPECTIONAPPLY)) {
if (examApply.getReportType() != null) {
examApply.setReportType(AliasName.INSPECTION_REPORT);
}
examApplyService.save(examApply);
} else {
textContent = "该申请单不存在";
}
}
return textContent;
}
}

@ -0,0 +1,18 @@
package com.ann.demo.service;
import com.ann.demo.entity.filing.ArchiveDetail;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/12 9:12
*/
public interface ArchiveDetailService {
public void save(ArchiveDetail archiveDetail) throws Exception;
public void delete(String id) throws Exception;
public ArchiveDetail isExit(String id, String type, String source, String applyId,String checkReportId) throws Exception;
}

@ -0,0 +1,9 @@
package com.ann.demo.service;
/**
* @author ljx
* @description: TODO
* @date 2021/5/26 15:09
*/
public class Demo {
}

@ -0,0 +1,22 @@
package com.ann.demo.service;
import com.ann.demo.entity.interfaceEntity.ExamApply;
/**
* @Author: LeiJiaXin
* @Date: 2019/8/22 16:20
*/
public interface ExamApplyService {
public void save(ExamApply examApply);
/* public boolean updateExamApplyIsValidById(String id);*/
//public String findId(String applyId,String inpNo,String visitId,String patientId);
public ExamApply findExamApply(String applyId);
Integer countExamApply(String applyId);
boolean updateExamApplyIsValid(String applyId) throws Exception;
}

@ -0,0 +1,27 @@
package com.ann.demo.service;
import com.ann.demo.entity.interfaceEntity.MessageLog;
import java.util.List;
/**
* @Description
* @Date 2019/7/9 10:24
* @Created by ljx
*/
public interface MessageService {
public void save(MessageLog log);
public Integer countByInputContentAndInterfaceName(String xmlStr, String hipMessageServer);
// 2019-10-11 查询所有9月15解析成功的数据
List<MessageLog> findAllMessage();
//2020-3-20 获取患者信息id
String getArchiveMasterId(String inpNo,String visitId);
// String getArchiveMasterId(String inpNo,String visitId,String patientId);
}

@ -0,0 +1,16 @@
package com.ann.demo.service;
import com.ann.demo.entity.filing.MessageSubordinate;
/**
* @Description
* @Date 2019/7/9 16:43
* @Created by ljx
*/
public interface MessageSubordinateService {
public void save(MessageSubordinate messageSubordinate);
public boolean countByPatientMainAndContentJson(String patientMainStr, String contentJson);
}

@ -0,0 +1,12 @@
package com.ann.demo.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
//name:与接口中的name一致区分作用无太大意义
//targetNamespace与接口中的命名空间一致,一般是接口的包名倒写
@WebService(name = "WebServiceDemo", targetNamespace = "http://service.webServicetest.docus.cn")
public interface WebServiceDemo {
@WebMethod
String receivePdfFile(@WebParam byte[] fileByte);
}

@ -0,0 +1,40 @@
package com.ann.demo.service.impl;
import com.ann.demo.entity.filing.ArchiveDetail;
import com.ann.demo.repository.ArchiveDetailRepository;
import com.ann.demo.service.ArchiveDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/12 9:12
*/
@Service
public class ArchiveDetailServiceImpl implements ArchiveDetailService {
@Autowired
ArchiveDetailRepository archiveDetailRepository;
@Override
public void save(ArchiveDetail archiveDetail) throws Exception{
archiveDetailRepository.save(archiveDetail);
}
@Override
public void delete(String id) throws Exception{
archiveDetailRepository.deleteById(id);
}
@Override
public ArchiveDetail isExit(String id, String type, String source, String applyId,String checkReportId) throws Exception {
if (archiveDetailRepository.countByMasterIDAndAssortIDAndSourceAndApplyId(id, type, source, applyId,checkReportId) > 0)
return archiveDetailRepository.findByMasterIDAndAssortIDAndSourceAndApplyIdAndFlagAndFileContext(id, type, source, applyId,"0",checkReportId);
return null;
}
}

@ -0,0 +1,40 @@
package com.ann.demo.service.impl;
import com.ann.demo.entity.interfaceEntity.ExamApply;
import com.ann.demo.repository.ExamApplyRepository;
import com.ann.demo.service.ExamApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author: LeiJiaXin
* @Date: 2019/8/22 16:20
*/
@Service
public class ExamApplyServiceImpl implements ExamApplyService {
@Autowired
ExamApplyRepository examApplyRepository;
@Override
public void save(ExamApply examApply) {
examApplyRepository.save(examApply);
}
@Override
public ExamApply findExamApply(String applyId) {
return examApplyRepository.findByApplyIdAndIsValidAndIsOpenHisAndIsOpenOther(applyId,0,"E","E");
}
@Override
public Integer countExamApply(String applyId) {
return examApplyRepository.countExamApply(applyId);
}
@Override
public boolean updateExamApplyIsValid(String applyId) throws Exception{
if (examApplyRepository.updateExamApplyIsValidById(applyId) > 0)
return true;
return false;
}
}

@ -0,0 +1,58 @@
package com.ann.demo.service.impl;
import com.ann.demo.entity.interfaceEntity.MessageLog;
import com.ann.demo.repository.MessageRepository;
import com.ann.demo.service.MessageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Date 2019/7/9 10:24
* @Created by ljx
*/
@Service
public class MessageServiceImpl implements MessageService {
static final Logger logger = LoggerFactory.getLogger(MessageServiceImpl.class);
@Autowired
MessageRepository messageRepository;
@Override
public void save(MessageLog log) {
//打日志信息
try {
messageRepository.save(log);
//-------------------------打出来的日志 需改善
} catch (Exception e) {
logger.error("出错咯!保存消息内容错误信息:" + e);
}
}
@Override
public Integer countByInputContentAndInterfaceName(String xmlStr, String hipMessageServer) {
return messageRepository.countByInputContentAndInterfaceName(xmlStr, hipMessageServer);
}
@Override
public List<MessageLog> findAllMessage() {
List<MessageLog> allHaha = messageRepository.findAllHaha();
System.out.println(allHaha.size());
return allHaha;
}
public String getArchiveMasterId(String inpNo,String visitId) {
return messageRepository.getArchiveMasterId(inpNo, visitId);
}
}

@ -0,0 +1,47 @@
package com.ann.demo.service.impl;
import com.ann.demo.entity.filing.MessageSubordinate;
import com.ann.demo.repository.MessageSubordinateRepository;
import com.ann.demo.service.MessageSubordinateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description
* @Date 2019/7/9 16:43
* @Created by ljx
*/
@Service
public class MessageSubordinateServiceImpl implements MessageSubordinateService {
static final Logger logger = LoggerFactory.getLogger(MessageSubordinateServiceImpl.class);
@Autowired
MessageSubordinateRepository subordinateRepository;
@Override
public void save(MessageSubordinate messageSubordinate) {
//打日志信息
try {
subordinateRepository.save(messageSubordinate);
} catch (Exception e) {
logger.error("出错咯!错误信息:" + e);
}
}
@Override
public boolean countByPatientMainAndContentJson(String patientMainStr, String contentJson) {
try {
if (patientMainStr != null && contentJson != null) {
if (subordinateRepository.countByPatientMainAndContentJson(patientMainStr, contentJson) > 0)
return false;
return true;
}
} catch (Exception e) {
logger.error("查询消息ID与消息内容出错咯错误信息:" + e);
}
return false;
}
}

@ -0,0 +1,77 @@
package com.ann.demo.service.impl;
import com.ann.demo.interfaces.HomepageDictionary;
import com.ann.demo.service.WebServiceDemo;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class WebServiceDemoImpl implements WebServiceDemo {
@Autowired
private HomepageDictionary homepageDictionary;
private static final Logger logger = LoggerFactory.getLogger(WebServiceDemoImpl.class);
@Override
public String receivePdfFile(byte[] fileByte) {
if(null == fileByte || fileByte.length == 0){
return "参数不能为空";
}else {
try {
String decode= "";
//fileByte = FileUtils.getBytesByFile("F:\\inputStr.txt");
decode = new String(fileByte, "UTF-8");
//decode = Base64Utils.jdkBase64Decode(decode);
logger.info(decode);
String result = homepageDictionary.HIPMessageServer("LisSendReportBack", decode);
logger.info(result);
return result;
}catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
return e.getMessage();
}
}
}
/*@Override
public String receivePdfFile(byte[] fileByte) {
//定义返回值
int resultCode = 0;
String resultContent = "成功";
if(null != fileByte && fileByte.length != 0){
String outPath = "D:\\zwh";
String s = UUID.randomUUID().toString();
String fileName = "fileDemo_"+s+".pdf";
try {
FileUtil.getFileByBytes(fileByte,outPath,fileName);
} catch (Exception e) {
e.printStackTrace();
resultCode = 500;
resultContent = e.getMessage();
}
}else {
resultCode = 500;
resultContent = "参数不能为空";
}
return "<Response>\n" +
" <Header>\n" +
" <SourceSystem></SourceSystem>\n" +
" <MessageID></MessageID>\n" +
" </Header>\n" +
" <Body>\n" +
" <ResultCode>"+resultCode+"</ResultCode>\n" +
" <ResultContent>"+resultContent+"</ResultContent>\n" +
" </Body>\n" +
"</Response>";
}*/
}

@ -0,0 +1,16 @@
package com.ann.demo.utils;
import org.apache.axis.encoding.Base64;
public class Base64Utils {
public static String jdkBase64Decode(String src) {
try {
src = src.replaceAll("\r\n","");
byte[] decode = Base64.decode(src);
return new String(decode);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

@ -0,0 +1,89 @@
package com.ann.demo.utils;
import java.io.File;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
/**
* @Description
* @Date 2019/6/24 10:51
* @Created by ljx
*/
public class DateUtils {
// 生成指定格式的时间
public static String getDate() {
//日期转换为字符串
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
return now.format(format);
}
public static int getAge(Date birthDay) throws Exception {
Calendar cal = Calendar.getInstance();
if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
throw new IllegalArgumentException(
"The birthDay is before Now.It's unbelievable!");
}
int yearNow = cal.get(Calendar.YEAR); //当前年份
int monthNow = cal.get(Calendar.MONTH); //当前月份
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期
cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
int age = yearNow - yearBirth; //计算整岁数
if (monthNow <= monthBirth) {
if (monthNow == monthBirth) {
if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一
} else {
age--;//当前月份在生日之前,年龄减一
}
}
return age;
}
public static Date parse(String strDate) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("2019/6/29 0:00:00");
return sdf.parse(strDate);
}
public static void main(String[] args) {
/* //LocalDate date1 = LocalDate.now();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd hh:mm:ss");
String date = "2019/06/29 00:00:00";
LocalDate date1 = LocalDate.parse(date,dateTimeFormatter);
LocalDate date2 = LocalDate.of(date1.getYear(), date1.getMonth(), date1.getDayOfMonth());
int age = date2.until(date1).getDays();
System.out.println("You're " + age + " years old.");*/
File file = new File("C:/Users/ljx/Desktop/pdf/外3");
File[] files = file.listFiles();
for (File file1 : files) {
System.out.println(file1.getName());
}
}
/**
* yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date strToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
}

@ -0,0 +1,144 @@
package com.ann.demo.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.io.*;
import java.time.LocalDate;
import java.util.Objects;
import java.util.UUID;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/24 16:42
*/
@Component
public class FileUtils {
static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
// 错误文件地址
public static String errorPath;
@Value("${file.errorPath}")
public void setErrorPath(String errorPath) {
FileUtils.errorPath = errorPath;
}
public static String getErrorPath() {
return errorPath;
}
// pdf地址
public static String pdfPath;
@Value("${file.pdfPath}")
public void setPdfPath(String pdfPath) {
FileUtils.pdfPath = pdfPath;
}
public static String getPdfPath() {
return pdfPath;
}
//将文件转换成Byte数组
public static byte[] getBytesByFile(String pathStr) {
File file = new File(pathStr);
try {
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
fis.close();
byte[] data = bos.toByteArray();
bos.close();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String createFile(String interfaceName, String param,String message) throws IOException {
File localFile = null;
OutputStreamWriter write = null;
BufferedWriter writer = null;
try {
//生成文件地址
LocalDate date = LocalDate.now();
String fileDirName = null;
fileDirName = errorPath+"/" + date.getYear() + "/" + date.getMonthValue() + "/" + interfaceName;
// 如果参数不为空时,再增加一级目录
if(!ObjectUtils.isEmpty(param)){
fileDirName += "_" + param;
}
//判断是否有该文件夹 否则创建
File fileDir = new File(fileDirName);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
String fileName = fileDir + "/" + UUID.randomUUID() + ".txt";
localFile = new File(fileName);
if (!localFile.exists()) {
localFile.createNewFile();
}
write = new OutputStreamWriter(new FileOutputStream(localFile));
writer = new BufferedWriter(write);
writer.write(message);
writer.flush();
} catch (IOException e) {
throw e;
}finally {
if(!ObjectUtils.isEmpty(write)){
write.close();
}
if(!ObjectUtils.isEmpty(writer)){
writer.close();
}
}
return localFile.getAbsolutePath();
}
public static File createFile(String fileType, String inpNo, String visitId, String detailId, String tempPath) throws IOException {
File localFile = null;
try {
//生成图片地址
LocalDate date = LocalDate.now();
String fileDirName = pdfPath + "/" + date.getYear() + "/" + date.getMonthValue() + "/" + inpNo + "_" + visitId;
//判断是否有该文件夹 否则创建
File fileDir = new File(fileDirName);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
String fileName = null;
if (Objects.equals(fileType, "images")) {
fileName = fileDir + "/" + tempPath + detailId + ".jpg";
} else if (Objects.equals(fileType, "pdfs")) {
fileName = fileDir + "/" + detailId + ".pdf";
}
localFile = new File(fileName);
if (!localFile.exists()) {
localFile.createNewFile();
}
} catch (IOException e) {
throw e;
}
return localFile;
}
public static void main(String[] args) throws ClassNotFoundException {
String address = "ftp://10.6.0.155/2019-10-21/000581031700_1_000581031700_0_1_JHR06.00.02_34_2_0.pdf";
String a = address.substring(0, address.indexOf(".pdf"));
String emrPath = a.substring(a.lastIndexOf("_") + 1, a.length());
System.out.println(emrPath);
}
}

@ -0,0 +1,69 @@
package com.ann.demo.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;
import sun.misc.BASE64Decoder;
import java.io.*;
/**
* @Author: LeiJiaXin
* @Date: 2019/7/11 22:32
*/
public class PdfUtils {
static final Logger logger = LoggerFactory.getLogger(PdfUtils.class);
/**
* base64PDF
*
* @param base64String 1.使BASE64Decoder
* 2.使ByteArrayInputStream
* 3.BufferedInputStream
* 4.使BufferedOutputStreamFileOutputSteam
*/
public static boolean base64StringToPDF(String base64String, File file/*File file*/) throws Exception {
BASE64Decoder decoder = new BASE64Decoder();
BufferedInputStream bin = null;
FileOutputStream fout = null;
BufferedOutputStream bout = null;
try {
//将base64编码的字符串解码成字节数组
byte[] bytes = decoder.decodeBuffer(base64String);
//创建一个将bytes作为其缓冲区的ByteArrayInputStream对象
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
//创建从底层输入流中读取数据的缓冲输入流对象
bin = new BufferedInputStream(bais);
//创建到指定文件的输出流
fout = new FileOutputStream(file);
//为文件输出流对接缓冲输出流对象
bout = new BufferedOutputStream(fout);
byte[] buffers = new byte[1024];
int len = bin.read(buffers);
while (len != -1) {
bout.write(buffers, 0, len);
len = bin.read(buffers);
}
//刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
bout.flush();
} catch (IOException e) {
logger.error("加密字节流转换pdf失败" + e.getMessage());
throw e;
} finally {
if (!ObjectUtils.isEmpty(bout)) {
bout.close();
}
if (!ObjectUtils.isEmpty(fout)) {
fout.close();
}
if (!ObjectUtils.isEmpty(bin)) {
bin.close();
}
}
return true;
}
}

@ -0,0 +1,317 @@
package com.ann.demo.utils;
import com.alibaba.fastjson.JSON;
import com.ann.demo.entity.constant.AliasName;
import com.ann.demo.entity.constant.InterfaceName;
import com.ann.demo.entity.filing.dto.MessageDto;
import com.ann.demo.entity.interfaceEntity.*;
import org.apache.axis.utils.StringUtils;
import org.dom4j.*;
import org.dom4j.io.SAXReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
import javax.annotation.PostConstruct;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description
* @Date 2019/6/17 15:14
* @Created by ljx
*/
@Component
public class XMLUtils {
static final Logger logger = LoggerFactory.getLogger(XMLUtils.class);
private static final String DEFAULT_ENCODING = "UTF-8";
private static final Map<String, String> map;
static {
map = new HashMap<String, String>();
map.put("ns", "urn:hl7-org:v3");
}
public static String path;
@Value("${file.path}")
private String pathTemp;
// 检验报告
public static String inspectionReportPath;
@Value("${file.inspectionReportPath}")
private String inspectionReportPathTemp;
// 检验申请单
public static String inspectionApplyPath;
@Value("${file.inspectionApplyPath}")
private String inspectionApplyPathTemp;
// 检验申请单确立
public static String verificationInspectionApplyPath;
@Value("${file.verificationInspectionApplyPath}")
private String verificationInspectionApplyPathTemp;
@PostConstruct
public void init() {
path = pathTemp;
inspectionReportPath = inspectionReportPathTemp;
inspectionApplyPath = inspectionApplyPathTemp;
verificationInspectionApplyPath = verificationInspectionApplyPathTemp;
}
/**
* V3xml
*/
public static String generateV3XmlStr(String typeCodeValue, String textContent) throws Exception{
try {
SAXReader reader = new SAXReader();
Document document = reader.read(path);
Element root = document.getRootElement();
Element creationTime = root.element("creationTime");
Attribute value = creationTime.attribute("value");
value.setValue(DateUtils.getDate());
Element acknowledgement = root.element("acknowledgement");
Attribute typeCode = acknowledgement.attribute("typeCode");
typeCode.setValue(typeCodeValue);
Element acknowledgementDetail = acknowledgement.element("acknowledgementDetail");
Element text = acknowledgementDetail.element("text");
text.setText(textContent);
return document.getRootElement().asXML();
}catch (Exception e){
return null;
}
}
//--------------------------------------------向外抛出异常
public static MessageDto xpathToBean(String xmlStr, Class tClass, String source) {
MessageDto messageDto = null;
Document doc = null;
Object obj = null;
try {
xmlStr = xmlStr.replaceAll("&", "&amp;");
SAXReader saxReader = new SAXReader();
saxReader.setXMLFilter(new XMLFilterImpl() {
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
String text = new String(ch, start, length);
if (length == 1) {
if ((int) ch[0] == 160) {
char[] escape = " ".toCharArray();
super.characters(escape, 0, escape.length);
return;
}
}
super.characters(ch, start, length);
}
});
doc = saxReader.read(new ByteArrayInputStream(xmlStr.getBytes("UTF-8")), "UTF-8");
if (tClass != null) {
messageDto = getInstance(source);
obj = tClass.newInstance();
} else {
// 是检查报告的接口
String str = "/ns:ClinicalDocument/ns:component/ns:structuredBody/ns:component/ns:section/ns:entry/ns:observation/ns:code[@displayName='检查报告科室']/../ns:value/text()";
//-----------------------存在一个错误 如果str找不到 就会向外抛出异常org.apache.cxf.interceptor.Fault: org/jaxen/JaxenException
XPath x = doc.createXPath(str);
x.setNamespaceURIs(map);
Node node = x.selectSingleNode(doc);
if (node != null) {
messageDto = getInstance(node.getText());
if (messageDto != null) {
obj = messageDto.getObject();
}
}
}
if (obj != null && messageDto != null) {
if (messageDto.getPropertiesPath() != null) {
// 加载配置文件
InputStream inputStream = new BufferedInputStream(new FileInputStream(new File(messageDto.getPropertiesPath())));
Properties properties = new Properties();
//加载格式化后的流
properties.load(new InputStreamReader(inputStream, DEFAULT_ENCODING));
Enumeration<?> enumeration = properties.propertyNames();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
String xpath = properties.getProperty(key);
XPath x = doc.createXPath(xpath);
x.setNamespaceURIs(map);
// 根据properties的value获取xml的value
String value = "";
Node node = x.selectSingleNode(doc);
if (node != null) {
value = node.getText();
}
// 判断属性是否存在
String objField = existsField(obj.getClass(), key);
if (objField != null) {
PropertyDescriptor descriptor = new PropertyDescriptor(key, obj.getClass());
if (("class java.util.Date").equals(objField)) {
if (value != null && value.length() > 0) {
// 20200526 将时间格式定义成局部变量
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date parse = simpleDateFormat.parse(value, new ParsePosition(0));
descriptor.getWriteMethod().invoke(obj, parse);
}
} else {
descriptor.getWriteMethod().invoke(obj, value);
}
}
String messageField = existsField(messageDto.getClass(), key);
if (messageField != null) {
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(key, messageDto.getClass());
// 给messageDto赋值
if (("class java.util.Date").equals(messageField)) {
if (value != null && value.length() > 0) {
// 20200526 将时间格式定义成局部变量
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
propertyDescriptor.getWriteMethod().invoke(messageDto, simpleDateFormat.parse(value, new ParsePosition(0)));
}
} else {
propertyDescriptor.getWriteMethod().invoke(messageDto, value);
}
}
}
// 将对象转成json
messageDto.setObject(JSON.toJSONString(obj));
Map<String, String> map1 = new HashMap<>();
//重置pdf的base64为reportAddress节点的text
if(xmlStr.contains("广州金域") && StringUtils.isEmpty(messageDto.getReportAddress())){
parseXml2Map(xmlStr, map1);
String reportAddress = map1.get("component.structuredBody.component.section.pdf");
messageDto.setReportAddress(reportAddress);
}
return messageDto;
}
}
} catch (DocumentException e) {
logger.error("出错咯!错误信息:" + e);
} catch (UnsupportedEncodingException e) {
logger.error("出错咯!错误信息:" + e);
} catch (FileNotFoundException e) {
logger.error("出错咯!错误信息:" + e);
} catch (IOException e) {
logger.error("出错咯!错误信息:" + e);
} catch (IllegalAccessException e) {
logger.error("出错咯!错误信息:" + e);
} catch (IntrospectionException e) {
logger.error("出错咯!错误信息:" + e);
} catch (InvocationTargetException e) {
logger.error("出错咯!错误信息:" + e);
} catch (InstantiationException e) {
logger.error("出错咯!错误信息:" + e);
}
return null;
}
public static Map<String, String> parseXml2Map(String xml, Map<String, String> map) {
try {
SAXReader reader = new SAXReader();
Document doc = reader.read(new StringReader(xml));
Element root = doc.getRootElement();
String path = "";
if (map.containsKey(root.getName().trim())) {
path = map.get(root.getName().trim());
map.remove(root.getName().trim());
}
for (Iterator i = root.elementIterator(); i.hasNext();) {
Element element = (Element) i.next();
if (element.isTextOnly()) {
if (path.length() > 0) {
map.put(path + element.getName().trim(), element.getTextTrim());
} else {
map.put(element.getName().trim(), element.getTextTrim());
}
} else {
map.put(element.getName().trim(), path+ element.getName().trim() + ".");
parseXml2Map(element.asXML(), map);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
public static String replaceXpath(String xmlStr, String replaceContent) throws Exception{
Document doc = null;
try {
xmlStr = xmlStr.replaceAll("&", "&amp;");
SAXReader saxReader = new SAXReader();
saxReader.setXMLFilter(new XMLFilterImpl() {
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
String text = new String(ch, start, length);
if (length == 1) {
if ((int) ch[0] == 160) {
char[] escape = " ".toCharArray();
super.characters(escape, 0, escape.length);
return;
}
}
super.characters(ch, start, length);
}
});
doc = saxReader.read(new ByteArrayInputStream(xmlStr.getBytes("UTF-8")), "UTF-8");
XPath x = doc.createXPath("/ns:ClinicalDocument/ns:component/ns:structuredBody/ns:component[3]/ns:section/ns:pdf/@value");
x.setNamespaceURIs(map);
Node node = x.selectSingleNode(doc);
if (node != null) {
node.setText(replaceContent);
System.out.println(node.getText());
}
}catch (Exception e){
return null;
}
return doc.asXML();
}
public static MessageDto getInstance(String source) {
MessageDto messageDto = null;
// 根据source判断是哪个实体类
switch (source) {
case InterfaceName.INSPECTION_REPORT: // 检验报告
messageDto = new MessageDto(UltrasonicReport.class.getName(), new UltrasonicReport(), AliasName.INSPECTION_REPORT, inspectionReportPath, source);
break;
case InterfaceName.PARAMETER_INSPECTIONAPPLY: // 检验报告申请单
messageDto = new MessageDto(ExamApply.class.getName(), new ExamApply(), AliasName.PARAMETER_INSPECTIONAPPLY, inspectionApplyPath, source);
break;
case InterfaceName.PARAMETER_VERIFICATIONINSPECTIONAPPLY: // 检验报告申请单 核收检体
messageDto = new MessageDto(ExamApply.class.getName(), new ExamApply(), AliasName.PARAMETER_VERIFICATIONINSPECTIONAPPLY, verificationInspectionApplyPath, source);
break;
// case InterfaceName.PARAMETER_VERIFICATIONINSPECTIONAPPLY: // 检验申请单 确立
// messageDto = new MessageDto(ExamApply.class.getName(), new ExamApply(), AliasName.PARAMETER_INSPECTIONAPPLY, inspectionApplyPath, source);
// break;
}
return messageDto;
}
public static String existsField(Class clz, String fieldName) {
try {
Field declaredField = clz.getDeclaredField(fieldName);
if (declaredField != null) {
return declaredField.getGenericType().toString();
}
} catch (Exception e) {
}
return null;
}
}

@ -0,0 +1,65 @@
spring:
datasource:
# url: jdbc:mysql://localhost:3306/test
# # url: jdbc:mysql://10.6.1.127:3306/test
# username: root
# password: 123456
# driver-class-name: com.mysql.jdbc.Driver
# jpa:
# database: mysql
# hibernate:
# ddl-auto: update
# show-sql: true
# database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
#url: jdbc:sqlserver://10.6.1.127:1433;DatabaseName=DB_PrivilegeManagement_GYFY
url: jdbc:sqlserver://localhost:1433;DatabaseName=zj_record_new
username: sa
password: docus702
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
jpa:
database: sql_server
show-sql: false
hibernate:
dialect: org.hibernate.dialect.SQLServer2008Dialect
hikari:
#是否为只读数据库
read-only: false
# 等待连接池分配链接的最大时长
connection-timeout: 60000
# 一个链接idle状态最大时长
idle-timeout: 60000
validation-timeout: 3000
# 一个链接最长的生命时长,超时没有被使用则被释放掉 简易比数据库超时时长少 30s
max-lifetime: 70000
login-timeout: 5
# 连接池允许的最大连接数
maximum-pool-size: 60
# 连接池维护的最小空闲连接数
minimum-idle: 10
thymeleaf:
prefix: classpath:/templates/
suffix: .html
encoding: utf-8
mode: HTML5
cache: false
#logging:
# level:
# org.springframework.security: debug #- info
# org.springframework.web: error
# org.hibernate.SQL: debug
# org.hibernate.engine.QueryParameters: debug
# org.hibernate.engine.query.HQLQueryPlan: debug
# org.hibernate.type.descriptor.sql.BasicBinder: trace
file:
path: D:\\1\MCCI_IN000002UV01.xml
inspectionReportPath: D:\\1\inspectionReport.properties
inspectionApplyPath: D:\\1\inspectionApply.properties
verificationInspectionApplyPath: D:\\1\verificationInspectionApplyPath.properties
errorPath: D:/logs/errorMessage/
# 真正部署的时候 这个要改成Z盘
pdfPath: D:/project_js
server:
port: 8080

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">
<contextName>logback</contextName>
<!-- 格式化输出:%date表示日期%thread表示线程名%-5level级别从左显示5个字符宽度 %msg日志消息%n是换行符-->
<property name="LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
<!-- 定义日志存储的路径,不要配置相对路径 D:/logs/spring-log.%d{yyyy-MM-dd}.%i.log -->
<property name="FILE_PATH" value="D:/logs/%d{yyyy-MM-dd}/LISInterface.%i.log"/>
<!-- 控制台输出日志 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- 日志级别过滤INFO以下 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<!-- 按照上面配置的LOG_PATTERN来打印日志 -->
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!--每天生成一个日志文件保存30天的日志文件。rollingFile用来切分文件的 -->
<appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${FILE_PATH}</fileNamePattern>
<!-- keep 15 days' worth of history -->
<maxHistory>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- 日志文件的最大大小 -->
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 超出删除老文件 -->
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- project default level -->
<logger name="com.ann" level="ERROR"/>
<!-- 日志输出级别 -->
<root level="error">
<appender-ref ref="console"/>
<appender-ref ref="rollingFile"/>
</root>
</configuration>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="/static/bootstrap/bootstrap.min.css">
<script src="/static/bootstrap/jquery.min.js"></script>
<script src="/static/bootstrap/bootstrap.min.js"></script>
</head>
<body>
<br>
<form class="form-horizontal" role="form" action="/haha" method="post">
<div class="form-group">
<div class="col-sm-offset-1 col-sm-6">
<label for="url">URL</label>
<select class="form-control" id="url" name="url">
<option value="http://localhost:8080/services/HomepageDictionary?wsdl">本地</option>
<option value="http://10.6.1.128:8888/AcquisitionServer/services/HomepageDictionary?wsdl">服务端</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-6">
<label for="interfaceName">接口名称</label>
<select class="form-control" id="interfaceName" name="interfaceName">
<option value="HIPMessageServer">HIPMessageServer</option>
<option value="ReceiveDict">ReceiveDict</option>
<option value="InpSummary">InpSummary</option>
<option value="handNumbnessReport">handNumbnessReport</option>
<option value="ICUReport">ICUReport</option>
<option value="BloodTransfusionUrl">BloodTransfusionUrl</option>
<option value="NurseData">NurseData</option>
<option value="DoctorData">DoctorData</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-6">
<label for="parameter">参数</label>
<select class="form-control" id="parameter" name="parameter">
<option value="ExamReportBackRequest">检查报告</option>
<option value="InPatientAddRequest">入院记录</option>
<option value="PatientOutRequest">出院记录</option>
<option value="CalPatientRequest">取消记录</option>
<option value="InpatientTransferRequest">转科记录</option>
<option value="ExamApplyRequest">检查申请单</option>
<option value="LisSendReportBack">检验报告</option>
<option value="InspectionApplyRequest">检验申请单</option>
<option value="VerificationInspectionApplyRequest">检验申请单核体验收</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-8">
<label for="content">内容</label>
<textarea class="form-control" rows="14" id="content" name="content"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-6">
<input type="submit" class="btn btn-primary" value="确定"/>
<input type="reset" class="btn btn-default" value="清空"/>
</div>
</div>
</form>
</body>
</html>

@ -0,0 +1,16 @@
package com.ann.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}
Loading…
Cancel
Save