This commit is contained in:
zimoyin
2026-04-02 17:42:00 +08:00
parent ac95dbb1c8
commit 4c841b9dbf
963 changed files with 347242 additions and 354 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id ID(主键)
* @property string $username 用户名
* @property string $nickname 昵称
* @property string $password 密码
* @property string $avatar 头像
* @property string $email 邮箱
* @property string $mobile 手机
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property string $login_at 登录时间
* @property string $roles 角色
* @property integer $status 状态 0正常 1禁用
*/
class Admin extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_admins';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace app\model;
use support\Model;
/**
* AdminData 模型
* 表说明:admin_data 数据表模型
* 对应数据表:admin_data
* @property int $id id(非空,主键)
* @property int $uid uid 用户ID(非空)
* @property string $hospital_id hospital_id 医院id(非空)
* @property string $dept_id dept_id 科室id(非空)
*/
class AdminData extends Model
{
/**
* 数据表名
* @var string
*/
protected $table = 'admin_data';
/**
* 主键字段名
* @var string
*/
protected $pk = 'id';
/**
* 关闭自动时间戳(如需开启请改为 true,需确保表有 create_time/update_time 字段)
* @var bool
*/
protected $autoWriteTimestamp = false;
/**
* 字段严格检查(false=允许操作未定义字段)
* @var bool
*/
protected $strict = false;
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id ID(主键)
* @property string $admin_id 管理员id
* @property string $role_id 角色id
*/
class AdminRole extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_admin_roles';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
public $timestamps = false;
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace plugin\admin\app\model;
use DateTimeInterface;
use support\Model;
class Base extends Model
{
/**
* @var string
*/
protected $connection = 'plugin.admin.mysql';
/**
* 格式化日期
*
* @param DateTimeInterface $date
* @return string
*/
protected function serializeDate(DateTimeInterface $date)
{
return $date->format('Y-m-d H:i:s');
}
}
+96
View File
@@ -0,0 +1,96 @@
<?php
namespace plugin\admin\app\model;
use support\exception\BusinessException;
/**
* 字典相关
*/
class Dict
{
/**
* 获取字典
* @param $name
* @return mixed|null
*/
public static function get($name)
{
$value = Option::where('name', static::dictNameToOptionName($name))->value('value');
return $value ? json_decode($value, true) : null;
}
/**
* 保存字典
* @param $name
* @param $values
* @return void
* @throws BusinessException
*/
public static function save($name, $values)
{
if (!preg_match('/[a-zA-Z]/', $name)) {
throw new BusinessException('字典名只能包含字母');
}
$option_name = static::dictNameToOptionName($name);
if (!$option = Option::where('name', $option_name)->first()) {
$option = new Option;
}
$format_values = static::filterValue($values);
$option->name = $option_name;
$option->value = json_encode($format_values, JSON_UNESCAPED_UNICODE);
$option->save();
}
/**
* 删除字典
* @param array $names
* @return void
*/
public static function delete(array $names)
{
foreach ($names as $index => $name) {
$names[$index] = static::dictNameToOptionName($name);
}
Option::whereIn('name', $names)->delete();
}
/**
* 字典名到option名转换
* @param string $name
* @return string
*/
public static function dictNameToOptionName(string $name): string
{
return "dict_$name";
}
/**
* option名到字典名转换
* @param string $name
* @return string
*/
public static function optionNameToDictName(string $name): string
{
return substr($name, 5);
}
/**
* 过滤值
* @param array $values
* @return array
* @throws BusinessException
*/
public static function filterValue(array $values): array
{
$format_values = [];
foreach ($values as $item) {
if (!isset($item['value']) || !isset($item['name'])) {
throw new BusinessException('字典格式错误', 1);
}
$format_values[] = ['value' => $item['value'], 'name' => $item['name']];
}
return $format_values;
}
}
@@ -0,0 +1,58 @@
<?php
namespace app\model;
use support\Model;
/**
* OpmMwDepartment 模型
* 表说明:opm_mw_department 数据表模型
* 对应数据表:opm_mw_department
* @property string $id id(非空,主键)
* @property int $organ_id organ_id
* @property int $sort_id sort_id
* @property string $dept_name dept_name
* @property string $description description
* @property string $dept_code dept_code
* @property string $dept_det_code dept_det_code
* @property string $dept_det_name dept_det_name
* @property string $coll_type coll_type 归集方式 0:本院产生,1:外院归集(默认值:1)
* @property string $handover_code handover_code 科室的交接码,每一个科室有一个交接码
* @property string $created_at created_at
* @property int $collection_id collection_id
* @property int $card_id card_id
* @property int $storey_id storey_id 属于那栋楼
* @property int $floor_id floor_id 属于那一层
* @property int $is_sync is_sync 是否同步(默认值:1)
* @property string $type type
* @property string $report_dep_id report_dep_id
* @property int $is_report is_report(默认值:1
* @property string $deptId deptId
* @property int $s_report s_report(默认值:1
*/
class OpmMwDepartment extends Model
{
/**
* 数据表名
* @var string
*/
protected $table = 'opm_mw_department';
/**
* 主键字段名
* @var string
*/
protected $pk = 'id';
/**
* 关闭自动时间戳(如需开启请改为 true,需确保表有 create_time/update_time 字段)
* @var bool
*/
protected $autoWriteTimestamp = false;
/**
* 字段严格检查(false=允许操作未定义字段)
* @var bool
*/
protected $strict = false;
}
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace app\model;
use support\Model;
/**
* OpmMwHospital 模型
* 表说明:opm_mw_hospital 数据表模型
* 对应数据表:opm_mw_hospital
* @property string $id id(非空,主键)
* @property int $area_id area_id
* @property string $organ_name organ_name
* @property string $former_name former_name
* @property string $sql_host sql_host
* @property string $sql_database sql_database
* @property string $sql_port sql_port
* @property string $sql_account sql_account
* @property string $sql_password sql_password
* @property string $organ_code organ_code
* @property string $organ_level organ_level 0未定级 1一级 2二级 3三级
* @property string $grade grade 0未定级 1甲级 2乙级
* @property string $contacts_idcard contacts_idcard
* @property string $phone phone
* @property string $region_code region_code
* @property string $address address
* @property string $person_name person_name
* @property string $created_at created_at
* @property string $mobile mobile
* @property string $push_url push_url
* @property int $is_true is_true(默认值:1
* @property string $dealer dealer 经销商
* @property string $dealer_mobile dealer_mobile 经销商联系电话
* @property string $leader leader 医院负责人
* @property string $leader_mobile leader_mobile 医院负责人电话
* @property string $warranty_period warranty_period 质保期
* @property int $is_report is_report(默认值:1
* @property string $url2 url2
* @property int $is_push is_push(默认值:0
*/
class OpmMwHospital extends Model
{
/**
* 数据表名
* @var string
*/
protected $table = 'opm_mw_hospital';
/**
* 主键字段名
* @var string
*/
protected $pk = 'id';
/**
* 关闭自动时间戳(如需开启请改为 true,需确保表有 create_time/update_time 字段)
* @var bool
*/
protected $autoWriteTimestamp = false;
/**
* 字段严格检查(false=允许操作未定义字段)
* @var bool
*/
protected $strict = false;
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace plugin\admin\app\model;
/**
* @property integer $id (主键)
* @property string $name 键
* @property mixed $value 值
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class Option extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_options';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace plugin\admin\app\model;
/**
* @property integer $id 主键(主键)
* @property string $name 角色名
* @property string $rules 权限
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property integer $pid 上级id
*/
class Role extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_roles';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* @return mixed
*/
public function getRuleIds()
{
return $this->rules ? explode(',', $this->rules) : [];
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id 主键(主键)
* @property string $title 标题
* @property string $icon 图标
* @property string $key 标识
* @property integer $pid 上级菜单
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property string $href url
* @property integer $type 类型
* @property integer $weight 排序
*/
class Rule extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_rules';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id 主键(主键)
* @property string $name 名称
* @property string $url url
* @property integer $admin_id 管理员
* @property integer $user_id 用户
* @property integer $file_size 文件大小
* @property string $mime_type mime类型
* @property integer $image_width 图片宽度
* @property integer $image_height 图片高度
* @property string $ext 扩展名
* @property string $storage 存储位置
* @property string $created_at 上传时间
* @property string $category 类别
* @property string $updated_at 更新时间
*/
class Upload extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_uploads';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id 主键(主键)
* @property string $username 用户名
* @property string $nickname 昵称
* @property string $password 密码
* @property string $sex 性别
* @property string $avatar 头像
* @property string $email 邮箱
* @property string $mobile 手机
* @property integer $level 等级
* @property string $birthday 生日
* @property integer $money 余额
* @property integer $score 积分
* @property string $last_time 登录时间
* @property string $last_ip 登录ip
* @property string $join_time 注册时间
* @property string $join_ip 注册ip
* @property string $token token
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property integer $role 角色
* @property integer $status 禁用
*/
class User extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_users';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}