123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- (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 <data.past.length; p++){
- past.push(data.past[p].name);
- }*/ //大数据推送没有现病史
- var body = [];
- for(var n = 0;n <data.vitals.length; n++){
- body.push(data.vitals[n].featureName);
- }
- var symptom = [];
- for(var x = 0;x <data.symptom.length; x++){
- symptom.push(data.symptom[x].featureName);
- }
- var dis = data.dis;
- var infoUrl,str='';
- var modeClass = '.'+config.mode;
- for(var i=0;i<dis.length;i++){
- infoUrl="./case_info.html?diseaseId="+dis[i].id;
- str += '<a>'+dis[i].featureName+'</a>';
- }
- 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;i<item.length;i++){
- if(i>config.num-1){
- itemDom += '<a href="##" class="hide">'+item[i]+'</a>';
- }else{
- itemDom += '<a href="##">'+item[i]+'</a>';
- }
- }
- $(dom).html(itemDom||"无");
- var hide = $(dom).find(".hide")[0];
- if(hide){
- $("<a class='more'>...</a>").insertBefore(hide);
- $(".more").click(function(e){
- $(e.target).siblings(".hide").removeClass("hide");
- $(e.target).hide();
- })
- }
- }
- })(jQuery);
|