Files
zyt/server/app/adminapi/validate/tcm/PrescriptionValidate.php
T
2026-05-20 15:40:01 +08:00

82 lines
2.8 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace app\adminapi\validate\tcm;
use app\common\validate\BaseValidate;
class PrescriptionValidate extends BaseValidate
{
protected $rule = [
'id' => 'require',
'diagnosis_id' => 'number',
'appointment_id' => 'number',
'dosage_bag_count' => 'integer|between:1,5',
'patient_name' => 'require',
'phone' => 'require|max:20',
'gender' => 'require|in:0,1',
'clinical_diagnosis' => 'require',
'herbs' => 'require|array',
'action' => 'require|in:approve,reject',
'remark' => 'max:500',
];
protected $message = [
'dosage_bag_count.integer' => '用量袋数必须为整数',
'dosage_bag_count.between' => '用量袋数必须在1到5袋之间',
'patient_name.require' => '患者姓名不能为空',
'phone.require' => '手机号不能为空',
'phone.max' => '手机号过长',
'gender.require' => '请选择性别',
'gender.in' => '性别无效',
'clinical_diagnosis.require' => '临床诊断不能为空',
'herbs.require' => '请添加中药',
];
public function sceneAdd()
{
return $this->only([
'prescription_type', 'dosage_amount', 'dosage_unit', 'dosage_bag_count', 'need_decoction', 'bags_per_dose',
'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
'usage_days', 'times_per_day', 'aux_usage', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
'usage_notes', 'doctor_name', 'is_shared', 'visible_role_ids',
'diagnosis_id', 'appointment_id', 'audit_status',
]);
}
public function sceneEdit()
{
return $this->only([
'id', 'prescription_type', 'dosage_amount', 'dosage_unit', 'dosage_bag_count', 'need_decoction', 'bags_per_dose',
'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
'usage_days', 'times_per_day', 'aux_usage', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
'usage_notes', 'doctor_name', 'is_shared', 'visible_role_ids', 'diagnosis_id',
]);
}
public function sceneDelete()
{
return $this->only(['id']);
}
public function sceneDetail()
{
return $this->only(['id']);
}
public function scenePatchPatient()
{
return $this->only(['id', 'patient_name', 'phone', 'gender']);
}
public function sceneAudit()
{
return $this->only(['id', 'action', 'remark']);
}
}