|
@@ -0,0 +1,138 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\controller\tvuser;
|
|
|
+
|
|
|
+use app\common\controller\Apitv;
|
|
|
+use think\Db;
|
|
|
+/**
|
|
|
+ * 首页接口
|
|
|
+ */
|
|
|
+class Tvdoctor extends Apitv
|
|
|
+{
|
|
|
+ protected $noNeedLogin = ['*'];
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
+
|
|
|
+ protected $Dbapp;
|
|
|
+
|
|
|
+ //科室列表
|
|
|
+ public function keshi_list(){
|
|
|
+ $list = Db::name('keshi')->where('is_show',1)->order('weigh','desc')->select();
|
|
|
+ $this->success(1,$list);
|
|
|
+ }
|
|
|
+
|
|
|
+ //医生列表
|
|
|
+ //首页推荐,搜索
|
|
|
+ public function doctor_list(){
|
|
|
+
|
|
|
+ $where = [
|
|
|
+ 'd.status' => 1,
|
|
|
+ 'd.doctor_status' => 1,
|
|
|
+ 'info.video_switch' => 1,
|
|
|
+ ];
|
|
|
+
|
|
|
+ //科室id
|
|
|
+ $keshi_id = input('keshi_id',0);
|
|
|
+ if($keshi_id){
|
|
|
+ $where['d.keshi_id'] = $keshi_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $field = [
|
|
|
+ 'd.id','d.nickname','d.avatar','d.keshi_id','d.level_id','d.hospital','d.goodat',
|
|
|
+ 'keshi.name as keshi_name',
|
|
|
+ 'level.name as level_name',
|
|
|
+ ];
|
|
|
+ $list = $this->Dbapp->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')->page($this->page,$this->pagenum)->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.info',
|
|
|
+ 'keshi.name as keshi_name',
|
|
|
+ 'level.name as level_name',
|
|
|
+ ];
|
|
|
+ $info = $this->Dbapp->name('doctor')->alias('d')
|
|
|
+ ->field($field)
|
|
|
+ ->join('doctor_level level','d.level_id = level.id','LEFT')
|
|
|
+ ->join('keshi','d.keshi_id = keshi.id','LEFT')
|
|
|
+ ->where('d.id',$id)->find();
|
|
|
+ $info = info_domain_image($info,['avatar']);
|
|
|
+
|
|
|
+ //是否关注
|
|
|
+ $info['is_follow'] = $this->is_follow($this->auth->id,$id);
|
|
|
+
|
|
|
+ //视频说明
|
|
|
+ $info['wenzhen_video_serverrule'] = config('site.wenzhen_video_serverrule');
|
|
|
+
|
|
|
+ $this->success(1,$info);
|
|
|
+ }
|
|
|
+
|
|
|
+ //医生排班
|
|
|
+ public function doctor_paiban(){
|
|
|
+ $doctor_id = input('doctor_id',0);
|
|
|
+
|
|
|
+ //测试临时屏蔽
|
|
|
+ //$list = $this->Dbapp->name('doctor_paiban')->where('doctor_id',$doctor_id)->where('active',1)->where('activetime','gt',time()+7200)->order('activetime asc')->select();
|
|
|
+ $list = $this->Dbapp->name('doctor_paiban')->where('doctor_id',$doctor_id)->where('active',1)->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] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $newlist[$date][] = date('H:i',$val['activetime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success(1,$newlist);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //关注某人,取关
|
|
|
+ public function follow_one(){
|
|
|
+ $follow_uid = input('doctor_id',0);
|
|
|
+
|
|
|
+ if(!$follow_uid){
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+
|
|
|
+ $checkuser = $this->Dbapp->name('doctor')->find($follow_uid);
|
|
|
+ if(empty($checkuser)){
|
|
|
+ $this->error('此医生不存在');
|
|
|
+ }
|
|
|
+
|
|
|
+ $map = [
|
|
|
+ 'uid' => $this->auth->id,
|
|
|
+ 'follow_uid' => $follow_uid,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $check = Db::name('user_follow')->where($map)->find();
|
|
|
+ if($check){
|
|
|
+ //取关
|
|
|
+ $rs = Db::name('user_follow')->where($map)->delete();
|
|
|
+ $this->success('操作成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ $id = Db::name('user_follow')->insertGetId($map);
|
|
|
+
|
|
|
+ $this->success('操作成功',$id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|