新增功能
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\validate\doctor;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 医生预约验证器
|
||||
* Class AppointmentValidate
|
||||
* @package app\adminapi\validate\doctor
|
||||
*/
|
||||
class AppointmentValidate extends BaseValidate
|
||||
{
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'patient_id' => 'require|integer',
|
||||
'doctor_id' => 'require|integer',
|
||||
'appointment_date' => 'require|date',
|
||||
'period' => 'in:morning,afternoon,all',
|
||||
'appointment_time' => 'require',
|
||||
'appointment_type' => 'in:video,text,phone',
|
||||
];
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => '预约ID',
|
||||
'patient_id' => '患者ID',
|
||||
'doctor_id' => '医生ID',
|
||||
'appointment_date' => '预约日期',
|
||||
'period' => '时段',
|
||||
'appointment_time' => '预约时间',
|
||||
'appointment_type' => '预约类型',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 创建预约场景
|
||||
* @return AppointmentValidate
|
||||
*/
|
||||
public function sceneCreate()
|
||||
{
|
||||
return $this->only(['patient_id', 'doctor_id', 'appointment_date', 'period', 'appointment_time', 'appointment_type']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 取消预约场景
|
||||
* @return AppointmentValidate
|
||||
*/
|
||||
public function sceneCancel()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 预约详情场景
|
||||
* @return AppointmentValidate
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 可用时间段场景
|
||||
* @return AppointmentValidate
|
||||
*/
|
||||
public function sceneAvailableSlots()
|
||||
{
|
||||
return $this->only(['doctor_id', 'appointment_date', 'period']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 完成预约场景
|
||||
* @return AppointmentValidate
|
||||
*/
|
||||
public function sceneComplete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\validate\doctor;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 医生排班验证器
|
||||
* Class RosterValidate
|
||||
* @package app\adminapi\validate\doctor
|
||||
*/
|
||||
class RosterValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'doctor_id' => 'require',
|
||||
'date' => 'require|date',
|
||||
'period' => 'require|in:morning,afternoon',
|
||||
'status' => 'require|in:1,2,3,4',
|
||||
'quota' => 'number',
|
||||
'max_patients' => 'number',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '请选择排班',
|
||||
'doctor_id.require' => '请选择医生',
|
||||
'date.require' => '请选择日期',
|
||||
'date.date' => '日期格式不正确',
|
||||
'period.require' => '请选择时段',
|
||||
'period.in' => '时段参数错误',
|
||||
'status.require' => '请选择状态',
|
||||
'status.in' => '状态参数错误',
|
||||
'quota.number' => '号源数必须是数字',
|
||||
'max_patients.number' => '最大接诊数必须是数字',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 保存场景
|
||||
*/
|
||||
public function sceneSave()
|
||||
{
|
||||
return $this->only(['doctor_id', 'date', 'period', 'status', 'quota', 'max_patients', 'remark']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 批量保存场景
|
||||
*/
|
||||
public function sceneBatchSave()
|
||||
{
|
||||
return $this->only(['rosters'])
|
||||
->append('rosters', 'require|array');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 复制场景
|
||||
*/
|
||||
public function sceneCopy()
|
||||
{
|
||||
return $this->only(['source_start_date', 'source_end_date', 'target_start_date'])
|
||||
->append('source_start_date', 'require|date')
|
||||
->append('source_end_date', 'require|date')
|
||||
->append('target_start_date', 'require|date');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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_date' => 'require',
|
||||
'diagnosis_type' => 'require',
|
||||
'syndrome_type' => 'require',
|
||||
'status' => 'in:0,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '参数缺失',
|
||||
'patient_name.require' => '请输入患者姓名',
|
||||
'patient_name.length' => '患者姓名长度须在1-50位字符',
|
||||
'id_card.length' => '身份证号长度不正确',
|
||||
'phone.require' => '请输入手机号',
|
||||
'phone.mobile' => '手机号格式不正确',
|
||||
'gender.require' => '请选择性别',
|
||||
'gender.in' => '性别参数错误',
|
||||
'age.require' => '请输入年龄',
|
||||
'age.number' => '年龄必须为数字',
|
||||
'age.between' => '年龄范围0-150',
|
||||
'diagnosis_date.require' => '请选择诊断日期',
|
||||
'diagnosis_type.require' => '请选择诊断类型',
|
||||
'syndrome_type.require' => '请选择证型',
|
||||
'status.in' => '状态参数错误',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'patient_name', 'id_card', 'phone', 'gender', 'age', 'diagnosis_date', 'diagnosis_type', 'syndrome_type', 'past_history', 'symptoms', 'tongue_coating', 'pulse', 'treatment_principle', 'prescription', 'doctor_advice', 'remark', 'status']);
|
||||
}
|
||||
|
||||
public function sceneId()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
protected function checkDiagnosis($value)
|
||||
{
|
||||
$diagnosis = Diagnosis::findOrEmpty($value);
|
||||
if ($diagnosis->isEmpty()) {
|
||||
return '诊单不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user