|
@ -3,27 +3,24 @@ package com.yihu.ehr.ws;
|
|
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
|
|
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
|
|
import com.yihu.ehr.model.DataSource;
|
|
import com.yihu.ehr.model.DataSource;
|
|
import com.yihu.ehr.model.WSReturnModel;
|
|
import com.yihu.ehr.model.WSReturnModel;
|
|
import com.yihu.ehr.ws.inf.ISQLWebService;
|
|
|
|
|
|
import com.yihu.ehr.util.operator.StringUtil;
|
|
import org.apache.commons.dbcp2.BasicDataSource;
|
|
import org.apache.commons.dbcp2.BasicDataSource;
|
|
import org.apache.cxf.endpoint.Client;
|
|
|
|
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
|
|
|
import javax.jws.WebService;
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileReader;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by Administrator on 2016/5/19.
|
|
* Created by Administrator on 2016/5/19.
|
|
*/
|
|
*/
|
|
@WebService(endpointInterface = "com.yihu.ehr.ws.inf.ISQLWebService", targetNamespace = "com.yihu.ehr.ws.inf")
|
|
|
|
public class SQLWebService implements ISQLWebService {
|
|
|
|
|
|
public class ExcuteService {
|
|
public static JdbcTemplate jdbcTemplate = null;
|
|
public static JdbcTemplate jdbcTemplate = null;
|
|
|
|
|
|
public void initJDBC() throws Exception{
|
|
|
|
|
|
public void initJDBC() throws Exception {
|
|
if (jdbcTemplate == null) {
|
|
if (jdbcTemplate == null) {
|
|
//jdbc:oracle:thin:hos/hos@//172.19.103.71:1521/orcl
|
|
//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:mysql://172.19.103.71:1521/orcl?user=hos&password=hos&useUnicode=true&characterEncoding=UTF-8
|
|
@ -95,8 +92,7 @@ public class SQLWebService implements ISQLWebService {
|
|
* @param reportType
|
|
* @param reportType
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
|
|
public String getReportList(
|
|
|
|
|
|
public String GetReportList(
|
|
String TransactionCode,
|
|
String TransactionCode,
|
|
String cardType,
|
|
String cardType,
|
|
String cardNo,
|
|
String cardNo,
|
|
@ -107,47 +103,18 @@ public class SQLWebService implements ISQLWebService {
|
|
WSReturnModel wsReturnModel = new WSReturnModel();
|
|
WSReturnModel wsReturnModel = new WSReturnModel();
|
|
wsReturnModel.setTransactionCode(TransactionCode);
|
|
wsReturnModel.setTransactionCode(TransactionCode);
|
|
try {
|
|
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 + "'");
|
|
|
|
}
|
|
|
|
|
|
//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 "<Resp> \n" +
|
|
|
|
"<TransactionCode></TransactionCode> \n" +
|
|
|
|
"<RespMessage>成功</RespMessage>\n" +
|
|
|
|
"<Data>\n" +
|
|
|
|
"<ReportId>8F5F14C2-FAB8-4CB5-BB91-AECF0EC64E69</ReportId>\n" +
|
|
|
|
"<ReportType>1</ReportType>\n" +
|
|
|
|
"<SubmissionTime>2015-03-12 09:52:47.0</SubmissionTime>\n" +
|
|
|
|
"<PatientName>张三</PatientName>\n" +
|
|
|
|
"<ItemName>测试报告1</ItemName>\n" +
|
|
|
|
"<State>1</ State >\n" +
|
|
|
|
"<EventNo>事件号</EventNo>\n" +
|
|
|
|
"<EventType>就诊类型</EventType>\n" +
|
|
|
|
"<EventTime>就诊时间</EventTime>\n" +
|
|
|
|
"<LocalCardNo>就诊卡号</LocalCardNo>\n" +
|
|
|
|
"<IdCardNo>身份证号</IdCardNo>\n" +
|
|
|
|
"</Data> \n" +
|
|
|
|
"<Data>\n" +
|
|
|
|
"<ReportId>8F5F14C2-FAB8-4CB5-BB91-AECF0EC64E69</ReportId>\n" +
|
|
|
|
"<ReportType>1</ReportType>\n" +
|
|
|
|
"<SubmissionTime>2015-03-12 09:52:47.0</SubmissionTime>\n" +
|
|
|
|
"<PatientName>张三</PatientName>\n" +
|
|
|
|
"<ItemName>测试报告1</ItemName>\n" +
|
|
|
|
"<State>1</State>\n" +
|
|
|
|
"<EventNo>事件号</EventNo>\n" +
|
|
|
|
"<EventType>就诊类型</EventType>\n" +
|
|
|
|
"<EventTime>就诊时间</EventTime>\n" +
|
|
|
|
"<LocalCardNo>就诊卡号</LocalCardNo>\n" +
|
|
|
|
"<IdCardNo>身份证号</IdCardNo>\n" +
|
|
|
|
"</Data>\n" +
|
|
|
|
"</Resp>";
|
|
|
|
|
|
//wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
|
|
|
|
// return WSReturnModel.toXml(wsReturnModel);
|
|
|
|
return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\GetReportList.xml");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
wsReturnModel.setTransactionCode("-30000");
|
|
wsReturnModel.setTransactionCode("-30000");
|
|
wsReturnModel.setRespMessage(e.getMessage());
|
|
wsReturnModel.setRespMessage(e.getMessage());
|
|
@ -162,75 +129,48 @@ public class SQLWebService implements ISQLWebService {
|
|
* @param reportType
|
|
* @param reportType
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
|
|
public String getReportInfo(
|
|
|
|
|
|
public String GetReportInfo(
|
|
String TransactionCode,
|
|
String TransactionCode,
|
|
String reportId,
|
|
String reportId,
|
|
String reportType) {
|
|
String reportType) {
|
|
WSReturnModel wsReturnModel = new WSReturnModel();
|
|
WSReturnModel wsReturnModel = new WSReturnModel();
|
|
wsReturnModel.setTransactionCode(TransactionCode);
|
|
wsReturnModel.setTransactionCode(TransactionCode);
|
|
try {
|
|
try {
|
|
|
|
/*
|
|
initJDBC();
|
|
initJDBC();
|
|
StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
|
|
StringBuffer sb = new StringBuffer("select * from HDSD01_01 where 1=1 ");
|
|
if (!StringUtils.isEmpty(reportId)) {
|
|
|
|
|
|
if (!StringUtil.isEmpty(reportId)) {
|
|
sb.append(" and HDSD00_05_026 < '" + reportId + "'");
|
|
sb.append(" and HDSD00_05_026 < '" + reportId + "'");
|
|
}
|
|
}
|
|
if (!StringUtils.isEmpty(reportType)) {
|
|
|
|
|
|
if (!StringUtil.isEmpty(reportType)) {
|
|
sb.append(" and HDSD00_01_001 > '" + reportType + "'");
|
|
sb.append(" and HDSD00_01_001 > '" + reportType + "'");
|
|
|
|
}*/
|
|
|
|
|
|
|
|
// wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
|
|
|
|
return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\GetReportInfo.xml");
|
|
|
|
} catch (Exception e) {
|
|
|
|
wsReturnModel.setTransactionCode("-30000");
|
|
|
|
wsReturnModel.setRespMessage(e.getMessage());
|
|
|
|
return WSReturnModel.toXml(wsReturnModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 HDSD01_01 where 1=1 ");
|
|
|
|
if (!StringUtil.isEmpty(reportId)) {
|
|
|
|
sb.append(" and HDSD00_05_026 < '" + reportId + "'");
|
|
}
|
|
}
|
|
|
|
if (!StringUtil.isEmpty(reportType)) {
|
|
|
|
sb.append(" and HDSD00_01_001 > '" + reportType + "'");
|
|
|
|
}*/
|
|
|
|
|
|
// wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
|
|
|
|
return "<Resp> \n" +
|
|
|
|
"<TransactionCode></TransactionCode> \n" +
|
|
|
|
"<RespMessage>成功</RespMessage>\n" +
|
|
|
|
"<Data>\n" +
|
|
|
|
"\t<ReportTitle>报告单2</ReportTitle>\n" +
|
|
|
|
"\t<ClinicCard>K5698012</ClinicCard>\n" +
|
|
|
|
"\t<UserType>0</UserType>\n" +
|
|
|
|
"\t<HosBedNo>6</HosBedNo>\n" +
|
|
|
|
"\t<SigningTime>2015-03-09 09:52:47.0</SigningTime>\n" +
|
|
|
|
"\t<Checker>审核人2</Checker>\n" +
|
|
|
|
"\t<BarCode>456456456</BarCode>\n" +
|
|
|
|
"\t<Sex>2</Sex>\n" +
|
|
|
|
"\t<PatientName>李四</PatientName>\n" +
|
|
|
|
"\t<SampleNumber>Yao77822</SampleNumber>\n" +
|
|
|
|
"\t<SampleType>2</SampleType>\n" +
|
|
|
|
"\t<ApplicationDepartment>口腔科</ApplicationDepartment>\n" +
|
|
|
|
"\t<SubmissionTime>2015-03-10 09:52:47.0</SubmissionTime>\n" +
|
|
|
|
"\t<Rmark>牙齿蛀牙</Rmark>\n" +
|
|
|
|
"\t<ReportTime>2015-03-12 09:52:47.0</ReportTime>\n" +
|
|
|
|
"\t<Inspector>检验员2</Inspector>\n" +
|
|
|
|
"\t<ItemNum>2</ItemNum>\n" +
|
|
|
|
"\t<ClinicNo>门诊号</ClinicNo>\n" +
|
|
|
|
"\t<HosUserNo>住院号</HosUserNo>\n" +
|
|
|
|
"\t<Data_1>\n" +
|
|
|
|
"\t\t\t<ItemDetailsName>xxx1</ItemDetailsName>\n" +
|
|
|
|
"\t\t\t<ResultValue>xxx1</ResultValue>\n" +
|
|
|
|
"\t\t\t<Unit>分</Unit>\n" +
|
|
|
|
"\t\t\t<ReferenceValues>100~250</ReferenceValues>\n" +
|
|
|
|
"\t\t\t<IsNormal></IsNormal>\n" +
|
|
|
|
"<ExFlag></ExFlag>\n" +
|
|
|
|
"<Range></Range>\n" +
|
|
|
|
"<SeFlag></SeFlag>\n" +
|
|
|
|
"<Words></Words>\n" +
|
|
|
|
"<GermName></GermName>\n" +
|
|
|
|
"<GrowStatus></GrowStatus>\n" +
|
|
|
|
"\t</Data_1>\n" +
|
|
|
|
"\t<Data_1>\n" +
|
|
|
|
"\t\t\t<ItemDetailsName>xxx2</ItemDetailsName>\n" +
|
|
|
|
"\t\t\t<ResultValue>xxx2</ResultValue>\n" +
|
|
|
|
"\t\t\t<Unit>分</Unit>\n" +
|
|
|
|
"\t\t\t<ReferenceValues>100~250</ReferenceValues>\n" +
|
|
|
|
"\t\t\t<IsNormal></IsNormal>\n" +
|
|
|
|
"<ExFlag></ExFlag>\n" +
|
|
|
|
"<Range></Range>\n" +
|
|
|
|
"<SeFlag></SeFlag>\n" +
|
|
|
|
"<Words></Words>\n" +
|
|
|
|
"<GermName></GermName>\n" +
|
|
|
|
"<GrowStatus></GrowStatus>\n" +
|
|
|
|
"\t</Data_1>\n" +
|
|
|
|
" </Data>\n" +
|
|
|
|
"</Resp>";
|
|
|
|
|
|
// wsReturnModel.setData(jdbcTemplate.queryForList(sb.toString()));
|
|
|
|
return getFileByPath("C:\\Documents and Settings\\Administrator\\桌面\\data\\QueryUserInfo.xml");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
wsReturnModel.setTransactionCode("-30000");
|
|
wsReturnModel.setTransactionCode("-30000");
|
|
wsReturnModel.setRespMessage(e.getMessage());
|
|
wsReturnModel.setRespMessage(e.getMessage());
|
|
@ -240,6 +180,7 @@ public class SQLWebService implements ISQLWebService {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
/*
|
|
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
|
|
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
|
|
Client client = factory.createClient("http://172.19.103.71:8080/service/sql?wsdl");
|
|
Client client = factory.createClient("http://172.19.103.71:8080/service/sql?wsdl");
|
|
//Client client = factory.createClient("http://localhost:8080/service/sql?wsdl");
|
|
//Client client = factory.createClient("http://localhost:8080/service/sql?wsdl");
|
|
@ -250,6 +191,40 @@ public class SQLWebService implements ISQLWebService {
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|