define(function(require, exports) { var $ = require("jquery"), bajs = require("bajs")($), live = require("yd.pc.ready")($, bajs,{range: 1200}), util = require("yd.pc.util/public.new")($, bajs), time = require("yd.pc.util/public/time")($, bajs), //排班通用 ,模板修添加experts_date com = require("yd.pc.com/live/public")($, bajs, live); exports.setEasySlider = function(i){ if($(".f2BoxR"+i+" .f2BoxR dt li").length >1 ){ new bajs.view.EasySlider(".f2BoxR"+i+" .f2BoxR dt",{ autoplay : false, pagination : true, effect : { name : "slide" }, navigation : true }); } } $(function(){ $(".f2Box .f2BoxCon").each(function(i){ $(this).addClass("f2BoxR"+i); exports.setEasySlider(i); }) var now = new Date(); var show_day = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六"); var date_week = "医生"; var weekDay = new Array("one", "two", "three", "four", "five", "six", "seven"); //获取当前日期的星期一日期 function GetWeekDate(time) { var now = new Date(time); //当前日期 this.nowDayOfWeek = now.getDay(); //今天本周的第几天 this.nowYear = now.getYear(); //当前年 this.nowMonth = now.getMonth(); //月 this.nowDay = now.getDate(); //日 this.nowYear += (this.nowYear < 2000) ? 1900 : 0; // this.nowDayOfWeek = this.nowDayOfWeek == 0 ? 7 : this.nowDayOfWeek; // 如果是周日,就变成周七 this.weekStartDate = new Date(this.nowYear, this.nowMonth, this.nowDay - this.nowDayOfWeek + 1); var timestamp2 = Date.parse(new Date(this.weekStartDate)); timestamp2 = timestamp2 / 1000; return timestamp2; } function getData(keshi, data, tabBar, tabCon) { var arr = new Array(); $.each(keshi, function(i) { arr[keshi[i]["id"]] = new Array(); $.each(data, function(j) { var status = 1; if(parseInt(data[j]["typeid"]) == keshi[i]["id"]) { for(var k = 0; k <= arr[keshi[i]["id"]].length - 1; k++) { if(parseInt(arr[keshi[i]["id"]][k][0]["aid"]) == (data[j]["aid"])) { arr[keshi[i]["id"]][k].push(data[j]); status = 0 } } if(status == 1) { arr[keshi[i]["id"]].push([data[j]]); } } }) }) $.each(keshi, function(i) { var zj_paiban = ""; var zj_paiban1 = ""; var zj_paiban2 = ""; for(var n in arr[keshi[i]["id"]]) { zj_paiban += "
  • "; zj_paiban += arr[keshi[i]["id"]][n][0]["zjname"]; zj_paiban += ""; //for(var m = arr[keshi[i]["id"]][n].length - 1; m >= 0; m--) { for(var m = 0; m < arr[keshi[i]["id"]][n].length ; m++) { var pb = arr[keshi[i]["id"]][n]; var this_day = now.getDay(); if(this_day==0){ this_day=7; } if(m == 0) { var this_week = pb[m]["paiban_date"] - GetWeekDate(Date.parse(new Date())); //如果当前排班数据只有下周 if(this_week==604800){ //输出本周为空数据 for(var l = 0; l < (7 - this_day + 1); l++) { zj_paiban += ""; } for(var q = 0; q < ( 7 - (7 - this_day + 1)); q++) { (pb[m][weekDay[q] + "_bai"] != null || pb[m][weekDay[q] + "_zhong"] != null || pb[m][weekDay[q] + "_wan"] != null) ? zj_paiban += "预约": zj_paiban += ""; } }else{ var today=this_day-1; for(var l = 0; l < (7 - this_day + 1); l++) { (pb[m][weekDay[today] + "_bai"] != null || pb[m][weekDay[today] + "_zhong"] != null || pb[m][weekDay[today] + "_wan"] != null) ? zj_paiban += "预约": zj_paiban += ""; today++; } if(arr[keshi[i]["id"]][n].length - 1 == 0) { for(var o = 0; o < 7 - (7 - this_day + 1); o++) { zj_paiban += ""; } } } } if(m == 1) { for(var j = 0; j < (this_day - 1); j++) { (pb[m][weekDay[j] + "_bai"] != null || pb[m][weekDay[j] + "_zhong"] != null || pb[m][weekDay[j] + "_wan"] != null) ? zj_paiban += "预约": zj_paiban += ""; } } } zj_paiban += "
  • " } $(tabBar + " ul").append( "
  • " + keshi[i]["typename"] + "
  • " ); $(tabCon).append( "
    " + "
    " + date_week + "
    " + "" + "
    " + "
    " + "" ); }) } //建立科室数据索引 var keshi = [ //科室 { "id": "722 ", "typename": "妇科 " }, { "id": "723 ", "typename": "儿科 " }, { "id": "1591 ", "typename": "产科" }, { "id": "725 ", "typename": "口腔科 " }, { "id": "726 ", "typename": "儿保科 " }, /*{ "id": "727 ", "typename": "营养门诊 " },*/ { "id": "728 ", "typename": "乳腺外科 " }, /* { "id": "729 ", "typename": "医疗美容科 " }, { "id": "897 ", "typename": "健康体检 " }, */ /* { "id": "730 ", "typename": "馨月馆 " }, */ { "id": "896 ", "typename": "内科 " }, /*{ "id": "1587 ", "typename": "外科 " },*/ { "id": "1652 ", "typename": "盆底专科 " }, { "id": "1747 ", "typename": "中医科" }, { "id": "1765 ", "typename": "耳鼻喉科" } ]; var vipKeshi = [ // vip科室 { "id": "1756", "typename": "产科VIP" }, { "id": "1757", "typename": "妇科VIP" }, { "id": "1758", "typename": "儿科VIP" }, { "id": "1759", "typename": "儿童保健VIP" }, { "id": "1760", "typename": "内科VIP" } ]; for(var i = 1; i <= 7; i++) { //后7天 showDate = (now.getMonth() + 1) + "/" + now.getDate(); date_week = date_week + "" + showDate + show_day[now.getDay()] + ""; now.setDate(now.getDate() + 1); } // 获取数据 $.getJSON("/api/paiban.htmp", { dataType: "JSONP" }, // 数据加载成功 function(data) { getData(keshi, data, ".tab2", ".f1BoxCon1"); getData(vipKeshi, data, ".tab1", ".f1BoxCon2"); $(".f1BoxCon1 .f1Table").eq(0).addClass("active") $(".f1BoxCon2 .f1Table").eq(0).addClass("active") $(".tab1 li").eq(0).addClass("hover") $(".tab2 li").eq(0).addClass("hover") tabbar() var box1=$(".f1BoxCon") for(var i = 0; i <$(".f1BoxCon1 .f1Table").size(); i++){ for (var t=1;t"); smallObj = new bajs.view.EasySlider(expertSmall,{ autoplay : false, pagination : true, navigation : true, effect : { name : "slide" }, onReady : function(){ $(expertSmall).find("dl").on("click", function(){ var index = parseInt($(this).attr("data-index")); $(this).addClass("current").siblings().removeClass("current"); slideObj.slideTo(index); }).eq(0).addClass("current"); } }); }; exports.exportsPaiban = function(i,t){ var f1Box = ".f1BoxCon"+t+" "+".f1Box"+ i slideObj = ".f1BoxCon"+t+" "+".f1Box"+i f1BoxList = $(f1Box).find("li").size() if (f1BoxList >4) { slideObj = new bajs.view.EasySlider(f1Box,{ autoplay : false, pagination : false, effect : { name : "slide", options : { mode : "Y" } }, navigation : true }); } f1BoxList = $(f1Box+" li").size(); if (f1BoxList >= 4) { slideObj = new bajs.view.EasySlider(f1Box,{ autoplay : true, pagination : false, effect : { name : "slide", options : { mode : "Y" } }, navigation : true }); } } //服务满意度,诊疗满意度 exports.setDemo = function(obj,input){ var $aLi=$(obj); $aLi.each(function(i, ele){ $(ele).mouseover(function(){ var index = $(this).index(); $(input).val(index+1); $aLi.each(function(j){ if(j <= index){ $aLi.eq(j).css("background", "url(/images/2017index/img.png) 0 -359px no-repeat"); }else{ $aLi.eq(j).css("background", "url(/images/2017index/img.png) -24px -359px no-repeat"); } }); }); }); } });