|  |  |  | @ -30,7 +30,6 @@ import com.glxp.mipsdl.dao.inout.IoOrderDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.dao.thrsys.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.entity.axxyy.PriceDict; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.entity.basic.BasicCorpEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.entity.basic.BasicUdirelEntity; | 
			
		
	
	
		
			
				
					|  |  |  | @ -63,23 +62,40 @@ import com.glxp.mipsdl.thirddao.njxyy.ThrProductsMapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.thirddao.njxyy.ThrSickerMapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.mipsdl.util.*; | 
			
		
	
		
			
				
					|  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  |  | import org.dom4j.Document; | 
			
		
	
		
			
				
					|  |  |  |  | import org.dom4j.DocumentException; | 
			
		
	
		
			
				
					|  |  |  |  | import org.dom4j.DocumentHelper; | 
			
		
	
		
			
				
					|  |  |  |  | import okhttp3.*; | 
			
		
	
		
			
				
					|  |  |  |  | import org.apache.commons.lang3.StringEscapeUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.apache.cxf.endpoint.Client; | 
			
		
	
		
			
				
					|  |  |  |  | import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  |  | import org.w3c.dom.Document; | 
			
		
	
		
			
				
					|  |  |  |  | import org.w3c.dom.Element; | 
			
		
	
		
			
				
					|  |  |  |  | import org.w3c.dom.Node; | 
			
		
	
		
			
				
					|  |  |  |  | import org.w3c.dom.NodeList; | 
			
		
	
		
			
				
					|  |  |  |  | import org.xml.sax.InputSource; | 
			
		
	
		
			
				
					|  |  |  |  | import org.xml.sax.SAXException; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.bind.JAXBException; | 
			
		
	
		
			
				
					|  |  |  |  | import java.io.OutputStream; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.parsers.DocumentBuilder; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.parsers.DocumentBuilderFactory; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.parsers.ParserConfigurationException; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.OutputKeys; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.Transformer; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.TransformerException; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.TransformerFactory; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.dom.DOMSource; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.xml.transform.stream.StreamResult; | 
			
		
	
		
			
				
					|  |  |  |  | ; | 
			
		
	
		
			
				
					|  |  |  |  | import java.io.*; | 
			
		
	
		
			
				
					|  |  |  |  | import java.math.BigDecimal; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.HttpURLConnection; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.URI; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.URL; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.URLEncoder; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.logging.Level; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.regex.Matcher; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.regex.Pattern; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.HttpURLConnection; | 
			
		
	
		
			
				
					|  |  |  |  | import java.net.URL; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  |  * 安溪县医院对接物资系统Client | 
			
		
	
	
		
			
				
					|  |  |  | @ -142,29 +158,68 @@ public class AxxyyClient extends CommonHttpClient { | 
			
		
	
		
			
				
					|  |  |  |  |      * @param methodName 方法名 | 
			
		
	
		
			
				
					|  |  |  |  |      * @return | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |  |     public String getMsgHeader(String methodName) { | 
			
		
	
		
			
				
					|  |  |  |  |     public static String getMsgHeader(String methodName) { | 
			
		
	
		
			
				
					|  |  |  |  |         return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<root>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<serverName>" + methodName + "</serverName>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<format>" + "xml" + "</format>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<format>xml</format>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<callOperator>" + "" + "</callOperator>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<certificate>" + "ousrgPVbTpn7ckRUZWypfBR7tGWi2EINBp4vIHOS44V/jN3U5dD+5A==" + "</certificate>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<certificate>ousrgPVbTpn7ckRUZWypfBR7tGWi2EINBp4vIHOS44V/jN3U5dD+5A==</certificate>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</root>"; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public String setFilter() { | 
			
		
	
		
			
				
					|  |  |  |  |     public static String setFilter() { | 
			
		
	
		
			
				
					|  |  |  |  |         return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<root>\n" + | 
			
		
	
		
			
				
					|  |  |  |  | //                "<code>" + "" + "</code>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  |                 "<name>" + "红细胞寿命测定-呼气法" + "</name>\n" + | 
			
		
	
		
			
				
					|  |  |  |  | //                "<spell>" + "" + "</spell>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "<invalid>" + "" + "</invalid>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "<subject>" + "" + "</subject>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  |                 "<code>" + "" + "</code>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<name>红细胞寿命测定-呼气法</name>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<spell>" + "" + "</spell>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<invalid>" + "" + "</invalid>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<subject>" + "" + "</subject>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</root>"; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private static String buildSoapRequest(String msgHeader, String msgBody) { | 
			
		
	
		
			
				
					|  |  |  |  |         // 构建 SOAP 请求消息
 | 
			
		
	
		
			
				
					|  |  |  |  | //        String soapRequestTemplate =
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:zys=\"http://www.zysoft.com.cn/\">\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "<soapenv:Header/>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "   <soapenv:Body>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "    <zys:CallInterface>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "    <zys:msgHeader><![CDATA[%s]]></zys:msgHeader>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "    <zys:msgBody><![CDATA[%s]]></zys:msgBody>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "      </zys:CallInterface>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "   </soapenv:Body>\n" +
 | 
			
		
	
		
			
				
					|  |  |  |  | //                "</soapenv:Envelope>";
 | 
			
		
	
		
			
				
					|  |  |  |  |         String soapRequestTemplate = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:zys=\"http://www.zysoft.com.cn/\">\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<soapenv:Header/>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "   <soapenv:Body>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <zys:CallInterface>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <zys:msgHeader><![CDATA[<root>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <serverName>getPriceDict</serverName>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <format>xml</format>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <callOperator></callOperator>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    <certificate>ousrgPVbTpn7ckRUZWypfBR7tGWi2EINBp4vIHOS44V/jN3U5dD+5A==</certificate>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "    </root>]]>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</zys:msgHeader>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<zys:msgBody><![CDATA[\t\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<root>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "<name>红细胞寿命测定-呼气法</name>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</root>]]>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</zys:msgBody>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "      </zys:CallInterface>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "   </soapenv:Body>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</soapenv:Envelope>"; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | //        return String.format(soapRequestTemplate, msgHeader, msgBody);
 | 
			
		
	
		
			
				
					|  |  |  |  |         return soapRequestTemplate; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 获取产品信息---(A001产品信息查询) | 
			
		
	
		
			
				
					|  |  |  |  |      * | 
			
		
	
	
		
			
				
					|  |  |  | @ -957,74 +1012,109 @@ public class AxxyyClient extends CommonHttpClient { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse getBasicProject(DlThirdProjectRequest dlThirdProjectRequest)  { | 
			
		
	
		
			
				
					|  |  |  |  |         CtqyyRequest ctqyyRequest = new CtqyyRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         String getPriceDict = getMsgHeader("getPriceDict"); | 
			
		
	
		
			
				
					|  |  |  |  |         String s = setFilter(); | 
			
		
	
		
			
				
					|  |  |  |  |         log.error("DANGQIAN 请求头:::" + getPriceDict); | 
			
		
	
		
			
				
					|  |  |  |  |         log.error("DANGQIAN 请求体:::" + s); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |  |             String response = callInterface(getMsgHeader("getPriceDict"), setFilter()); | 
			
		
	
		
			
				
					|  |  |  |  |             System.out.println("Response: " + response); | 
			
		
	
		
			
				
					|  |  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("解析安溪县医院智业返回项目信息数据异常,返回结果:{}", e); | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("异常信息:{}", e); | 
			
		
	
		
			
				
					|  |  |  |  |             e.printStackTrace(); | 
			
		
	
		
			
				
					|  |  |  |  |             // 发送请求
 | 
			
		
	
		
			
				
					|  |  |  |  |             BaseResponse response = callInterface(getMsgHeader("getPriceDict"), setFilter()); | 
			
		
	
		
			
				
					|  |  |  |  |             // 记录日志
 | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("获取智业收费项目222: " + response); | 
			
		
	
		
			
				
					|  |  |  |  | //            log.error("获取智业收费项目:::::: " + response);
 | 
			
		
	
		
			
				
					|  |  |  |  |         }catch (Exception e){ | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("获取智业收费项目失败" ); | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("Response: " + e.getMessage()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return null; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private static final String WSDL_URL = "http://173.19.192.196:8882/OTHER/BtmsEntranceWs?wsdl"; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public static String callInterface(String msgHeader, String msgBody) throws Exception { | 
			
		
	
		
			
				
					|  |  |  |  |         URL url = new URL("http://173.19.192.196:8882/OTHER/BtmsEntranceWs?wsdl"); | 
			
		
	
		
			
				
					|  |  |  |  |         HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | 
			
		
	
		
			
				
					|  |  |  |  |         connection.setRequestMethod("POST"); | 
			
		
	
		
			
				
					|  |  |  |  |         connection.setRequestProperty("Content-Type", "application/xml"); | 
			
		
	
		
			
				
					|  |  |  |  |         connection.setDoOutput(true); | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse callInterface(String msgHeader, String msgBody) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         String requestBody = "<request>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "  <msgHeader>" + msgHeader + "</msgHeader>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "  <msgBody>" + msgBody + "</msgBody>\n" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</request>"; | 
			
		
	
		
			
				
					|  |  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         try (OutputStream os = connection.getOutputStream()) { | 
			
		
	
		
			
				
					|  |  |  |  |             byte[] input = requestBody.getBytes("utf-8"); | 
			
		
	
		
			
				
					|  |  |  |  |             os.write(input, 0, input.length); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |             // 构建请求头
 | 
			
		
	
		
			
				
					|  |  |  |  |             Map<String, String> headers = Map.of( | 
			
		
	
		
			
				
					|  |  |  |  |                     "Content-Type", "text/xml;charset=utf-8", | 
			
		
	
		
			
				
					|  |  |  |  |                     "SOAPAction","http://www.zysoft.com.cn/CallInterface" | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         int responseCode = connection.getResponseCode(); | 
			
		
	
		
			
				
					|  |  |  |  |             ); | 
			
		
	
		
			
				
					|  |  |  |  |             // 注意:这里我们实际上是在构建一个表单体,而不是直接发送XML或JSON
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 因此,我们需要对msgHeader和msgBody进行URL编码,并将它们作为表单字段发送
 | 
			
		
	
		
			
				
					|  |  |  |  |             String postData =  buildSoapRequest(null,null); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         log.error("Response Code: " + responseCode); | 
			
		
	
		
			
				
					|  |  |  |  |         if (responseCode == HttpURLConnection.HTTP_OK) { | 
			
		
	
		
			
				
					|  |  |  |  |             // 读取响应
 | 
			
		
	
		
			
				
					|  |  |  |  |             java.util.Scanner scanner = new java.util.Scanner(connection.getInputStream()).useDelimiter("\\A"); | 
			
		
	
		
			
				
					|  |  |  |  |             String response = scanner.hasNext() ? scanner.next() : ""; | 
			
		
	
		
			
				
					|  |  |  |  |            log.error("Response Body: " + response); | 
			
		
	
		
			
				
					|  |  |  |  |             return scanner.hasNext() ? scanner.next() : ""; | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("HTTP error code : " + responseCode); | 
			
		
	
		
			
				
					|  |  |  |  |             throw new RuntimeException("HTTP error code : " + responseCode); | 
			
		
	
		
			
				
					|  |  |  |  |             HttpRequest request = HttpRequest.post(WSDL_URL) | 
			
		
	
		
			
				
					|  |  |  |  |                     .addHeaders(headers) | 
			
		
	
		
			
				
					|  |  |  |  |                     .body(postData); | 
			
		
	
		
			
				
					|  |  |  |  |             HttpResponse xmlResponse = request.execute(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             String xml = xmlResponse.body(); | 
			
		
	
		
			
				
					|  |  |  |  |             // 假设 XML 解析到的 JSON 字符串部分
 | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("获取智业收费项目999:" + xml); | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, xml); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |  |             log.error("获取智业收费项目失败===" + e.getMessage()); | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, "获取智业收费项目失败===" + e.getMessage()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public static void main(String[] args) { | 
			
		
	
		
			
				
					|  |  |  |  |         String soapXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body><zys:CallInterfaceResponse xmlns:zys=\"http://www.zysoft.com.cn/\">" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "  <zys:payload><?xml version=\"1.0\" encoding=\"utf-8\"?><root><code>0</code><data><lists><code>023050000701</code><name>红细胞寿命测定-呼气法</name><unit>次</unit><price>245</price><spell>HXBSMCDHQF</spell><valid>Y</valid><sequence></sequence><std_code>23050000701</std_code><subject>D</subject><subjectname>化验</subjectname><dispreceipt>FJ15</dispreceipt><dispreceiptname>化验费</dispreceiptname><resireceipt>FJ15</resireceipt><resireceiptname>化验费</resireceiptname><starttime>20190412000000</starttime><stoptime></stoptime><modifytime>20190505170000</modifytime><modifyoperator>SYSTEM3</modifyoperator><item_connotation>红细胞寿命测定-呼气法</item_connotation><except_content></except_content><country_code>002305000070000-23050000701</country_code><org_stdcode></org_stdcode></lists></data></root></zys:payload>" + | 
			
		
	
		
			
				
					|  |  |  |  |                 "</zys:CallInterfaceResponse></soapenv:Body></soapenv:Envelope>"; | 
			
		
	
		
			
				
					|  |  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |  |             // 提取 <zys:payload> 中的内容
 | 
			
		
	
		
			
				
					|  |  |  |  |             int payloadStart = soapXml.indexOf("<zys:payload>") + "<zys:payload>".length(); | 
			
		
	
		
			
				
					|  |  |  |  |             int payloadEnd = soapXml.indexOf("</zys:payload>"); | 
			
		
	
		
			
				
					|  |  |  |  |             String escapedXml = soapXml.substring(payloadStart, payloadEnd); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 处理转义字符
 | 
			
		
	
		
			
				
					|  |  |  |  |             String unescapedXml = StringEscapeUtils.unescapeXml(escapedXml); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 解析 XML
 | 
			
		
	
		
			
				
					|  |  |  |  |             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | 
			
		
	
		
			
				
					|  |  |  |  |             DocumentBuilder builder = factory.newDocumentBuilder(); | 
			
		
	
		
			
				
					|  |  |  |  |             Document doc = builder.parse(new InputSource(new StringReader(unescapedXml))); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 转换为字符串
 | 
			
		
	
		
			
				
					|  |  |  |  |             TransformerFactory transformerFactory = TransformerFactory.newInstance(); | 
			
		
	
		
			
				
					|  |  |  |  |             Transformer transformer = transformerFactory.newTransformer(); | 
			
		
	
		
			
				
					|  |  |  |  |             transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); | 
			
		
	
		
			
				
					|  |  |  |  |             transformer.setOutputProperty(OutputKeys.METHOD, "xml"); | 
			
		
	
		
			
				
					|  |  |  |  |             transformer.setOutputProperty(OutputKeys.INDENT, "yes"); | 
			
		
	
		
			
				
					|  |  |  |  |             transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             StringWriter writer = new StringWriter(); | 
			
		
	
		
			
				
					|  |  |  |  |             transformer.transform(new DOMSource(doc), new StreamResult(writer)); | 
			
		
	
		
			
				
					|  |  |  |  |             String standardXml = writer.toString(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 处理空标签,将 <tag/> 替换为 <tag></tag>
 | 
			
		
	
		
			
				
					|  |  |  |  |             Pattern pattern = Pattern.compile("<([^/][^>]*)\\s*/>"); | 
			
		
	
		
			
				
					|  |  |  |  |             Matcher matcher = pattern.matcher(standardXml); | 
			
		
	
		
			
				
					|  |  |  |  |             String resultXml = matcher.replaceAll("<$1></$1>"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             // 输出标准 XML
 | 
			
		
	
		
			
				
					|  |  |  |  |             System.out.println(resultXml); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } catch (ParserConfigurationException | SAXException | TransformerException | IOException e) { | 
			
		
	
		
			
				
					|  |  |  |  |             e.printStackTrace(); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |     private static String formatXML(Document doc) throws TransformerException { | 
			
		
	
		
			
				
					|  |  |  |  |         TransformerFactory transformerFactory = TransformerFactory.newInstance(); | 
			
		
	
		
			
				
					|  |  |  |  |         Transformer transformer = transformerFactory.newTransformer(); | 
			
		
	
		
			
				
					|  |  |  |  |         transformer.setOutputProperty(OutputKeys.INDENT, "yes"); | 
			
		
	
		
			
				
					|  |  |  |  |         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | //    public String parserResult(String response) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (response.contains("<root")) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            try {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                JAXBUtil.unmarshalAndGetResult()
 | 
			
		
	
		
			
				
					|  |  |  |  | //                Document document = DocumentHelper.parseText(response);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                String message = document.getRootElement().element("message").getText();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                return message;
 | 
			
		
	
		
			
				
					|  |  |  |  | //            } catch (DocumentException e) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                log.info("解析安溪县医院智业接口返回结果异常, 返回结果:{}", response);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                log.error("异常信息:", e);
 | 
			
		
	
		
			
				
					|  |  |  |  | //            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //        return response;
 | 
			
		
	
		
			
				
					|  |  |  |  | //    }
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         DOMSource source = new DOMSource(doc); | 
			
		
	
		
			
				
					|  |  |  |  |         StringWriter writer = new StringWriter(); | 
			
		
	
		
			
				
					|  |  |  |  |         StreamResult result = new StreamResult(writer); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         transformer.transform(source, result); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return writer.toString(); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |