You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.3 KiB
78 lines
2.3 KiB
6 days ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Requests\Registration;
|
||
|
|
||
|
use App\Dictionary\Medical\PatientProperty;
|
||
|
use App\Dictionary\Medical\SettleType;
|
||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
use Illuminate\Validation\Rules\Enum;
|
||
|
|
||
|
class RegisterPreSettleRequest extends FormRequest
|
||
|
{
|
||
|
/**
|
||
|
* Determine if the user is authorized to make this request.
|
||
|
*/
|
||
|
public function authorize(): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the validation rules that apply to the request.
|
||
|
*
|
||
|
* @return array<string, ValidationRule|array|string>
|
||
|
*/
|
||
|
/**
|
||
|
* 规则
|
||
|
* @return array
|
||
|
*/
|
||
|
public function rules(): array
|
||
|
{
|
||
|
return [
|
||
|
'date' => 'required|date_format:Y-m-d||after_or_equal:today',
|
||
|
'dept_id' => 'required',
|
||
|
'doctor_id' => 'required',
|
||
|
'reg_id' => 'required',
|
||
|
'patient_property' => ['required', new Enum(PatientProperty::class)],
|
||
|
'settle_type' => ['required', new Enum(SettleType::class)],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 错误提示语句
|
||
|
* @return array
|
||
|
*/
|
||
|
public function messages(): array
|
||
|
{
|
||
|
return [
|
||
|
'date.required' => '必须选择挂号日期',
|
||
|
'date.date_format' => '必须选择挂号日期',
|
||
|
'date.after_or_equal' => '挂号日期不得小于今天',
|
||
|
'dept_id.required' => '必须选择挂号科室',
|
||
|
'doctor_id.required' => '必须选择挂号医生',
|
||
|
'reg_id.required' => '必须选择挂号时间段',
|
||
|
'patient_property.required' => '请选择病人性质',
|
||
|
'patient_property.Illuminate\Validation\Rules\Enum' => '请选择正确的病人性质',
|
||
|
'settle_type.required' => '请选择结算类型',
|
||
|
'settle_type.Illuminate\Validation\Rules\Enum' => '请选择正确的结算类型',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 字段名称
|
||
|
* @return array
|
||
|
*/
|
||
|
public function attributes(): array
|
||
|
{
|
||
|
return [
|
||
|
'date' => '挂号日期',
|
||
|
'dept_id' => '挂号科室',
|
||
|
'doctor_id' => '挂号医生',
|
||
|
'reg_id' => '挂号时间段',
|
||
|
'patient_property' => '病人性质',
|
||
|
'settle_type' => '结算类型',
|
||
|
];
|
||
|
}
|
||
|
}
|