|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.docus.bgts.service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.docus.bgts.entity.AfCollectTask;
|
|
|
|
@ -11,8 +12,10 @@ import com.docus.bgts.facade.IAfCollectTaskService;
|
|
|
|
|
import com.docus.bgts.facade.IBgtsService;
|
|
|
|
|
import com.docus.bgts.utils.FileUtils;
|
|
|
|
|
import com.docus.bgts.utils.HttpUtils;
|
|
|
|
|
import com.docus.bgts.utils.JAXDynamicClientFactory;
|
|
|
|
|
import com.docus.bgts.utils.XmlUtils;
|
|
|
|
|
import org.apache.axis.client.Call;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import org.apache.cxf.endpoint.Client;
|
|
|
|
|
import org.dom4j.Document;
|
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
|
import org.dom4j.Element;
|
|
|
|
@ -20,13 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
|
|
import javax.xml.rpc.ParameterMode;
|
|
|
|
|
import javax.xml.rpc.ServiceException;
|
|
|
|
|
import javax.xml.rpc.encoding.XMLType;
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.rmi.RemoteException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -36,8 +33,6 @@ import java.util.Map;
|
|
|
|
|
public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
@Value("${ws.url}")
|
|
|
|
|
private String wsUrl;
|
|
|
|
|
@Value("${ws.namespaceUrl}")
|
|
|
|
|
private String wsNamespaceUrl;
|
|
|
|
|
@Value("${ws.localMethod}")
|
|
|
|
|
private String wsLocalMethod;
|
|
|
|
|
|
|
|
|
@ -45,7 +40,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
IAfCollectTaskService afCollectTaskService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collect(String empId, String collectSubId) throws Exception {
|
|
|
|
|
public void collect(String empId) throws Exception {
|
|
|
|
|
//通过empId获取报告单号集合
|
|
|
|
|
List<String[]> exams = getExamNo(empId);
|
|
|
|
|
//通过报告单号集合采集
|
|
|
|
@ -53,7 +48,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectByExamNo(String emamNo, String empId, String collectSubId) throws Exception {
|
|
|
|
|
public void collectByExamNo(String emamNo, String empId) throws Exception {
|
|
|
|
|
String[] strings = new String[2];
|
|
|
|
|
//通过报告单号和系统id查询任务表
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
@ -71,7 +66,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @param exams
|
|
|
|
|
* @param empId
|
|
|
|
|
*/
|
|
|
|
|
private void collectExams(List<String[]> exams, String empId) throws UnsupportedEncodingException, RemoteException, ServiceException {
|
|
|
|
|
private void collectExams(List<String[]> exams, String empId) throws Exception {
|
|
|
|
|
//获取插入表数据
|
|
|
|
|
ReportDownDto reportDownDto = getUrlCreateReportDto(exams, empId);
|
|
|
|
|
//插入文件af_collect_task表数据
|
|
|
|
@ -95,7 +90,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @param empId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ReportDownDto getUrlCreateReportDto(List<String[]> exams, String empId) throws UnsupportedEncodingException, ServiceException, RemoteException {
|
|
|
|
|
private ReportDownDto getUrlCreateReportDto(List<String[]> exams, String empId) throws Exception {
|
|
|
|
|
ReportDownDto reportDownDto = new ReportDownDto();
|
|
|
|
|
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
|
|
|
|
|
reportDownPatientDto.setJzh(empId);
|
|
|
|
@ -124,7 +119,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @param exam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ReportDownScanFileDto getScanByExam(String[] exam) throws UnsupportedEncodingException, ServiceException, RemoteException {
|
|
|
|
|
private ReportDownScanFileDto getScanByExam(String[] exam) throws Exception {
|
|
|
|
|
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
|
|
|
|
|
reportDownScanFileDto.setSerialnum(exam[0]);
|
|
|
|
|
reportDownScanFileDto.setFiletitle(exam[1]);
|
|
|
|
@ -207,21 +202,35 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
return exams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String invokeWs(String xml) throws ServiceException, RemoteException {
|
|
|
|
|
Object[] object = new Object[]{xml};//请求参数
|
|
|
|
|
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
|
|
Call call = (Call) service.createCall();
|
|
|
|
|
call.setTargetEndpointAddress(wsUrl);// 远程调用路径
|
|
|
|
|
// 调用的命名空间和方法名
|
|
|
|
|
call.setOperationName(new QName(wsNamespaceUrl, wsLocalMethod));
|
|
|
|
|
call.setUseSOAPAction(true);
|
|
|
|
|
// call.setSOAPActionURI(wsNamespaceUrl + "pushSurveyReport");
|
|
|
|
|
call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN);
|
|
|
|
|
call.setReturnType(XMLType.XSD_STRING);// 返回值类型:String
|
|
|
|
|
call.setTimeout(100000);//超时
|
|
|
|
|
String result = (String) call.invoke(object);// 远程调用
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 调用web service
|
|
|
|
|
* @param xml
|
|
|
|
|
* @return
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public String invokeWs(String xml) throws Exception {
|
|
|
|
|
// Object[] object = new Object[]{xml};//请求参数
|
|
|
|
|
// org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
|
|
// Call call = (Call) service.createCall();
|
|
|
|
|
// call.setTargetEndpointAddress(wsUrl);// 远程调用路径
|
|
|
|
|
// // 调用的命名空间和方法名
|
|
|
|
|
//// call.setOperationName(new QName(wsNamespaceUrl, wsLocalMethod));
|
|
|
|
|
// call.setOperationName(wsLocalMethod);
|
|
|
|
|
// call.setUseSOAPAction(true);
|
|
|
|
|
//// call.setSOAPActionURI(wsNamespaceUrl + "pushSurveyReport");
|
|
|
|
|
// call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN);
|
|
|
|
|
// call.setReturnType(XMLType.XSD_STRING);// 返回值类型:String
|
|
|
|
|
// call.setTimeout(100000);//超时
|
|
|
|
|
// String result = (String) call.invoke(object);// 远程调用
|
|
|
|
|
// System.out.println(result);
|
|
|
|
|
|
|
|
|
|
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
|
|
|
|
|
Client client = dcf.createClient(wsUrl);
|
|
|
|
|
Object[] objects = client.invoke(wsLocalMethod,xml);
|
|
|
|
|
String str = objects[0].toString();
|
|
|
|
|
System.out.println(str);
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|