89 lines
3.1 KiB
PHP
89 lines
3.1 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Request;
|
||
|
||
use App\Constants\HttpEnumCode;
|
||
use Hyperf\Validation\Request\FormRequest;
|
||
|
||
class DetectionRequest extends FormRequest
|
||
{
|
||
protected array $scenes = [
|
||
'addDetectionOrder' => [ // 创建检测订单
|
||
'company_id',
|
||
'patient_id',
|
||
'family_id',
|
||
'nation_id',
|
||
'detection_disease_class_ids',
|
||
'detection_project_id', // 检测项目id
|
||
'purpose_id', // 检测项目用途id
|
||
'doctor_id', // 医生id
|
||
'client_type', // 客户端类型(1:手机 2:电脑)
|
||
],
|
||
'getDetectionOrderFirst' => [ // 获取患者进行中的检测订单
|
||
'family_id',
|
||
'detection_project_id',
|
||
],
|
||
'bindDetectionTube' => [ // 绑定检测管
|
||
'detection_bar_code',
|
||
'detection_pic',
|
||
],
|
||
'getDetectionDoctorList' => [ // 绑定检测管
|
||
'province_id',
|
||
'city_id',
|
||
'county_id',
|
||
'company_id'
|
||
],
|
||
];
|
||
|
||
/**
|
||
* 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.
|
||
*/
|
||
public function rules(): array
|
||
{
|
||
return [
|
||
'patient_id' => 'required',
|
||
'family_id' => 'required',
|
||
'nation_id' => 'required',
|
||
'detection_disease_class_ids' => 'required',
|
||
'detection_project_id' => 'required',
|
||
'doctor_id' => 'required',
|
||
'client_type' => 'required|integer|min:1|max:2',
|
||
'detection_bar_code' => 'required',
|
||
'province_id' => 'required_with:city_id,county_id',
|
||
'city_id' => 'required_with:county_id',
|
||
];
|
||
}
|
||
|
||
/**
|
||
* 获取已定义验证规则的错误消息.
|
||
*/
|
||
public function messages(): array
|
||
{
|
||
return [
|
||
'patient_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'family_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'nation_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'detection_disease_class_ids.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'doctor_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'client_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'client_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'detection_bar_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||
'province_id.required_with' => "请选择省份",
|
||
'city_id.required_with' => "请选择城市",
|
||
];
|
||
}
|
||
}
|