SOURCE

console 命令行工具 X clear

                    
>
console
var requestJson = {
  YWXML: {
    DLSJ: {
      JGDM: "42505781100",
      JGMC: "奉贤区中心医院",
      DLYH: "123",
      DLMM: "#ett44",
      YSGH: "018",
      YSXM: "李明"
    }
  }
};
var vue = new Vue({
  el: "#app",
  data: {
    url: "web/test.html"
  },
  methods: {
    callByRestful(useUrl) {
      var jsonPara = requestJson;
      if (useUrl) {
        //是否使用指定客户端要打开的url
        jsonPara = _.extend({ replaceurl: this.url }, requestJson);
      }
      //因跨域问题Content-Type必须为application/x-www-form-urlencoded;
      //且json必须通过JSON.stringify转为字符串传递。
      $.post("http://127.0.0.1:8081/open", JSON.stringify(jsonPara), function(
        data,
        status
      ) {
        $("#result").html(
          "Data: " + JSON.stringify(data) + ", Status: " + status
        );
      });
    },
    callByUrl(useUrl) {
      var jsonPara = requestJson;
      if (useUrl) {
        //是否使用指定客户端要打开的url
        jsonPara = _.extend({ replaceurl: this.url }, requestJson);
      }
      var encodeJson = encodeURIComponent(JSON.stringify(jsonPara));
      window.location.href = "Synergy:///" + encodeJson;
    }
  }
});

//返回json示例
var resposeJson = {
  YWXT: {
    STATUS: "T",
    MSG: "调用成功!"
  }
};
<div id="app">
  <div>
    <h2>HisAPI调用示例</h2></div>
  <hr />
  <h3>RESTful API方式调用</h3>
  <table>
    <tr>
      <td><button @click="callByRestful(false)">调用客户端</button></td>
      <td><input v-model="url" /><button @click="callByRestful(true)">调用客户端(指定url,内测调用)</button></td>
    </tr>
  </table>
  <div>注:RESTful API仅在客户端正在运行情况下才能正常调用</div>
  <div id="result"></div>
  <hr align="left" style="width:90%" />
  <h3>URL协议 API方式调用</h3>
  <table>
    <tr>
      <td><button @click="callByUrl(false)">调用客户端</button></td>
      <td><input v-model="url" /><button @click="callByUrl(true)">调用客户端(指定url,内测调用)</button></td>
    </tr>
  </table>
  <div>注:URL协议 API在客户端安装后即可调用,不要求客户端必须正在运行</div>
  <hr align="left" style="width:90%" />
</div>
td {
  text-align: left;
  min-width: 100px;
}