123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- $(function(){
- var doctorInfo;
- var request = GetRequest();
- var hospitalId =request["hospitalId"];
- var hosDeptId = request["hosDeptId"];
- var doctorId = request["doctorId"];
- initData();
-
- bindEvents();//注册事件
-
-
- function initData(){
- d.show();
- getDoctorInfo();
- }
-
- function getDoctorInfo(){
- var params ={};
- params.city="350200";
- params.doctorId = doctorId;
- params.hospitalId = hospitalId;
- params.hosDeptId = hosDeptId;
- sendPost("third/guahao/GetDoctorInfo",params,"JSON","POST",queryFailed,queryDoctorSuc);
-
- }
-
- function getDocWorkTimeInfo(){
- var params ={};
- params.city="350200";
- params.doctorId = doctorId;
- params.hospitalId = hospitalId;
- params.hosDeptId = hosDeptId;
- sendPost("third/guahao/GetDoctorArrange",params,"JSON","POST",queryFailed,queryWorkTimeSuc);
- }
-
- function queryFailed(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 queryDoctorSuc(res){
- d.close();
- if(res.status==200){
- showDocInfo(res.data);
- }else{
- queryFailed(res);
- }
- }
-
- function queryWorkTimeSuc(res){
- if(res.status==200){
- showWorkTimeList(res.data);
- }else{
- queryFailed(res);
- }
- }
-
- function showDocInfo(data){
- $("#name").html(data.name);
- $("#jobName").html(data.title);
- $("#hospitalName").html(data.hospitalName);
- $("#introduce").html(data.introduce);
- if(data.sex==2){
- $("#photo").attr("src","../../../images/d-female.png");
- }else{
- $("#photo").attr("src","../../../images/d-male.png");
- }
- doctorInfo = data;
- getDocWorkTimeInfo();
- }
-
-
- function showWorkTimeList(data){
- var timeList = "";
- for(var j in data){
- var detail = data[j];
- var dateTime = detail.date+"";
- var date= dateTime.split(" ")[0];
- var week = getWeek(date);
- var riqi = date.split("-");
- riqi = riqi[1]+"-"+riqi[2];
- var used = detail.used;
- var max = detail.max;
- var isMo = detail.time;
- if(isMo =="a"){
- isMo ="上午";
- }else{
- isMo ="下午";
- }
- var status = detail.status;
- var statusHtml ="";
- if(status==2){
- statusHtml= '<div class="div-btn-status">'+
- '<div class="div-dian cb-909090"></div>'+
- '<div class="div-status-content c-909090">已满</div>'+
- '</div>';
- }else{
- statusHtml= '<div class="div-btn-status">'+
- '<div class="div-dian cb-74bf00"></div>'+
- '<div class="div-status-content c-74bf00">预约</div>'+
- '</div>';
- }
- var liHtml = appendLi(detail);
- var titleColor = 'c-323232';
- if(detail.regType != undefined){
- if(detail.regType.indexOf('vip')>-1 || detail.regType.indexOf('VIP')>-1 || detail.fee == '300'){
- titleColor = 'c-FF9526';
- }
- }else{
- if(detail.fee == '300'){
- titleColor = 'c-FF9526';
- detail.regType = "VIP门诊";
- }else{
- detail.regType = "普通门诊";
- }
- }
- timeList+= '<div class="div-item-content">'+
- '<div class="member-sel plr10 bor-b-f2" data-id="'+j+'">'+
- '<a class="arrow-shou fr ahide"></a>'+
- '<div class="h60">'+
- '<div class="div-item">'+
- '<div class="f-fs14 c-323232 f-tac h30 lh30 div-date">'+
- date+
- '</div>'+
- '<div class="f-fs12 f-tac h30 lh30 c-909090 div-week">'+
- week+" "+isMo+
- '</div>'+
- '</div>'+
- '<div class="div-item">'+
- '<div class="f-fs14 '+titleColor+' f-tac h30 lh30">'+
- detail.regType +
- '</div>'+
- '<div class="f-fs12 f-tac h30 lh30 c-909090">'+
- '诊查费:<span class="zcf-money">'+detail.fee+'元</span>'+
- '</div>'+
- '</div>'+
- '<div class="div-item">'+
- statusHtml+
- '</div>'+
- '<div>'+
- '</div>'+
- '</div>'+
- '</div>'+
- '<ul class="c-list member-list bor-b-f2 mt10 cb-f3f3f3 c-hide mb10">'+
- liHtml+
- '</ul>'+
- '</div>';
- }
- $("#tice_list").append(timeList);
- init();//页面初始化
- }
- function appendLi(detail){
- var sections = detail.sections;
- var liHtml = "";
- for(var j in sections){
- var data = sections[j];
- if(j%3==0){
- if(j!=0){
- liHtml+='</li>';
- }
- liHtml+='<li class="c-list-link h34">';
- }
- var start = data.startTime;
- var end = data.endTime;
- var max = data.max;
- var used = data.used;
- var clazz = "div-time-enable";
- if(max==used){
- clazz = "div-time-disable";
- }
- liHtml+='<div data-attr=\'{"sectionType":"'+detail.time+'","startTime":"'+start+'","yysj":"'+getTime(start)+"-"+getTime(end)+'"}\' class="'+clazz+'">'+getTime(start)+"-"+getTime(end)+'</div>';
- if(j==(sections.length-1)){
- liHtml+='</li>';
- }
- }
- return liHtml;
- }
- function getWeek(d){
- var dateArray = d.split("/");
- var year = dateArray[0], month = dateArray[1], date = dateArray[2];
- var dt = new Date(year, month-1, date);
- var weekDay = ["周天", "周一", "周二", "周三", "周四", "周五", "周六"];
- return weekDay[dt.getDay()]
- }
-
-
- function getTime(dateTime){
- var tempStrs = dateTime.split(" ");
- var timeStrs = tempStrs[1].split(":");
- var hour = timeStrs [0];
- var minute = timeStrs [1];
- var second = timeStrs [2];
- return hour+":"+minute;
-
- }
-
- function init(){
- var request = GetRequest();
- var type = request["type"] || "";
- var id = decodeURIComponent(request["id"]);
-
- if(type==1 || type==""){//显示医生简介
- $("#doctorLi").addClass("hit");
- $(".div-doctor-info").show();
- }else{//显示门诊预约
- $("#deptyuyueLi").addClass("hit");
- $(".div-dept-info").show();
- }
- if($('.member-sel[data-id='+id+']').length>0){
- $('.member-sel[data-id='+id+']').siblings("ul").removeClass("c-hide");
- $('.member-sel[data-id='+id+']').find(".arrow-shou").addClass("active");
- var offset = $('.member-sel[data-id='+id+']').offset();
- window.scrollTo(offset.left,offset.top);
- }
- }
-
- function bindEvents(){
- //分组展开收起
- $(".div-dept-info").on('click', '.member-sel', function() {
- if(!$(this).siblings("ul").hasClass("c-hide")){
- $(this).find(".arrow-shou").removeClass("active");
- $(this).siblings("ul").addClass("c-hide");
- }else{
- $(".member-list").addClass("c-hide");
- $(".member-sel").find(".arrow-shou").removeClass("active");
- $(this).siblings("ul").removeClass("c-hide");
- $(this).find(".arrow-shou").addClass("active");
- }
- });
-
- $(".pt-tab").on("click","li",function(){
- var activeId = $(this).attr("id");
- $(".pt-tab li").removeClass("hit");
- $(this).addClass("hit");
- if(activeId=="doctorLi"){//医生简介
- $(".div-doctor-info").show();
- $(".div-dept-info").hide();
- }else{//门诊预约
- $(".div-doctor-info").hide();
- $(".div-dept-info").show();
- }
- })
-
- $(".div-dept-info").on("click",".div-time-enable",function(){
- $(".div-time-enable").removeClass("active");
- $(this).addClass("active");
- var arrangeDate = $(this).attr("data-attr");
- window.localStorage.setItem("arrangeDate",arrangeDate);
- window.localStorage.setItem("doctorInfo",JSON.stringify(doctorInfo));
- location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wxurl+"%2fwdyy%2fhtml%2finfo-confirm.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
- // location.href = "info-confirm.html";
- });
-
- }
-
-
- });
|