success('请求成功'); } //科室列表 public function keshi_list(){ $list = Db::name('keshi')->where('is_show',1)->order('weigh','desc')->select(); $this->success(1,$list); } //职称列表 public function level_list(){ $list = Db::name('doctor_level')->select(); $this->success(1,$list); } //医生列表 //首页推荐,搜索 public function doctor_list(){ $where = [ 'd.status' => 1, 'd.doctor_status' => 1, ]; //科室id $keshi_id = input('keshi_id',0); if($keshi_id){ $where['d.keshi_id'] = $keshi_id; } //职称id $level_id = input('level_id',0); if($level_id){ $where['d.level_id'] = $level_id; } //关注 $folllow = input('follow',0); if($folllow){ $my_follow_ids = controller('Userfollow')->my_follow_uids(); $where['d.id'] = ['IN',$my_follow_ids]; } //搜索 $keyword = input('keyword',''); if(!empty($keyword)){ $where['d.nickname|d.goodat|keshi.name'] = ['LIKE','%'.$keyword.'%']; if($this->auth->isLogin()){ Db::name('user_search')->insertGetId(['user_id'=>$this->auth->id,'keyword'=>$keyword]); } } //dump($where); $field = [ 'd.id','d.nickname','d.avatar','d.keshi_id','d.level_id','d.hospital','d.goodat','d.ordernum', 'keshi.name as keshi_name', 'level.name as level_name','level.name_en as level_name_en', 'info.typing_switch','info.video_switch','info.typing_price','info.video_price', ]; $list = Db::name('doctor')->alias('d') ->field($field) ->join('doctor_level level','d.level_id = level.id','LEFT') ->join('keshi','d.keshi_id = keshi.id','LEFT') ->join('doctor_info info','d.id = info.doctor_id','LEFT') ->where($where)->order('d.ordernum desc')->autopage()->select(); $list = list_domain_image($list,['avatar']); $this->success(1,$list); } //医生详情 public function doctor_info(){ $id = input('id',0); $field = [ 'd.id','d.nickname','d.avatar','d.keshi_id','d.level_id','d.hospital','d.goodat','d.ordernum','d.info', 'keshi.name as keshi_name', 'level.name as level_name', 'info.typing_switch','info.video_switch','info.typing_price','info.video_price', ]; $info = Db::name('doctor')->alias('d') ->field($field) ->join('doctor_level level','d.level_id = level.id','LEFT') ->join('keshi','d.keshi_id = keshi.id','LEFT') ->join('doctor_info info','d.id = info.doctor_id','LEFT') ->where('d.id',$id)->find(); $info = info_domain_image($info,['avatar']); //是否关注 $info['is_follw'] = $this->is_follow($this->auth->id,$id); //图文说明 $info['wenzhen_typing_serverrule'] = config('site.wenzhen_typing_serverrule'); //视频说明 $info['wenzhen_video_serverrule'] = config('site.wenzhen_video_serverrule'); $this->success(1,$info); } //医生排班 public function doctor_paiban(){ $doctor_id = input('doctor_id',0); $list = Db::name('doctor_paiban')->where('doctor_id',$doctor_id)->where('active',1)->where('activetime','gt',time()+7200)->order('activetime asc')->select(); $newlist = []; if(!empty($list)){ //排除接满4单的 foreach($list as $key => $val){ $date = date('Y-m-d',$val['activetime']); if(!isset($newlist[$date])){ $newlist[$date] = []; } // $val['activetime_text'] = date('H:i',$val['activetime']); // $newlist[$date][] = $val; $newlist[$date][] = date('H:i',$val['activetime']); } /*foreach($newlist as $k => $v){ $result[] = [ 'date'=>$k, 'child' => $v, ]; }*/ } $this->success(1,$newlist); } }