初始化提交
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class OrderInquiryRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'addInquiryOrder' => [
|
||||
'patient_id',
|
||||
'family_id',
|
||||
'disease_class_id',
|
||||
'diagnosis_date',
|
||||
'disease_desc',
|
||||
'is_allergy_history',// 过敏史
|
||||
'allergy_history',
|
||||
'is_family_history', // 家族病史
|
||||
'family_history',
|
||||
'is_pregnant',// 备孕、妊娠、哺乳期
|
||||
'pregnant',
|
||||
'product.product_ids', // 商品id
|
||||
'product.product_num', // 药品数量
|
||||
'height',
|
||||
'weight',
|
||||
'inquiry_type', // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
'inquiry_mode', // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'disease_class_id' => 'required',
|
||||
'diagnosis_date' => 'date',
|
||||
'disease_desc' => 'required',
|
||||
'is_allergy_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_family_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_pregnant' => ['sometimes','numeric','min:0','max:1'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'patient_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'family_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'disease_class_id.required' => "请您选择疾病",
|
||||
'diagnosis_date.date' => HttpEnumCode::getMessage(HttpEnumCode::DATE_FORMAT_ERROR),
|
||||
'disease_desc.required' => "请您输入病情主诉",
|
||||
'is_allergy_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user