92 lines
2.2 KiB
PHP
92 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\logic\DoctorLogic;
|
|
|
|
/**
|
|
* 医生控制器
|
|
* Class DoctorController
|
|
* @package app\api\controller
|
|
*/
|
|
class DoctorController extends BaseApiController
|
|
{
|
|
public array $notNeedLogin = ['lists', 'detail', 'reviews'];
|
|
|
|
/**
|
|
* @notes 获取医生列表
|
|
* @return \think\response\Json
|
|
*/
|
|
public function lists()
|
|
{
|
|
$page_no = $this->request->get('page_no', 1);
|
|
$page_size = $this->request->get('page_size', 10);
|
|
$keyword = $this->request->get('keyword', '');
|
|
|
|
$params = [
|
|
'page_no' => $page_no,
|
|
'page_size' => $page_size,
|
|
'keyword' => $keyword
|
|
];
|
|
|
|
$result = DoctorLogic::getDoctorList($params);
|
|
return $this->success('', $result);
|
|
}
|
|
|
|
/**
|
|
* @notes 获取医生详情
|
|
* @return \think\response\Json
|
|
*/
|
|
public function detail()
|
|
{
|
|
$doctorId = $this->request->get('id', 0);
|
|
|
|
if (!$doctorId) {
|
|
return $this->fail('医生ID不能为空');
|
|
}
|
|
|
|
$result = DoctorLogic::getDoctorDetail($doctorId);
|
|
|
|
if (!$result) {
|
|
return $this->fail('医生不存在');
|
|
}
|
|
|
|
return $this->success('', $result);
|
|
}
|
|
|
|
/**
|
|
* @notes 获取医生排班
|
|
* @return \think\response\Json
|
|
*/
|
|
public function roster()
|
|
{
|
|
$doctorId = $this->request->get('doctor_id', 0);
|
|
$date = $this->request->get('date', '');
|
|
|
|
if (!$doctorId || !$date) {
|
|
return $this->fail('参数不能为空');
|
|
}
|
|
|
|
$result = DoctorLogic::getDoctorRoster($doctorId, $date);
|
|
return $this->success('', $result);
|
|
}
|
|
|
|
/**
|
|
* @notes 获取医生评价列表
|
|
* @return \think\response\Json
|
|
*/
|
|
public function reviews()
|
|
{
|
|
$doctorId = $this->request->get('doctor_id', 0);
|
|
$pageNo = $this->request->get('page_no', 1);
|
|
$pageSize = $this->request->get('page_size', 10);
|
|
|
|
if (!$doctorId) {
|
|
return $this->fail('医生ID不能为空');
|
|
}
|
|
|
|
$result = DoctorLogic::getDoctorReviews($doctorId, $pageNo, $pageSize);
|
|
return $this->success('', $result);
|
|
}
|
|
}
|