first commit
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\validate\tcm;
|
||||
|
||||
use app\common\model\tcm\Diagnosis;
|
||||
use app\common\model\tcm\DiagnosisTodo;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 诊单待办事项验证
|
||||
* Class DiagnosisTodoValidate
|
||||
* @package app\adminapi\validate\tcm
|
||||
*/
|
||||
class DiagnosisTodoValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'diagnosis_id' => 'require|number|gt:0|checkDiagnosis',
|
||||
'content' => 'require|length:1,500',
|
||||
'remind_time' => 'require|number|checkRemindFuture',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'diagnosis_id.require' => '诊单 id 不能为空',
|
||||
'diagnosis_id.gt' => '诊单 id 非法',
|
||||
'content.require' => '请输入提醒内容',
|
||||
'content.length' => '提醒内容长度需在 1-500 字',
|
||||
'remind_time.require' => '请选择提醒时间',
|
||||
'remind_time.number' => '提醒时间格式错误',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['diagnosis_id', 'content', 'remind_time']);
|
||||
}
|
||||
|
||||
public function sceneCancel()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneList()
|
||||
{
|
||||
return $this->only(['diagnosis_id'])
|
||||
->append('diagnosis_id', 'require|number|gt:0');
|
||||
}
|
||||
|
||||
/**
|
||||
* 诊单存在校验
|
||||
*/
|
||||
protected function checkDiagnosis($value): bool|string
|
||||
{
|
||||
$diagnosis = Diagnosis::findOrEmpty((int) $value);
|
||||
if ($diagnosis->isEmpty()) {
|
||||
return '诊单不存在';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提醒时间必须在当前时间之后(至少 30 秒),避免立刻就过期
|
||||
*/
|
||||
protected function checkRemindFuture($value): bool|string
|
||||
{
|
||||
$ts = (int) $value;
|
||||
if ($ts <= time() + 30) {
|
||||
return '提醒时间必须晚于当前时间';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\tcm;
|
||||
|
||||
use app\common\model\tcm\Diagnosis;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 中医辨房病因诊单验证
|
||||
* Class DiagnosisValidate
|
||||
* @package app\adminapi\validate\tcm
|
||||
*/
|
||||
class DiagnosisValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkDiagnosis',
|
||||
'patient_name' => 'require|length:1,50',
|
||||
'id_card' => 'length:15,18',
|
||||
'phone' => 'require|mobile',
|
||||
'gender' => 'require|in:0,1',
|
||||
'age' => 'require|number|between:0,150',
|
||||
'diagnosis_type' => 'require',
|
||||
'local_hospital_name' => 'require|max:255',
|
||||
'status' => 'in:0,1',
|
||||
'show_card' => 'in:0,1',
|
||||
'create_source' => 'max:32',
|
||||
'current_medications' => 'max:2000',
|
||||
'tongue_images' => 'array',
|
||||
'report_files' => 'array',
|
||||
'diabetes_discovery_year' => 'max:50',
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date|checkDateRange',
|
||||
'diagnosis_id' => 'require|integer|checkDiagnosisId',
|
||||
'tracking_content' => 'require|length:1,1000',
|
||||
'revisit_slot_start_offset' => 'integer|between:0,20',
|
||||
'report_id' => 'number|gt:0',
|
||||
'content' => 'max:12000',
|
||||
'task' => 'require|in:summary,tcm_pattern,prescription_review,medication_review,exam_review,complication_risk,guideline_review,custom',
|
||||
'prompt' => 'max:500',
|
||||
'model' => 'in:qwen,openai',
|
||||
'patient_id' => 'integer|gt:0',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'patient_name.require' => '请输入患者姓名',
|
||||
'patient_name.length' => '患者姓名长度须在1-50位字符',
|
||||
'id_card.length' => '身份证号长度不正确',
|
||||
'id_card.require' => '请输入身份证号',
|
||||
'phone.require' => '请输入手机号',
|
||||
'phone.mobile' => '手机号格式不正确',
|
||||
'gender.require' => '请选择性别',
|
||||
'gender.in' => '性别参数错误',
|
||||
'age.require' => '请输入年龄',
|
||||
'age.number' => '年龄必须为数字',
|
||||
'age.between' => '年龄范围0-150',
|
||||
'diagnosis_type.require' => '请选择诊断类型',
|
||||
'local_hospital_name.require' => '请输入当地就诊医院名称',
|
||||
'local_hospital_name.max' => '当地就诊医院名称最多255个字符',
|
||||
'status.in' => '状态参数错误',
|
||||
'create_source.max' => '渠道来源长度不能超过32个字符',
|
||||
'current_medications.max' => '在用药物最多2000个字符',
|
||||
'diabetes_discovery_year.max' => '发现糖尿病患病史最多50个字符',
|
||||
'start_date.date' => '开始日期格式不正确',
|
||||
'end_date.date' => '结束日期格式不正确',
|
||||
'diagnosis_id.require' => '诊单ID不能为空',
|
||||
'tracking_content.require' => '跟踪备注内容不能为空',
|
||||
'tracking_content.length' => '跟踪备注最多1000个字符',
|
||||
'report_id.require' => '报告ID不能为空',
|
||||
'report_id.number' => '报告ID必须为数字',
|
||||
'report_id.gt' => '报告ID必须大于0',
|
||||
'content.require' => '报告内容不能为空',
|
||||
'content.max' => '报告内容最多12000个字符',
|
||||
'task.require' => '请选择 AI 助手任务',
|
||||
'task.in' => 'AI 助手任务不受支持',
|
||||
'prompt.max' => '问题最多500个字符',
|
||||
'model.in' => 'AI模型仅支持qwen或openai',
|
||||
'patient_id.require' => '患者ID不能为空',
|
||||
'patient_id.integer' => '患者ID必须为整数',
|
||||
'patient_id.gt' => '患者ID必须大于0',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
// 全局规则里混有跟踪备注、AI 助手字段;新增诊单只去掉这些无关校验。
|
||||
// 不要改成 only([...]):add 还会写入现病史等多选字段,only 会把它们从请求里丢掉。
|
||||
return $this->remove('id', true)
|
||||
->remove('diagnosis_id', true)
|
||||
->remove('tracking_content', true)
|
||||
->remove('task', true)
|
||||
->remove('prompt', true)
|
||||
->remove('model', true)
|
||||
->remove('report_id', true)
|
||||
->remove('content', true);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'patient_name', 'id_card', 'phone', 'gender', 'age', 'diagnosis_date', 'diagnosis_type', 'syndrome_type', 'marital_status', 'height', 'weight', 'region', 'systolic_pressure', 'diastolic_pressure', 'fasting_blood_sugar', 'diabetes_discovery_year', 'local_hospital_diagnosis', 'local_hospital_name', 'past_history', 'symptoms', 'tongue_coating', 'pulse', 'treatment_principle', 'prescription', 'doctor_advice', 'remark', 'current_medications', 'status', 'show_card', 'create_source']);
|
||||
}
|
||||
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneReadonlyDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneTrackingWindow()
|
||||
{
|
||||
return $this->only(['id', 'start_date', 'end_date']);
|
||||
}
|
||||
|
||||
/** 新增跟踪备注:诊单ID + 备注内容 */
|
||||
public function sceneAddTrackingNote()
|
||||
{
|
||||
return $this->only(['diagnosis_id', 'tracking_content']);
|
||||
}
|
||||
|
||||
/** 拉取跟踪备注列表:诊单ID */
|
||||
public function sceneTrackingNotes()
|
||||
{
|
||||
return $this->only(['diagnosis_id']);
|
||||
}
|
||||
|
||||
public function sceneGenerateQrcode()
|
||||
{
|
||||
return $this->only(['diagnosis_id', 'doctor_id', 'patient_id', 'share_user_id', 'mini_program_path'])
|
||||
// The global diagnosis_id rule is required for diagnosis APIs, but
|
||||
// video QR codes identify the doctor instead. Keep diagnosis_id
|
||||
// optional here while still validating it when it is supplied.
|
||||
->remove('diagnosis_id', 'require')
|
||||
->append('patient_id', 'require|integer|checkQrcodeIds')
|
||||
->append('share_user_id', 'require|integer')
|
||||
->append('doctor_id', 'integer');
|
||||
}
|
||||
|
||||
public function sceneGenerateOrderQrcode()
|
||||
{
|
||||
return $this->only([]);
|
||||
}
|
||||
|
||||
public function sceneFillIdCard()
|
||||
{
|
||||
return $this->only(['id', 'id_card'])
|
||||
->append('id', 'require')
|
||||
->append('id_card', 'require|length:15,18');
|
||||
}
|
||||
|
||||
public function sceneGuahaoLogList()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/** 业务订单 tab:设置复诊接诊率统计起始偏移 */
|
||||
public function sceneSetRevisitSlotStartOffset()
|
||||
{
|
||||
return $this->only(['id', 'revisit_slot_start_offset'])
|
||||
->append('revisit_slot_start_offset', 'require|integer|between:0,20');
|
||||
}
|
||||
|
||||
public function sceneAiReports()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneAiAssistant()
|
||||
{
|
||||
return $this->only(['id', 'task', 'prompt']);
|
||||
}
|
||||
|
||||
public function sceneAiAnalysis()
|
||||
{
|
||||
return $this->only(['id', 'model'])
|
||||
->remove('id', 'checkDiagnosis')
|
||||
->append('id', 'integer|gt:0|checkAiAnalysisPayload');
|
||||
}
|
||||
|
||||
public function scenePatientAiReports()
|
||||
{
|
||||
return $this->only(['patient_id'])
|
||||
->append('patient_id', 'require|integer|gt:0|checkPatientAiReportsPayload');
|
||||
}
|
||||
|
||||
public function sceneGeneratePatientAiReport()
|
||||
{
|
||||
return $this->only(['patient_id', 'model'])
|
||||
->append('patient_id', 'require|integer|gt:0|checkGeneratePatientAiReportPayload')
|
||||
->append('model', 'require|in:qwen,openai');
|
||||
}
|
||||
|
||||
public function sceneGenerateAiReports()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function sceneEditAiReport()
|
||||
{
|
||||
return $this->only(['id', 'report_id', 'content'])
|
||||
->append('report_id', 'require|number|gt:0')
|
||||
->append('content', 'require|max:12000');
|
||||
}
|
||||
|
||||
protected function checkDiagnosis($value)
|
||||
{
|
||||
$diagnosis = Diagnosis::findOrEmpty($value);
|
||||
if ($diagnosis->isEmpty()) {
|
||||
return '诊单不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 校验 diagnosis_id 字段(addTrackingNote 等场景使用,避开 id 字段) */
|
||||
protected function checkDiagnosisId($value)
|
||||
{
|
||||
$diagnosis = Diagnosis::findOrEmpty($value);
|
||||
if ($diagnosis->isEmpty()) {
|
||||
return '诊单不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** end_date 不能早于 start_date */
|
||||
protected function checkDateRange($value, $rule, $data = [])
|
||||
{
|
||||
$start = $data['start_date'] ?? '';
|
||||
if ($start && $value && strtotime($value) < strtotime($start)) {
|
||||
return '结束日期不能早于开始日期';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 视频场景需 doctor_id,确认诊单需 diagnosis_id */
|
||||
protected function checkQrcodeIds($value, $rule, $data = [])
|
||||
{
|
||||
$page = $data['mini_program_path'] ?? '';
|
||||
$hasDoctor = !empty($data['doctor_id']);
|
||||
$hasDiagnosis = !empty($data['diagnosis_id']);
|
||||
if ($page === 'pages/login/login') {
|
||||
return $hasDoctor ? true : '视频二维码需传挂号医生ID';
|
||||
}
|
||||
return $hasDiagnosis ? true : '诊单ID不能为空';
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 智能分析仅接受诊单 ID 和可选的固定模型键。客户端不得提供
|
||||
* provider、凭据、上游地址、提示词等服务端配置或控制字段。
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param mixed $rule
|
||||
* @param array<string,mixed> $data
|
||||
* @return bool|string
|
||||
*/
|
||||
protected function checkAiAnalysisPayload($value, $rule, array $data = [])
|
||||
{
|
||||
if (!array_key_exists('id', $data)) {
|
||||
return 'AI智能分析请求缺少id参数';
|
||||
}
|
||||
|
||||
$extraFields = array_diff(array_keys($data), ['id', 'model']);
|
||||
if ($extraFields !== []) {
|
||||
return 'AI智能分析请求仅允许id及可选model参数';
|
||||
}
|
||||
|
||||
if (array_key_exists('model', $data)) {
|
||||
$model = $data['model'];
|
||||
if (!is_string($model) || !in_array($model, ['qwen', 'openai'], true)) {
|
||||
return 'AI模型仅支持qwen或openai';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $data */
|
||||
protected function checkPatientAiReportsPayload($value, $rule, array $data = [])
|
||||
{
|
||||
if (!array_key_exists('patient_id', $data)) {
|
||||
return '请求缺少patient_id参数';
|
||||
}
|
||||
$extraFields = array_diff(array_keys($data), ['patient_id']);
|
||||
return $extraFields === [] ? true : '请求仅允许patient_id参数';
|
||||
}
|
||||
|
||||
/**
|
||||
* 患者报告生成端点只接受稳定患者ID与服务端模型白名单键。
|
||||
* provider、凭据、BASE_URL、提示词和任意来源正文均不得由客户端注入。
|
||||
*
|
||||
* @param array<string,mixed> $data
|
||||
*/
|
||||
protected function checkGeneratePatientAiReportPayload($value, $rule, array $data = [])
|
||||
{
|
||||
if (!array_key_exists('patient_id', $data) || !array_key_exists('model', $data)) {
|
||||
return '请求缺少patient_id或model参数';
|
||||
}
|
||||
$extraFields = array_diff(array_keys($data), ['patient_id', 'model']);
|
||||
if ($extraFields !== []) {
|
||||
return '请求仅允许patient_id和model参数';
|
||||
}
|
||||
if (!is_string($data['model']) || !in_array($data['model'], ['qwen', 'openai'], true)) {
|
||||
return 'AI模型仅支持qwen或openai';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\validate\tcm;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 处方库验证器
|
||||
*/
|
||||
class PrescriptionLibraryValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'prescription_name' => 'require|max:100',
|
||||
'formula_type' => 'in:主方,辅方',
|
||||
'herbs' => 'require|array',
|
||||
'is_public' => 'in:0,1',
|
||||
'disable_edit' => 'in:0,1',
|
||||
'report_id' => 'require|number|gt:0',
|
||||
'content' => 'require|max:12000',
|
||||
'limit' => 'integer|between:1,500'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '处方ID不能为空',
|
||||
'id.number' => '处方ID必须为数字',
|
||||
'prescription_name.require' => '处方名称不能为空',
|
||||
'prescription_name.max' => '处方名称最多100个字符',
|
||||
'formula_type.in' => '处方类型只能是主方或辅方',
|
||||
'herbs.require' => '药材列表不能为空',
|
||||
'herbs.array' => '药材列表格式错误',
|
||||
'is_public.in' => '是否公开参数错误',
|
||||
'disable_edit.in' => '禁用修改参数错误',
|
||||
'report_id.require' => '报告ID不能为空',
|
||||
'report_id.number' => '报告ID必须为数字',
|
||||
'report_id.gt' => '报告ID必须大于0',
|
||||
'content.require' => '报告内容不能为空',
|
||||
'content.max' => '报告内容最多12000个字符',
|
||||
'limit.integer' => '数量限制必须为整数',
|
||||
'limit.between' => '数量限制必须在1到500之间'
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['prescription_name', 'formula_type', 'herbs', 'is_public', 'disable_edit']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'prescription_name', 'formula_type', 'herbs', 'is_public', 'disable_edit']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 读取已保存的处方 AI 解释
|
||||
*/
|
||||
public function sceneAiReports()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查询尚无任何 AI 报告的处方
|
||||
*/
|
||||
public function sceneMissingAiReports()
|
||||
{
|
||||
return $this->only(['limit']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 重新生成全部固定模型的处方 AI 解释
|
||||
*/
|
||||
public function sceneGenerateAiReports()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑一份已保存的处方 AI 解释
|
||||
*/
|
||||
public function sceneEditAiReport()
|
||||
{
|
||||
return $this->only(['id', 'report_id', 'content']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\validate\tcm;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class PrescriptionOrderValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|integer',
|
||||
'diagnosis_id' => 'require|integer|gt:0',
|
||||
'prescription_id' => 'require|integer',
|
||||
'pay_order_ids' => 'array',
|
||||
'recipient_name' => 'require|max:50',
|
||||
'recipient_phone' => 'require|max:20',
|
||||
'shipping_address' => 'require|max:500',
|
||||
'is_follow_up' => 'in:0,1',
|
||||
'prev_staff' => 'max:100',
|
||||
'service_channel' => 'max:100',
|
||||
'service_package' => 'max:100',
|
||||
'tracking_number' => 'max:80',
|
||||
'express_company' => 'max:20',
|
||||
'ship_mode' => 'in:gancao,direct',
|
||||
'resolution' => 'require|in:CONFIRM_SUCCESS,CONFIRM_NOT_CREATED',
|
||||
'remote_order_no' => 'max:64',
|
||||
'note' => 'require|max:1000',
|
||||
'fee_type' => 'require|in:1,2,3,4,5,6,7,8',
|
||||
'amount' => 'require|float',
|
||||
'order_type' => 'require|in:1,2,3,4,5,6,7,8',
|
||||
'pay_amount' => 'require|float|egt:0',
|
||||
'pay_remark' => 'max:200',
|
||||
'remark_extra' => 'max:500',
|
||||
'remark_assistant' => 'max:500',
|
||||
'action' => 'require|in:approve,reject',
|
||||
'remark' => 'max:500',
|
||||
'summary' => 'require|max:500',
|
||||
'prescription_audit_status' => 'in:0,1,2',
|
||||
'payment_slip_audit_status' => 'in:0,1,2',
|
||||
'prescription_audit_remark' => 'max:500',
|
||||
'payment_slip_audit_remark' => 'max:500',
|
||||
'fulfillment_status' => 'require|integer|in:3,7,8,9,11,12',
|
||||
'reason' => 'require|max:500',
|
||||
'refund_amount' => 'float|egt:0',
|
||||
'patient_name' => 'require|max:50',
|
||||
'phone' => 'require|max:20',
|
||||
'phone_tail' => 'max:20|regex:/^\\d*$/',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'prescription_id.require' => '请选择处方',
|
||||
'diagnosis_id.require' => '请选择诊单',
|
||||
'recipient_name.require' => '请输入收货人',
|
||||
'recipient_phone.require' => '请输入收货手机',
|
||||
'shipping_address.require' => '请输入收货地址',
|
||||
'fee_type.require' => '请选择费用类别',
|
||||
'amount.require' => '请输入订单金额',
|
||||
'action.require' => '请选择审核操作',
|
||||
'patient_name.require' => '请输入患者姓名',
|
||||
'phone.require' => '请输入手机号',
|
||||
'tracking_number.require' => '请输入快递单号',
|
||||
'phone_tail.regex' => '手机后四位仅支持数字',
|
||||
'reason.require' => '请填写退款原因',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'create' => [
|
||||
'prescription_id', 'diagnosis_id', 'recipient_name', 'recipient_phone', 'shipping_address',
|
||||
'is_follow_up', 'prev_staff', 'service_channel', 'service_package',
|
||||
'tracking_number', 'express_company', 'ship_mode', 'fee_type', 'amount', 'remark_extra', 'remark_assistant', 'pay_order_ids',
|
||||
],
|
||||
'detail' => ['id'],
|
||||
'edit' => [
|
||||
'id', 'recipient_name', 'recipient_phone', 'shipping_address',
|
||||
'is_follow_up', 'prev_staff', 'service_channel', 'service_package',
|
||||
'tracking_number', 'express_company', 'fee_type', 'amount', 'remark_extra', 'remark_assistant', 'pay_order_ids',
|
||||
],
|
||||
'ddcode' => ['id', 'tracking_number', 'express_company'],
|
||||
'logisticsTrace' => ['id', 'phone_tail'],
|
||||
'logisticsJdUpdate' => ['id'],
|
||||
'auditPrescription' => ['id', 'action', 'remark'],
|
||||
'auditPayment' => ['id', 'action', 'remark'],
|
||||
'withdraw' => ['id'],
|
||||
'ship' => ['id', 'tracking_number', 'express_company', 'ship_mode'],
|
||||
'logs' => ['id'],
|
||||
'addLog' => ['id', 'summary'],
|
||||
'paidPayOrders' => ['diagnosis_id'],
|
||||
'addPayOrder' => ['id', 'order_type', 'pay_amount', 'pay_remark'],
|
||||
'linkPayOrder' => ['id', 'pay_order_id'],
|
||||
'requestCompletion' => ['id'],
|
||||
'complete' => ['id', 'fulfillment_status'],
|
||||
'refund' => ['id', 'reason', 'refund_amount'],
|
||||
'submitGancaoRecipel' => ['id'],
|
||||
'uploadToPharmacy' => ['id'],
|
||||
'previewGancaoRecipel' => ['id'],
|
||||
'patchPrescriptionPatient' => ['id', 'patient_name', 'phone'],
|
||||
'patchPrescriptionUsage' => ['id', 'times_per_day', 'usage_days', 'medication_days', 'aux_times_per_day', 'aux_usage_days'],
|
||||
'updateAmount' => ['id', 'amount'],
|
||||
'setShipMode' => ['id', 'ship_mode'],
|
||||
'confirmGancaoSubmission' => ['id', 'resolution', 'remote_order_no', 'note'],
|
||||
];
|
||||
|
||||
public function updateAmount(): PrescriptionOrderValidate
|
||||
{
|
||||
return $this->only(['id', 'amount'])
|
||||
->append('id', 'require|integer|gt:0')
|
||||
->append('amount', 'require|float|egt:0');
|
||||
}
|
||||
|
||||
public function ddcode(): PrescriptionOrderValidate
|
||||
{
|
||||
return $this->only(['id', 'tracking_number', 'express_company'])
|
||||
->append('id', 'require|integer|gt:0')
|
||||
->append('tracking_number', 'require|max:80')
|
||||
->append('express_company', 'max:20');
|
||||
}
|
||||
|
||||
public function patchPrescriptionUsage(): PrescriptionOrderValidate
|
||||
{
|
||||
return $this->only(['id', 'times_per_day', 'usage_days', 'medication_days', 'aux_times_per_day', 'aux_usage_days'])
|
||||
->append('id', 'require|integer|gt:0')
|
||||
->append('times_per_day', 'require|integer|between:1,6')
|
||||
->append('usage_days', 'require|integer|between:1,999')
|
||||
->append('medication_days', 'require|integer|between:1,999')
|
||||
->append('aux_times_per_day', 'integer|between:1,6')
|
||||
->append('aux_usage_days', 'integer|between:1,999');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user