|
@ -1,7 +1,13 @@
|
|
|
var Request = GetRequest();
|
|
|
var request = GetRequest();
|
|
|
var d = dialog({contentType:'load', skin:'bk-popup'});
|
|
|
var doctorCode = Request["doctorCode"],
|
|
|
type = Request["type"]; //如果是扫二维码的页面,则这个type值为1
|
|
|
var doctorCode = request["doctorCode"], //医生二维码扫描连接的参数,doctorCode_type
|
|
|
doctor = request["doctor"],
|
|
|
type = ''; //如果是扫二维码的页面,则这个type值为1
|
|
|
|
|
|
if(doctorCode){
|
|
|
doctor = doctorCode.split("_")[0];
|
|
|
type = 1;
|
|
|
}
|
|
|
var userAgent = window.localStorage.getItem(agentName);
|
|
|
var pagetype = 0;
|
|
|
var docInfo;
|
|
@ -21,7 +27,7 @@ function pageInitData(){
|
|
|
d.show();
|
|
|
var url = "family_contract/homepage/homepage",
|
|
|
params = {
|
|
|
doctor:doctorCode
|
|
|
doctor:doctor
|
|
|
}
|
|
|
sendPost(url, params, 'json', 'post', queryFailed, function(res){
|
|
|
if(res.status==200){
|
|
@ -79,7 +85,9 @@ function bindEvents(){
|
|
|
if($this.hasClass("grey")){
|
|
|
concernDoctor();
|
|
|
}else{
|
|
|
cancelConcern();
|
|
|
//先判断是否有未结束的咨询,如果有未结束的咨询则不允许取消关注
|
|
|
d.show();
|
|
|
is_consult_finished(true);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@ -90,7 +98,7 @@ function concernDoctor(addConsult){
|
|
|
var url = "/patient/concern/addConcern",
|
|
|
params = {
|
|
|
patient: userAgent.uid,
|
|
|
doctor: doctorCode,
|
|
|
doctor: doctor,
|
|
|
concernSource: type || '2'//(关注方式: 1扫描二维码 2咨询关注 3.其他)
|
|
|
};
|
|
|
sendPost(url, params, 'json', 'post', queryFailed, function(res){
|
|
@ -112,11 +120,11 @@ function concernDoctor(addConsult){
|
|
|
|
|
|
//取消关注
|
|
|
function cancelConcern(){
|
|
|
d.show();
|
|
|
// d.show();
|
|
|
var url = "/patient/concern/deleteConcern",
|
|
|
params = {
|
|
|
patient: userAgent.uid,
|
|
|
doctor: doctorCode
|
|
|
doctor: doctor
|
|
|
};
|
|
|
sendPost(url, params, 'json', 'post', queryFailed, function(res){
|
|
|
d.close();
|
|
@ -130,20 +138,30 @@ function cancelConcern(){
|
|
|
}
|
|
|
|
|
|
//判断是否有未结束的咨询
|
|
|
function is_consult_finished(){
|
|
|
function is_consult_finished(isCancelConcern){
|
|
|
var url = 'patient/consult/is_consult_unfinished',
|
|
|
params = {doctor: docInfo.doctor};
|
|
|
sendPost(url, params, 'json', 'post', function(res){
|
|
|
queryFailed(res, '获取是否存在咨询失败');
|
|
|
},function(res){
|
|
|
d.close();
|
|
|
if(res.status == 200){
|
|
|
if(res.data == ""){
|
|
|
//无进行中的咨询, 跳转去
|
|
|
window.location.href = "add-consult.html?doctorCode="+docInfo.doctor+"&doctorName="+docInfo.name+"&jobName="+docInfo.jobName;
|
|
|
if(isCancelConcern){
|
|
|
cancelConcern();
|
|
|
}else{
|
|
|
checkDocInWork();
|
|
|
// window.location.href = "add-consult.html?doctorCode="+docInfo.doctor+"&doctorName="+docInfo.name+"&jobName="+docInfo.jobName;
|
|
|
}
|
|
|
} else {
|
|
|
d.close();
|
|
|
var content = '十分抱歉,您与'+ docInfo.name +'医生还有<br/>未结束咨询,';
|
|
|
if(isCancelConcern){
|
|
|
content += '需结束咨询后才能取消关注';
|
|
|
}else{
|
|
|
content += '无法发起新的咨询';
|
|
|
}
|
|
|
dialog({
|
|
|
content: '十分抱歉,您与'+ docInfo.name +'医生还有<br/>未结束咨询,无法发起新的咨询',
|
|
|
content: content,
|
|
|
okValue:'前往查看',
|
|
|
ok: function (){
|
|
|
var url = "../../qygl/html/sign_info.html?consult="+res.data+"&doctor="+docInfo.doctor;
|
|
@ -161,6 +179,38 @@ function is_consult_finished(){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//获取签约医生的工作时间
|
|
|
function checkDocInWork(){
|
|
|
var url = 'patient/consult/isDoctorWorkWhenconsult',
|
|
|
params = {
|
|
|
doctor: doctor
|
|
|
};
|
|
|
sendPost(url, params, 'json', 'post', queryFailed, function(res){
|
|
|
if(res.status == 200){
|
|
|
d.close();
|
|
|
// data:0-医生不接受咨询/1-医生当前接受咨询/2-全科医生和健管师当前都不在工作时间/3-全科医生当前不在工作时间/4-健管师当前不在工作时间 健管师当前不在工作时间
|
|
|
if(!(res.data == "1")){
|
|
|
dialog({
|
|
|
content: '您好,由于您关注的医生工作繁忙,设置了每日回复咨询的时间段,所以,在该时间段外的时间,您的咨询将不会马上获得医生的回复。',
|
|
|
okValue:'查看医生工作时间',
|
|
|
ok: function (){
|
|
|
window.location.href = "doctor-work-hours.html?doctor=" + doctor;
|
|
|
},
|
|
|
cancelValue: '继续新增咨询',
|
|
|
cancel: function () {
|
|
|
window.location.href = "add-consult.html?doctorCode="+docInfo.doctor+"&doctorName="+docInfo.name+"&jobName="+docInfo.jobName;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}else{
|
|
|
//跳转到新增咨询页面
|
|
|
window.location.href = "add-consult.html?doctorCode="+docInfo.doctor+"&doctorName="+docInfo.name+"&jobName="+docInfo.jobName;
|
|
|
}
|
|
|
}else{
|
|
|
queryFailed(res);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function queryFailed(res){
|
|
|
d.close();
|
|
|
if (res && res.msg) {
|