调用聚合数据API--全国医院在线挂号预约
By
admin
at 2017-12-10 • 0人收藏 • 1545人看过
import console; import web.rest.jsonLiteClient; var restClient = web.rest.jsonLiteClient(); var hospital = restClient.declareApi("http://v.juhe.cn/hospital/") //挂号查询 var response = hospital.query( key = "应用APPKEY"; //应用APPKEY keyword = "神经病"; //查询的关键字,院名/疾病名 province = "浙江"; area = "杭州"; ) if( !response.result ){ console.log("请到www.juhe.cn申请APPKEY - 注意免费key有每日查询次数限制") return; } console.log("挂号查询结果:",response.reason) for(k,v in response.result.data){ console.log(v.address,v.level,v.id) } //挂号预约 var response = hospital.reserve( key = "应用APPKEY"; username = "挂号网账号"; password = "挂号网密码"; doctorid = "挂号医生ID"; //上一步查询得到的ID date = "2014-07-10"; //预约的日期 time = "morning"; //预约时段 disease = "神经病 - 测试API"; //疾病描述 ) //输出返回的JSON restClient.lastResponse() if( response.result ) { console.log("手机验证ID",response.result.id ) } else { console.log("挂号预约失败",response.reason ) } //手机验证 var response = hospital.submit( key = "应用APPKEY"; id = "上一步得到的手机验证ID"; code = "手机验证码" ) console.log("挂号结果:",response.reason)
以上代码不可用, 只能提供学习交流
登录后方可回帖