Browse Source

Merge branch 'master' of http://192.168.1.220:10080/esb/esb

lingfeng 9 năm trước cách đây
mục cha
commit
8f06d8b084

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

@ -87,7 +87,7 @@ public class RPCUtil {
        // TODO Auto-generated method stub
        String apiName = "ZEUS.HosHOPWs.GetReportInfo";
        apiName = "ZEUS.HosHOPWs.QueryUserInfo";
       // apiName = "ZEUS.HosHOPWs.QueryUserInfo";
        String param = "<Req><TransactionCode>5001</TransactionCode><Data><ReportId>201405228-A-110B</ReportId><ReportType>0</ReportType><CardNo>000021341249</CardNo></Data></Req>";
        String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
                "\"ParamType\"=1," +

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

@ -11,8 +11,10 @@ import net.sf.json.JSON;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.jdom2.input.SAXBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.LinkedList;
@ -51,9 +54,10 @@ public class QLCController {
                                @ApiParam(value = "PatientId", required = true) @RequestParam(value = "PatientId") String PatientId,
                                @ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
                                HttpServletRequest request) {
        String returnMessage = "成功";
        try {
            String param = "<Req><TransactionCode>5001</TransactionCode><Data><CardType>" + CardType + "</CardType><CardNo>" + CardNo + "</CardNo><PatientId>" + PatientId + "</PatientId></Data></Req>";
            String apiparam = "{\"ChannelId\"=\"\"+Config.channelId+\"\"," +
            String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
                    "\"ParamType\"=1," +
                    "\"Params\"=\"" + param + "\"," +
                    "\"Guid\"=\"" + "00000001111111" + "\"," +
@ -63,9 +67,9 @@ public class QLCController {
            Object s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryUserInfo", apiparam);
            //解析xml
            SAXReader saxReader = new SAXReader();
            Document document = saxReader.read(s.toString());
            Document document = DocumentHelper.parseText(s.toString());
            Element root = document.getRootElement();
            if ("10000".equals(root.element("RespCode"))) {
            if ("10000".equals(root.element("RespCode").getText())) {
                //xml轉json
                Element dataXML = root.element("Data");
                JSONObject obj = xml2json(root.element("Data"));
@ -84,16 +88,19 @@ public class QLCController {
                params.put("cardNo", CardNo);
                params.put("eventNo", PatientId);
                httpClientUtil.doPost(Config.startCollect, params, null, null);
            } else {
                returnMessage = "RPC返回RespCode:" + root.element("RespCode").getText();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
        return "成功";
        return returnMessage;
    }
    /**
     * 院方_检查/检验报告单推送---数据说明
     *  localhost:8890/gateway/transfer?api=patientInformationPush&param={CardType:"",CardNo:"",ReportType:"",ReportId:"",State:"",HospitalId:""}&requestId="目前没用随便写"
     * localhost:8890/gateway/transfer?api=patientInformationPush&param={CardType:"",CardNo:"",ReportType:"",ReportId:"",State:"",HospitalId:""}&requestId="目前没用随便写"
     */
    @RequestMapping(value = "/patientInformation", method = RequestMethod.POST)
    @ApiOperation(value = "检查/检验报告单推送-", response = Object.class, produces = "application/json", notes = "检查/检验报告单推送-")
@ -104,6 +111,7 @@ public class QLCController {
                                     @ApiParam(value = "报告单状态1 报告未出 2报告已出", required = true) @RequestParam(value = "State") String State,
                                     @ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
                                     HttpServletRequest request) {
        String returnMessage = "成功";
        try {
            if ("1".equals(State)) {
                return "报告未出,结束 ";
@ -111,7 +119,7 @@ public class QLCController {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
            String data =
                    "<Req><TransactionCode>5001</TransactionCode><Data><CardNo>" + CardNo + "</CardNo><ReportId>" + ReportId + "</ReportId><ReportType>" + ReportType + "</ReportType></Data></Req>";
            String apiparam = "{\"ChannelId\"=\"\"+Config.channelId+\"\"," +
            String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
                    "\"ParamType\"=1," +
                    "\"Params\"=\"" + data + "\"," +
                    "\"Guid\"=\"" + "00000001111111" + "\"," +
@ -120,10 +128,11 @@ public class QLCController {
                    "\"HospitalId\"=\"" + HospitalId + "\"}";
            Object s = RPCUtil.getRPCData("ZEUS.HosHOPWs.GetReportInfo", apiparam);
            //解析xml
            SAXReader saxReader = new SAXReader();
            Document document = saxReader.read(s.toString());
            SAXReader saxReader = new SAXReader(false);
            Document document = DocumentHelper.parseText(s.toString());
            Element root = document.getRootElement();
            if ("10000".equals(root.element("RespCode"))) {
            System.out.println(root.element("RespCode").getText());
            if ("10000".equals(root.element("RespCode").getText())) {
                //xml轉json
                JSONObject obj = new JSONObject();
                //得到Data节点
@ -156,11 +165,14 @@ public class QLCController {
                    }
                }
            } else {
                returnMessage = "RPC返回RespCode:" + root.element("RespCode").getText();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
        return "成功";
        return returnMessage;
    }
    /**

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

@ -1,4 +1,4 @@
rpc.url=172.18.20.123:8085
rpc.url=172.18.20.21:2181
rpc.appId=EsbCloud
rpc.channelId=100123
rpc.port=8081

+ 3 - 1
Hos-resource/Hos-Resource.iml

@ -63,8 +63,10 @@
    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1" level="project" />
    <orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final" level="project" />
    <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:4.0.5.Final" level="project" />
    <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
    <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
    <orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:4.3.11.Final" level="project" />
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.9.4.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.1.8.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.1.8.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.1.8.RELEASE" level="project" />