新增功能
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\doctor;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\doctor\AppointmentLists;
|
||||
use app\adminapi\logic\doctor\AppointmentLogic;
|
||||
use app\adminapi\validate\doctor\AppointmentValidate;
|
||||
|
||||
/**
|
||||
* 医生预约控制器
|
||||
* Class AppointmentController
|
||||
* @package app\adminapi\controller\doctor
|
||||
*/
|
||||
class AppointmentController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* @notes 获取可用时间段
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function availableSlots()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('availableSlots');
|
||||
$result = AppointmentLogic::getAvailableSlots($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 创建预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('create');
|
||||
$result = AppointmentLogic::create($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('预约成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 取消预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('cancel');
|
||||
$result = AppointmentLogic::cancel($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('取消成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 预约列表
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AppointmentLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 预约详情
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('detail');
|
||||
$result = AppointmentLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取医生可用号源数
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function doctorAvailability()
|
||||
{
|
||||
$doctorId = $this->request->get('doctor_id');
|
||||
$date = $this->request->get('date');
|
||||
|
||||
if (!$doctorId || !$date) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
|
||||
$availableCount = AppointmentLogic::getDoctorAvailability($doctorId, $date);
|
||||
return $this->data(['available_count' => $availableCount]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 完成预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function complete()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('complete');
|
||||
$result = AppointmentLogic::complete($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('操作成功');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user