123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- var pageIndex = 1;
- var pageSize = 100;
- var patient = null;
- var hospitalId = null;
- var deptId= null;
- var scroller1 = null;
- var xtCode = "";
-
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- patient = self.patient;
- hospitalId = self.hospitalId;
- deptId = self.deptId;
- xtCode = self.xtCode
- bindEvents();
- initDoctors();
- initScroller();
- //协同
- if(xtCode){
- $('#no_appoint').show()
- $('#no_appoint').on('click',function(){
- mui.openWindow({
- id: "xietongfuwu-deal",
- url: "../../xtfw/html/xietongfuwu-deal.html",
- extras: {
- type:1,
- code:xtCode
- }
- })
- })
- }
- });
-
- function initScroller(){
- scroller1 = $("#wrapper3").initScroll(
- {
- pullDownAction: function(){
- initDoctors();
- },pullUpAction: function() {
- updatePullUpText(scroller1,new Array());
- }
- }
- );
- }
-
- var updatePullUpText= function(scroller,list) {
- var $wrap = $(scroller.wrapper),
- $pullupLabel = $wrap.find('.pullUpLabel');
- $(".pullUp").removeClass("loading");
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- scroller.on('refresh',function() {
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- })
- }
-
-
-
- function bindEvents(){
- $(".c-list").on("click","li",function(event){
- var doctorId = $(this).attr("data-id");
- var target = $(event.target);
- var params = {};
- params.patient = patient;
- params.xtCode = xtCode;
- if(target.closest(".div-timeList").length==0){
- params.type=1;
- params.doctorId = doctorId;
- params.hospitalId = hospitalId;
- params.deptId = deptId;
- //跳转到医生简介
- openWebviewExtras("doctor-detail.html",params);
- }else{//跳转到门诊预约
- var id = target.closest("div").eq(0).attr("data-id");
- params.type=2;
- params.doctorId = doctorId;
- params.hospitalId = hospitalId;
- params.deptId = deptId;
- params.dataid = id;
- openWebviewExtras("doctor-detail.html",params);
- }
- })
- }
-
-
- function initDoctors(){
- pageIndex = 1 ;
- $(".c-list").html("");
- $("#wrapper3").hide()
- getDoc();
- }
-
-
- function getDoc(){
- var data={};
- data.city = CITY_CODE;
- data.filter ="";
- data.hospitalId = hospitalId;
- data.hosDeptId = deptId;
- data.pageIndex = pageIndex;
- data.pageSize = pageSize;
- plus.nativeUI.showWaiting();
- sendPost('third/guahao/GetDoctorList', data,getListFail, successFun);
- }
-
- function successFun(res){
- if(res.status==200){
- if(res.data.length > 0){
- appendDoc(res.data);
- }else{
- $("#wrapper3").show();
- $(".pullUp").hide();
- $("#no_result_wrap").removeClass("c-hide");
- plus.nativeUI.closeWaiting();
- }
- }else{
- getListFail(res);
- }
- }
-
- function getListFail(res){
- plus.nativeUI.closeWaiting();
- if (res && res.msg) {
- mui.toast(res.msg);
- } else {
- mui.toast("医生列表获取失败!");
- }
- }
-
- function appendDoc(dataList){
- var dochtml ="";
- if(pageIndex==1){
- $(".c-list").html("");
- }
- updatePullUpText(scroller1,dataList);
- for(var j in dataList){
- var data = dataList[j];
- getDocTime(data);
- }
- }
-
- function getDocTime(data){
- var params={};
- params.OrgCode = hospitalId;
- params.DeptCode = deptId;
- params.DocCode = data.id;
- sendPost('wlyy_service/third/smjk/RegDeptSpeDoctorSectionList', params, getListFail, function(res){
- if(res.status==200){
- plus.nativeUI.closeWaiting();
- if(!res.data||res.data.length==0){
- return;
- }
- var title = "";
- var introduce = "";
- var img = getImgUrl(data.photo) || "d-male.png";
- if(data.title){
- title = '<span class="c-f16 c-666666 pl10">('+data.title+')</span>';
- }
- if(data.introduce){
- introduce = '<div class="mt5 c-f12 c-666666 mb5 pl10">'+
- '<span class="span-content">擅长:'+
- data.introduce+
- '</span>'+
- '</div>';
- }
- var dochtml = '<li class="mt10" data-id="'+data.id+'">'+
- '<div class="n-list dr-item c-border">'+
- '<div class="n-list-li pl10">'+
- '<div class="n-list-key">'+
- '<div class="n-avatar-l img-round">'+
- '<img src="../../../images/'+img+'">'+
- '</div>'+
- '</div>'+
- '<div class="pl15 c-100">'+
- '<div>'+
- '<span class="c-f16 c-bold c-323232">'+data.name+'</span>'+
- title+
- '</div>'+
- '<div class="c-f12 c-323232 div-hospital">'+data.hospitalName+'</div>'+
- '<div class="c-f12 c-323232">'+data.hosDeptName+'</div>'+
- '</div>'+
- '</div>'+
- introduce+
- '<div class="line"></div>'+
- '<div class="mt10 c-f14 c-666666 mb10 pl10">'+
- '<span class="">'+
- '医生坐诊时间'+
- '</span>'+
- '</div>'+
- '<div class="div-timeList">';
- for(var j in res.data){
- if(j%2==0){
- dochtml+='<div class="height-40">';
- }
- var timeData = res.data[j];
- var dateTime = timeData.date+"";
- var date= dateTime.split(" ")[0];
- var week = getWeek(date);
- var riqi = date.split("/");
- riqi = riqi[1]+"-"+riqi[2];
- var used = parseInt(timeData.used);
- var max = parseInt(timeData.max);
- var isMo = timeData.time;
- var status = timeData.status;
- if(isMo =="a"){
- isMo ="上午";
- }else{
- isMo ="下午";
- }
- var clazz = "div-fr-time-item";
- if(j%2==0){
- clazz = "div-time-item"
- }
- var vip_icon = "";
- var timeBg = 'cb-74BF00';
- if(res.data[j].regType != undefined){
- if(res.data[j].regType.indexOf('vip')>-1 || res.data[j].regType.indexOf('VIP')>-1 || res.data[j].fee == '300'){
- vip_icon = '<i class="vip-icon"></i>';
- clazz = clazz+' vip-bg';
- timeBg = 'cb-FF9526';
- }
- }else{
- if(res.data[j].fee == '300'){
- vip_icon = '<i class="vip-icon"></i>';
- clazz = clazz+' vip-bg';
- timeBg = 'cb-FF9526';
- }
- }
- if(status==2||max<=used){
- dochtml+='<div class="'+clazz+'" data-id="'+j+'">'+
- '<span class="div-item-time">'+riqi+" "+week+isMo+'</span>'+
- '<span class="div-item-man c-fff cb-A8A8A8">满</span>'+
- vip_icon +
- '</div>';
- }
- else if(status==0){
- dochtml+='<div class="'+clazz+'" data-id="'+j+'">'+
- '<span class="div-item-time">'+riqi+" "+week+isMo+'</span>'+
- '<span class="div-item-man c-fff cb-A8A8A8">停</span>'+
- vip_icon +
- '</div>';
- }
- else{
- dochtml+='<div class="'+clazz+'" data-id="'+j+'">'+
- '<span class="div-item-no-man">'+riqi+" "+week+isMo+'</span>'+
- '<span class="div-item-man c-fff ' + timeBg + '">'+(max-used)+'</span>'+
- vip_icon +
- '</div>';
- }
- if(j%2==1||j==(res.data.lenth-1)){
- dochtml +='</div>';
- }
- }
- dochtml+='</div></div></li>';
- $(".c-list").append(dochtml);
- scroller1.refresh();
- $("#wrapper3").show()
- }else{
- getListFail(res);
- }
- });
- }
-
- 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()]
- }
|