|
@ -0,0 +1,297 @@
|
|
|
var page = 1;
|
|
|
var pageSize = 1000000;
|
|
|
var d = dialog({contentType:'load', skin:'bk-popup'});
|
|
|
var patientcode ="";
|
|
|
var isSearch = false;
|
|
|
// 搜索框
|
|
|
//var $searchbar = $('.searchbar'),
|
|
|
//// 搜索输入框
|
|
|
//$searchbarInput = $('.searchbar input'),
|
|
|
//// 搜索取消按钮
|
|
|
//$searchCancelBtn = $('.searchbar-cancel'),
|
|
|
//// 搜索框下面悬浮的搜索提示
|
|
|
//$searchSuggest = $('#search_suggest_text'),
|
|
|
//$listTIt = $('#list_tit'),
|
|
|
//// 搜索结果展示容器
|
|
|
//$searchtResult = $('.div-content');
|
|
|
//// 搜索框初始化
|
|
|
//$searchbar.addClass("searchbar-active");
|
|
|
var getReqPromise = null;
|
|
|
var scroller1 = null;
|
|
|
$(function(){
|
|
|
//添加isrcoll
|
|
|
scroller1 = new IScrollPullUpDown('wrapper2',{
|
|
|
probeType:2,
|
|
|
bounceTime: 250,
|
|
|
bounceEasing: 'quadratic',
|
|
|
mouseWheel:false,
|
|
|
scrollbars:true,
|
|
|
click:true,
|
|
|
fadeScrollbars:true,
|
|
|
interactiveScrollbars:false
|
|
|
},pullDownAction);
|
|
|
|
|
|
bindEvents();
|
|
|
pageInit();
|
|
|
})
|
|
|
|
|
|
//下拉刷新
|
|
|
function pullDownAction(theScrollerTemp) {
|
|
|
setTimeout(function () {
|
|
|
$(".c-list").html("");
|
|
|
page=1;
|
|
|
pageInit();
|
|
|
}, 1000);
|
|
|
}
|
|
|
|
|
|
//上拉加载数据
|
|
|
function pullUpAction(theScrollerTemp) {
|
|
|
$(".pullUp").show();
|
|
|
setTimeout(function () {
|
|
|
page++;
|
|
|
pageInit();
|
|
|
}, 1000);
|
|
|
}
|
|
|
|
|
|
|
|
|
function pageInit(){
|
|
|
d.show();
|
|
|
var params = {};
|
|
|
params.page = page;
|
|
|
params.pagesize = pageSize;
|
|
|
params.name = $(".inp-search").val();
|
|
|
getReqPromise("patient/consult/concernDoctorList",params).then(function(data){
|
|
|
// getReqPromise("patient/consult/famousDoctorList",params).then(function(data){
|
|
|
if(data.status == 200){
|
|
|
var rowData = data.list;
|
|
|
if (rowData.length > 0) {
|
|
|
var listResult = _.map(rowData,function(item,index){
|
|
|
var countClass = "c-74bf00";
|
|
|
var num = item.num || 0;
|
|
|
var expertise = "";
|
|
|
var job_name = "";
|
|
|
var photo = item.photo;
|
|
|
if(!photo){
|
|
|
var photo = "../../../images/noSexDoctor.jpg";
|
|
|
if(item.sex==1){
|
|
|
photo = "../../../images/d-male.png";
|
|
|
}else if(item.sex==2){
|
|
|
photo = "../../../images/d-female.png";
|
|
|
}
|
|
|
}
|
|
|
if(num==0){
|
|
|
countClass = "c-FF6A56";
|
|
|
}
|
|
|
if(item.expertise){
|
|
|
expertise = '<div class="c-f12 c-666666">'+
|
|
|
'<span class="span-content">'+item.expertise || ""+'</span>'+
|
|
|
// '<span class="span-content">高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠心病、心律失常等疾病的诊治擅长高血压、冠</span>'+
|
|
|
'</div>';
|
|
|
}
|
|
|
if(item.job_name.trim()){
|
|
|
job_name = '<span class="c-f14 c-666666 pl10">('+item.job_name+')</span>';
|
|
|
}
|
|
|
var content ='<li class="mt10" data-code="'+item.code+'" data-name="'+item.name+'" data-id="'+item.id+'">'+
|
|
|
'<div class="n-list dr-item c-border c-100">'+
|
|
|
'<div class="n-list-li">'+
|
|
|
'<div class="n-list-key">'+
|
|
|
'<div class="n-avatar-l img-round">'+
|
|
|
'<img src="'+getImgUrl(item.photo)+'">'+
|
|
|
'</div>'+
|
|
|
'</div>'+
|
|
|
'<div class="pdr-50 pl5">'+
|
|
|
'<div class="c-f14 c-323232">'+
|
|
|
'<span class="c-bold search-target-text">'+item.name+'</span>'+
|
|
|
'<span class="plr5">'+ item.dept_name +'</span>' + item.job_name +
|
|
|
'</div>'+
|
|
|
'<div class="c-f14 c-323232">'+
|
|
|
'<span>'+item.hospital_name+'</span>'+
|
|
|
'</div>'+
|
|
|
expertise+
|
|
|
'<div class="c-f12 c-323232 pt10 clearfix">' +
|
|
|
'<div class="fl w-33"><span class="pr5">关注</span>' + item.concernNum + '</div>' +
|
|
|
'<div class="fl w-33"><span class="pr5">咨询</span>'+item.consultNum+'</div>' +
|
|
|
'<div class="fl w-33"><span class="pr5">文章</span>'+item.articleNum+'</div>' +
|
|
|
'</div>'+
|
|
|
'</div>'+
|
|
|
'</div>'+
|
|
|
'</div>'+
|
|
|
'</li>';
|
|
|
id = item.id;
|
|
|
return content;
|
|
|
})
|
|
|
$(".c-list").append(listResult);
|
|
|
var kw = $(".inp-search").val();
|
|
|
highlightKeyword(kw);
|
|
|
scroller1.myScroll.refresh();
|
|
|
}else {
|
|
|
if(isSearch){//查询无结果
|
|
|
$(".main").show();
|
|
|
$(".div-content").hide();
|
|
|
$(".div-no-search-info").show();
|
|
|
$(".div-search-content").html("查无数据");
|
|
|
isSearch = false;
|
|
|
}else if(page==1){//page为1的时候证明是第一次加载,第一次加载无数据,显示无数据界面
|
|
|
$(".main").hide();
|
|
|
$(".div-no-search-info").show();
|
|
|
$(".div-search-content").html("暂无已关注(咨询)医生,请先添加关注~");
|
|
|
}else {
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'无更多数据'}).show();
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:data.msg}).show();
|
|
|
}
|
|
|
d.close();
|
|
|
$(".pullUp").hide();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function bindEvents(){
|
|
|
|
|
|
$(".c-list").on("click","li",function(){
|
|
|
d.show();
|
|
|
var doctorCode = $(this).attr("data-code");
|
|
|
var docName = $(this).attr("data-name");
|
|
|
sendPost('patient/consult/is_consult_unfinished', {doctor: doctorCode}, 'json', 'post',
|
|
|
function(res){
|
|
|
d.close();
|
|
|
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(res){
|
|
|
d.close();
|
|
|
if(res.status == 200){
|
|
|
if(res.data == ""){
|
|
|
window.location.href = "mingyi-homepage.html?doctorCode="+doctorCode;
|
|
|
} else {
|
|
|
dialog({
|
|
|
content: '十分抱歉,您与'+ docName +'医生还有<br/>未结束咨询,无法发起新的咨询',
|
|
|
okValue:'前往查看',
|
|
|
ok: function (){
|
|
|
var userAgent = window.localStorage.getItem(agentName);
|
|
|
var userInfo = JSON.parse(userAgent);
|
|
|
var rep = userInfo.represented?userInfo.represented:userInfo.uid;
|
|
|
window.location.href = "consulting-doctor.html?consult=" + res.data +"&toUser="+rep;
|
|
|
},
|
|
|
cancelValue: '我知道了',
|
|
|
cancel: function () {
|
|
|
$(".modal-overlay").trigger("click");
|
|
|
$(".sanshi-icon").removeClass("active");
|
|
|
$(".jiating-icon").removeClass("active");
|
|
|
$(".mingyi-icon").removeClass("active");
|
|
|
return;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}
|
|
|
} else {
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
|
|
|
// 控制搜索关键字悬浮提示的显示
|
|
|
getReqPromise = function(url, data) {
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
sendPost(url, data, "json", "post",
|
|
|
function queryFailed (req) {
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
|
|
|
// TODO 开启示例数据
|
|
|
//resolve({});
|
|
|
}
|
|
|
, function success(req) {
|
|
|
resolve(req);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// //取消事件
|
|
|
// $searchCancelBtn.on('click',function() {
|
|
|
// $(this).hide();
|
|
|
// $searchSuggest.text('');
|
|
|
// $searchSuggest.hide();
|
|
|
// $listTIt.show()
|
|
|
// $searchtResult.show();
|
|
|
// });
|
|
|
//
|
|
|
// $searchSuggest.on('click',function() {
|
|
|
// search();
|
|
|
// });
|
|
|
//
|
|
|
// //搜索框事件
|
|
|
// $(".inp-search").on("input",function(){
|
|
|
// var text = $(this).val().trim();
|
|
|
// $searchtResult.hide();
|
|
|
// showSearchSuggest(text);
|
|
|
// if(text){
|
|
|
// $searchCancelBtn.show();
|
|
|
// $searchCancelBtn.css("opacity","1");
|
|
|
// }else{
|
|
|
// $searchCancelBtn.hide();
|
|
|
// $searchCancelBtn.css("opacity","0");
|
|
|
// search();
|
|
|
// }
|
|
|
// })
|
|
|
}
|
|
|
|
|
|
// var showSearchSuggest = function(text) {
|
|
|
// var suggestText = '搜索“'+text+'”';
|
|
|
// // 如果text不为空,则显示;否则隐藏
|
|
|
// if(text&&text.trim().length) {
|
|
|
// $searchSuggest.text(suggestText);
|
|
|
// $searchSuggest.show();
|
|
|
// $listTIt.hide();
|
|
|
// } else {
|
|
|
// $searchSuggest.text('');
|
|
|
// $searchSuggest.hide();
|
|
|
// $listTIt.show();
|
|
|
// }
|
|
|
// },
|
|
|
// 关键字高亮显示
|
|
|
var highlightKeyword = function(kw) {
|
|
|
$searchTarget = $('.search-target-text');
|
|
|
$searchTarget.hide();
|
|
|
_.each($searchTarget,function(ele){
|
|
|
var $ele = $(ele),
|
|
|
text = $ele.text(),
|
|
|
reg = new RegExp(kw+"(?!>)","gi"),
|
|
|
html = text.replace(reg,'<em>'+kw+'</em>');
|
|
|
$ele.html(html);
|
|
|
});
|
|
|
$searchTarget.show();
|
|
|
},
|
|
|
// // TODO搜索框搜索执行方法
|
|
|
// search = function () {
|
|
|
// $(".div-no-search-info").hide();
|
|
|
// isSearch = true;
|
|
|
// $searchSuggest.text('');
|
|
|
// $searchSuggest.hide();
|
|
|
// $listTIt.show()
|
|
|
// $searchCancelBtn.hide();
|
|
|
// $searchCancelBtn.css("opacity","0");
|
|
|
// $searchtResult.show();
|
|
|
// $(".c-list").html("");
|
|
|
// id=0;
|
|
|
// pageInit();
|
|
|
// },
|
|
|
// 重置搜索结果的容器高度(为了让滚动条出现在容器内部,而不引起外部内容滚动)
|
|
|
resetResultWrapHeight = function() {
|
|
|
var winHeight = $(window).height(),
|
|
|
diff = 45,
|
|
|
$wrap = $('.div-content');
|
|
|
$wrap.height(winHeight-diff);
|
|
|
},
|
|
|
// 监听窗口大小变化,重置所属区列表、社区列表列表容器高度
|
|
|
resultWrapAutoAdapt = function() {
|
|
|
resetResultWrapHeight();
|
|
|
$(window).on('resize',function() {
|
|
|
resetResultWrapHeight();
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|