(function ($) { var urls = { 'host':"/icss-web", //His推送接口 'get_push':'http://192.168.2.234:8080/web/doc/algorithm/neural' }; $.support.cors = true; var config = { width:'560px', //推送内容显示的宽度 num:'11', //每行显示的最大个数 mode:'horizontal' //布局模式水平horizontal,垂直vertical }; var urlSearch = parseUrl(); handleConfig(); getPushData(); function parseUrl() { var r = window.location.search.substr(1).split("&"), obj = {}; $.each(r, function (i, v) { if (v) { var arr = v.split("="); obj[arr[0]] = arr[1]?decodeURI(arr[1]):''; } }); return obj; }; function handleConfig(){ $("tr td:last-child,.item-box").css({width:config.width}); $('.'+config.mode).show(); } function getPushData(){ var url = urls.get_push; var myParam = { symptom: urlSearch.symptomJson||"", past: urlSearch.pastJson||"", other: urlSearch.otherJson||"", vital: urlSearch.vitalsJson||"", lis: urlSearch.labsJson||"", pacs: urlSearch.pacsJson||"", diag: urlSearch.disJson||"", featureType: "1,4,7" }; $.ajax({ url: url, type:'post', dataType: "json", contentType:"application/json", data:JSON.stringify(myParam), success:function(response){ var data = response.data; if(response.ret=='0'){ fillPushData(data); } }, error:function(error){ console.log("error:"+error); }, complete:function(){ console.log("complete") } }); } //填入推送信息 function fillPushData(data){ if(!data||JSON.stringify(data)=='{}'){ console.warn("获取推送数据为空!"); return ; } var past = []; /*for(var p = 0;p '; } mapItem(modeClass+" .main-suit",symptom); mapItem(modeClass+" .past-item", past); mapItem(modeClass+" .body-item", body); $(modeClass+" .treatment").html(str); } //遍历数据 function mapItem(dom,item){ var itemDom = ''; for(var i=0;iconfig.num-1){ itemDom += ''+item[i]+''; }else{ itemDom += ''+item[i]+''; } } $(dom).html(itemDom||"无"); var hide = $(dom).find(".hide")[0]; if(hide){ $("...").insertBefore(hide); $(".more").click(function(e){ $(e.target).siblings(".hide").removeClass("hide"); $(e.target).hide(); }) } } })(jQuery);