123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- (function (c) {
- config.init();
- var selectedDate = window.Fx.getUrlParam('date');
- var a = {
- hospitalId: Fx.getUrlParam("hospitalId"),
- deptId: Fx.getUrlParam("deptId"),
- doctorId: Fx.getUrlParam("doctorId")
- };
- var b = {
- hospitalId: Fx.getUrlParam("hospitalId"),
- deptId: Fx.getUrlParam("deptId"),
- doctorId: Fx.getUrlParam("doctorId"),
- regDate: window.Fx.getUrlParam('date')||(new Date()).pattern('yyyy-MM-dd')
- }
- //界面显示日期 url参数
- // c('#date').html(selectedDate);
- //获取医生诊疗费用
- c.ajax({
- type: "get",
- url: window.apiUrl + "index.php?c=Other&a=getDoctorBookingScheduleSyn",
- dataType: "jsonp",
- data: c.extend(window.hzAPI.getToken(), a),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success: function (data) {
- //显示金额
- c('#money').html('¥'+data.dataInfo.data[0].treatFee/100 + '.00');
- },
- error: function (error) {
- window.hzAPI.dialog(false, window.hzAPI.options.timeout, "网络链接失败");
- },
- timeout: 9000
- });
-
- //医生信息
- hzAPI.getData(window.apiUrl + "?c=Index&a=doctorInfo", a, "#docinfo");
- //hzAPI.getData(window.apiUrl + "?c=Index&a=doctorInfo", a, "#list1 ul", 1, null, null, null);
- var getTime = function () {
- var deferred = c.Deferred();
- c.ajax({
- type: "get",
- url: window.apiUrl+"index.php?c=ReqHis&a=getTimeRegInfo",
- dataType: "jsonp",
- data: c.extend(window.hzAPI.getToken(),b),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success:function (data) {
- deferred.resolve(data);
- },
- error: function (error) {
- window.hzAPI.dialog(false, window.hzAPI.options.timeout, "服务器繁忙,请刷新重试");
- },
- timeout: 9000
- });
- return deferred.promise();
- }
- var getDate = function () {
- var deferred = c.Deferred();
- c.ajax({
- type: "get",
- url: window.apiUrl+"index.php?c=Other&a=getDoctorBookingScheduleSyn",
- dataType: "jsonp",
- data: c.extend(window.hzAPI.getToken(),a),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success:function (data) {
- deferred.resolve(data);
- },
- error: function (error) {
- window.hzAPI.dialog(false, window.hzAPI.options.timeout, "网络链接失败");
- },
- timeout: 9000
- });
- return deferred.promise();
- }
- //就诊日期 获取参数生成链接
- c.when(getTime(),getDate()).done(function (res1,res2) {
- //如果返回的结果是 false 说明医院的接口又拿不到数据啦~
- if(!res1||!res2){
- window.hzAPI.dialog(fasle,window.hzAPI.options.timeout,"服务器繁忙,请刷新重试");
- return false;
- }
- console.log(res1,res2);
- var list = res1.dataInfo.data;
- var dateList = res2.dataInfo.data;
- var timeFlag = '';
- var regFee = '';
- var treatFee = '';
- var listStr = '';
- //找出选择日期的参数的值
- for(var i in dateList){
- if(dateList[i].regDate == selectedDate){
- timeFlag = dateList[i].timeFlag;
- regFee = dateList[i].regFee;
- treatFee = dateList[i].treatFee;
- }
- }
- $('.subscribeList li').eq(0).siblings().remove();
- for(var i = 0; i<list.length ; i++ ){
- if(list[i].regLeaveCount > 0){
- listStr += '<li class="line1">' +
- '<a href="doctorBookingSure.html?scheduleCode='+ list[i].scheduleCode +'&hospitalId='+b.hospitalId+'&deptId='+b.deptId+'&doctorId='+b.doctorId+
- '®Date='+ b.regDate +'&timeFlag='+ timeFlag +'®Fee='+ regFee +'&treatFee='+ treatFee +'&startTime='+ list[i].startTime +'&endTime='+ list[i].endTime +'">' +
- ' <span class="button"><i class="icon-arrowright"></i> </span>' +
- ' <div class="info_line1" style="text-align: center;color: #008a8a">' + list[i].startTime + '~' + list[i].endTime +
- '(总'+ list[i].regTotalCount +'余'+ list[i].regLeaveCount +')号 '+
- '<span>可预约</span>' +
- ' </div>' +
- ' <div class="clear"></div>' +
- '</a>' +
- '</li>';
- }else{
- listStr += '<li class="line1">' +
- '<a href="javascript:;">' +
- ' <span class="button"><i class="icon-arrowright"></i> </span>' +
- ' <div class="info_line1" style="text-align: center;color: #008a8a">' + list[i].startTime + '~' + list[i].endTime +
- '(总'+ list[i].regTotalCount +'余'+ list[i].regLeaveCount +')号 '+
- '<span style="color: gray;">不可预约</span>' +
- ' </div>' +
- ' <div class="clear"></div>' +
- '</a>' +
- '</li>';
- }
- '<span style="color: red">已约满</span>'
- }
- $('.subscribeList ul').append(listStr);
- })
- //旧接口
- // hzAPI.getData(window.apiUrl + "?c=Other&a=getDoctorBookingScheduleSyn", a, "#list1 ul", 1, null, null, null, "该周暂无出诊安排");
- c('#subscribe').click(function (e) {
- c('#d-title').html('<div>'+$('.doctor .name').html()+' <span>'+$('.doctor .title').html()+'</span></div>');
- c('#d-img').attr('src',$('.doctor img').attr('src'));
- c('.lists').addClass('active');
- });
- c('.wrap').click(function (e) {
- c('.lists').removeClass('active');
- // c('#list1 ul').html('');
- });
- c('body').on('click','.close',function (e) {
- c('.lists').removeClass('active');
- })
- //添加关注
- // c('#favorite').click(function (e) {
- // window.hzAPI.sendData(window.apiUrl+"?c=Index&a=favoriteDoctor",c.extend(a,{status: 1}),false, ["更新失败", "更新成功"], [0, c(this)]);
- // })
- })(Zepto);
|