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 创建预约场景
@@ -10,6 +10,7 @@ class PrescriptionOrderValidate extends BaseValidate
{
protected $rule = [
'id' => 'require|integer',
'create_time' => 'require|string|dateFormat:Y-m-d H:i:s',
'diagnosis_id' => 'require|integer|gt:0',
'prescription_id' => 'require|integer',
'pay_order_ids' => 'array',
@@ -62,6 +63,8 @@ class PrescriptionOrderValidate extends BaseValidate
'tracking_number.require' => '请输入快递单号',
'phone_tail.regex' => '手机后四位仅支持数字',
'reason.require' => '请填写退款原因',
'create_time.require' => '创建时间必填',
'create_time.dateFormat' => '创建时间格式不正确',
];
protected $scene = [
@@ -71,6 +74,7 @@ class PrescriptionOrderValidate extends BaseValidate
'tracking_number', 'express_company', 'ship_mode', 'fee_type', 'amount', 'remark_extra', 'remark_assistant', 'pay_order_ids',
],
'detail' => ['id'],
'editTime' => ['id', 'create_time'],
'edit' => [
'id', 'recipient_name', 'recipient_phone', 'shipping_address',
'is_follow_up', 'prev_staff', 'service_channel', 'service_package',
@@ -109,6 +113,11 @@ class PrescriptionOrderValidate extends BaseValidate
->append('pay_order_id', 'require|integer|gt:0');
}
public function sceneEditTime(): PrescriptionOrderValidate
{
return $this->only(['id', 'create_time'])->append('id', 'require|integer|gt:0');
}
public function updateAmount(): PrescriptionOrderValidate
{
return $this->only(['id', 'amount'])