瀏覽代碼

优化检验报告查询

lighter 3 年之前
父節點
當前提交
de3aa606fd

+ 1 - 11
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>8.0</version>
+    <version>8.1</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 
@@ -73,16 +73,6 @@
             <artifactId>dom4j</artifactId>
             <version>2.1.1</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-frontend-jaxws</artifactId>
-            <version>3.1.10</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-transports-http</artifactId>
-            <version>3.1.10</version>
-        </dependency>
         <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>

+ 13 - 14
src/main/java/thyyxxk/wxservice_server/service/InspectionsService.java

@@ -62,24 +62,24 @@ public class InspectionsService {
         }
         String sendEnd = "<START_TIME>" + param.getStart() + "</START_TIME><END_TIME>" + param.getEnd() + "</END_TIME></message>";
         String send0 = sendHead0 + sendEnd;
-        String xml0 = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{send0});
-        List<ExamIndexResult> list0 = invokeService.analyzeExamIndex(xml0.substring(1, xml0.length() - 1));
+        String xml0 = invokeService.invokeRemoteMethod("GetLabReportIndex", send0);
+        List<ExamIndexResult> list0 = invokeService.analyzeExamIndex(xml0);
         if (null != sendHead1) {
             String send1 = sendHead1 + sendEnd;
-            String xml1 = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{send1});
-            List<ExamIndexResult> list1 = invokeService.analyzeExamIndex(xml1.substring(1, xml1.length() - 1));
+            String xml1 = invokeService.invokeRemoteMethod("GetLabReportIndex", send1);
+            List<ExamIndexResult> list1 = invokeService.analyzeExamIndex(xml1);
             list0.addAll(list1);
         }
         if (null != sendHead2) {
             String send2 = sendHead2 + sendEnd;
-            String xml2 = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{send2});
-            List<ExamIndexResult> list2 = invokeService.analyzeExamIndex(xml2.substring(1, xml2.length() - 1));
+            String xml2 = invokeService.invokeRemoteMethod("GetLabReportIndex", send2);
+            List<ExamIndexResult> list2 = invokeService.analyzeExamIndex(xml2);
             list0.addAll(list2);
         }
         if (null != sendHead3) {
             String send3 = sendHead3 + sendEnd;
-            String xml3 = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{send3});
-            List<ExamIndexResult> list3 = invokeService.analyzeExamIndex(xml3.substring(1, xml3.length() - 1));
+            String xml3 = invokeService.invokeRemoteMethod("GetLabReportIndex", send3);
+            List<ExamIndexResult> list3 = invokeService.analyzeExamIndex(xml3);
             list0.addAll(list3);
         }
         return ResultVoUtil.success(list0);
@@ -118,8 +118,8 @@ public class InspectionsService {
         if (null != mzNos && mzNos.size() > 0) {
             for (String mzNo : mzNos) {
                 String mzHead = "<message><PATIENT_TYPE>0</PATIENT_TYPE><PTNT_NO>" + mzNo + "</PTNT_NO>";
-                String xml = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{mzHead+xmlEnd});
-                List<ExamIndexResult> list = invokeService.analyzeExamIndex(xml.substring(1, xml.length() - 1));
+                String xml = invokeService.invokeRemoteMethod("GetLabReportIndex", mzHead+xmlEnd);
+                List<ExamIndexResult> list = invokeService.analyzeExamIndex(xml);
                 for (ExamIndexResult index : list) {
                     if (BooleanUtil.isCovidExam(index.getAPLY_CTNT())) {
                         results.add(index);
@@ -130,8 +130,8 @@ public class InspectionsService {
         if (null != hshjNos && hshjNos.size() > 0) {
             for (HshjPatient hshj : hshjNos) {
                 String hshjHead = "<message><PATIENT_TYPE>0</PATIENT_TYPE><PTNT_NO>" + hshj.getParentId() + "</PTNT_NO>";
-                String xml = invokeService.invokeRemoteMethod("GetLabReportIndex", new Object[]{hshjHead+xmlEnd});
-                List<ExamIndexResult> list = invokeService.analyzeExamIndex(xml.substring(1, xml.length() - 1));
+                String xml = invokeService.invokeRemoteMethod("GetLabReportIndex", hshjHead+xmlEnd);
+                List<ExamIndexResult> list = invokeService.analyzeExamIndex(xml);
                 for (ExamIndexResult index : list) {
                     if (BooleanUtil.isCovidExam(index.getAPLY_CTNT())) {
                         index.setPTNT_ID(hshj.getPatientId());
@@ -150,8 +150,7 @@ public class InspectionsService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "报告ID不能为空!");
         }
         String send = "<message><ORDR_ID>" + param.getOrderId() + "</ORDR_ID></message>";
-        String xml = invokeService.invokeRemoteMethod("GetLabReport", new Object[]{send});
-        xml = xml.substring(1, xml.length() - 1);
+        String xml = invokeService.invokeRemoteMethod("GetLabReport", send);
         Element retEle = null;
         try {
             Document document = DocumentHelper.parseText(xml);

+ 9 - 32
src/main/java/thyyxxk/wxservice_server/service/SoapInvokeService.java

@@ -1,24 +1,18 @@
 package thyyxxk.wxservice_server.service;
 
 import lombok.extern.slf4j.Slf4j;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
-import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.BindingOperationInfo;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import thyyxxk.wxservice_server.entity.inspections.ExamIndexResult;
+import thyyxxk.wxservice_server.webservice.PushService;
+import thyyxxk.wxservice_server.webservice.PushServiceSoap;
 
-import javax.xml.namespace.QName;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -29,31 +23,14 @@ import java.util.List;
 @Slf4j
 @Service
 public class SoapInvokeService {
-    @Value("${inspectionUrl}")
-    private String inspectionUrl;
 
-    public String invokeRemoteMethod(String operation, Object[] parameters) {
-        log.info("查询检验报告:方法:{},参数:{}", operation, parameters[0]);
-        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
-        Client client = dcf.createClient(inspectionUrl);
-        Endpoint endpoint = client.getEndpoint();
-        QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), operation);
-        BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
-        if (bindingInfo.getOperation(opName) == null) {
-            for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
-                if (operation.equals(operationInfo.getName().getLocalPart())) {
-                    opName = operationInfo.getName();
-                    break;
-                }
-            }
-        }
-        Object[] res = null;
-        try {
-            res = client.invoke(opName, parameters);
-        } catch (Exception e) {
-            log.error("【" + operation + "】查询检验报告出错", e);
+    public String invokeRemoteMethod(String operation, String message) {
+        log.info("查询检验报告:方法:{},参数:{}", operation, message);
+        PushServiceSoap soap = new PushService().getPushServiceSoap();
+        if (operation.equals("GetLabReportIndex")) {
+            return soap.getLabReportIndex(message);
         }
-        return Arrays.toString(res);
+        return soap.getLabReport(message);
     }
 
     public List<ExamIndexResult> analyzeExamIndex(String xml) {
@@ -63,7 +40,7 @@ public class SoapInvokeService {
             Element root = document.getRootElement();
             retEle = root.element("return");
         } catch (DocumentException e) {
-            log.error("【SoapInvokeService.class: line 67】解析检验报告出错", e);
+            log.error("【SoapInvokeService.class: line 51】解析检验报告出错", e);
         }
         if (retEle == null) {
             return new ArrayList<>();

+ 74 - 0
src/main/java/thyyxxk/wxservice_server/webservice/PushService.java

@@ -0,0 +1,74 @@
+package thyyxxk.wxservice_server.webservice;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+@WebServiceClient(name = "PushService", targetNamespace = "http://www.elims.com.cn/", wsdlLocation = "http://172.16.32.178:622/pushservice.asmx?wsdl")
+public class PushService extends Service {
+
+    private final static URL PUSHSERVICE_WSDL_LOCATION;
+    private final static WebServiceException PUSHSERVICE_EXCEPTION;
+    private final static QName PUSHSERVICE_QNAME = new QName("http://www.elims.com.cn/", "PushService");
+
+    static {
+        URL url = null;
+        WebServiceException e = null;
+        try {
+            url = new URL("http://172.16.32.178:622/pushservice.asmx?wsdl");
+        } catch (MalformedURLException ex) {
+            e = new WebServiceException(ex);
+        }
+        PUSHSERVICE_WSDL_LOCATION = url;
+        PUSHSERVICE_EXCEPTION = e;
+    }
+
+    public PushService() {
+        super(__getWsdlLocation(), PUSHSERVICE_QNAME);
+    }
+
+    public PushService(WebServiceFeature... features) {
+        super(__getWsdlLocation(), PUSHSERVICE_QNAME, features);
+    }
+
+    public PushService(URL wsdlLocation) {
+        super(wsdlLocation, PUSHSERVICE_QNAME);
+    }
+
+    public PushService(URL wsdlLocation, WebServiceFeature... features) {
+        super(wsdlLocation, PUSHSERVICE_QNAME, features);
+    }
+
+    public PushService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public PushService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
+        super(wsdlLocation, serviceName, features);
+    }
+
+    private static URL __getWsdlLocation() {
+        if (PUSHSERVICE_EXCEPTION != null) {
+            throw PUSHSERVICE_EXCEPTION;
+        }
+        return PUSHSERVICE_WSDL_LOCATION;
+    }
+
+    @WebEndpoint(name = "PushServiceSoap")
+    public PushServiceSoap getPushServiceSoap() {
+        return super.getPort(new QName("http://www.elims.com.cn/", "PushServiceSoap"), PushServiceSoap.class);
+    }
+
+    @WebEndpoint(name = "PushServiceSoap")
+    public PushServiceSoap getPushServiceSoap(WebServiceFeature... features) {
+        return super.getPort(new QName("http://www.elims.com.cn/", "PushServiceSoap"), PushServiceSoap.class, features);
+    }
+
+}

+ 31 - 0
src/main/java/thyyxxk/wxservice_server/webservice/PushServiceSoap.java

@@ -0,0 +1,31 @@
+package thyyxxk.wxservice_server.webservice;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+@WebService(name = "PushServiceSoap", targetNamespace = "http://www.elims.com.cn/")
+public interface PushServiceSoap {
+
+    @WebMethod(operationName = "GetLabReportIndex", action = "http://www.elims.com.cn/GetLabReportIndex")
+    @WebResult(targetNamespace = "http://www.elims.com.cn/")
+    @RequestWrapper(localName = "GetLabReportIndex", targetNamespace = "http://www.elims.com.cn/", className = "adicon.GetLabReportIndex")
+    @ResponseWrapper(localName = "GetLabReportIndexResponse", targetNamespace = "http://www.elims.com.cn/", className = "adicon.GetLabReportIndexResponse")
+    String getLabReportIndex(@WebParam(name = "message", targetNamespace = "http://www.elims.com.cn/") String message);
+
+    @WebMethod(operationName = "GetLabReport", action = "http://www.elims.com.cn/GetLabReport")
+    @WebResult(targetNamespace = "http://www.elims.com.cn/")
+    @RequestWrapper(localName = "GetLabReport", targetNamespace = "http://www.elims.com.cn/", className = "adicon.GetLabReport")
+    @ResponseWrapper(localName = "GetLabReportResponse", targetNamespace = "http://www.elims.com.cn/", className = "adicon.GetLabReportResponse")
+    String getLabReport(@WebParam(name = "message", targetNamespace = "http://www.elims.com.cn/") String message);
+
+}