瀏覽代碼

添加webservice

lingfeng 9 年之前
父節點
當前提交
d2edc0686e

+ 29 - 19
Hos-Resource-Rest/pom.xml

@ -206,30 +206,40 @@
            <artifactId>xom</artifactId>
            <version>1.1</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.apache.axis2</groupId>-->
            <!--<artifactId>axis2</artifactId>-->
            <!--<version>1.6.3</version>-->
        <!--</dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.apache.axis2</groupId>-->
            <!--<artifactId>axis2-adb</artifactId>-->
            <!--<version>1.6.3</version>-->
        <!--</dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.apache.axis2</groupId>-->
            <!--<artifactId>axis2-kernel</artifactId>-->
            <!--<version>1.6.3</version>-->
        <!--</dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.apache.axis2</groupId>-->
            <!--<artifactId>org.apache.axis2.osgi</artifactId>-->
            <!--<version>1.6.3</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>1.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.6.3</version>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20151123</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>org.apache.axis2.osgi</artifactId>
            <version>1.6.3</version>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>3.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20151123</version>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>3.1.6</version>
        </dependency>
    </dependencies>

+ 36 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/config/CxfConfig.java

@ -0,0 +1,36 @@
package com.yihu.hos.config;
import com.yihu.hos.ws.service.ServiceGateWay;
import com.yihu.hos.ws.service.ServiceGateWayPortType;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
@Configuration
public class CxfConfig {
    @Bean
    public ServletRegistrationBean dispatcherServlet() {
        return new ServletRegistrationBean(new CXFServlet(), "/service/*");
    }
    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }
    @Bean
    public ServiceGateWayPortType serviceGateWayPortType() {
        return new ServiceGateWay();
    }
    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), serviceGateWayPortType());
        endpoint.publish("/ServiceGateWay");
        return endpoint;
    }
}

+ 20 - 27
Hos-Resource-Rest/src/main/java/com/yihu/hos/gateway/util/RPCUtil.java

@ -3,13 +3,6 @@ package com.yihu.hos.gateway.util;
import com.yihu.hos.config.Config;
import com.yihu.wsgw.api.ServiceBus;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
import javax.xml.namespace.QName;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * Created by Administrator on 2016/4/18.
@ -33,26 +26,26 @@ public class RPCUtil {
     * @param inputValuetype
     * @return
     */
    public static String getObjectByAxis2CallClient(String webServiceAddr, String webserviceNamespace, String webServiceMethod,
                                                    Object[] inputValues, Class[] inputValuetype) {
        try {
            //新建RPC服务客户端
            RPCServiceClient serviceClient = new RPCServiceClient();
            Options options = serviceClient.getOptions();
            //设置URL
            EndpointReference targetEPR = new EndpointReference(webServiceAddr);
            options.setTo(targetEPR);
            //设置参数的类型
            //设置namespace和方法名
            QName opAddEntry = new QName(webserviceNamespace, webServiceMethod);
            //数组的第一个值为返回值
            return (String) (serviceClient.invokeBlocking(opAddEntry, inputValues, inputValuetype))[0];
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
//    public static String getObjectByAxis2CallClient(String webServiceAddr, String webserviceNamespace, String webServiceMethod,
//                                                    Object[] inputValues, Class[] inputValuetype) {
//
//        try {
//            //新建RPC服务客户端
//            RPCServiceClient serviceClient = new RPCServiceClient();
//            Options options = serviceClient.getOptions();
//            //设置URL
//            EndpointReference targetEPR = new EndpointReference(webServiceAddr);
//            options.setTo(targetEPR);
//            //设置参数的类型
//            //设置namespace和方法名
//            QName opAddEntry = new QName(webserviceNamespace, webServiceMethod);
//            //数组的第一个值为返回值
//            return (String) (serviceClient.invokeBlocking(opAddEntry, inputValues, inputValuetype))[0];
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "";
//    }
    /*
    public static void main(String[] args) throws Exception {
        String apiName = "report.ReportWs.GetReportList";

+ 1428 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/resource/util/StringUtil.java

@ -0,0 +1,1428 @@
package com.yihu.hos.resource.util;
import org.apache.commons.lang.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
public class StringUtil {
    public static String substring(String str, int start) {
        return StringUtils.substring(str, start);
    }
    public static String substring(String str, int start, int end) {
        return StringUtils.substring(str, start, end);
    }
    public static boolean isBlank(String str) {
        return StringUtils.isBlank(str);
    }
    public static String toString(Object obj) {
        if (obj == null) {
            return null;
        }
        return obj.toString();
    }
    public static String trimLeft(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int index = -1;
        for (int i = 0; i < ch.length; i++) {
            if (Character.isWhitespace(ch[i])) {
                index = i;
            } else {
                break;
            }
        }
        if (index != -1) {
            result = result.substring(index + 1);
        }
        return result;
    }
    /**
     * �ù���ѹ���ַ������ұ߿ո�
     *
     * @param value ��Դ��
     * @return String src����ַ���
     */
    public static String trimRight(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int endIndex = -1;
        for (int i = ch.length - 1; i > -1; i--) {
            if (Character.isWhitespace(ch[i])) {
                endIndex = i;
            } else {
                break;
            }
        }
        if (endIndex != -1) {
            result = result.substring(0, endIndex);
        }
        return result;
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ���ǰ����Ӷ��"0",���ع̶����� ��ڲ�����param str:��������ַ��� param len�����ع̶����� �� �أ�Stirng
     * <p/> ��д���ڣ� �޸ı�ע�� ******************************************************
     */
    public static String fillHeadCharsLen(String strOri, int len) {
        return fillHeadCharsLen(strOri, "0", len);
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ���������Ӷ��"0",���ع̶����� ��ڲ�����param str:��������ַ��� param len�����ع̶����� �� �أ�Stirng
     * <p/> ��д���ڣ� �޸ı�ע�� ******************************************************
     */
    public static String fillBackCharsLen(String strOri, int len) {
        return fillBackCharsLen(strOri, "0", len);
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ���ǰ����Ӷ���ظ��ַ���,���ع̶����� ��ڲ�����param str:��������ַ��� param subStr:�ظ������ַ���
     * param len�����ع̶����� �� �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillHeadCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = fillStr + strOri;
        return (subStr.substring(subStr.length() - len, subStr.length()));
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ���������Ӷ���ظ��ַ���,���ع̶����� ��ڲ�����param str:��������ַ��� param subStr:�ظ������ַ���
     * param len�����ع̶����� �� �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillBackCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = strOri + fillStr;
        return (subStr.substring(0, len));
    }
    /**
     * ***************************************************** �� �ܣ����ַ���ǰ����Ӷ��"0"
     * ��ڲ�����param str:��������ַ��� param counter���ظ������� �� �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillHeadChars(String strOri, int counter) {
        return fillHeadChars(strOri, "0", counter);
    }
    /**
     * ***************************************************** �� �ܣ����ַ���������Ӷ��"0"
     * ��ڲ�����param str:��������ַ��� param counter���ظ������� �� �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillBackChars(String strOri, int counter) {
        return fillBackChars(strOri, "0", counter);
    }
    /**
     * ***************************************************** �� �ܣ����ַ���ǰ����Ӷ���ظ��ַ���
     * ��ڲ�����param str:��������ַ��� param subStr:�ظ������ַ��� param counter���ظ������� ��
     * �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillHeadChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (fillStr + strOri);
    }
    /**
     * ***************************************************** �� �ܣ����ַ���������Ӷ���ظ��ַ���
     * ��ڲ�����param str:��������ַ��� param subStr:�ظ������ַ��� param counter���ظ������� ��
     * �أ�Stirng <p/> ��д���ڣ� �޸ı�ע��
     * ******************************************************
     */
    public static String fillBackChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (strOri + fillStr);
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж��ַ����Ƿ�Ϊ�ջ���null(ѹ���ո��) ��ڲ�����param str:��������ַ��� ���ڲ����� �� �أ��գ�null��true;
     * ���գ�false <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isEmpty(Object strObj) {
        if (strObj == null || strObj.toString().trim().length() < 1) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�һ���ַ����Ƿ�Ϊ��ֵ��null����(ѹ���ո��)�� ��ڲ�����param str:���жϵ��ַ��� ���ڲ����� ��
     * �أ�true���գ�false���ǿ� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isStrEmpty(String str) {
        if ((str == null) || (str.trim().length() < 1) || "null".endsWith(str.toLowerCase())) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ�����һ���ַ���ȥ���ұ߿ո���ֵ�����Ϊnull�򷵻ؿմ� ��ڲ�����param str:��������ַ��� ���ڲ����� ��
     * �أ�ȥ���ұ߿ո����ַ������߿մ� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String getValue(String str) {
        if (str == null) {
            return "";
        }
        if (str.trim().length() <= 0)
            return "";
        str = "H" + str;
        str = str.trim();
        str = str.substring(1);
        return str;
    }
    /**
     * ***************************************************** �� �ܣ��ж�һ���ַ����Ƿ񳬳���������
     * ��ڲ�����param text:���жϵ��ַ�����param len:�����ij��� ���ڲ����� �� �أ�return
     * true��δ������false��Ϊ�ջ��߳��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean chkTextLen(String text, int len) {
        if (text == null || text.length() > len) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�һ���ַ���ȥ���ո��Ƿ񳬳��������� ��ڲ�����param text:���жϵ��ַ�����param len:�����ij��� ���ڲ����� ��
     * �أ�return true��δ������false��Ϊ�ջ��߳��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean chkTextTrimLen(String text, int len) {
        if (text == null || text.trim().length() > len) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�һ���ַ����Ƿ�ֻ��english ��ڲ�����param text:���жϵ��ַ����� ���ڲ����� �� �أ�return
     * true���Ϸ���false:�������Ļ��������Ƿ��ַ� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isStrEn(String text) {
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) > 127) {
                return false;
            }
        }
        return true;
    }
    /**
     * ***************************************************** �� �ܣ��ж�һ���ַ����Ƿ�����
     * ��ڲ�����param ch:���жϵ��ַ� ���ڲ����� �� �أ�return true�����֣�false:������ <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isCharNum(char ch) {
        if (ch > 47 && ch < 58) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�һ���ַ����Ƿ��з����ֵ��ַ� ��ڲ�����param str:���жϵ��ַ��� ���ڲ����� �� �أ�return
     * true��Null���߲�ȫ�����֣�false:ȫ������ <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isStrNum(String str) {
        if (isStrEmpty(str)) {
            return true;
        }
        boolean notNum = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharNum(str.charAt(i))) {
                notNum = true;
            }
        }
        return !notNum;
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�һ���ַ����Ƿ��з����ֵ��ַ� ��ڲ�����param strSrc:���жϵ��ַ��� ���ڲ����� �� �أ�return
     * true��ȫ�����֣�false:��ȫ������ <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isNum(String strSrc) throws Exception {
        for (int i = 0; i < strSrc.length(); i++) {
            if (!isCharNum(strSrc.charAt(i)))
                return false;
        }
        return true;
    }
    /**
     * ***************************************************** �� �ܣ��ж�һ���ַ��Ƿ���Ӣ����ĸ
     * ��ڲ�����param ch:���жϵ��ַ� ���ڲ����� �� �أ�return true����Ӣ����ĸ��false:����Ӣ����ĸ <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isCharLetter(char ch) {
        if ((ch >= 65 && ch <= 90) && (ch >= 97 && ch <= 122)) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** �� �ܣ��ж�һ���ַ����Ƿ�ȫ��Ӣ����ĸ
     * ��ڲ�����param str:���жϵ��ַ��� ���ڲ����� �� �أ�return true��NULL���з�Ӣ����ĸ��false:ȫ��Ӣ����ĸ
     * <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean isStrLetter(String str) {
        if (isStrEmpty(str))
            return true;
        boolean notLetter = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharLetter(str.charAt(i))) {
                notLetter = true;
            }
        }
        return !notLetter;
    }
    /**
     * ***************************************************** ��
     * �ܣ���������ַ���ȡ����һ���ַ����� ��ڲ�����param src:������ַ��� ���ڲ����� �� �أ�return
     * ��������ַ���ȡ����һ���ַ����� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static char strToChar(String src) {
        src = src.trim();
        char result = src.charAt(0);
        return result;
    }
    /**
     * ***************************************************** ��
     * �ܣ���������ַ���ת�ɶ�Ӧ��ASCII�봮 ��ڲ�����param sql:�������sql������ ���ڲ����� �� �أ��������ַ��� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String encodeSQL(String sql) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < sql.length(); i++) {
            tempBuff.append(Integer.toHexString(sql.charAt(i)));
        }
        return tempBuff.toString();
    }
    /**
     * ***************************************************** ��
     * �ܣ��������ASCII�봮����Ϊ��Ӧ���ַ��� ��ڲ�����param encoded:��������ַ��� ���ڲ����� �� �أ��������ַ��� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String decodeSQL(String encoded) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < encoded.length(); i += 2) {
            tempBuff.append((char) Integer.parseInt(
                    encoded.substring(i, i + 2), 16));
        }
        return tempBuff.toString();
    }
    /**
     * ***************************************************** �� �ܣ���ȡ���·��
     * ��ڲ�����param path1:����·����param context1:������ ���ڲ����� �� �أ�return ���·�� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String getAbsolutePath(String path1, String context1) {
        int i1 = path1.indexOf(context1);
        if (i1 < 0) {
            return path1;
        } else {
            return path1.substring(path1.indexOf(context1) + context1.length());
        }
    }
    /**
     * ***************************************************** �� �ܣ���ȡ�Ӵ� ��ڲ�����param
     * str1:��ȡ�Ӵ����ַ�����param sindex:��ʼλ�ã�param eindex:����λ�� ���ڲ����� ��
     * �أ����ش���ʼλ�ÿ�ʼ����λ�ý������Ӵ����������λ��С��0���򷵻ش���ʼλ�ÿ�ʼ���Ӵ� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String getSubString(String str1, int sindex, int eindex) {
        if (str1 == null) {
            return "";
        }
        if (str1.trim().length() <= 0)
            return "";
        if (str1.length() > sindex) {
            if (eindex >= 0)
                return str1.substring(sindex, eindex);
            else if (eindex < 0)
                return str1.substring(sindex);
        }
        return "";
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ����������䵽ָ���Ĵ�С��������ÿմ����� ��ڲ�����param strs:��������ַ������飬param size1:���������鳤��
     * ���ڲ����� �� �أ�return �������ַ������� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[] getValues(String[] strs, int size1) {
        String[] strs1 = new String[size1];
        for (int i = 0; i < size1; i++) {
            strs1[i] = "";
        }
        if (strs == null) {
            return strs1;
        } else {
            if (strs.length < size1) {
                for (int i = 0; i < strs.length; i++) {
                    strs1[i] = strs[i];
                }
                return strs1;
            } else {
                return strs;
            }
        }
    }
    /**
     * ***************************************************** �� �ܣ��ַ���ȫ���滻����
     * ��ڲ�����param strSource ���滻���ַ�����param strFrom Դ�ַ�����param strTo Ŀ���ַ��� ���ڲ����� ��
     * �أ��滻����ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String replaceStrAll(String strSource, String strFrom,
                                       String strTo) {
        String strDest = "";
        int intFromLen = strFrom.length();
        int intPos;
        while ((intPos = strSource.indexOf(strFrom)) != -1) {
            strDest = strDest + strSource.substring(0, intPos);
            strDest = strDest + strTo;
            strSource = strSource.substring(intPos + intFromLen);
        }
        strDest = strDest + strSource;
        return strDest;
    }
    public static String replaceStr(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            iIndex = strTarget.indexOf('\n');
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж��ַ����������Ƿ��и��ַ��� ��ڲ�����param str1 ��Ѱ�ҵ��ַ�����param strarray ��Ѱ�ҵ��ַ������飬
     * ���ڲ����� �� �أ�return true������;false��δ���� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static boolean includestr(String str1, String[] strarray) {
        if (strarray == null || strarray.length <= 0)
            return false;
        for (int i = 0; i < strarray.length; i++) {
            if (strarray[i] == null) {
                if (str1 == null)
                    return true;
                else
                    continue;
            }
            if (strarray[i].trim().equals(str1)) {
                return true;
            }
        }
        return false;
    }
    /**
     * ***************************************************** ��
     * �ܣ���\n��Ϊ�ָ��������ַ����ָ������飬��ȥ��\r ��ڲ�����param fvalue ��ת�����ַ��� ���ڲ����� �� �أ�return
     * ת��������� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[] getAreaValues(String fvalue) {
        String tmpstr = fvalue;
        int i = 0;
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return null;
        while (tmpstr.indexOf("\n") >= 0) {
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (tmpstr.trim().equals("")) {
            i--;
        }
        String[] fvalues = new String[i + 1];
        tmpstr = fvalue;
        i = 0;
        while (tmpstr.indexOf("\n") >= 0) {
            fvalues[i] = tmpstr.substring(0, tmpstr.indexOf("\n"));
            if (fvalues[i].indexOf("\r") >= 0)
                fvalues[i] = fvalues[i].substring(0, fvalues[i].indexOf("\r"));
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (!tmpstr.trim().equals(""))
            fvalues[i] = tmpstr;
        return fvalues;
    }
    /**
     * ***************************************************** �� �ܣ����ַ����е�|ת�ɴ�\n
     * ��ڲ�����param fvalue ��ת�����ַ��� ���ڲ����� �� �أ�ת������ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String getrealAreaValues(String fvalue) {
        String tmpstr = fvalue;
        String returnstr = "";
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return "";
        while (tmpstr.indexOf("|") > 0) {
            returnstr += tmpstr.substring(0, tmpstr.indexOf("|")) + "\n";
            tmpstr = tmpstr.substring(tmpstr.indexOf("|") + 1);
        }
        return returnstr;
    }
    /**
     * ***************************************************** ��
     * �ܣ������ַ����к��е�ָ���ַ��ĸ��� ��ڲ�����param strInput ��������ַ�����param chr ��Ѱ�ҵ��ַ� ���ڲ����� ��
     * �أ�return ������ַ����� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static int countChar(String strInput, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        if (strInput.trim().length() == 0)
            return 0;
        // ����ָ�����ٸ��ַ���
        for (int i = 0; i < strInput.length(); i++) {
            chrTmp = strInput.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        return iCount;
    }
    /**
     * ***************************************************** �� �ܣ�����ά����ת��һ���ַ����ͳ�
     * ��ڲ�����param strs ��ת�����ַ������� ���ڲ����� �� �أ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String strArrayToStr(String[] strs) {
        return strArrayToStr(strs, null);
    }
    /**
     * ***************************************************** �� �ܣ����еĴ�ӡ���ַ������������
     * ��ڲ�����param strs ����ӡ���ַ������� ���ڲ����� �� �أ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static void printStrs(String[] strs) {
        for (int i = 0; i < strs.length; i++) {
            System.out.println(strs[i]);
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ���ά�����У�һά���еĴ�ӡ���ַ������������ ��ڲ�����param strs ����ӡ�Ķ�ά�ַ������� ���ڲ����� �� �أ��� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static void printDualStr(String[][] dualStr) {
        for (int i = 0; i < dualStr.length; i++) {
            for (int j = 0; j < dualStr[i].length; j++) {
                System.out.print(dualStr[i][j] + " ");
            }
            System.out.println();
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ�����ά��������ߵ������б�Ϊ�У����б�Ϊ�� ��ڲ�����param dualStr ����Ķ�ά���� ���ڲ����� �� �أ�return
     * �ߵ���Ķ�ά���� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[][] rowToColumn(String[][] dualStr) {
        String[][] returnDualStr = null;
        if (dualStr != null) {
            returnDualStr = new String[dualStr[0].length][dualStr.length];
            for (int i = 0; i < dualStr.length; i++)
                for (int j = 0; j < dualStr[0].length; j++)
                    returnDualStr[j][i] = dualStr[i][j];
        }
        return returnDualStr;
    }
    /**
     * ***************************************************** ��
     * �ܣ���Ҫ��ֵ��ҳ����ʾ���String�����е������ַ�����ת��� ��ڲ�����param inStr ������ַ��� ���ڲ����� �� �أ�return
     * ���ת�������ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String latinString(String inStr) {
        String res = inStr;
        if (null == res)
            return null;
        res = replaceStrAll(res, "\"", "\\\"");
        res = replaceStrAll(res, "'", "\\'");
        return res;
    }
    /**
     * ***************************************************** �� �ܣ����ַ������пո��滻��ָ����
     * ��ڲ�����param String strTarget, String strNew ���ڲ����� �� �أ�return String
     * �����ѱ��滻���ִ� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String replaceWhiteSpace(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            char cRep = 32;
            iIndex = strTarget.indexOf(cRep);
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    /**
     * ***************************************************** ��
     * �ܣ�������д�ɷ���Ҫ���С����λ����ֻȥ�������С����λ��������չλ���� ��ڲ�����param amount ����Ľ��, param
     * length ָ����С��λ���� ���ڲ����� �� �أ�return ���ת�������ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String double2str(double amount, int length) {
        String strAmt = Double.toString(amount);
        int pos = strAmt.indexOf('.');
        if (pos != -1 && strAmt.length() > length + pos + 1)
            strAmt = strAmt.substring(0, pos + length + 1);
        return strAmt;
    }
    /**
     * ***************************************************** ��
     * �ܣ�����chr�ָ��ַ�������ΪString���Դ���split��֧����"|"Ϊ�ָ���� ��ڲ�����param str ��Ҫ���ָ�Ĵ�,param
     * chr �ָ���� ���ڲ����� �� �أ�return String[] �ָ����ַ�������,���������һ��|������ַ��� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[] doSplit(String str, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        // ����ָ�����ٸ��ַ���
        for (int i = 0; i < str.length(); i++) {
            chrTmp = str.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        String[] strArray = new String[iCount];
        for (int i = 0; i < iCount; i++) {
            int iPos = str.indexOf(chr);
            if (iPos == 0) {
                strArray[i] = "";
            } else {
                strArray[i] = str.substring(0, iPos);
            }
            str = str.substring(iPos + 1); // ��iPos+1������,str��������С
        }
        return strArray;
    }
    /**
     * ***************************************************** ��
     * �ܣ�����s�ָ��ַ�������ΪString���Դ���split��֧����"|"Ϊ�ָ���� ��ڲ�����param str ��Ҫ���ָ�Ĵ�,param s
     * �ָ��ַ��� ���ڲ����� �� �أ�return String[] �ָ����ַ�������,�������һ��|������ַ��� <p/>
     * ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[] strSplit(String src, String splitchar) {
        int resultSize = 0;
        int len = src.length();
        int idx = 0;
        String strTemp = "";
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                resultSize++;
            }
        }
        if ((len > 1) & (!src.substring(len - 1, len).equals(splitchar))) {
            resultSize++;
        }
        String result[] = new String[resultSize];
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                result[idx] = strTemp;
                idx++;
                strTemp = "";
            } else {
                strTemp = String.valueOf(strTemp)
                        + String.valueOf(src.charAt(i));
            }
        }
        if (!strTemp.equals("")) {
            result[idx] = strTemp;
        }
        return result;
    }
    /**
     * ***************************************************** ��
     * �ܣ�����strSeparator�ָ��ַ�����ֻ�ָ���ָ����С���ַ��� ��ڲ�����param strToSplit ��Ҫ���ָ�Ĵ�,param
     * strSeparator �ָ��ַ���,param iLimit ָ����С ���ڲ����� �� �أ�return String[] �ָ����ַ�������
     * <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String[] split(String strToSplit, String strSeparator,
                                 int iLimit) {
        ArrayList tmpList = new ArrayList();
        int iFromIndex = 0;
        int iCurIndex = strToSplit.length();
        String strUnitInfo = "";
        int iCurCounts = 0;
        while ((iCurIndex != -1) && (iFromIndex < strToSplit.length())
                && (iCurCounts < iLimit)) {
            iCurIndex = strToSplit.indexOf(strSeparator, iFromIndex);
            if (iCurIndex == -1) {
                strUnitInfo = strToSplit.substring(iFromIndex, strToSplit
                        .length());
            } else {
                strUnitInfo = strToSplit.substring(iFromIndex, iCurIndex);
                iFromIndex = iCurIndex + 1;
            }
            tmpList.add(strUnitInfo);
            iCurCounts++;
        }
        int iCounts = tmpList.size();
        String tmpArray[] = new String[iCounts];
        for (int i = 0; i < iCounts; i++) {
            tmpArray[i] = (String) tmpList.get(i);
        }
        return tmpArray;
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ�����С��ָ�����ȣ�����IJ�����...���� ��ڲ�����param src ��Ҫ������Ĵ�,param len ָ����С ���ڲ����� ��
     * �أ�return String ��С��ָ�����ȣ�����IJ�����...�������ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String strIntercept(String src, int len) {
        if (src == null) {
            return "";
        }
        if (src.length() > len) {
            src = String.valueOf(String.valueOf(src.substring(0, len))).concat(
                    "...");
        }
        return src;
    }
    /**
     * ***************************************************** ��
     * �ܣ����ַ���ת��ISO8859_1���� ��ڲ�����param str_in Ҫ��������ַ����� ���ڲ����� �� �أ�return String
     * ת������ַ����� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public static String strtochn(String str_in) {
        try {
            String temp_p = str_in;
            if (temp_p == null) {
                temp_p = "";
            }
            String temp = "";
            if (!temp_p.equals("")) {
                byte[] byte1 = temp_p.getBytes("ISO8859_1");
                temp = new String(byte1);
            }
            return temp;
        } catch (Exception e) {
        }
        return "null";
    }
    /**
     * ***************************************************** ��
     * �ܣ���ISO8859_1�ַ���ת��GBK���� ��ڲ�����param strvalue Ҫ��������ַ����� ���ڲ����� �� �أ�return
     * String ת������ַ����� �޸ı�ע��
     * ******************************************************
     */
    public static String ISO2GBK(String strvalue) {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * ***************************************************** ��
     * �ܣ���ҳ��Ҫ��ʾ���Ķ�����б���ת�� ��ڲ�����param str Ҫ��������ַ����� ���ڲ����� �� �أ�return String
     * ת������ַ����� �޸ı�ע�� ******************************************************
     */
    public static String cnCodeTrans(String str) {
        String s = "";
        try {
            s = new String(str.getBytes("GB2312"), "8859_1");
        } catch (UnsupportedEncodingException a) {
            System.out.print("chinese thansform exception");
        }
        return s;
    }
    /**
     * ***************************************************** ��
     * �ܣ��ж�Դ���Ƿ���Ϲ�������STaaaa����ST****** ��ڲ�����param strSourceҪ��������ַ�����param
     * strRule���� ���ڲ����� �� �أ�return false:Դ����ƥ�����true:Դ��ƥ����� �޸ı�ע��
     * ******************************************************
     */
    public static boolean judgeMatch(String strSource, String strRule) {
        int i = 0;
        // Դ�������ж�
        if ((null == strSource) || (strSource.length() == 0))
            return false;
        // ���򴮳����ж�
        if ((null == strRule) || (strRule.length() == 0))
            return false;
        // ���Ȳ��ɳ���
        if (strSource.length() > strRule.length())
            return false;
        // ÿһλ���ж�
        for (i = 0; i < strRule.length(); i++) {
            // Դ���ȹ��򴮶�
            if (strSource.length() < i + 1) {
                break;
            }
            if ((strRule.charAt(i) != '*')
                    && (strSource.charAt(i) != strRule.charAt(i))) {
                return false;
            }
        }
        // ����Դ���ȹ��򴮶̵�����������򴮺��Ǿ�Ϊ'*'����ƥ�䲻��
        for (; i < strRule.length(); i++) {
            if (strRule.charAt(i) != '*')
                return false;
        }
        return true;
    }
    public static String column2Property(String column) {
        column = column.toLowerCase();
        int i = column.indexOf("_");
        while (i != -1) {
            if (i != column.length() - 1) {
                char temp = column.charAt(i + 1);
                String strTemp = String.valueOf(temp);
                column = column.replaceFirst("_" + strTemp, strTemp
                        .toUpperCase());
                i = column.indexOf("_");
            } else {
                break;
            }
        }
        return column;
    }
    public static String strArrayToStr(String[] strs, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (strs == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < strs.length; i++) {
            returnstr.append(strs[i]);
            if (i < strs.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String objectArrayToStr(Object[] objects, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (objects == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < objects.length; i++) {
            returnstr.append(String.valueOf(objects[i]));
            if (i < objects.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String listToStr(List element, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (element == null)
            return "";
        if (separator == null)
            separator = "";
        Iterator it = element.iterator();
        while (it.hasNext()) {
            returnstr.append(String.valueOf(it.next()));
            if (it.hasNext())
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String[] listToStrArray(List element) {
        if (element == null || element.size() == 0)
            return null;
        Iterator it = element.iterator();
        String[] strArray = new String[element.size()];
        int i = 0;
        while (it.hasNext()) {
            strArray[i] = String.valueOf(it.next());
            i++;
        }
        return strArray;
    }
    public static List strToList(String str, String separator) {
        if (str == null || str.equals(""))
            return null;
        if (separator == null)
            separator = "";
        String[] strArr = str.split(separator);
        int size = strArr.length;
        List list = new ArrayList();
        for (int i = 0; i < size; i++) {
            list.add(strArr[i]);
        }
        return list;
    }
    public static StringBuffer populate(StringBuffer bf, String value,
                                        boolean isNotLast) {
        if (value == null) {
            return bf;
        }
        // ���ַ�����ÿ���������滻�����������ţ�ע�⣺����˫���ţ�����SQL����ѯ������
        System.out.println(value.replaceAll("'", "''"));
        bf.append("'").append(value.replaceAll("'", "''")).append("'");
        if (isNotLast)
            bf.append(",");
        return bf;
    }
    public static boolean isExist(String str, String substr, String sepatator) {
        if (str == null || str.trim().equals(""))
            return false;
        if (substr == null || substr.trim().equals(""))
            return false;
        String[] strArr = str.split(sepatator);
        int size = strArr.length;
        for (int i = 0; i < size; i++) {
            if (strArr[i].equals(substr))
                return true;
        }
        return false;
    }
    public static boolean isExist(String str, String substr) {
        return isExist(str, substr, ",");
    }
    public static String leftInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return str + "%";
    }
    public static String rightInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str;
    }
    public static String include(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str + "%";
    }
    /**
     * ���һ���ַ���Ϊ�գ���ת��Ϊָ�����ַ���
     *
     * @param source String ԭ����
     * @param target String ת�������
     * @return String ���
     */
    public static String nvl(Object source, Object target) {
        return source != null ? String.valueOf(source)
                : (target != null ? String.valueOf(target) : null);
    }
    /**
     * ��clob�ֶ�ֵ����Ϊ�ַ���
     *
     * @param clobValue
     * @return
     * @throws SQLException
     */
    public static String clob2Str(Object clobValue) throws SQLException {
        return ((Clob) clobValue).getSubString(1, (int) ((Clob) clobValue)
                .length());
    }
    /**
     * ��ȡweb�ͻ�����ʵIp
     *
     * @param request
     * @return
     */
    public static String getRemoteAddr(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
    public static String hideFlowStr(String str, int maxLen) {
        if (str == null || maxLen == 0) {
            return "";
        }
        if (str.length() > maxLen) {
            str = str.substring(0, maxLen) + "...";
        }
        return str;
    }
    /**
     * ���������Ƿ�����
     *
     * @param str
     * @return
     */
    public static String escapeLuceneSpecialCharacters(String str) {
        if (str == null) {
            return null;
        }
        try {
            StringWriter writer = new StringWriter(str.length() * 2);
            escapeLuceneSpecialCharacterString(writer, str);
            return writer.toString();
        } catch (IOException ioe) {
            // this should never ever happen while writing to a StringWriter
            ioe.printStackTrace();
            return null;
        }
    }
    private static void escapeLuceneSpecialCharacterString(Writer out,
                                                           String str) throws IOException {
        if (str == null) {
            return;
        }
        int sz = str.length();
        for (int i = 0; i < sz; i++) {
            char ch = str.charAt(i);
            /*
             * Reference link:
			 * http://lucene.apache.org/java/docs/queryparsersyntax.html Lucene
			 * supports escaping special characters that are part of the query
			 * syntax. The current list special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \
			 * To escape these character use the \ before the character.
			 */
            switch (ch) {
                case '+':
                case '-':
                case '!':
                case '(':
                case ')':
                case '{':
                case '}':
                case '[':
                case ']':
                case '^':
                case '\"':
                case '~':
                case '*':
                case '?':
                case ':':
                case '\\':
                    out.write('\\');
                    out.write(ch);
                    break;
                case '&':
                case '|':
                    // check if it is '&&' or '||' ~ check if the next char is '&'
                    // or '|'
                    if ((i + 1) < sz && str.charAt(i + 1) == ch) {
                        out.write('\\');
                        out.write(ch);
                        i++;
                    }
                    out.write(ch);
                    break;
                default:
                    out.write(ch);
                    break;
            }
        }
    }
    /**
     * ȡ�ø������ֵ�����ĸ������ĸ
     */
    public static String getFirstLetter(String chinese) {
        /**
         * ��ĸ
         */
        final int[] li_SecPosValue = {1601, 1637, 1833, 2078, 2274, 2302,
                2433, 2594, 2787, 3106, 3212, 3472, 3635, 3722, 3730, 3858,
                4027, 4086, 4390, 4558, 4684, 4925, 5249, 5590};
        final String[] lc_FirstLetter = {"A", "B", "C", "D", "E", "F", "G",
                "H", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
                "W", "X", "Y", "Z"};
        if (chinese == null || chinese.trim().length() == 0) {
            return "";
        }
        chinese = conversionStr(chinese, "GB2312", "ISO8859-1");
        if (chinese.length() > 1) { // �ж��Dz��Ǻ���
            int li_SectorCode = (int) chinese.charAt(0); // ��������
            int li_PositionCode = (int) chinese.charAt(1); // �����
            li_SectorCode = li_SectorCode - 160;
            li_PositionCode = li_PositionCode - 160;
            int li_SecPosCode = li_SectorCode * 100 + li_PositionCode;// �������
            if (li_SecPosCode > 1600 && li_SecPosCode < 5590) {
                for (int i = 0; i < 23; i++) {
                    if (li_SecPosCode >= li_SecPosValue[i]
                            && li_SecPosCode < li_SecPosValue[i + 1]) {
                        chinese = lc_FirstLetter[i];
                        break;
                    }
                }
            } else {
                chinese = conversionStr(chinese, "ISO8859-1", "GB2312");
                chinese = chinese.substring(0, 1);
            }
        }
        return chinese;
    }
    private static String conversionStr(String str, String charsetName,
                                        String toCharsetName) {
        try {
            str = new String(str.getBytes(charsetName), toCharsetName);
        } catch (UnsupportedEncodingException ex) {
            ex.printStackTrace();
        }
        return str;
    }
    /**
     * �ı��༭���˷���
     *
     * @param html
     * @return
     */
    public static String checkStr(String html) {
        try {
            html = html.replaceAll("\r", "");
            html = html.replaceAll("\n", "");
            html = html.replaceAll("\"", "'");
            html = html.replaceAll("\t", " ");
            Pattern p_script;
            java.util.regex.Matcher m_script;
            Pattern p_href;
            java.util.regex.Matcher m_href;
            Pattern p_a;
            java.util.regex.Matcher m_a;
            Pattern p_on;
            java.util.regex.Matcher m_on;
            Pattern p_iframe;
            java.util.regex.Matcher m_iframe;
            Pattern p_frameset;
            java.util.regex.Matcher m_frameset;
            Pattern p_img;
            java.util.regex.Matcher m_img;
            Pattern p_p1;
            java.util.regex.Matcher m_p1;
            Pattern p_p2;
            java.util.regex.Matcher m_p2;
            String stript_str = "<script[\\s\\S]+</script *>";
            String href_str = " href *= *[\\s\\S]*script *:";
            String on_str = " on[\\s\\S]*=";
            String iframe_str = "<iframe[\\s\\S]+</iframe *>";
            String frameset_str = "<frameset[\\s\\S]+</frameset *>";
            String a_str = "<a ([^>])*>.*?</a([^>])*>";
            //String img_str = "\\<img[^\\>]+\\>";
            String p_str1 = "</p>";
            String p_str2 = "<p>";
            p_script = Pattern.compile(stript_str, Pattern.CASE_INSENSITIVE);
            m_script = p_script.matcher(html);
            html = m_script.replaceAll(""); // ����script��ǩ
            p_href = Pattern.compile(href_str, Pattern.CASE_INSENSITIVE);
            m_href = p_href.matcher(html);
            html = m_href.replaceAll(""); // ����script��ǩ
            p_a = Pattern.compile(a_str, Pattern.CASE_INSENSITIVE);
            m_a = p_a.matcher(html);
            html = m_a.replaceAll(""); // ����script��ǩ
            p_on = Pattern.compile(on_str, Pattern.CASE_INSENSITIVE);
            m_on = p_on.matcher(html);
            html = m_on.replaceAll(""); // ����script��ǩ
            p_iframe = Pattern.compile(iframe_str, Pattern.CASE_INSENSITIVE);
            m_iframe = p_iframe.matcher(html);
            html = m_iframe.replaceAll(""); // ����script��ǩ
            p_frameset = Pattern
                    .compile(frameset_str, Pattern.CASE_INSENSITIVE);
            m_frameset = p_frameset.matcher(html);
            html = m_frameset.replaceAll(""); // ����script��ǩ
            // p_img = Pattern.compile(img_str, Pattern.CASE_INSENSITIVE);
            // m_img = p_img.matcher(html);
            // html = m_img.replaceAll(""); // ����script��ǩ
            p_p1 = Pattern.compile(p_str1, Pattern.CASE_INSENSITIVE);
            m_p1 = p_p1.matcher(html);
            html = m_p1.replaceAll(""); // ����script��ǩ
            p_p2 = Pattern.compile(p_str2, Pattern.CASE_INSENSITIVE);
            m_p2 = p_p2.matcher(html);
            html = m_p2.replaceAll(""); // ����script��ǩ
        } catch (Exception e) {
            System.err.println("Html2Text: " + e.getMessage());
        }
        return html;
    }
    public static String substr(String value, int maxlength, String postfix) {
        int k = 0;
        int l = 0;
        for (int i = 0; i < value.length() && maxlength > l * 2 + k; i++) {
            if (value.charAt(i) > '\200') {
                l++;
            } else {
                k++;
            }
        }
        // value����������Ϊ�����ַ���
        if (l + k >= value.length()) {
            return value;
        } else if (maxlength >= l * 2 + k && l + k > 0) {
            value = value.substring(0, l + k);
        } else if (l + k > 0) {
            value = value.substring(0, (l + k) - 1);
        } else {
            return value;
        }
        // ��ָ���޶���ʾ����ʱ����ȡָ�����ȵ��ַ�����Ϊ���
        if (!StringUtils.isEmpty(postfix)) {
            value += postfix;
        }
        return value;
    }
    public static void main(String[] args) {
        String str = "���!";
    }
    /**
     * ***************************************************** ��
     * �ܣ����紫����ַ�����null��ת�ɿմ������򷵻�ԭ�ַ��� ��ڲ�����param Content:��ת�����ַ��� ���ڲ����� ��
     * �أ�����ַ�����null��ת�ɿմ������򷵻�ԭ�ַ��� <p/> ��д���ڣ�20051220 �޸ı�ע��
     * ******************************************************
     */
    public String nullToSpace(String Content) {
        if (Content == null) {
            Content = "";
        }
        return Content;
    }
    /**
     * ***************************************************** ��
     * �ܣ���GBK�ַ���ת��ISO8859_1���� ��ڲ�����param strvalue Ҫ��������ַ����� ���ڲ����� �� �أ�return
     * String ת������ַ����� �޸ı�ע��
     * ******************************************************
     */
    public String GBK2ISO(String strvalue) throws Exception {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("GBK"), "ISO8859_1");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
}

+ 35 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/model/DataSource.java

@ -0,0 +1,35 @@
package com.yihu.hos.ws.model;
/**
 * Created by hzp on 2016/2/26.
 */
public class DataSource {
    private String id;
    private String name;
    private String config;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getConfig() {
        return config;
    }
    public void setConfig(String config) {
        this.config = config;
    }
}

+ 48 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/model/User.java

@ -0,0 +1,48 @@
package com.yihu.hos.ws.model;
import java.io.Serializable;
import java.util.Date;
public class User implements Serializable {
    private static final long serialVersionUID = -5939599230753662529L;
    private Long              userId;
    private String            username;
    private String            email;
    private Date gmtCreate;
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    public Long getUserId() {
        return userId;
    }
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public Date getGmtCreate() {
        return gmtCreate;
    }
    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }
}

+ 154 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/model/WSReturnModel.java

@ -0,0 +1,154 @@
package com.yihu.hos.ws.model;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2016/5/23.
 */
public class WSReturnModel {
    private String TransactionCode;
    private List<Map<String, Object>> Data = new ArrayList<Map<String, Object>>();
    private String RespCode = "10000";
    private String RespMessage = "成功";
    public String getTransactionCode() {
        return TransactionCode;
    }
    public void setTransactionCode(String transactionCode) {
        TransactionCode = transactionCode;
    }
    public List<Map<String, Object>> getData() {
        return Data;
    }
    public void setData(List<Map<String, Object>> data) {
        Data = data;
    }
    public String getRespMessage() {
        return RespMessage;
    }
    public void setRespMessage(String respMessage) {
        RespMessage = respMessage;
    }
    public static String toXml(WSReturnModel wsReturnModel) {
        String root = "Resg";
        String transactionCode = "TransactionCode";
        String respMessage = "RespMessage";
        String data = "Data";
        String respCode = "RespCode";
        Document document = DocumentHelper.createDocument();
        Element rootElement = DocumentHelper.createElement(root);
        //添加TransactionCode
        Element transactionCodeElement = DocumentHelper.createElement(transactionCode);
        transactionCodeElement.addText(wsReturnModel.getTransactionCode());
        rootElement.add(transactionCodeElement);
        //添加RespMessage
        Element respMessageElement = DocumentHelper.createElement(respMessage);
        respMessageElement.addText(wsReturnModel.getRespMessage());
        rootElement.add(respMessageElement);
        //respCode
        Element respCodeElement = DocumentHelper.createElement(respCode);
        respCodeElement.addText(wsReturnModel.getRespCode());
        rootElement.add(respCodeElement);
        //添加Data
        for (Map<String, Object> map : wsReturnModel.getData()) {
            Element dataElement = DocumentHelper.createElement(data);
            for (Map.Entry<String, Object> e : map.entrySet()) {
                if ("data_1".equals(e.getKey().toLowerCase())) {
                    //判断是否是data1
                    Element elemenData1Temp = DocumentHelper.createElement("Data_1");
                    List<Map<String,Object>> list= (List<Map<String, Object>>) e.getValue();
                    for(Map<String,Object> one:list){
                        for (Map.Entry<String, Object> dataE : one.entrySet()) {
                            Element elemenData1TempElement = DocumentHelper.createElement(toUpperCaseFirstOne(dataE.getKey()));
                            if (!StringUtils.isEmpty(e.getValue())) {
                                elemenData1TempElement.addText(dataE.getValue().toString());
                            }
                            elemenData1Temp.add(elemenData1TempElement);
                        }
                    }
                    dataElement.add(elemenData1Temp);
                } else {
                    // Element elemenTemp = DocumentHelper.createElement(toUpperCaseFirstOne(e.getKey()));
                    Element elemenTemp = DocumentHelper.createElement(toUpperCaseFirstOne(e.getKey()));
                    if (!StringUtils.isEmpty(e.getValue())) {
                        elemenTemp.addText(e.getValue().toString());
                    }
                    dataElement.add(elemenTemp);
                }
            }
            rootElement.add(dataElement);
        }
        document.setRootElement(rootElement);
        System.out.println(document.asXML());
        return document.asXML();
    }
    public static String toUpperCaseFirstOne(String name) {
        char[] ch = name.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            if (i == 0) {
                ch[0] = Character.toUpperCase(ch[0]);
            } else {
                ch[i] = Character.toLowerCase(ch[i]);
            }
        }
        StringBuffer a = new StringBuffer();
        a.append(ch);
        return underlineToCamel(a.toString());
    }
    public static String underlineToCamel(String param) {
        if (param == null || "".equals(param.trim())) {
            return "";
        }
        int len = param.length();
        StringBuilder sb = new StringBuilder(len);
        for (int i = 0; i < len; i++) {
            char c = param.charAt(i);
            if (c=='_') {
                if (++i < len) {
                    sb.append(Character.toUpperCase(param.charAt(i)));
                }
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
    public static void main(String[] args) {
        System.out.println(underlineToCamel("asd_a"));
    }
    public String getRespCode() {
        return RespCode;
    }
    public void setRespCode(String respCode) {
        RespCode = respCode;
    }
    @Override
    public String toString() {
        return "WSReturnModel{" +
                "TransactionCode='" + TransactionCode + '\'' +
                ", Data=" + Data +
                ", RespCode='" + RespCode + '\'' +
                ", RespMessage='" + RespMessage + '\'' +
                '}';
    }
}

+ 264 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/service/ExcuteService.java

@ -0,0 +1,264 @@
package com.yihu.hos.ws.service;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.hos.resource.util.StringUtil;
import com.yihu.hos.ws.model.DataSource;
import com.yihu.hos.ws.model.WSReturnModel;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2016/5/19.
 */
public class ExcuteService {
    public static JdbcTemplate jdbcTemplate = null;
    public void initJDBC() throws Exception {
        if (jdbcTemplate == null) {
            //jdbc:oracle:thin:hos/hos@//172.19.103.71:1521/orcl
            //jdbc:mysql://172.19.103.71:1521/orcl?user=hos&password=hos&useUnicode=true&characterEncoding=UTF-8
            //jdbc:sqlserver://172.19.103.71:1521/orcl?user=hos&password=hos
            DBHelper dbTemp = new DBHelper();
            DataSource source = dbTemp.load(DataSource.class, "select * from system_datasource");
            String config = source.getConfig();
            BasicDataSource dasicDataSource = new BasicDataSource();
            if (config.contains("oracle")) {
                //oracle数据库
                dasicDataSource.setUrl(source.getConfig());
                dasicDataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
                String[] s1 = config.split("@");
                String[] s2 = s1[0].split(":");
                String[] s3 = s2[3].split("/");
                dasicDataSource.setUsername(s3[0]);
                dasicDataSource.setPassword(s3[1]);
            } else if (config.contains("mysql")) {
                //mysql数据库
                dasicDataSource.setUrl(source.getConfig());
                dasicDataSource.setDriverClassName("com.mysql.jdbc.Driver");
                String[] s1 = config.split("\\?");
                String[] s2 = s1[1].split("&");
                dasicDataSource.setUsername(s2[0].split("=")[1]);
                dasicDataSource.setPassword(s2[1].split("=")[1]);
            } else if (config.contains("sqlserver")) {
                //sqlserver数据库
                dasicDataSource.setUrl(source.getConfig());
                dasicDataSource.setDriverClassName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                String[] s1 = config.split("\\?");
                String[] s2 = s1[1].split("&");
                dasicDataSource.setUsername(s2[0].split("=")[1]);
                dasicDataSource.setPassword(s2[1].split("=")[1]);
            }
            jdbcTemplate = new JdbcTemplate();
            jdbcTemplate.setDataSource(dasicDataSource);
            System.out.println(jdbcTemplate.queryForMap("select 1 from dual"));
        }
    }
    /**
     * 执行sql语句
     *
     * @param sql
     * @return
     */
    public String excuteSQL(String TransactionCode,
                            String sql) {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            initJDBC();
            wsReturnModel.setData(jdbcTemplate.queryForList(sql));
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e1) {
            wsReturnModel.setRespCode("-30000");
            wsReturnModel.setRespMessage(e1.getMessage());
            return WSReturnModel.toXml(wsReturnModel);
        }
    }
    /**
     * 获取检查报告单的列表
     *
     * @param cardType
     * @param cardNo
     * @param startDate
     * @param endDate
     * @param mobile
     * @param reportType 1是检查 2是检验
     * @return
     */
    public String GetReportList(
            String TransactionCode,
            String cardType,
            String cardNo,
            String startDate,
            String endDate,
            String mobile,
            String reportType) {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            initJDBC();
            if ("2".equals(reportType)) {
                //检验
                StringBuffer sb = new StringBuffer("select * from HDSD02_01 where 1=1 ");
                if (!StringUtils.isEmpty(endDate)) {
                    sb.append(" and HDSD00_05_026 < '" + endDate + "'");
                }
                if (!StringUtils.isEmpty(startDate)) {
                    sb.append(" and HDSD00_01_001 > '" + startDate + "'");
                }
                if (!StringUtils.isEmpty(mobile)) {
                    sb.append(" and HDSD00_01_001 = '" + mobile + "'");
                }
                if (!StringUtils.isEmpty(cardNo)) {
                    sb.append(" and HDSD00_01_001 = '" + cardNo + "'");
                }
                if (!StringUtils.isEmpty(cardType)) {
                    sb.append(" and HDSD00_01_001 = '" + cardType + "'");
                }
                wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            } else {
                //检查
                StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
                if (!StringUtils.isEmpty(endDate)) {
                    sb.append(" and HDSD00_05_026 < '" + endDate + "'");
                }
                if (!StringUtils.isEmpty(startDate)) {
                    sb.append(" and HDSD00_01_001 > '" + startDate + "'");
                }
                if (!StringUtils.isEmpty(mobile)) {
                    sb.append(" and HDSD00_01_001 = '" + mobile + "'");
                }
                if (!StringUtils.isEmpty(cardNo)) {
                    sb.append(" and HDSD00_01_001 = '" + cardNo + "'");
                }
                if (!StringUtils.isEmpty(cardType)) {
                    sb.append(" and HDSD00_01_001 = '" + cardType + "'");
                }
                wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            }
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setRespCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
            e.printStackTrace();
            return WSReturnModel.toXml(wsReturnModel);
        }
    }
    /**
     * 检查报告单/检验报告单明细
     *
     * @param reportId
     * @param reportType //报告单类型
     * @return
     */
    public String GetReportInfo(
            String TransactionCode,
            String reportId,
            String reportType) {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            initJDBC();
            if ("1".equals(reportType)) {
                //检验
                StringBuffer sb = new StringBuffer("select * from REPORT_JY where 1=1 ");
                if (!StringUtils.isEmpty(reportId)) {
                    sb.append(" and REPORT_ID = '" + reportId + "'");
                }
                List<Map<String, Object>> returnData = jdbcTemplate.queryForList(sb.toString());
                for (Map<String, Object> oneM : returnData) {
                    //检验-图片报告单
                    sb = new StringBuffer("select * from REPORT_JY_MX where 1=1 ");
                    if (!StringUtils.isEmpty(oneM.get("REPORT_ID"))) {
                        sb.append(" and REPORT_ID = '" + reportId + "'");
                    }
                    oneM.put("Data_1", jdbcTemplate.queryForList(sb.toString()));
                }
                wsReturnModel.setData(returnData);
            } else {
                //检查
                StringBuffer sb = new StringBuffer("select * from REPORT_JC where 1=1 ");
                if (!StringUtils.isEmpty(reportId)) {
                    sb.append(" and REPORT_ID = '" + reportId + "'");
                }
                List<Map<String, Object>> returnData = jdbcTemplate.queryForList(sb.toString());
                wsReturnModel.setData(returnData);
            }
            System.out.println(wsReturnModel);
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setRespCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
            e.printStackTrace();
            return WSReturnModel.toXml(wsReturnModel);
        }
    }
    /**
     * 人口学信息查询
     *
     * @param TransactionCode
     * @param CardType
     * @param CardNo
     * @param Mobile
     * @param PatientId
     * @return
     */
    public String QueryUserInfo(String TransactionCode, String CardType, String CardNo, String Mobile, String PatientId) {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            initJDBC();
            //人口学信息
            StringBuffer sb = new StringBuffer("select * from PATIENT_INFO a where 1=1 ");
            if (!StringUtil.isEmpty(CardNo)) {
                sb.append(" and a.CARD_NO = '" + CardNo + "'");
            }
            if (!StringUtil.isEmpty(CardType)) {
                sb.append(" and a.CARD_TYPE = '" + CardType + "'");
            }
            List<Map<String, Object>> RKXMap = jdbcTemplate.queryForList(sb.toString());
            wsReturnModel.setData(RKXMap);
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setRespCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
            e.printStackTrace();
            return WSReturnModel.toXml(wsReturnModel);
        }
    }
    public String QueryRegInfo(String TransactionCode, String CardType,String CardNo, String IdCardNo, String OrderId, String ClinicCard, String TimeSlice, String StartTime, String EndTime, String RegFlag) {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            initJDBC();
            //预约信息查询
            StringBuffer sb = new StringBuffer("select * from REG_INFO a where 1=1 ");
            if (!StringUtil.isEmpty(CardNo)) {
                sb.append(" and a.CARD_NO = '" + CardNo + "'");
            }
            if (!StringUtil.isEmpty(CardType)) {
                sb.append(" and a.CARD_TYPE = '" + CardType + "'");
            }
            List<Map<String, Object>> RKXMap = jdbcTemplate.queryForList(sb.toString());
            wsReturnModel.setData(RKXMap);
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setRespCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
            e.printStackTrace();
            return WSReturnModel.toXml(wsReturnModel);
        }
    }
}

+ 150 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/service/ServiceGateWay.java

@ -0,0 +1,150 @@
package com.yihu.hos.ws.service;
import com.yihu.hos.resource.util.StringUtil;
import com.yihu.hos.ws.model.WSReturnModel;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Created by Administrator on 2016/5/19.
 */
@javax.jws.WebService(endpointInterface = "com.yihu.hos.ws.service.ServiceGateWayPortType",
        targetNamespace = "http://com.yihu.wsgw/ServiceGateWay",
        serviceName = "ServiceGateWay",
        portName = "ServiceGateWayHttpPort")
public class ServiceGateWay implements ServiceGateWayPortType {
    private ExcuteService excuteService = new ExcuteService();
    /**
     * 执行sql语句
     *
     * @param sql
     * @return
     */
//    public String excuteSQL(String TransactionCode,
//                            String sql) {
//
//        return excuteService.excuteSQL(TransactionCode, sql);
//
//    }
    public static String replaceBlank(String str) {
        String dest = "";
        if (str != null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
    public String service(String authInfo, String sequenceNo, String api, String param, int paramType, int outType, String v) {
        System.out.println("authInfo:" + authInfo);
        System.out.println("sequenceNo:" + sequenceNo);
        System.out.println("api,:" + api);
        System.out.println("param:" + param);
        System.out.println("paramType:" + paramType);
        System.out.println("outType:" + outType);
        System.out.println("v:" + v);
        WSReturnModel wsReturnModel = new WSReturnModel();
        String xml = "";
        try {
            switch (api) {
                case "basic.BasicApi.QueryUserInfo": {
                    Document document = DocumentHelper.parseText(param.trim());
                    Element root = document.getRootElement();
                    Element data = root.element("Data");
                    xml = excuteService.QueryUserInfo(
                            StringUtil.isEmpty(root.element("TransactionCode").getText()) ? "" : root.element("TransactionCode").getText(),
                            StringUtil.isEmpty(data.element("CardType").getText()) ? "" : data.element("CardType").getText(),
                            StringUtil.isEmpty(data.element("CardNo").getText()) ? "" : data.element("CardNo").getText(),
                            StringUtil.isEmpty(data.element("Mobile").getText()) ? "" : data.element("Mobile").getText(),
                            StringUtil.isEmpty(data.element("PatientId").getText()) ? "" : data.element("PatientId").getText());
                    break;
                }
                case "report.ReportWs.GetReportInfo": {
                    Document document = DocumentHelper.parseText(param.trim());
                    Element root = document.getRootElement();
                    Element data = root.element("Data");
                    xml = excuteService.GetReportInfo(
                            StringUtil.isEmpty(root.element("TransactionCode").getText()) ? "" : root.element("TransactionCode").getText(),
                            StringUtil.isEmpty(data.element("ReportId").getText()) ? "" : data.element("ReportId").getText(),
                            StringUtil.isEmpty(data.element("ReportType").getText()) ? "" : data.element("ReportType").getText()
                    );
                    break;
                }
                case "yy.yygh.QueryRegInfo": {
                    Document document = DocumentHelper.parseText(param.trim());
                    Element root = document.getRootElement();
                    Element data = root.element("Data");
                    xml = excuteService.QueryRegInfo(
                            StringUtil.isEmpty(root.element("TransactionCode").getText()) ? "" : root.element("TransactionCode").getText(),
                            StringUtil.isEmpty(data.element("CardType").getText()) ? "" : data.element("CardType").getText(),
                            StringUtil.isEmpty(data.element("CardNo").getText()) ? "" : data.element("CardNo").getText(),
                            StringUtil.isEmpty(data.element("IdCardNo").getText()) ? "" : data.element("IdCardNo").getText(),
                            StringUtil.isEmpty(data.element("OrderId").getText()) ? "" : data.element("OrderId").getText(),
                            StringUtil.isEmpty(data.element("ClinicCard").getText()) ? "" : data.element("ClinicCard").getText(),
                            StringUtil.isEmpty(data.element("TimeSlice").getText()) ? "" : data.element("TimeSlice").getText(),
                            StringUtil.isEmpty(data.element("StartTime").getText()) ? "" : data.element("StartTime").getText(),
                            StringUtil.isEmpty(data.element("EndTime").getText()) ? "" : data.element("EndTime").getText(),
                            StringUtil.isEmpty(data.element("RegFlag").getText()) ? "" : data.element("RegFlag").getText()
                    );
                    break;
                }
                case "report.ReportWs.GetReportList": {
                    Document document = DocumentHelper.parseText(param.trim());
                    Element root = document.getRootElement();
                    Element data = root.element("Data");
                    xml = excuteService.GetReportList(
                            StringUtil.isEmpty(root.element("TransactionCode").getText()) ? "" : root.element("TransactionCode").getText(),
                            StringUtil.isEmpty(data.element("CardType").getText()) ? "" : data.element("CardType").getText(),
                            StringUtil.isEmpty(data.element("CardNo").getText()) ? "" : data.element("CardNo").getText(),
                            StringUtil.isEmpty(data.element("EndDate").getText()) ? "" : data.element("EndDate").getText(),
                            StringUtil.isEmpty(data.element("Mobile").getText()) ? "" : data.element("Mobile").getText(),
                            StringUtil.isEmpty(data.element("PatientName").getText()) ? "" : data.element("PatientName").getText(),
                            StringUtil.isEmpty(data.element("ReportType").getText()) ? "" : data.element("ReportType").getText());
                    break;
                }
                default: {
                    wsReturnModel.setTransactionCode("-10000");
                    wsReturnModel.setRespMessage("没有对应的API");
                    xml = "<Resp> \n" +
                            "<TransactionCode>" + api + "</TransactionCode> \n" +
                            "<RespCode>-10000</RespCode>\n" +
                            "<RespMessage>没有对应的API</RespMessage>\n" +
                            "</Resp>";
                }
            }
        } catch (Throwable e) {
            e.printStackTrace();
            return "<Resp> \n" +
                    "<TransactionCode>" + api + "</TransactionCode> \n" +
                    "<RespCode>-10000</RespCode>\n" +
                    "<RespMessage>参数错误:" + e.getMessage() + "</RespMessage>\n" +
                    "</Resp>";
        }
        return xml;
    }
//    public static void main(String[] args) throws Exception {
        /*
        JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
        Client client = factory.createClient("http://172.19.103.71:8080/service/sql?wsdl");
        //Client client = factory.createClient("http://localhost:8080/service/sql?wsdl");
        try {
            Object[] result = client.invoke("ExcuteSQL", "10000", "select count(1) as COUNT,max(to_number(HDSD03_01_031)) as MAX_KEYVALUE from HDSC01_02 where 1=1 order by to_number(HDSD03_01_031)"); // 按照方法的参数来提供值
            if (result != null && result.length > 0) {
                System.out.println(result[0]); // 通过getUsername来获取对象的username属性
            }
        } catch (Exception e) {
            e.printStackTrace();
        }*/
//    }
}

+ 30 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/ws/service/ServiceGateWayPortType.java

@ -0,0 +1,30 @@
package com.yihu.hos.ws.service;
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;
/**
 * Created by Administrator on 2016/5/19.
 */
@WebService(name = "ServiceGateWayPortType", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay")
public interface ServiceGateWayPortType {
    @WebMethod(operationName = "service")
    @WebResult(name = "out", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay")
    @RequestWrapper(localName = "service", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay", className = "com.yihu.yuyue.service.client.screnmingyy.servicegateway.Service")
    @ResponseWrapper(localName = "serviceResponse", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay", className = "com.yihu.yuyue.service.client.screnmingyy.servicegateway.ServiceResponse")
    String service(
            @WebParam(name = "authInfo", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") String authInfo,
            @WebParam(name = "sequenceNo", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") String sequenceNo,
            @WebParam(name = "api", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") String api,
            @WebParam(name = "param", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") String param,
            @WebParam(name = "paramType", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") int paramType,
            @WebParam(name = "outType", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") int outType,
            @WebParam(name = "v", targetNamespace = "http://com.yihu.wsgw/ServiceGateWay") String v
    );
}