81 lines
2.0 KiB
PHP
81 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\validate\doctor;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
/**
|
|
* 医生排班验证器
|
|
* Class RosterValidate
|
|
* @package app\adminapi\validate\doctor
|
|
*/
|
|
class RosterValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'doctor_id' => 'require',
|
|
'date' => 'require|date',
|
|
'period' => 'require|in:morning,afternoon',
|
|
'status' => 'require|in:1,2,3,4',
|
|
'quota' => 'number',
|
|
'max_patients' => 'number',
|
|
];
|
|
|
|
protected $message = [
|
|
'id.require' => '请选择排班',
|
|
'doctor_id.require' => '请选择医生',
|
|
'date.require' => '请选择日期',
|
|
'date.date' => '日期格式不正确',
|
|
'period.require' => '请选择时段',
|
|
'period.in' => '时段参数错误',
|
|
'status.require' => '请选择状态',
|
|
'status.in' => '状态参数错误',
|
|
'quota.number' => '号源数必须是数字',
|
|
'max_patients.number' => '最大接诊数必须是数字',
|
|
];
|
|
|
|
/**
|
|
* @notes 保存场景
|
|
*/
|
|
public function sceneSave()
|
|
{
|
|
return $this->only(['doctor_id', 'date', 'period', 'status', 'quota', 'max_patients', 'remark']);
|
|
}
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 批量保存场景
|
|
*/
|
|
public function sceneBatchSave()
|
|
{
|
|
return $this->only(['rosters'])
|
|
->append('rosters', 'require|array');
|
|
}
|
|
|
|
/**
|
|
* @notes 复制场景
|
|
*/
|
|
public function sceneCopy()
|
|
{
|
|
return $this->only(['source_start_date', 'source_end_date', 'target_start_date'])
|
|
->append('source_start_date', 'require|date')
|
|
->append('source_end_date', 'require|date')
|
|
->append('target_start_date', 'require|date');
|
|
}
|
|
}
|