123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var pagetype = 48;
- var barCode;
-
- $(function(){
- checkUserAgent();
- getImmuneMembers();
- bindEvents();
- })
- function getImmuneMembers(){
- var data = {};
- sendPost("patient/family/members", data, "json", "get", queryListFailed, queryAppoListSuccesss);
- }
- function queryAppoListSuccesss(res){
- if (res.status == 200) {
- barCode = "";
- if (res.data.immunemembers.length > 0) {
- showMember(res);
- }
- if(res.data.immunemembers.length == 0){
- $('#wrapper2').css('top','0px');
- d.close();
- $(".main").hide();
- $(".div-no-info").show();
- }
- }else{
- //非200则为失败
- queryListFailed(res);
- }
- }
- function queryListFailed(res) {
- if (res && res.msg) {
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
- } else {
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载家庭成员失败'}).show();
- }
- }
- function showMember(res){
- var html='',
- data=res.data.immunemembers;
- for(var i=0;i<data.length;i++){
- //"relation": 1//---1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
- if(data[i].relation==5){
- data[i].familyRelationName = '儿子'
- }else if(data[i].relation==6){
- data[i].familyRelationName = '女儿'
- }else{
- data[i].familyRelationName = '其他'
- }
- html = html + '<div class="mui-control-item" data-code="'+data[i].barcode+'" data-name="'+data[i].name+'" style="display: inline-block;margin-right: 15px;-webkit-user-select: none;vertical-align: middle;text-align: center;">\
- <img style="width: 40px;height: 40px;border-radius: 50%;overflow: hidden;border:solid 1px #dcdcdc;" src="../images/youer_moren_img.png"/>\
- <div class="name" style="font-size: 12px;color: #333;line-height: 20px;">'+data[i].name+'('+data[i].familyRelationName+')</div></div>'
- }
- html = '<div class="mui-scroll-wrapper family-member" style="position: absolute;z-index: 999;top: 0;bottom: 0;left: 0;overflow: hidden;width: 100%;height: 90px;background-color:#f3f3f3;padding-left: 15px;padding-top: 7px;border-bottom:solid 1px #dcdcdc;box-sizing: border-box;">\
- <div class="mui-scroll" style="position: absolute;width: auto;z-index: 99;white-space: nowrap;-webkit-transform: translateZ(0);transform: translateZ(0);">'+html+'</div></div>';
- $('#memberContainer').append(html);
- setTimeout(function(){
- addEvent();
- },200)
-
- initData();
- }
- function active(one){
- one.find('img').css({width: '55px',height: '55px'});
- one.find('.name').css({'font-size': '14px','line-height':'23px'});
- }
- function addEvent(){
- mui('.family-member').scroll({
- scrollY: false, //是否竖向滚动
- scrollX: true, //是否横向滚动
- });
- $('#memberContainer').on('tap','.mui-control-item',function(){
- var $this = $(this),
- $code = $this.data('code');
- barCode = $code;
- $('.mui-control-item').find('img').css({width: '40px',height: '40px'});
- $('.mui-control-item').find('.name').css({'font-size': '12px','line-height':'20px'});
- active($this);
- initData();
- })
- }
- function initData(){
- $(".c-list").html("");
- pageIndex = 1;
- getMyAppo();
- }
- function getMyAppo(){
- d.show();
- var data={};
- if(barCode==""){
- var $ul = $('#memberContainer').find('.mui-control-item');
- barCode = $ul.eq(0).data('code')
- if(barCode){
- active($ul.eq(0));
- }
- }
- if(barCode){
- $('#wrapper2').css('top','90px');
- $('.div-no-info').css('padding-top','150px');
- $(".main").show();
- $(".div-no-info").hide();
- data.BarCode = barCode;
- sendPost('/patient/guahao/imm/GetResImmuneListWithBarCode', data, 'json', 'get', getListFail, successFun);
- }else{
- $('#wrapper2').css('top','0px');
- d.close();
- $(".main").hide();
- $(".div-no-info").show();
- }
- }
- function successFun(res){
- if(res.status==200){
- if(res.data&&res.data.length>0){
- pageIndex=pageIndex+1;
- appendMyAppo(res.data);
- }else{
- if(pageIndex==1){
- $(".main").hide();
- $(".div-no-info").show();
- $("#footer").show();
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show();
- }
- d.close();
- }
-
- }else{
- getListFail(res);
- }
- }
- function getListFail(res){
- d.close();
- if (res && res.msg) {
- if((res.msg).indexOf("SOAP")>=0){
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:"医院接口访问异常,请刷新后重试!",bottom:true}).show();
- return false;
- }
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg,bottom:true}).show();
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败',bottom:true}).show();
- }
- }
- function appendMyAppo(dataList){
- var appoHtml ="";
- appoHtml = template("doctor_list_tmp", {list:dataList});
- $(".c-list").append(appoHtml);
- setTimeout(function(){
- scroller1.myScroll.refresh();
- },500)
-
- d.close();
- $(".main").show();
- $("#footer").show();
- }
- function bindEvents(){
- $(".c-list").on("click",".n-list-li,.n-list-content",function(event){
- var parentLi = $(this).closest("li");
- var id = parentLi.attr("data-id");
- var guahaoTime = parentLi.attr("guahao-time");
- var jiuzhenTime = parentLi.attr("jiuzhen-time");
- var jiezhongHospital = parentLi.attr("jiezhong-hospital");
- var jiuzhenName = parentLi.attr("jiuzhen-name");
- var idCard = parentLi.attr("id-card");
- var hospitalCard = parentLi.attr("hospital-card");
- var dataPhone = parentLi.attr("data-phone");
- var dataStatus = parentLi.attr("data-status");
- var SectionType = parentLi.attr("Section-type");
- var hospitalId = parentLi.attr("hospital-id");
- location.href = "detail-immune-appointment.html?barCode="+id+"&guahaoTime="+guahaoTime
- +"&jiuzhenTime="+jiuzhenTime+"&jiezhongHospital="+jiezhongHospital+"&jiuzhenName="+jiuzhenName+"&idCard="+idCard
- +"&hospitalCard="+hospitalCard+"&dataPhone="+dataPhone+"&dataStatus="+dataStatus+"&SectionType="+SectionType+"&hospitalId="+hospitalId;
- }).on("click",".div-again",function(){
- var parentLi = $(this).closest("li");
- var hospitalId = parentLi.attr("hospital-id");
- location.href = "immune-date.html?hospitalId="+hospitalId;
- })
-
- $(".div-add-btn").on("click",function(){
- location.href = "appointment-register.html";
- })
- }
- //下拉刷新
- function pullDownAction(theScrollerTemp) {
- // $(".main").hide();
- // $("#footer").hide();
- // $(".pullDown").show();
- // initData();
- // setTimeout(function () {
- // $(".pullDown").hide();
- // }, 1000);
- }
- //将scroller1的初始化代码放到外面来,不然从微信授权重定向过来这个页面的时候,
- //iscroll-pull-up-down 里监听的window的load方法不会触发,导致scroller初始化代码没有执行
- var scroller1 = new IScrollPullUpDown('wrapper2',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- scrollbars:true,
- fadeScrollbars:true,
- click:true,
- interactiveScrollbars:false
- },pullDownAction,null);
-
|