123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var page = 0,
- pageSize = 10,
- userAgent = window.localStorage.getItem(agentName),
- pagetype = 2;
- // 获取链接带参
- var request = GetRequest(),
- deptId =request["deptId"] || null;
-
- $(function(){
- checkUserAgent();
- });
- function queryInit(){
- userAgent = JSON.parse(userAgent);
- initScroller();
- getDoctorList(true);
- bindEvents();
- getTemplateHelper();
- }
- function getDoctorList(isInit){
- d.show();
- if(isInit){
- page = 0;
- }
- var url = "/patient/concern/getConcernDoctors",
- params = {
- patient: userAgent.uid,
- page: page,
- pageSize: pageSize
- };
- sendPost(url, params, 'JSON', 'GET', queryFailed, function(res){
- if(res.status == 200){
- d.close();
- var list = res.data;
- if(list.length>0){
- page ++;
- var html = template("doctor_tmp", {list: list});
- if(isInit){
- $("#docList").empty().append(html);
- }else{
- $("#docList").append(html);
- }
- if(list.length < pageSize){
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
- }else{
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(false);
- }
- }else{
- if(isInit){
- $(".main").hide();
- $(".div-no-search-info").show();
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
- }else{
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
- }
- }
- }else{
- queryFailed(res);
- }
- })
- }
- function bindEvents(){
- //单个医生点击
- $("#docList").on("tap", "li .c-border-radius-l", function(){
- var doctorCode = $(this).parent("li").attr("data-code");
- window.location.href = "doctor-homepage.html?doctor="+doctorCode;
- })
- $("#docList").on("tap", "li .zixun", function(){
- var doctorCode = $(this).parent("li").attr("data-code");
- isdetailfull(doctorCode)
- })
-
- }
- function getTemplateHelper(){
- template.helper("getImgUrl", function(str){
- return getImgUrl(str);
- });
- }
- function initScroller(){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
- mui.ready(function() {
- mui(".mui-scroll-wrapper").pullRefresh({
- down:{
- callback: function(){
- getDoctorList(true);
- this.refresh(true);
- }
- },
- up: {
- callback: function() {
- var self = this;
- setTimeout(function() {
- getDoctorList(false);
- //self.endPullupToRefresh();
- }, 1000);
- }
- }
- });
- });
- }
- //请求失败处理事件
- function queryFailed(res, message){
- d.close();
- if(message){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content: message}).show();
- }else{
- 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 isdetailfull(doctorCode){
- d.show();
- var reqParams = [{
- url: "patient/baseinfo",
- data: {},
- reqType: 'post'
- }]
- getReqPromises(reqParams).then(function(ress){
- d.close();
- if (ress[0].status == 200) {
- if(ress[0].data.label){
- checkDocInWork(doctorCode)
- }else{
- dialog({
- content: '请完善您的资料',
- okValue:'前往完善',
- ok: function (){
- window.location.href = "../../grzx/html/my-detail.html";
- // window.location.href = "../../grzx/html/updateService.html?doctor="+doctorCode;
- },
- cancelValue: '暂不咨询',
- cancel: function () {
- }
- }).showModal();
- }
- }
- });
- }
- //获取签约医生的工作时间
- function checkDocInWork(doctor){
- var url = 'patient/consult/isDoctorWorkWhenconsult',
- params = {
- doctor: doctor
- };
- sendPost(url, params, 'json', 'post', queryFailed, function(res){
- $("#isFocus").removeClass("disabled");
- 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="+doctor;
- }
- }).showModal();
- }else{
- //跳转到新增咨询页面
- window.location.href = "add-consult.html?doctorCode="+doctor;
- }
- }else{
- queryFailed(res);
- }
- });
- }
|