var dataBase, jiandangCase2; var d = dialog({contentType:'load', skin:'bk-popup'}); function toast(msg){ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show() } //请求失败 function queryFailed(){ d.close();toast('请求失败');} $(function(){ var case2 = window.localStorage.getItem("jiandangCase2"); jiandangCase2 = case2?JSON.parse(case2):''; // 获取字典 d.show() sendPost('patient/getArchiveComboList', {}, 'json', 'get',queryFailed, function(res) { d.close() if(res.status==200) { dataBase = res.data; var html = template('list_tmp',{data:dataBase,cache:jiandangCase2}) $('.c-main').html(html) bindEvent() }else{ toast('获取数据失败') } }) function bindEvent(){ $('.xc-li-more .one').on('click',function(e){ e.stopPropagation(); var $this = $(this) $this.addClass('active').siblings().removeClass('active') var $parent = $this.closest('.xc-li-more'); if($this.attr('data-id')==1){ $parent.find('.xc-li-radio').show() }else{ $parent.find('.xc-li-radio').hide() $parent.find('.child').removeClass('active') $parent.find('input').val('') $parent.find('input.j-hide').hide() $parent.find('select.sickSel').attr('data-code','') $parent.find('select.sickSel').attr('data-name','') if($parent.hasClass('j-family')){ addContent5(dataBase.familyHistory,true)//初始化 } } }) $(".j-checkbox").on('tap',function(){ var $this = $(this).parent() if($this.hasClass('active')){ $this.removeClass('active') }else{ $this.addClass('active') } }) $(".j-showbox").on('click',function(){ var $this = $(this).parent() if($this.hasClass('active')){ $this.removeClass('active') $this.find('input').hide() $this.find('input').val('') }else{ $this.addClass('active') $this.find('input').css('display','block') } }) //提交 $(".jm-btn").on('tap',function(){ var $gen = $('.j-gen').find('.one.active').attr('data-id'), $past = $('.j-past').find('.one.active').attr('data-id'), $drug = $('.j-drug').find('.one.active').attr('data-id'), $family = $('.j-family').find('.one.active').attr('data-id'); function getCode($id){ var that = $id.find('.j-noOther.active') var codeArr=[]; for(var i=0;i' + arr[i].value + '' }else{ html += '' } } $('#schoolSel').html(html) $('#schoolSel').mobiscroll().select({ theme: "ios", lang: "zh", placeholder:'请选择文化程度', display: "bottom", onSelect: function(valueText, inst) { $('#school').attr('data-code',inst._tempValue) $('#school').attr('data-name',valueText) } }) } function addContent2(arr) { var len = arr.length; var html = ""; for(var i = 0; i < len; i++) { if(jiandangCase2&&jiandangCase2.occupation == arr[i].code){ html += '' }else{ html += '' } } $('#jobSel').html(html) $('#jobSel').mobiscroll().select({ theme: "ios", lang: "zh", placeholder:'请选择职业', display: "bottom", onSelect: function(valueText, inst) { $('#job').attr('data-code',inst._tempValue) $('#job').attr('data-name',valueText) } }) } function addContent3(arr) { var len = arr.length; var html = ""; for(var i = 0; i < len; i++) { if(jiandangCase2&&jiandangCase2.payment == arr[i].code){ html += '' }else{ html += '' } } $('#paySel').html(html) $('#paySel').mobiscroll().select({ theme: "ios", lang: "zh", placeholder:'请选择支付方式', display: "bottom", onSelect: function(valueText, inst) { $('#pay').attr('data-code',inst._tempValue) $('#pay').attr('data-name',valueText) } }) } function addContent4(arr) { var len = arr.length; var html = ""; for(var i = 0; i < len; i++) { if(jiandangCase2&&jiandangCase2.disabilitys == arr[i].code){ html += '' }else{ html += '' } } $('#disabilitySel').html(html) $('#disabilitySel').mobiscroll().select({ theme: "ios", lang: "zh", placeholder:'请选择残疾情况', display: "bottom", onSelect: function(valueText, inst) { $('#disability').attr('data-code',inst._tempValue) $('#disability').attr('data-name',valueText) } }) } function addContent5(arr,init) { for(var i=0;i<$('.j-sel').length;i++){ var $this = $('.j-sel').eq(i).find('.sickSel'); var len = arr.length; var html = ""; if(init){ for(var j = 0; j < len; j++) { html += '' } $this.html(html) }else{ for(var j = 0; j < len; j++) { if(jiandangCase2){ if(i==0){ html += isSelFun(jiandangCase2.familyFatherHistorys,arr[j]) } if(i==1){ html += isSelFun(jiandangCase2.familyMotherHistorys,arr[j]) } if(i==2){ html += isSelFun(jiandangCase2.familyBrotherHistorys,arr[j]) } if(i==3){ html += isSelFun(jiandangCase2.familyChildrenHistorys,arr[j]) } }else{ html += '' } } $this.html(html) } $this.mobiscroll().select({ theme: "ios", lang: "zh", placeholder:'请选择疾病类型', display: "bottom", onSelect: function(valueText, inst) { $(this).attr('data-code',inst._tempValue) $(this).attr('data-name',valueText) } }) } } function isSelFun(str,own){ var bood = false; if(str){ var child = str.split(',') for(var z = 0; z < child .length; z++){ if(own.code == child[z]){ bood = true; } } } if(!!bood){ return '' }else{ return '' } } })