This commit is contained in:
Your Name
2026-09-09 12:18:17 +08:00
parent 0cea43b027
commit 40319eea41
76 changed files with 4821 additions and 268 deletions
@@ -2,7 +2,8 @@
namespace app\adminapi\validate\doctor;
use app\common\validate\BaseValidate;
use app\common\validate\BaseValidate;
use app\common\enum\AppointmentTypeEnum;
/**
* 医生预约验证器
@@ -23,7 +24,7 @@ class AppointmentValidate extends BaseValidate
'appointment_date' => 'require|date',
'appointment_time' => 'require',
'period' => 'in:morning,afternoon,all',
'appointment_type' => 'require|in:video,text,phone',
'appointment_type' => 'require|checkAppointmentType',
'status' => 'require|integer|between:1,4',
'remark' => 'max:500',
'channel_source' => 'require',
@@ -38,7 +39,7 @@ class AppointmentValidate extends BaseValidate
* 参数描述
* @var string[]
*/
protected $field = [
protected $field = [
'id' => '预约ID',
'patient_id' => '患者ID',
'doctor_id' => '医生ID',
@@ -53,7 +54,21 @@ class AppointmentValidate extends BaseValidate
'channel_source' => '渠道来源',
'channel_source_detail' => '渠道补充说明',
'ids' => '预约ID列表',
];
];
protected function checkAppointmentType($value)
{
return AppointmentTypeEnum::isWritable($value) ? true : '问诊类型仅支持图文问诊或视频问诊';
}
public function check(array $data, array $rules = []): bool
{
if ($this->currentScene === 'create') {
$data = AppointmentTypeEnum::withDefault($data);
}
return parent::check($data, $rules);
}
/**
* @notes 创建预约场景