89 lines
2.0 KiB
PHP
89 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\validate\doctor;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
/**
|
|
* 医生预约验证器
|
|
* Class AppointmentValidate
|
|
* @package app\adminapi\validate\doctor
|
|
*/
|
|
class AppointmentValidate extends BaseValidate
|
|
{
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'patient_id' => 'require|integer',
|
|
'doctor_id' => 'require|integer',
|
|
'appointment_date' => 'require|date',
|
|
'period' => 'in:morning,afternoon,all',
|
|
'appointment_time' => 'require',
|
|
'appointment_type' => 'in:video,text,phone',
|
|
'channel_source' => 'require',
|
|
];
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => '预约ID',
|
|
'patient_id' => '患者ID',
|
|
'doctor_id' => '医生ID',
|
|
'appointment_date' => '预约日期',
|
|
'period' => '时段',
|
|
'appointment_time' => '预约时间',
|
|
'appointment_type' => '预约类型',
|
|
'channel_source' => '渠道来源',
|
|
];
|
|
|
|
/**
|
|
* @notes 创建预约场景
|
|
* @return AppointmentValidate
|
|
*/
|
|
public function sceneCreate()
|
|
{
|
|
return $this->only(['patient_id', 'doctor_id', 'appointment_date', 'period', 'appointment_time', 'appointment_type', 'channel_source']);
|
|
}
|
|
|
|
/**
|
|
* @notes 取消预约场景
|
|
* @return AppointmentValidate
|
|
*/
|
|
public function sceneCancel()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 预约详情场景
|
|
* @return AppointmentValidate
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 可用时间段场景
|
|
* @return AppointmentValidate
|
|
*/
|
|
public function sceneAvailableSlots()
|
|
{
|
|
return $this->only(['doctor_id', 'appointment_date', 'period']);
|
|
}
|
|
|
|
/**
|
|
* @notes 完成预约场景
|
|
* @return AppointmentValidate
|
|
*/
|
|
public function sceneComplete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
}
|