省中医住院接口

master
lzy 4 years ago
parent d6c438beaf
commit dde60d6c22

@ -22,9 +22,9 @@
//,&
"downurl":"BASE64&ORIGINAL_URL",
//id
"assortid":"",
"assortid":"Wiw213woq412awqe41",
//id
"collectorid":"2",
"collectorid":"22",
//id
"assortidParamKey":"DOCUMENT_TOPIC",
//( 1:2)
@ -32,7 +32,7 @@
//(1:2ftp3)
"filestoragetype":1,
//
"uploadConnector":"http://192.168.1.107:9291/api/downplatform/report",
"uploadConnector":"http://192.9.100.171:9291/api/downplatform/report",
//doubleBasic
"basicDirectory":[""],
//
@ -53,6 +53,17 @@
//
"repealSerialnum":"UNIQUE_ID",
//
"repoalConnector":"http://192.168.1.107:9291/api/down/cancel"
"repoalConnector":"http://192.9.100.171:9291/api/down/cancel",
//--------------------
"zyUrl":"http://192.9.100.32:9022/ktin/api/webservice/ChasWebService?wsdl",
// "zyUrl":"http://localhost:9000/services/api?wsdl",
"zyMethod":"ChasMessageServer",
// "zyMethod":"getPdfId",
"zyNamespance":"http://webservice.http.plugins.api.his.karrytech.com/",
// "zyNamespance":"http://server.webservice.example.com",
"zyDirectory":["PDF_DETAIL_INFO"],
"pdfUrl":"http://192.9.100.32:9022/ktin/api/flow/flow-mra-getpdffile?PDF_ID=",
"zysj":"2022-01-28"
}

@ -0,0 +1,69 @@
{
//-----------------------
//,
"ResHead":"Response,Result",
//
"ResCode":"Code",
//
"ResMsg":"Msg",
//
"successCode":"1",
//
"errorCode":"0",
//,
"directory":[],
//
"indexFlag":"VISITING_SERIAL_NUMBER",
//
"serialnum":"UNIQUE_ID",
//
"filetitle":"DOCUMENT_TITLE",
//,&
"downurl":"BASE64&ORIGINAL_URL",
//id
"assortid":"Wiw213woq412awqe41",
//id
"collectorid":"22",
//id
"assortidParamKey":"DOCUMENT_TOPIC",
//( 1:2)
"filesource":1,
//(1:2ftp3)
"filestoragetype":1,
//
"uploadConnector":"http://192.9.100.171:9291/api/downplatform/report",
//doubleBasic
"basicDirectory":[""],
//
"doubleBasic":["TestItemInfo","BioTestInfo"],
//--------------/---------------
/// 01
"isJudge":"0",
//
"judgeDirectory":[""],
//,0-1-2-
"judgeIndex":"",
//--------------------
//,
"repealDirectory":[""],
//
"repealSerialnum":"UNIQUE_ID",
//
"repoalConnector":"http://192.9.100.171:9291/api/down/cancel",
//--------------------
"zyUrl":"http://192.9.100.32:9022/ktin/api/webservice/ChasWebService?wsdl",
// "zyUrl":"http://localhost:9000/services/api?wsdl",
"zyMethod":"ChasMessageServer",
// "zyMethod":"getPdfId",
"zyNamespance":"http://webservice.http.plugins.api.his.karrytech.com/",
// "zyNamespance":"http://server.webservice.example.com",
"zyDirectory":["PDF_DETAIL_INFO"],
"pdfUrl":"http://192.9.100.32:9022/ktin/api/flow/flow-mra-getpdffile?PDF_ID=",
"zysj":"2022-01-28"
}

@ -118,6 +118,27 @@
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>

@ -1,21 +1,68 @@
package com.docus.bgts.config;
import com.alibaba.fastjson.JSON;
import com.docus.bgts.entity.ReportDownDto;
import com.docus.bgts.entity.ReportDownPatientDto;
import com.docus.bgts.entity.ReportDownScanFileDto;
import com.docus.bgts.enums.Codes;
import com.docus.bgts.facade.IAfCollectTaskService;
import com.docus.bgts.facade.IMrReportErrorService;
import com.docus.bgts.utils.FileUtils;
import com.docus.bgts.utils.HttpUtils;
import com.docus.bgts.utils.XmlUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.ByteArrayOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.io.ByteArrayInputStream;
import java.io.PrintStream;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@Component
public class MyScheduling {
public static Date oneDate;
public static String namespance = "";
private static String methodName = "";
private static String url;
private static String pdfUrl;
static {
url = String.valueOf(FileUtils.getJsonByName("zyUrl"));
methodName = String.valueOf(FileUtils.getJsonByName("zyMethod"));
pdfUrl = String.valueOf(FileUtils.getJsonByName("pdfUrl"));
namespance = String.valueOf(FileUtils.getJsonByName("zyNamespance"));
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
oneDate = fmt.parse(String.valueOf(FileUtils.getJsonByName("zysj")));
} catch (ParseException e) {
e.printStackTrace();
}
}
@Autowired
private IMrReportErrorService mrReportErrorService;
@Autowired
private IAfCollectTaskService afCollectTaskService;
@Value("${beat.url}")
private String beatUrl;
@ -37,4 +84,141 @@ public class MyScheduling {
}
}
//10分钟执行一次
@Scheduled(fixedRate = 1000 * 60 * 30)
public void ruyuan() {
log.info("----------开始采集------------");
log.info("-----采集时间:"+oneDate);
Date twoDate = new Date();
//获取jzh列表
List<String> jzhs = afCollectTaskService.listJZHByDate(oneDate, twoDate);
int size = jzhs.size();
log.info("-------本次采集数:" + size);
if(size==0){
oneDate=twoDate;
log.info("------------采集结束-----------------");
return;
}
Object[] params;
List<String> keys = new ArrayList<>();
keys.add("action");
keys.add("message");
XmlUtils xmlUtils;
List<String> zyDirectory = (List<String>) FileUtils.getJsonByName("zyDirectory");
String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
String filesource = String.valueOf(FileUtils.getJsonByName("filesource"));
String filestoragetype = String.valueOf(FileUtils.getJsonByName("filestoragetype"));
String res;
Element element;
Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json");
for (String jzh : jzhs) {
try {
params = new Object[]{"flow-mra-queryencounterpdf", "<Req>\n" +
"<Params>\n" +
"<ENCT_ID>" + jzh + "</ENCT_ID>\n" +
"</Params>\n" +
"</Req>"};
res = requestFunctionWebService(params, url, methodName, namespance, keys);
log.info("返回值:" + res);
xmlUtils = new XmlUtils(new ByteArrayInputStream(res.getBytes("UTF-8")));
element = xmlUtils.getElement(zyDirectory);
List<Element> items = element.elements("ITEM");
if (items == null || items.size() <= 0) {
throw new RuntimeException("查询到的信息不存在");
}
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setCollectorid(collectorid);
reportDownDto.setAssortid(assortid);
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
reportDownPatientDto.setJzh(jzh);
reportDownDto.setPatient(reportDownPatientDto);
List<ReportDownScanFileDto> scanFileDtos = new ArrayList<>();
ReportDownScanFileDto reportDownScanFileDto;
for (Element item : items) {
Element pdfId = item.element("PDF_ID");
if (pdfId != null && StringUtils.isNotBlank(pdfId.getText())) {
//采集流水号
String pdfIdText = pdfId.getText();
//文件标题
String fileTitle = item.element("MED_REC_CAT_NAME").getText();
//url地址
String pdf = pdfUrl + pdfIdText;
reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setFiletitle(fileTitle);
reportDownScanFileDto.setFilesource(Integer.parseInt(filesource));
reportDownScanFileDto.setFilestoragetype(Integer.parseInt(filestoragetype));
reportDownScanFileDto.setSerialnum(pdfIdText);
reportDownScanFileDto.setDownurl(pdf);
scanFileDtos.add(reportDownScanFileDto);
} else {
log.info("记账号:", jzh + "不存在pdfId");
size--;
throw new RuntimeException("记账号:" + jzh + "不存在pdfId");
}
}
log.info("文件信息:" + scanFileDtos);
reportDownDto.setScanfiles(scanFileDtos);
afCollectTaskService.insert(reportDownDto);
String post = "";
logger.info("--------执行上传功能----------");
Map paramMap = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class);
logger.info("上传参数:" + paramMap);
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, paramMap);
// String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), map, headMap);
if (StringUtils.isBlank(post)) {
logger.info("--------上传时出现错误,可能是文件服务没有启动----------");
throw new RuntimeException("上传时出现错误,可能是文件服务没有启动");
}
Map resMap = JSON.parseObject(post, Map.class);
if (String.valueOf(resMap.get("code")).equals("500")) {
throw new RuntimeException(String.valueOf(resMap.get("msg")));
} else {
logger.info("----------执行成功,当前最后更新日期" + twoDate + "-----------");
}
} catch (Exception e) {
log.info(e.getMessage());
e.printStackTrace();
size--;
mrReportErrorService.insert(jzh);
}
}
log.info("-------本次成功采集数:" + size);
oneDate = twoDate;
}
private String requestFunctionWebService(Object[] params,
String url,
String methodName,
String namespance,
List<String> parameterNames) {
String result = "";
if (null != params) {
try {
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName(namespance, methodName));
for (int i = 0; i < parameterNames.size(); i++) {
call.addParameter(parameterNames.get(i), XMLType.XSD_STRING, ParameterMode.IN);//接口的参数
}
call.setReturnType(XMLType.XSD_STRING);//设置返回类型
result = (String) call.invoke(params);
} catch (Exception e) {
e.printStackTrace();
//方法名
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
log.error("requestFunctionWebService请求接口异常" + exception);
}
}
return result;
}
}

@ -7,6 +7,9 @@ import com.docus.bgts.entity.CanlcelDto;
import com.docus.bgts.entity.ReportDownDto;
import com.docus.bgts.entity.ZdAssort;
import java.util.Date;
import java.util.List;
/**
* <p>
*
@ -25,6 +28,8 @@ public interface IAfCollectTaskService extends IService<AfCollectTask> {
void updateInterfaceCollect(String collectSubId, int state);
List<String> listJZHByDate(Date date1,Date date2);
/**
*
* @param canlcelDto

@ -6,6 +6,9 @@ import com.docus.bgts.entity.AfCollectTask;
import com.docus.bgts.entity.ZdAssort;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* <p>
* Mapper
@ -15,6 +18,8 @@ import org.apache.ibatis.annotations.Param;
* @since 2021-05-07
*/
public interface AfCollectTaskMapper extends BaseMapper<AfCollectTask> {
List<String> listJZHByDate(@Param("date1") Date date1, @Param("date2") Date date2);
/**
* id
* @param empId

@ -2,6 +2,11 @@ package com.docus.bgts.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.bgts.entity.AfInterfaceCollectSub;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface AfInterfaceCollectSubMapper extends BaseMapper<AfInterfaceCollectSub> {
}

@ -123,6 +123,11 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
}
@Override
public List<String> listJZHByDate(Date date1, Date date2) {
return afCollectTaskMapper.listJZHByDate(date1, date2);
}
@Override
public void invokeRepoalFile(CanlcelDto canlcelDto) throws Exception {
//上传接口地址

@ -1,5 +1,5 @@
server:
port: 9701
port: 9205
# http
mybatis-plus:
@ -16,7 +16,7 @@ beat:
system:
code: "EmrDocAr"
prop: 9801
prop: 9805
# web service

@ -0,0 +1,28 @@
server:
port: 9205
# http
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
call-setters-on-nulls: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
field-strategy: NOT_EMPTY
db-type: MYSQL
beat:
url: http://localhost:9399/beat
system:
code: "EmrDocAr"
prop: 9805
# web service
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: docus
password: docus702
url: jdbc:mysql://db.docus.cn:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true

@ -3,6 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.AfCollectTaskMapper">
<select id="listJZHByDate" resultType="string">
select jzh from docus_medicalrecord.t_basic
where create_time >=#{date1} and create_time &lt;=#{date2} and jzh is not null and is_archive=0
</select>
<select id="getpatientIdByEmpId" resultType="string">
select patient_id
from docus_medicalrecord.t_basic

Loading…
Cancel
Save