瀏覽代碼

rest代码提交

chenweida 9 年之前
父節點
當前提交
90ec2cbd6e

+ 11 - 7
Hos-Resource-Rest/src/main/java/com/yihu/hos/qlc/controller/QLCController.java

@ -56,7 +56,7 @@ public class QLCController {
                                            @ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
                                            HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();
        Object s = null;
        try {
            String param = "<Req><TransactionCode>5001</TransactionCode><Data><CardType>" + CardType + "</CardType><CardNo>" + CardNo + "</CardNo><PatientId>" + PatientId + "</PatientId></Data></Req>";
            String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
@ -66,7 +66,7 @@ public class QLCController {
                    "\"V\"=\"3.0.0\"," +
                    "\"OutType\"=0n ," +
                    "\"HospitalId\"=\"" + HospitalId + "\"}";
            Object s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryUserInfo", apiparam);
            s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryUserInfo", apiparam);
            //解析xml
            SAXReader saxReader = new SAXReader();
            Document document = DocumentHelper.parseText(s.toString());
@ -95,7 +95,8 @@ public class QLCController {
            }
        } catch (Exception e) {
            restResponseResult.setResponseCode("20000");
            restResponseResult.setResponseMessage(e.getMessage());
            restResponseResult.setResponseMessage(e.getMessage() + "RPC:返回" + s);
            return restResponseResult;
        }
        return restResponseResult;
    }
@ -114,9 +115,10 @@ public class QLCController {
                                                 @ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
                                                 HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();
        Object s = null;
        try {
            if ("1".equals(State)) {
                throw new Exception("报告未出,结束" );
                throw new Exception("报告未出,结束");
            }
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
            String data =
@ -128,12 +130,11 @@ public class QLCController {
                    "\"V\"=\"3.0.0\"," +
                    "\"OutType\"=0," +
                    "\"HospitalId\"=\"" + HospitalId + "\"}";
            Object s = RPCUtil.getRPCData("ZEUS.HosHOPWs.GetReportInfo", apiparam);
            s = RPCUtil.getRPCData("ZEUS.HosHOPWs.GetReportInfo", apiparam);
            //解析xml
            SAXReader saxReader = new SAXReader(false);
            Document document = DocumentHelper.parseText(s.toString());
            Element root = document.getRootElement();
            System.out.println(root.element("RespCode").getText());
            if ("10000".equals(root.element("RespCode").getText())) {
                //xml轉json
                JSONObject obj = new JSONObject();
@ -166,13 +167,16 @@ public class QLCController {
                        httpClientUtil.doPost(Config.startCollect, params, null, null);
                    }
                } else {
                    throw new Exception("RPC返回数据格式不合法:" + dataXml.getText());
                }
            } else {
                throw new Exception("RPC返回RespCode:" + root.element("RespCode").getText());
            }
        } catch (Exception e) {
            restResponseResult.setResponseCode("20000");
            restResponseResult.setResponseMessage(e.getMessage());
            restResponseResult.setResponseMessage(e.getMessage() + "RPC:返回" + s);
            return restResponseResult;
        }
        return restResponseResult;
    }

+ 16 - 7
Hos-Resource-Rest/src/main/java/com/yihu/hos/resource/control/ResourceControl.java

@ -108,7 +108,7 @@ public class ResourceControl {
     */
    @RequestMapping(value = "/getResource", method = RequestMethod.GET)
    @ApiOperation(value = "数据资源接口", response = Object.class, produces = "application/json", notes = "查询数据资源")
    public Object getResource(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
    public RestResponseResult getResource(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
                              @ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
                              @ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
                              HttpServletRequest request) {
@ -162,7 +162,7 @@ public class ResourceControl {
     */
    @RequestMapping(value = "/getDictionary", method = RequestMethod.GET)
    @ApiOperation(value = "数据字典接口", response = Object.class, produces = "application/json", notes = "查询数据字典")
    public Object getDictionary(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
    public RestResponseResult getDictionary(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
                                @ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
                                @ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition, HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();
@ -208,7 +208,7 @@ public class ResourceControl {
    @RequestMapping(value = "/getResourceMetadata", method = RequestMethod.GET)
    @ApiOperation(value = "资源元数据接口", response = Object.class, produces = "application/json", notes = "查询资源元数据")
    public Object getResourceMetadata(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
    public RestResponseResult getResourceMetadata(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
                                      @ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
                                      @ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition, HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();
@ -230,9 +230,18 @@ public class ResourceControl {
        return restResponseResult;
    }
    /**
     *  localhost:8890/gateway/transfer?api=queryResourceData&param={page:"",rows:"000021341249",condition:"0",tableCode:"201405228-A-110B"}&requestId="目前没用随便写"
     * @param page
     * @param rows
     * @param condition
     * @param tableCode
     * @param request
     * @return
     */
    @RequestMapping(value = "/getMongoDBData", method = RequestMethod.GET)
    @ApiOperation(value = "Mongo资源接口", response = Object.class, produces = "application/json", notes = "查询Mongo资源")
    public Object getMongoDBData(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
    public RestResponseResult getMongoDBData(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
                                 @ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
                                 @ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
                                 @ApiParam(value = "mongo表名", required = true) @RequestParam(value = "tableCode") String tableCode,
@ -262,7 +271,7 @@ public class ResourceControl {
    @RequestMapping(value = "/collectionData", method = RequestMethod.GET)
    @ApiOperation(value = "采集数据", response = Object.class, produces = "application/json", notes = "采集monogo数据")
    public Object collectionData(
    public RestResponseResult collectionData(
            @ApiParam(value = "mongo表名", required = true) @RequestParam(value = "tableCode") String tableCode,
            @ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
            HttpServletRequest request) {
@ -288,7 +297,7 @@ public class ResourceControl {
    @RequestMapping(value = "/getCurrentTime", method = RequestMethod.GET)
    @ApiOperation(value = "得到系统时间", response = Object.class, produces = "application/json", notes = "得到系统时间")
    public Object collectionData(
    public RestResponseResult collectionData(
            HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();
        String returnDate = "";
@ -305,7 +314,7 @@ public class ResourceControl {
    @RequestMapping(value = "/executeSQL", method = RequestMethod.GET)
    @ApiOperation(value = "执行SQL语句", response = Object.class, produces = "application/json", notes = "执行SQL语句")
    public Object executeSQL(
    public RestResponseResult executeSQL(
            @ApiParam(value = "SQL语句", required = true) @RequestParam(value = "sql") String sql,
            HttpServletRequest request) {
        RestResponseResult restResponseResult = new RestResponseResult();

+ 1 - 1
Hos-Resource-Rest/src/main/resources/application.properties

@ -1,6 +1,6 @@
#Created by JInto - www.guh-software.de
#Wed Jun 18 21:31:46 CST 2014
server.port=8890
server.port=8081
server.tomcat.access-log-enabled=true
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.1.220:3306/hos2_resource??useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true

+ 1 - 1
Hos-Resource-Rest/src/main/resources/rpc.properties

@ -1,7 +1,7 @@
rpc.url=172.18.20.21:2181
rpc.appId=EsbCloud
rpc.channelId=100123
rpc.port=8081
rpc.port=8182
http.monogourl=http://localhost:8080/datapush/datapush
http.startCollect=http://localhost:8080/crawler/patient