更新
This commit is contained in:
@@ -23,6 +23,7 @@ class AppointmentValidate extends BaseValidate
|
||||
'period' => 'in:morning,afternoon,all',
|
||||
'appointment_time' => 'require',
|
||||
'appointment_type' => 'in:video,text,phone',
|
||||
'channel_source' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,7 @@ class AppointmentValidate extends BaseValidate
|
||||
'period' => '时段',
|
||||
'appointment_time' => '预约时间',
|
||||
'appointment_type' => '预约类型',
|
||||
'channel_source' => '渠道来源',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -45,7 +47,7 @@ class AppointmentValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneCreate()
|
||||
{
|
||||
return $this->only(['patient_id', 'doctor_id', 'appointment_date', 'period', 'appointment_time', 'appointment_type']);
|
||||
return $this->only(['patient_id', 'doctor_id', 'appointment_date', 'period', 'appointment_time', 'appointment_type', 'channel_source']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\validate\doctor;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 药品库验证器
|
||||
*/
|
||||
class MedicineValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|integer',
|
||||
'name' => 'require|max:100',
|
||||
'supplier' => 'require|max:100',
|
||||
'unit' => 'require|max:20',
|
||||
'settlement_price' => 'require|float|>=:0',
|
||||
'retail_price' => 'require|float|>=:0',
|
||||
'stock' => 'integer|>=:0',
|
||||
'image' => 'max:255',
|
||||
'status' => 'in:0,1',
|
||||
'remark' => 'max:500',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '药品ID不能为空',
|
||||
'name.require' => '药材名称不能为空',
|
||||
'name.max' => '药材名称不能超过100个字符',
|
||||
'supplier.require' => '供应商名称不能为空',
|
||||
'supplier.max' => '供应商名称不能超过100个字符',
|
||||
'unit.require' => '单位不能为空',
|
||||
'settlement_price.require' => '结算价不能为空',
|
||||
'settlement_price.float' => '结算价必须是数字',
|
||||
'retail_price.require' => '零售价不能为空',
|
||||
'retail_price.float' => '零售价必须是数字',
|
||||
'stock.integer' => '库存必须是整数',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name', 'supplier', 'unit', 'settlement_price', 'retail_price', 'stock', 'image', 'status', 'remark']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'name', 'supplier', 'unit', 'settlement_price', 'retail_price', 'stock', 'image', 'status', 'remark']);
|
||||
}
|
||||
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
}
|
||||
@@ -12,26 +12,38 @@ use app\common\validate\BaseValidate;
|
||||
class RosterValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'id' => 'number',
|
||||
'doctor_id' => 'require',
|
||||
'date' => 'require|date',
|
||||
'period' => 'require|in:morning,afternoon',
|
||||
'period' => 'in:morning,afternoon,night,segment',
|
||||
// 须用数组写法:字符串规则里的 | 会与「多规则分隔符」冲突,导致 preg_match 报错
|
||||
'start_time' => ['require', 'regex' => '/^([01]\d|2[0-3]):[0-5]\d$/'],
|
||||
'end_time' => ['require', 'regex' => '/^([01]\d|2[0-3]):[0-5]\d$/'],
|
||||
'slot_minutes' => 'number|between:5,120',
|
||||
'status' => 'require|in:1,2,3,4',
|
||||
'quota' => 'number',
|
||||
'max_patients' => 'number',
|
||||
'remark' => 'max:500',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择排班',
|
||||
'id.number' => '排班ID格式错误',
|
||||
'doctor_id.require' => '请选择医生',
|
||||
'date.require' => '请选择日期',
|
||||
'date.date' => '日期格式不正确',
|
||||
'period.require' => '请选择时段',
|
||||
'period.in' => '时段参数错误',
|
||||
'period.in' => '时段类型参数错误',
|
||||
'start_time.require' => '请填写接诊开始时间',
|
||||
'start_time.regex' => '开始时间格式须为 HH:mm',
|
||||
'end_time.require' => '请填写接诊结束时间',
|
||||
'end_time.regex' => '结束时间格式须为 HH:mm',
|
||||
'slot_minutes.number' => '号源间隔须为数字',
|
||||
'slot_minutes.between' => '号源间隔须在 5~120 分钟',
|
||||
'status.require' => '请选择状态',
|
||||
'status.in' => '状态参数错误',
|
||||
'quota.number' => '号源数必须是数字',
|
||||
'max_patients.number' => '最大接诊数必须是数字',
|
||||
'remark.max' => '备注过长',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -39,7 +51,10 @@ class RosterValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneSave()
|
||||
{
|
||||
return $this->only(['doctor_id', 'date', 'period', 'status', 'quota', 'max_patients', 'remark']);
|
||||
return $this->only([
|
||||
'id', 'doctor_id', 'date', 'period', 'start_time', 'end_time', 'shift_type', 'slot_minutes',
|
||||
'status', 'quota', 'max_patients', 'remark',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +62,7 @@ class RosterValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
return $this->only(['id'])->append('id', 'require');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +70,7 @@ class RosterValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
return $this->only(['id'])->append('id', 'require');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user