esb преди 9 години
родител
ревизия
89273843b3
променени са 1 файла, в които са добавени 46 реда и са изтрити 82 реда
  1. 46 82
      Hos-Resource-WS/src/main/java/com.yihu.ehr/ws/ExcuteService.java

+ 46 - 82
Hos-Resource-WS/src/main/java/com.yihu.ehr/ws/ExcuteService.java

@ -7,11 +7,9 @@ import com.yihu.ehr.util.operator.StringUtil;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.*;
/**
@ -103,18 +101,28 @@ public class ExcuteService {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            //initJDBC();
            // 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 + "'");
            // }
            //wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            // return WSReturnModel.toXml(wsReturnModel);
            return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\GetReportList.xml");
            initJDBC();
             StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
            if (!StringUtils.isEmpty(cardType)) {
                sb.append(" and HDSD00_05_026 < '" + cardType + "'");
             }
            if (!StringUtils.isEmpty(cardNo)) {
                sb.append(" and HDSD00_01_001 > '" + cardNo + "'");
            }
            if (!StringUtils.isEmpty(startDate)) {
                sb.append(" and HDSD00_01_001 > '" + startDate + "'");
            }
            if (!StringUtils.isEmpty(endDate)) {
                sb.append(" and HDSD00_01_001 > '" + endDate + "'");
            }
            if (!StringUtils.isEmpty(mobile)) {
                sb.append(" and HDSD00_01_001 > '" + mobile + "'");
            }
            if (!StringUtils.isEmpty(reportType)) {
                sb.append(" and HDSD00_01_001 > '" + reportType + "'");
            }
            wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setTransactionCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
@ -136,18 +144,20 @@ public class ExcuteService {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            /*
            initJDBC();
            StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
            if (!StringUtil.isEmpty(TransactionCode)) {
                sb.append(" and HDSD00_05_026 < '" + TransactionCode + "'");
            }
            if (!StringUtil.isEmpty(reportId)) {
                sb.append(" and HDSD00_05_026 < '" + reportId + "'");
                sb.append(" and HDSD00_01_001 > '" + reportId + "'");
            }
            if (!StringUtil.isEmpty(reportType)) {
                sb.append(" and HDSD00_01_001 > '" + reportType + "'");
            }*/
            //  wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\GetReportInfo.xml");
            }
            wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setTransactionCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
@ -159,18 +169,23 @@ public class ExcuteService {
        WSReturnModel wsReturnModel = new WSReturnModel();
        wsReturnModel.setTransactionCode(TransactionCode);
        try {
            /*
            initJDBC();
            StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
            if (!StringUtil.isEmpty(reportId)) {
                sb.append(" and HDSD00_05_026 < '" + reportId + "'");
            if (!StringUtil.isEmpty(CardType)) {
                sb.append(" and HDSD00_05_026 < '" + CardType + "'");
            }
            if (!StringUtil.isEmpty(reportType)) {
                sb.append(" and HDSD00_01_001 > '" + reportType + "'");
            }*/
            //  wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\QueryUserInfo.xml");
            if (!StringUtil.isEmpty(CardNo)) {
                sb.append(" and HDSD00_01_001 > '" + CardNo + "'");
            }
            if (!StringUtil.isEmpty(Mobile)) {
                sb.append(" and HDSD00_01_001 > '" + Mobile + "'");
            }
            if (!StringUtil.isEmpty(PatientId)) {
                sb.append(" and HDSD00_01_001 > '" + PatientId + "'");
            }
           wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
            return WSReturnModel.toXml(wsReturnModel);
        } catch (Exception e) {
            wsReturnModel.setTransactionCode("-30000");
            wsReturnModel.setRespMessage(e.getMessage());
@ -178,55 +193,4 @@ public class ExcuteService {
        }
    }
    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();
        }*/
        System.out.println(getFileByPath("C:\\Users\\Administrator\\Desktop\\getReportInfo.xml"));
    }
    public static String getFileByPath(String path) {
        BufferedReader reader = null;
        FileReader fileReader = null;
        try {
            File cfgFile = ResourceUtils.getFile(path);
            fileReader=new FileReader(cfgFile);
            reader = new BufferedReader(fileReader);
            String line;
            String strContent = "";
            while ((line = reader.readLine()) != null) {
                strContent += line;
            }
            return strContent;
        } catch (Exception e) {
            return "";
        } finally {
            if(reader!=null){
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(fileReader!=null){
                try {
                    fileReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}