first commit

This commit is contained in:
Your Name
2026-09-08 11:40:15 +08:00
commit a5353f7eb5
9568 changed files with 1646214 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace app\common\model;
use app\common\service\FileService;
class AssetResource extends BaseModel
{
protected $name = 'asset_resource';
protected $autoWriteTimestamp = true;
public function getFileUrlAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
public function setFileUrlAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
public function getCoverUrlAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
public function setCoverUrlAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
// Relation to users via asset_user_resource
public function users()
{
return $this->belongsToMany(AssetUser::class, AssetUserResource::class, 'user_id', 'resource_id');
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace app\common\model;
use think\model\concern\SoftDelete;
class AssetUser extends BaseModel
{
protected $name = 'asset_user';
protected $autoWriteTimestamp = true;
// Optional: Hide password when returning array/json
protected $hidden = ['password'];
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model;
use think\model\Pivot;
class AssetUserResource extends Pivot
{
protected $name = 'asset_user_resource';
protected $autoWriteTimestamp = 'create_time';
protected $updateTime = false;
}
+50
View File
@@ -0,0 +1,50 @@
<?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\common\model;
use app\common\service\FileService;
use think\Model;
/**
* 基础模型
* Class BaseModel
* @package app\common\model
*/
class BaseModel extends Model
{
/**
* @notes 公共处理图片,补全路径
* @param $value
* @return string
* @author 张无忌
* @date 2021/9/10 11:02
*/
public function getImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 公共图片处理,去除图片域名
* @param $value
* @return mixed|string
* @author 张无忌
* @date 2021/9/10 11:04
*/
public function setImageAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
}
+19
View File
@@ -0,0 +1,19 @@
<?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\common\model;
class Config extends BaseModel
{
}
+80
View File
@@ -0,0 +1,80 @@
<?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\common\model;
use app\common\enum\CrontabEnum;
use think\model\concern\SoftDelete;
/**
* 定时任务模型
* Class Crontab
* @package app\common\model
*/
class Crontab extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $name = 'dev_crontab';
/**
* @notes 类型获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:05
*/
public function getTypeDescAttr($value)
{
$desc = [
CrontabEnum::CRONTAB => '定时任务',
CrontabEnum::DAEMON => '守护进程',
];
return $desc[$value] ?? '';
}
/**
* @notes 状态获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:06
*/
public function getStatusDescAttr($value)
{
$desc = [
CrontabEnum::START => '运行',
CrontabEnum::STOP => '停止',
CrontabEnum::ERROR => '错误',
];
return $desc[$value] ?? '';
}
/**
* @notes 最后执行时间获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:06
*/
public function getLastTimeAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
}
@@ -0,0 +1,50 @@
<?php
namespace app\common\model;
use app\common\model\user\User;
use app\common\model\tcm\Diagnosis;
use think\model\concern\SoftDelete;
/**
* 诊单查看记录模型
*/
class DiagnosisViewRecord extends BaseModel
{
use SoftDelete;
protected $name = 'diagnosis_view_records';
protected $deleteTime = 'delete_time';
/**
* @notes 关联用户
*/
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
/**
* @notes 关联诊单
*/
public function diagnosis()
{
return $this->hasOne(Diagnosis::class, 'id', 'diagnosis_id');
}
/**
* @notes 关联患者
*/
public function patient()
{
return $this->hasOne(User::class, 'id', 'patient_id');
}
/**
* @notes 关联分享用户
*/
public function shareUser()
{
return $this->hasOne(User::class, 'id', 'share_user_id');
}
}
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 物流查询日志模型
*/
class ExpressQueryLog extends BaseModel
{
protected $name = 'express_query_log';
// 表只有 create_time、无 update_timeconfig/database.php 全局 auto_timestamp=true,需显式关闭避免 Unknown column 'update_time'
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 物流状态变更记录模型
*/
class ExpressStateLog extends BaseModel
{
protected $name = 'express_state_log';
// 表只有 create_time、无 update_timeconfig/database.php 全局 auto_timestamp=true,需显式关闭避免 Unknown column 'update_time'
protected $autoWriteTimestamp = false;
/**
* 关联主表
*/
public function tracking()
{
return $this->belongsTo(ExpressTracking::class, 'tracking_id', 'id');
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 物流轨迹明细模型
*/
class ExpressTrace extends BaseModel
{
protected $name = 'express_trace';
// 表只有 create_time、无 update_timeconfig/database.php 全局 auto_timestamp=true,需显式关闭避免 Unknown column 'update_time'
protected $autoWriteTimestamp = false;
/**
* 关联主表
*/
public function tracking()
{
return $this->belongsTo(ExpressTracking::class, 'tracking_id', 'id');
}
}
+101
View File
@@ -0,0 +1,101 @@
<?php
declare(strict_types=1);
namespace app\common\model;
use think\model\concern\SoftDelete;
/**
* 物流追踪模型
*/
class ExpressTracking extends BaseModel
{
use SoftDelete;
protected $name = 'express_tracking';
protected $deleteTime = 'delete_time';
// 物流状态常量
public const STATE_IN_TRANSIT = '0'; // 在途
public const STATE_COLLECTED = '1'; // 揽收
public const STATE_PROBLEM = '2'; // 疑难
public const STATE_SIGNED = '3'; // 签收
public const STATE_RETURN_SIGNED = '4'; // 退签
public const STATE_DELIVERING = '5'; // 派件
public const STATE_RETURNING = '6'; // 退回
public const STATE_FORWARDING = '7'; // 转投
public const STATE_CUSTOMS = '8'; // 清关
public const STATE_WAIT_CUSTOMS = '10'; // 待清关
public const STATE_IN_CUSTOMS = '11'; // 清关中
public const STATE_CUSTOMS_DONE = '12'; // 已清关
public const STATE_CUSTOMS_ERROR = '13'; // 清关异常
public const STATE_REJECTED = '14'; // 拒签
/**
* 获取状态文本
*/
public static function getStateText(string $state): string
{
$map = [
self::STATE_IN_TRANSIT => '在途',
self::STATE_COLLECTED => '揽收',
self::STATE_PROBLEM => '疑难',
self::STATE_SIGNED => '已签收',
self::STATE_RETURN_SIGNED => '退签',
self::STATE_DELIVERING => '派件中',
self::STATE_RETURNING => '退回',
self::STATE_FORWARDING => '转投',
self::STATE_CUSTOMS => '清关',
self::STATE_WAIT_CUSTOMS => '待清关',
self::STATE_IN_CUSTOMS => '清关中',
self::STATE_CUSTOMS_DONE => '已清关',
self::STATE_CUSTOMS_ERROR => '清关异常',
self::STATE_REJECTED => '拒签',
];
return $map[$state] ?? '未知';
}
/**
* 是否为终态(不再需要更新)
*/
public static function isFinalState(string $state): bool
{
return in_array($state, [
self::STATE_SIGNED,
self::STATE_RETURN_SIGNED,
self::STATE_REJECTED,
], true);
}
/**
* 是否为异常状态
*/
public static function isProblemState(string $state): bool
{
return in_array($state, [
self::STATE_PROBLEM,
self::STATE_CUSTOMS_ERROR,
self::STATE_REJECTED,
], true);
}
/**
* 关联轨迹明细
*/
public function traces()
{
return $this->hasMany(ExpressTrace::class, 'tracking_id', 'id')
->order('trace_time_stamp', 'desc');
}
/**
* 关联状态变更记录
*/
public function stateLogs()
{
return $this->hasMany(ExpressStateLog::class, 'tracking_id', 'id')
->order('change_time', 'desc');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace app\common\model;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class Fan extends BaseModel
{
use SoftDelete;
protected $name = 'fan';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
public function getGenderDescAttr($value, $data)
{
$gender = [0 => '未知', 1 => '男', 2 => '女'];
return $gender[$data['gender']] ?? '未知';
}
public function getStatusDescAttr($value, $data)
{
$status = [0 => '禁用', 1 => '启用'];
return $status[$data['status']] ?? '未知';
}
public function visitRecords()
{
return $this->hasMany(FanVisitRecord::class, 'fan_id', 'id');
}
}
@@ -0,0 +1,29 @@
<?php
namespace app\common\model;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class FanVisitRecord extends BaseModel
{
use SoftDelete;
protected $name = 'fan_visit_record';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
public function getVisitTypeDescAttr($value, $data)
{
$types = [1 => '电话', 2 => '微信', 3 => '短信', 4 => '上门', 5 => '其他'];
return $types[$data['visit_type']] ?? '未知';
}
public function fan()
{
return $this->belongsTo(Fan::class, 'fan_id', 'id');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?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\common\model;
class HotSearch extends BaseModel
{
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace app\common\model;
class OperationLog extends BaseModel
{
}
+175
View File
@@ -0,0 +1,175 @@
<?php
declare(strict_types=1);
namespace app\common\model;
use think\model\concern\SoftDelete;
/**
* 订单模型
* Class Order
* @package app\common\model
*/
class Order extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $name = 'order';
/**
* @notes 关联订单详情
* @return \think\model\relation\HasMany
*/
public function details()
{
return $this->hasMany(OrderDetail::class, 'order_id', 'id');
}
/**
* @notes 关联患者(从诊单表)
* @return \think\model\relation\BelongsTo
*/
public function patient()
{
return $this->belongsTo('app\common\model\tcm\Diagnosis', 'patient_id', 'id');
}
/**
* @notes 关联创建人
* @return \think\model\relation\BelongsTo
*/
public function creator()
{
return $this->belongsTo('app\common\model\auth\Admin', 'creator_id', 'id');
}
/**
* @notes 搜索器-订单号
*/
public function searchOrderNoAttr($query, $value, $data)
{
if ($value) {
$query->where('order_no', 'like', '%' . $value . '%');
}
}
/**
* @notes 搜索器-患者关键词
*/
public function searchPatientKeywordAttr($query, $value, $data)
{
if ($value) {
$query->whereHas('patient', function ($q) use ($value) {
$q->where('patient_name|patient_phone', 'like', '%' . $value . '%');
});
}
}
/**
* @notes 搜索器-订单类型
*/
public function searchOrderTypeAttr($query, $value, $data)
{
if ($value) {
$query->where('order_type', '=', $value);
}
}
/**
* @notes 搜索器-订单状态
*/
public function searchStatusAttr($query, $value, $data)
{
if ($value) {
$query->where('status', '=', $value);
}
}
/**
* @notes 搜索器-创建时间开始
*/
public function searchCreateTimeStartAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '>=', $value . ' 00:00:00');
}
}
/**
* @notes 搜索器-创建时间结束
*/
public function searchCreateTimeEndAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '<=', $value . ' 23:59:59');
}
}
/**
* @notes 获取器-订单类型描述
*/
public function getOrderTypeDescAttr($value, $data)
{
$typeMap = [1 => '挂号费', 2 => '问诊费', 3 => '药品费用'];
return $typeMap[$data['order_type']] ?? '未知';
}
/**
* @notes 获取器-订单状态描述
*/
public function getStatusDescAttr($value, $data)
{
$statusMap = [1 => '待支付', 2 => '已支付', 3 => '已取消', 4 => '已退款', 5 => '待审核'];
return $statusMap[$data['status']] ?? '未知';
}
/**
* @notes 获取器-患者名称
*/
public function getPatientNameAttr($value, $data)
{
if ($value) {
return $value;
}
try {
$patient = $this->patient()->find();
return $patient ? $patient->patient_name : '';
} catch (\Exception $e) {
return '';
}
}
/**
* @notes 获取器-患者电话
*/
public function getPatientPhoneAttr($value, $data)
{
if ($value) {
return $value;
}
try {
$patient = $this->patient()->find();
return $patient ? $patient->patient_phone : '';
} catch (\Exception $e) {
return '';
}
}
/**
* @notes 获取器-创建人名称
*/
public function getCreatorNameAttr($value, $data)
{
if ($value) {
return $value;
}
try {
$creator = $this->creator()->find();
return $creator ? $creator->name : '';
} catch (\Exception $e) {
return '';
}
}
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 支付单(zyt_order)后台操作日志
*/
class OrderActionLog extends BaseModel
{
protected $name = 'order_action_log';
protected $autoWriteTimestamp = false;
}
+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 订单详情模型
* Class OrderDetail
* @package app\common\model
*/
class OrderDetail extends BaseModel
{
protected $table = 'la_order_detail';
/**
* @notes 关联订单
* @return \think\model\relation\BelongsTo
*/
public function order()
{
return $this->belongsTo(Order::class, 'order_id', 'id');
}
/**
* @notes 获取器-关联类型描述
*/
public function getRelatedTypeDescAttr($value, $data)
{
$typeMap = ['appointment' => '挂号', 'diagnosis' => '问诊', 'medicine' => '药品'];
return $typeMap[$data['related_type']] ?? '未知';
}
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace app\common\model;
use think\model\concern\SoftDelete;
/**
* 企业微信外部联系人模型
*/
class QywxExternalContact extends BaseModel
{
use SoftDelete;
protected $name = 'qywx_external_contact';
protected $deleteTime = 'delete_time';
/**
* 未删除行在库中为 delete_time = NULL(建表与同步 upsert 均如此)。
* 若设为 0Think 会生成 delete_time = 0,与数据不一致导致列表永远为空。
*/
protected $defaultSoftDelete = null;
}
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 企业微信「客户联系」事件流水模型
*
* - 每收到一次 `change_external_contact` 回调就落一行;
* - (change_type, user_id, external_userid, event_time) 唯一键做幂等,企微自动重试不会重复计数;
* - 用作"今天进来多少人 = 今日 change_type=add_external_contact 的行数"等零误差统计;
* - 与 `qywx_external_contact` 解耦:后者会软删/覆盖,这张表只追加、不改写。
*/
class QywxExternalContactEvent extends BaseModel
{
protected $name = 'qywx_external_contact_event';
}
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace app\common\model;
class QywxMediaChannel extends BaseModel
{
protected $name = 'qywx_media_channel';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $dateFormat = false;
}
@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 企业微信会话存档消息
*
* 数据来源为「会话内容存档」SDK 拉取后解密落库,msgid 官方唯一。
* 消息体字段根据 msgtype 有不同含义,统一用 content(摘要/文本)+ raw(原始 JSON)组合存储,
* 具体渲染放到业务层(前端或 Logic)再按需展开。
*/
class QywxMsgArchive extends BaseModel
{
protected $name = 'qywx_msg_archive';
protected $autoWriteTimestamp = 'int';
protected $type = [
'send_time' => 'integer',
'seq' => 'integer',
'file_size' => 'integer',
'play_length' => 'integer',
];
/** JSON 反序列化 to_list 访问器,便于业务层直接拿数组 */
public function getToListAttr($value): array
{
if ($value === null || $value === '') {
return [];
}
if (is_array($value)) {
return $value;
}
$decoded = json_decode((string) $value, true);
return is_array($decoded) ? $decoded : [];
}
public function setToListAttr($value): string
{
if (is_string($value)) {
return $value;
}
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace app\common\model;
class QywxMsgArchiveCursor extends BaseModel
{
protected $name = 'qywx_msg_archive_cursor';
protected $autoWriteTimestamp = 'int';
public const DEFAULT_KEY = 'global';
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace app\common\model;
class QywxMsgArchiveMedia extends BaseModel
{
protected $name = 'qywx_msg_archive_media';
protected $autoWriteTimestamp = 'int';
public const STATUS_PENDING = 0;
public const STATUS_SUCCESS = 1;
public const STATUS_FAILED = 2;
}
@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 员工代发消息(企业群发)任务
*
* 企业群发 add_msg_template 的特性:
* - 必须以「员工身份」为 sender 代发,客户端显示为员工本人
* - 员工手机端会弹一次"发送确认",员工点确认后才真正送达客户;admin 后台无法强制送达
* - 返回的 msgid 可通过 get_group_msg_send_result 查询确认 / 送达结果
*
* 状态:
* 0=待提交、1=已提交等待员工确认、2=员工已确认发送、3=失败
*/
class QywxMsgSendTask extends BaseModel
{
protected $name = 'qywx_msg_send_task';
protected $autoWriteTimestamp = 'int';
public const STATUS_PENDING = 0;
public const STATUS_SUBMITTED = 1;
public const STATUS_SENT = 2;
public const STATUS_FAILED = 3;
public function getExternalUseridsAttr($value): array
{
if ($value === null || $value === '') {
return [];
}
$decoded = json_decode((string) $value, true);
return is_array($decoded) ? $decoded : [];
}
public function setExternalUseridsAttr($value): string
{
if (is_string($value)) {
return $value;
}
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
}
public function getMsgPayloadAttr($value)
{
if ($value === null || $value === '') {
return [];
}
$decoded = json_decode((string) $value, true);
return is_array($decoded) ? $decoded : [];
}
public function setMsgPayloadAttr($value): string
{
if (is_string($value)) {
return $value;
}
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
}
public function getFailListAttr($value)
{
if ($value === null || $value === '') {
return [];
}
$decoded = json_decode((string) $value, true);
return is_array($decoded) ? $decoded : [];
}
public function setFailListAttr($value): string
{
if (is_string($value)) {
return $value;
}
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
}
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 企业微信 员工×客户 会话索引(用于 admin 聊天页左侧会话列表)
*/
class QywxMsgSession extends BaseModel
{
protected $name = 'qywx_msg_session';
protected $autoWriteTimestamp = 'int';
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace app\common\model;
/**
* 企业微信同步设置模型
*/
class QywxSyncSettings extends BaseModel
{
protected $name = 'qywx_sync_settings';
}
@@ -0,0 +1,14 @@
<?php
namespace app\common\model;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class WechatChatRecord extends BaseModel
{
use SoftDelete;
protected $name = 'wechat_chat_record';
protected $deleteTime = 'delete_time';
}
+112
View File
@@ -0,0 +1,112 @@
<?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\common\model\article;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯管理模型
* Class Article
* @package app\common\model\article;
*/
class Article extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 获取分类名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getCateNameAttr($value, $data)
{
return ArticleCate::where('id', $data['cid'])->value('name');
}
/**
* @notes 浏览量
* @param $value
* @param $data
* @return mixed
* @author 段誉
* @date 2022/9/15 11:33
*/
public function getClickAttr($value, $data)
{
return $data['click_actual'] + $data['click_virtual'];
}
/**
* @notes 设置图片域名
* @param $value
* @param $data
* @return array|string|string[]|null
* @author 段誉
* @date 2022/9/28 10:17
*/
public function getContentAttr($value, $data)
{
return get_file_domain($value);
}
/**
* @notes 清除图片域名
* @param $value
* @param $data
* @return array|string|string[]
* @author 段誉
* @date 2022/9/28 10:17
*/
public function setContentAttr($value, $data)
{
return clear_file_domain($value);
}
/**
* @notes 获取文章详情
* @param $id
* @return array
* @author 段誉
* @date 2022/10/20 15:23
*/
public static function getArticleDetailArr(int $id)
{
$article = Article::where(['id' => $id, 'is_show' => YesNoEnum::YES])
->findOrEmpty();
if ($article->isEmpty()) {
return [];
}
// 增加点击量
$article->click_actual += 1;
$article->save();
return $article->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->toArray();
}
}
@@ -0,0 +1,74 @@
<?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\common\model\article;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯分类管理模型
* Class ArticleCate
* @package app\common\model\article;
*/
class ArticleCate extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 关联文章
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/10/19 16:59
*/
public function article()
{
return $this->hasMany(Article::class, 'cid', 'id');
}
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/9/15 11:25
*/
public function getIsShowDescAttr($value, $data)
{
return $data['is_show'] ? '启用' : '停用';
}
/**
* @notes 文章数量
* @param $value
* @param $data
* @return int
* @author 段誉
* @date 2022/9/15 11:32
*/
public function getArticleCountAttr($value, $data)
{
return Article::where(['cid' => $data['id']])->count('id');
}
}
@@ -0,0 +1,52 @@
<?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\common\model\article;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯收藏
* Class ArticleCollect
* @package app\common\model\article
*/
class ArticleCollect extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 是否已收藏文章
* @param $userId
* @param $articleId
* @return bool (true=已收藏, false=未收藏)
* @author 段誉
* @date 2022/10/20 15:13
*/
public static function isCollectArticle($userId, $articleId)
{
$collect = ArticleCollect::where([
'user_id' => $userId,
'article_id' => $articleId,
'status' => YesNoEnum::YES
])->findOrEmpty();
return !$collect->isEmpty();
}
}
+116
View File
@@ -0,0 +1,116 @@
<?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\common\model\auth;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use app\common\model\dept\Dept;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
class Admin extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $append = [
'role_id',
'dept_id',
'jobs_id',
];
/**
* @notes 关联角色id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:00
*/
public function getRoleIdAttr($value, $data)
{
return AdminRole::where('admin_id', $data['id'])->column('role_id');
}
/**
* @notes 关联部门id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:00
*/
public function getDeptIdAttr($value, $data)
{
return AdminDept::where('admin_id', $data['id'])->column('dept_id');
}
/**
* @notes 关联岗位id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:01\
*/
public function getJobsIdAttr($value, $data)
{
return AdminJobs::where('admin_id', $data['id'])->column('jobs_id');
}
/**
* @notes 获取禁用状态
* @param $value
* @param $data
* @return string|string[]
* @author 令狐冲
* @date 2021/7/7 01:25
*/
public function getDisableDescAttr($value, $data)
{
return YesNoEnum::getDisableDesc($data['disable']);
}
/**
* @notes 最后登录时间获取器 - 格式化:年-月-日 时:分:秒
* @param $value
* @return string
* @author Tab
* @date 2021/7/13 11:35
*/
public function getLoginTimeAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
/**
* @notes 头像获取器 - 头像路径添加域名
* @param $value
* @return string
* @author Tab
* @date 2021/7/13 11:35
*/
public function getAvatarAttr($value)
{
return empty($value) ? FileService::getFileUrl(config('project.default_image.admin_avatar')) : FileService::getFileUrl(trim($value, '/'));
}
}
@@ -0,0 +1,32 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
class AdminDept extends BaseModel
{
/**
* @notes 删除用户关联部门
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}
@@ -0,0 +1,32 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
class AdminJobs extends BaseModel
{
/**
* @notes 删除用户关联岗位
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}
@@ -0,0 +1,34 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
class AdminRole extends BaseModel
{
/**
* @notes 删除用户关联角色
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}
@@ -0,0 +1,32 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
class AdminSession extends BaseModel
{
/**
* @notes 关联管理员表
* @return \think\model\relation\HasOne
* @author 令狐冲
* @date 2021/7/5 14:39
*/
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id')
->field('id,multipoint_login');
}
}
@@ -0,0 +1,31 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
/**
* 系统菜单
* Class SystemMenu
* @package app\common\model\auth
*/
class SystemMenu extends BaseModel
{
}
@@ -0,0 +1,43 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 角色模型
* Class Role
* @package app\common\model
*/
class SystemRole extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $name = 'system_role';
/**
* @notes 角色与菜单关联关系
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/7/6 11:16
*/
public function roleMenuIndex()
{
return $this->hasMany(SystemRoleMenu::class, 'role_id');
}
}
@@ -0,0 +1,30 @@
<?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\common\model\auth;
use app\common\model\BaseModel;
/**
* 角色与菜单权限关系
* Class SystemRoleMenu
* @package app\common\model\auth
*/
class SystemRoleMenu extends BaseModel
{
}
@@ -0,0 +1,28 @@
<?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\common\model\channel;
use app\common\model\BaseModel;
/**
* 微信公众号回复
* Class OfficialAccountReply
* @package app\common\model\channel
*/
class OfficialAccountReply extends BaseModel
{
}
@@ -0,0 +1,28 @@
<?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\common\model\decorate;
use app\common\model\BaseModel;
/**
* 装修配置-页面
* Class DecorateTabbar
* @package app\common\model\decorate
*/
class DecoratePage extends BaseModel
{
}
@@ -0,0 +1,63 @@
<?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\common\model\decorate;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 装修配置-底部导航
* Class DecorateTabbar
* @package app\common\model\decorate
*/
class DecorateTabbar extends BaseModel
{
// 设置json类型字段
protected $json = ['link'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* @notes 获取底部导航列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/23 12:07
*/
public static function getTabbarLists()
{
$tabbar = self::select()->toArray();
if (empty($tabbar)) {
return $tabbar;
}
foreach ($tabbar as &$item) {
if (!empty($item['selected'])) {
$item['selected'] = FileService::getFileUrl($item['selected']);
}
if (!empty($item['unselected'])) {
$item['unselected'] = FileService::getFileUrl($item['unselected']);
}
}
return $tabbar;
}
}
+46
View File
@@ -0,0 +1,46 @@
<?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\common\model\dept;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 部门模型
* Class Dept
* @package app\common\model\article
*/
class Dept extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/5/25 18:03
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}
+44
View File
@@ -0,0 +1,44 @@
<?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\common\model\dept;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 岗位模型
* Class Jobs
* @package app\common\model\dept
*/
class Jobs extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/5/25 18:03
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}
+47
View File
@@ -0,0 +1,47 @@
<?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\common\model\dict;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 字典数据模型
* Class DictData
* @package app\common\model\dict
*/
class DictData extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/6/20 16:31
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}
+47
View File
@@ -0,0 +1,47 @@
<?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\common\model\dict;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 字典类型模型
* Class DictType
* @package app\common\model\dict
*/
class DictType extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/6/20 15:54
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}
@@ -0,0 +1,103 @@
<?php
namespace app\common\model\doctor;
use app\common\model\BaseModel;
/**
* 医生预约模型
* Class Appointment
* @package app\common\model\doctor
*/
class Appointment extends BaseModel
{
protected $name = 'doctor_appointment';
// 自动时间戳类型设置为整型
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = false;
// 时间字段取出后的默认时间格式(设置为false表示保持整型)
protected $dateFormat = false;
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
*/
public function getStatusDescAttr($value, $data)
{
$statusMap = [
1 => '已预约',
2 => '已取消',
3 => '已完成',
4 => '已过号',
];
return $statusMap[$data['status']] ?? '未知';
}
/**
* @notes 时段描述
* @param $value
* @param $data
* @return string
*/
public function getPeriodDescAttr($value, $data)
{
return $data['period'] == 'morning' ? '上午' : '下午';
}
/**
* @notes 预约类型描述
* @param $value
* @param $data
* @return string
*/
public function getAppointmentTypeDescAttr($value, $data)
{
$typeMap = [
'video' => '视频问诊',
'text' => '图文问诊',
'phone' => '电话问诊',
];
return $typeMap[$data['appointment_type']] ?? '未知';
}
/**
* @notes 预约日期格式化
* @param $value
* @param $data
* @return string
*/
public function getAppointmentDateTextAttr($value, $data)
{
return $data['appointment_date'] ?? '';
}
/**
* @notes 关联患者
* @return \think\model\relation\HasOne
*/
public function patient()
{
return $this->hasOne('app\common\model\user\User', 'id', 'patient_id')
->bind(['patient_name' => 'nickname', 'patient_phone' => 'mobile']);
}
/**
* @notes 关联医生
* @return \think\model\relation\HasOne
*/
public function doctor()
{
return $this->hasOne('app\adminapi\logic\auth\AdminLogic', 'id', 'doctor_id')
->bind(['doctor_name' => 'name']);
}
public function diagnosis(){
return $this->belongsTo('app\common\model\tcm\Diagnosis', 'patient_id', 'id');
}
}
@@ -0,0 +1,17 @@
<?php
namespace app\common\model\doctor;
use app\common\model\BaseModel;
class DoctorNote extends BaseModel
{
protected $name = 'doctor_note';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
}
@@ -0,0 +1,33 @@
<?php
namespace app\common\model\doctor;
use app\common\model\BaseModel;
/**
* 药品库模型
*/
class Medicine extends BaseModel
{
protected $name = 'doctor_medicine';
// 设置字段信息
protected $schema = [
'id' => 'int',
'name' => 'string',
'name_pinyin_abbr' => 'string',
'supplier' => 'string',
'unit' => 'string',
'settlement_price' => 'float',
'retail_price' => 'float',
'stock' => 'int',
'image' => 'string',
'status' => 'int',
'type' => 'string',
'gid' => 'string',
'remark' => 'string',
'create_time' => 'int',
'update_time' => 'int',
'delete_time' => 'int',
];
}
+78
View File
@@ -0,0 +1,78 @@
<?php
namespace app\common\model\doctor;
use app\common\model\BaseModel;
/**
* 医生排班模型
* Class Roster
* @package app\common\model\doctor
*/
class Roster extends BaseModel
{
protected $name = 'doctor_roster';
// 自动时间戳类型设置为整型
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
// 时间字段取出后的默认时间格式(设置为false表示保持整型)
protected $dateFormat = false;
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
*/
public function getStatusDescAttr($value, $data)
{
$statusMap = [
1 => '出诊',
2 => '停诊',
3 => '休息',
4 => '请假',
];
return $statusMap[$data['status']] ?? '未知';
}
/**
* @notes 时段描述
* @param $value
* @param $data
* @return string
*/
public function getPeriodDescAttr($value, $data)
{
$st = $data['start_time'] ?? '';
$et = $data['end_time'] ?? '';
if ($st !== '' && $et !== '') {
return $st . '-' . $et;
}
if (($data['period'] ?? '') === 'morning') {
return '上午';
}
if (($data['period'] ?? '') === 'afternoon') {
return '下午';
}
if (($data['period'] ?? '') === 'night') {
return '夜班';
}
return '时段';
}
/**
* @notes 日期格式化
* @param $value
* @param $data
* @return string
*/
public function getDateTextAttr($value, $data)
{
return $data['date'] ?? '';
}
}
+24
View File
@@ -0,0 +1,24 @@
<?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\common\model\file;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class File extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
+25
View File
@@ -0,0 +1,25 @@
<?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\common\model\file;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class FileCate extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace app\common\model\finance;
use app\common\model\BaseModel;
use think\facade\Db;
class AccountCost extends BaseModel
{
protected $name = 'account_cost';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
public static function supportsDeptBinding(): bool
{
static $supported = null;
if ($supported !== null) {
return $supported;
}
try {
$fields = Db::name('account_cost')->getTableFields();
$supported = is_array($fields)
&& in_array('dept_id', $fields, true)
&& in_array('dept_name', $fields, true);
} catch (\Throwable) {
$supported = false;
}
return $supported;
}
}
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace app\common\model\finance;
use app\common\model\BaseModel;
class DeptPerformanceTarget extends BaseModel
{
protected $name = 'dept_performance_target';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
}
@@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | likeshop100%开源免费商用商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用,可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | gitee下载:https://gitee.com/likeshop_gitee
// | github下载:https://github.com/likeshop-github
// | 访问官网:https://www.likeshop.cn
// | 访问社区:https://home.likeshop.cn
// | 访问手册:http://doc.likeshop.cn
// | 微信公众号:likeshop技术社区
// | likeshop团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | // +----------------------------------------------------------------------
// | 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\common\model\notice;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 通知记录模型
* Class Notice
* @package app\common\model
*/
class NoticeRecord extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
@@ -0,0 +1,120 @@
<?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\common\model\notice;
use app\common\enum\DefaultEnum;
use app\common\enum\notice\NoticeEnum;
use app\common\model\BaseModel;
class NoticeSetting extends BaseModel
{
/**
* @notes 短信通知状态
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2022/2/16 3:22 下午
*/
public function getSmsStatusDescAttr($value,$data)
{
if ($data['sms_notice']) {
$sms_text = json_decode($data['sms_notice'],true);
return DefaultEnum::getEnableDesc($sms_text['status']);
}else {
return '停用';
}
}
/**
* @notes 通知类型
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2022/2/17 2:50 下午
*/
public function getTypeDescAttr($value,$data)
{
return NoticeEnum::getTypeDesc($data['type']);
}
/**
* @notes 接收者描述获取器
* @param $value
* @return string
* @author Tab
* @date 2021/8/18 16:42
*/
public function getRecipientDescAttr($value)
{
$desc = [
1 => '买家',
2 => '卖家',
];
return $desc[$value] ?? '';
}
/**
* @notes 系统通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:11
*/
public function getSystemNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 短信通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:12
*/
public function getSmsNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 公众号通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:13
*/
public function getOaNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 小程序通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:13
*/
public function getMnpNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
}
+30
View File
@@ -0,0 +1,30 @@
<?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\common\model\notice;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 短信记录模型
* Class SmsLog
* @package app\common\model
*/
class SmsLog extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
+56
View File
@@ -0,0 +1,56 @@
<?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\common\model\pay;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use app\common\service\FileService;
class PayConfig extends BaseModel
{
protected $name = 'dev_pay_config';
// 设置json类型字段
protected $json = ['config'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* @notes 支付图标获取器 - 路径添加域名
* @param $value
* @return string
* @author ljj
* @date 2021/7/28 2:12 下午
*/
public function getIconAttr($value)
{
return empty($value) ? '' : FileService::getFileUrl($value);
}
/**
* @notes 支付方式名称获取器
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2021/7/31 2:24 下午
*/
public function getPayWayNameAttr($value,$data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
}
+54
View File
@@ -0,0 +1,54 @@
<?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\common\model\pay;
use app\common\model\BaseModel;
use app\common\service\FileService;
class PayWay extends BaseModel
{
protected $name = 'dev_pay_way';
public function getIconAttr($value,$data)
{
return FileService::getFileUrl($value);
}
/**
* @notes 支付方式名称获取器
* @param $value
* @param $data
* @return mixed
* @author ljj
* @date 2021/7/28 4:02 下午
*/
public static function getPayWayNameAttr($value,$data)
{
return PayConfig::where('id',$data['pay_config_id'])->value('name');
}
/**
* @notes 关联支配配置模型
* @return \think\model\relation\HasOne
* @author ljj
* @date 2021/10/11 3:04 下午
*/
public function payConfig()
{
return $this->hasOne(PayConfig::class,'id','pay_config_id');
}
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\common\model\pharmacy;
use app\common\model\BaseModel;
class EjMedicineCatalog extends BaseModel
{
protected $name = 'ej_medicine_catalog';
protected $autoWriteTimestamp = true;
protected $dateFormat = false;
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\pharmacy;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class EjMedicineMapping extends BaseModel
{
use SoftDelete;
protected $name = 'ej_medicine_mapping';
protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = true;
protected $dateFormat = false;
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\common\model\pharmacy;
use app\common\model\BaseModel;
class EjPharmacyCallbackInbox extends BaseModel
{
protected $name = 'ej_pharmacy_callback_inbox';
protected $autoWriteTimestamp = true;
protected $dateFormat = false;
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\common\model\pharmacy;
use app\common\model\BaseModel;
class EjPharmacySubmission extends BaseModel
{
protected $name = 'ej_pharmacy_submission';
protected $autoWriteTimestamp = true;
protected $dateFormat = false;
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\common\model\pharmacy;
use app\common\model\BaseModel;
class PharmacySubmissionClaim extends BaseModel
{
protected $name = 'pharmacy_submission_claim';
protected $autoWriteTimestamp = true;
protected $dateFormat = false;
}
@@ -0,0 +1,57 @@
<?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\common\model\recharge;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 充值订单模型
* Class RechargeOrder
* @package app\common\model
*/
class RechargeOrder extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 支付方式
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getPayWayTextAttr($value, $data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
/**
* @notes 支付状态
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getPayStatusTextAttr($value, $data)
{
return PayEnum::getPayStatusDesc($data['pay_status']);
}
}
@@ -0,0 +1,58 @@
<?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\common\model\refund;
use app\common\enum\RefundEnum;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
/**
* 退款日志模型
* Class RefundLog
* @package app\common\model\refund
*/
class RefundLog extends BaseModel
{
/**
* @notes 操作人描述
* @param $value
* @param $data
* @return mixed
* @author 段誉
* @date 2022/12/1 10:55
*/
public function getHandlerAttr($value, $data)
{
return Admin::where('id', $data['handle_id'])->value('name');
}
/**
* @notes 退款状态描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:55
*/
public function getRefundStatusTextAttr($value, $data)
{
return RefundEnum::getStatusDesc($data['refund_status']);
}
}
@@ -0,0 +1,71 @@
<?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\common\model\refund;
use app\common\enum\RefundEnum;
use app\common\model\BaseModel;
/**
* 退款记录模型
* Class RefundRecord
* @package app\common\model\refund
*/
class RefundRecord extends BaseModel
{
/**
* @notes 退款类型描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:41
*/
public function getRefundTypeTextAttr($value, $data)
{
return RefundEnum::getTypeDesc($data['refund_type']);
}
/**
* @notes 退款状态描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:44
*/
public function getRefundStatusTextAttr($value, $data)
{
return RefundEnum::getStatusDesc($data['refund_status']);
}
/**
* @notes 退款方式描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/6 11:08
*/
public function getRefundWayTextAttr($value, $data)
{
return RefundEnum::getWayDesc($data['refund_way']);
}
}
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace app\common\model\stats;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class PersonalAccountCost extends BaseModel
{
use SoftDelete;
protected $name = 'personal_account_cost';
protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
}
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace app\common\model\stats;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class PersonalYeji extends BaseModel
{
use SoftDelete;
protected $name = 'personal_yeji';
protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
}
@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台(PHP版)
// +----------------------------------------------------------------------
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 血糖血压记录模型
* Class BloodRecord
* @package app\common\model\tcm
*/
class BloodRecord extends BaseModel
{
protected $name = 'tcm_blood_record';
// 自动时间戳类型设置为整型
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
// 时间字段取出后的默认时间格式(设置为false表示保持整型)
protected $dateFormat = false;
/**
* @notes 记录日期格式化
* @param $value
* @param $data
* @return string
*/
public function getRecordDateTextAttr($value, $data)
{
return !empty($data['record_date']) ? date('Y-m-d', $data['record_date']) : '';
}
/**
* @notes 血压文本
* @param $value
* @param $data
* @return string
*/
public function getBloodPressureTextAttr($value, $data)
{
if (!empty($data['systolic_pressure']) && !empty($data['diastolic_pressure'])) {
return $data['systolic_pressure'] . '/' . $data['diastolic_pressure'] . ' mmHg';
}
return '';
}
}
@@ -0,0 +1,49 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 通话记录模型
* Class CallRecord
* @package app\common\model\tcm
*/
class CallRecord extends BaseModel
{
protected $name = 'tcm_call_record';
/**
* @notes 关联诊单
*/
public function diagnosis()
{
return $this->belongsTo('app\common\model\tcm\Diagnosis', 'diagnosis_id', 'id');
}
/**
* @notes 获取通话类型文本
*/
public function getCallTypeTextAttr($value, $data)
{
$types = [
1 => '语音通话',
2 => '视频通话'
];
return $types[$data['call_type']] ?? '未知';
}
/**
* @notes 获取状态文本
*/
public function getStatusTextAttr($value, $data)
{
$status = [
1 => '进行中',
2 => '已结束',
3 => '未接听',
4 => '已取消'
];
return $status[$data['status']] ?? '未知';
}
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 日常记录家人点赞
*/
class DailyFamilyLike extends BaseModel
{
protected $name = 'tcm_daily_family_like';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 日常记录游戏化(稳糖分 / 勋章 / 任务领奖)
*/
class DailyGamify extends BaseModel
{
protected $name = 'tcm_daily_gamify';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 日常记录分享邀请码
*/
class DailyShareInvite extends BaseModel
{
protected $name = 'tcm_daily_share_invite';
protected $autoWriteTimestamp = false;
}
+119
View File
@@ -0,0 +1,119 @@
<?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\common\model\tcm;
use app\common\model\BaseModel;
use app\common\model\DiagnosisViewRecord;
use think\model\concern\SoftDelete;
/**
* 中医辨房病因诊单模型
* Class Diagnosis
* @package app\common\model\tcm
*/
class Diagnosis extends BaseModel
{
use SoftDelete;
protected $name = 'tcm_diagnosis';
// 自动时间戳类型设置为整型
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
// 时间字段取出后的默认时间格式(设置为false表示保持整型)
protected $dateFormat = false;
/**
* @notes 性别描述
* @param $value
* @param $data
* @return string
*/
public function getGenderDescAttr($value, $data)
{
return $data['gender'] == 1 ? '男' : '女';
}
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] == 1 ? '启用' : '禁用';
}
/**
* @notes 诊断日期格式化
* @param $value
* @param $data
* @return string
*/
public function getDiagnosisDateTextAttr($value, $data)
{
return !empty($data['diagnosis_date']) ? date('Y-m-d', $data['diagnosis_date']) : '';
}
/**
* @notes 既往史数组
* @param $value
* @param $data
* @return array
*/
public function getPastHistoryArrAttr($value, $data)
{
return !empty($data['past_history']) ? explode(',', $data['past_history']) : [];
}
/**
* @notes 口腔感觉数组读取
*/
public function getAppetiteAttr($value, $data)
{
return !empty($value) ? explode(',', $value) : [];
}
/**
* @notes 口腔感觉数组写入
*/
public function setAppetiteAttr($value)
{
return is_array($value) ? implode(',', $value) : $value;
}
/**
* @notes BMI 计算(身高cm,体重kg
* @param $value
* @param $data
* @return float|null
*/
public function getBmiAttr($value, $data)
{
if (!empty($data['height']) && !empty($data['weight'])) {
$heightM = $data['height'] / 100;
return round($data['weight'] / ($heightM * $heightM), 2);
}
return null;
}
public function DiagnosisViewRecord()
{
return $this->hasMany(DiagnosisViewRecord::class, 'diagnosis_id', 'id');
}
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单 AI 报告。
*/
class DiagnosisAiReport extends BaseModel
{
protected $name = 'diagnosis_ai_report';
protected $autoWriteTimestamp = true;
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单指派医助操作记录
*/
class DiagnosisAssignLog extends BaseModel
{
protected $name = 'tcm_diagnosis_assign_log';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单挂号 / 取消挂号操作日志(后台)
*/
class DiagnosisGuahaoLog extends BaseModel
{
protected $name = 'tcm_diagnosis_guahao_log';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,99 @@
<?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\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单待办事项模型
*
* 状态机:0=待执行 → 1=已发送 / 2=已取消 / 3=发送失败(终态,不重试)
*
* @package app\common\model\tcm
*/
class DiagnosisTodo extends BaseModel
{
protected $name = 'tcm_diagnosis_todo';
// 自动时间戳类型设置为整型
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
// 取出字段保持整型,前端按需要再格式化
protected $dateFormat = false;
/** 状态:待执行 */
public const STATUS_PENDING = 0;
/** 状态:已发送(成功) */
public const STATUS_SENT = 1;
/** 状态:已取消(人工) */
public const STATUS_CANCELLED = 2;
/** 状态:发送失败(终态,不重试) */
public const STATUS_FAILED = 3;
/**
* 状态文本映射
*
* @var array<int,string>
*/
public const STATUS_TEXT_MAP = [
self::STATUS_PENDING => '待执行',
self::STATUS_SENT => '已发送',
self::STATUS_CANCELLED => '已取消',
self::STATUS_FAILED => '发送失败',
];
/**
* @notes 状态文本访问器
*/
public function getStatusTextAttr($value, $data): string
{
$status = (int) ($data['status'] ?? 0);
return self::STATUS_TEXT_MAP[$status] ?? '未知';
}
/**
* @notes 提醒时间格式化(Y-m-d H:i
*/
public function getRemindTimeTextAttr($value, $data): string
{
$ts = (int) ($data['remind_time'] ?? 0);
return $ts > 0 ? date('Y-m-d H:i', $ts) : '';
}
/**
* @notes 推送时间格式化
*/
public function getNotifiedAtTextAttr($value, $data): string
{
$ts = (int) ($data['notified_at'] ?? 0);
return $ts > 0 ? date('Y-m-d H:i', $ts) : '';
}
/**
* @notes 取消时间格式化
*/
public function getCancelledAtTextAttr($value, $data): string
{
$ts = (int) ($data['cancelled_at'] ?? 0);
return $ts > 0 ? date('Y-m-d H:i', $ts) : '';
}
}
@@ -0,0 +1,52 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
class DietRecord extends BaseModel
{
protected $name = 'patient_diet_record';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
public function getRecordDateTextAttr($value, $data)
{
return !empty($data['record_date']) ? date('Y-m-d', $data['record_date']) : '';
}
public function getBreakfastImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setBreakfastImagesAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
public function getLunchImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setLunchImagesAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
public function getDinnerImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setDinnerImagesAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
}
@@ -0,0 +1,42 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
class ExerciseRecord extends BaseModel
{
protected $name = 'patient_exercise_record';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
public function getRecordDateTextAttr($value, $data)
{
return !empty($data['record_date']) ? date('Y-m-d', $data['record_date']) : '';
}
public function getIntensityTextAttr($value, $data)
{
$intensities = [
1 => '低强度',
2 => '中强度',
3 => '高强度'
];
return $intensities[$data['intensity']] ?? '未知';
}
public function getImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setImagesAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
}
@@ -0,0 +1,17 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单 IM 聊天记录归档
*/
class ImChatMessage extends BaseModel
{
protected $name = 'tcm_im_chat_message';
protected $autoWriteTimestamp = false;
protected $dateFormat = false;
}
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 患者级 AI 诊断报告快照。
*
* 每次生成均新增一行;本模型没有更新/覆盖历史报告的业务方法。
*/
class PatientAiReport extends BaseModel
{
protected $name = 'patient_ai_report';
protected $autoWriteTimestamp = false;
protected $dateFormat = false;
}
@@ -0,0 +1,40 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 患者TRTC账号模型
* Class PatientTrtc
* @package app\common\model\tcm
*/
class PatientTrtc extends BaseModel
{
protected $name = 'tcm_patient_trtc';
/**
* @notes 关联诊单
*/
public function diagnosis()
{
return $this->hasMany('app\common\model\tcm\Diagnosis', 'patient_id', 'patient_id');
}
/**
* @notes 检查是否过期
*/
public function isExpired(): bool
{
return $this->expire_time > 0 && $this->expire_time < time();
}
/**
* @notes 更新最后登录时间
*/
public function updateLastLogin(): bool
{
$this->last_login_time = time();
return $this->save();
}
}
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 中医处方单模型
*/
class Prescription extends BaseModel
{
protected $name = 'tcm_prescription';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
protected $json = ['herbs', 'case_record', 'aux_usage'];
protected $jsonAssoc = true;
// 字段类型转换
protected $type = [
'dosage_amount' => 'float',
'dosage_bag_count' => 'integer',
'need_decoction' => 'integer',
];
// 追加字段
protected $append = ['gender_desc'];
public function getGenderDescAttr($value, $data)
{
return ($data['gender'] ?? 0) == 1 ? '男' : '女';
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 处方库模型
*/
class PrescriptionLibrary extends BaseModel
{
protected $name = 'prescription_library';
protected $autoWriteTimestamp = true;
protected $deleteTime = 'delete_time';
/**
* @notes 获取器 - 创建时间
*/
public function getCreateTimeAttr($value)
{
return $value ? date('Y-m-d H:i:s', $value) : '';
}
/**
* @notes 获取器 - 更新时间
*/
public function getUpdateTimeAttr($value)
{
return $value ? date('Y-m-d H:i:s', $value) : '';
}
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 处方库 AI 解释报告。
*/
class PrescriptionLibraryAiReport extends BaseModel
{
protected $name = 'prescription_library_ai_report';
protected $autoWriteTimestamp = true;
}
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 消费者处方业务订单(非支付单 zyt_order)
*/
class PrescriptionOrder extends BaseModel
{
use SoftDelete;
protected $name = 'tcm_prescription_order';
protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $dateFormat = false;
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 处方业务订单操作日志
*/
class PrescriptionOrderLog extends BaseModel
{
protected $name = 'tcm_prescription_order_log';
protected $autoWriteTimestamp = false; // 时间戳由代码里显式写
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 处方业务订单与支付单(zyt_order)关联
*/
class PrescriptionOrderPayOrder extends BaseModel
{
protected $name = 'tcm_prescription_order_pay_order';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,21 @@
<?php
namespace app\common\model\tcm;
use app\common\model\BaseModel;
/**
* 诊单跟踪备注模型
* 表 zyt_tracking_note:按天一条,多次追加更新;只存文字。
*/
class TrackingNote extends BaseModel
{
protected $name = 'tracking_note';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
protected $dateFormat = false;
}
@@ -0,0 +1,39 @@
<?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\common\model\tools;
use app\common\model\BaseModel;
/**
* 代码生成器-数据表字段信息模型
* Class GenerateColumn
* @package app\common\model\tools
*/
class GenerateColumn extends BaseModel
{
/**
* @notes 关联table表
* @return \think\model\relation\BelongsTo
* @author 段誉
* @date 2022/6/15 18:59
*/
public function generateTable()
{
return $this->belongsTo(GenerateTable::class, 'id', 'table_id');
}
}
@@ -0,0 +1,59 @@
<?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\common\model\tools;
use app\common\enum\GeneratorEnum;
use app\common\model\BaseModel;
/**
* 代码生成器-数据表信息模型
* Class GenerateTable
* @package app\common\model\tools
*/
class GenerateTable extends BaseModel
{
protected $json = ['menu', 'tree', 'relations', 'delete'];
protected $jsonAssoc = true;
/**
* @notes 关联数据表字段
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/6/15 10:46
*/
public function tableColumn()
{
return $this->hasMany(GenerateColumn::class, 'table_id', 'id');
}
/**
* @notes 模板类型描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/6/14 11:25
*/
public function getTemplateTypeDescAttr($value, $data)
{
return GeneratorEnum::getTemplateTypeDesc($data['template_type']);
}
}
+187
View File
@@ -0,0 +1,187 @@
<?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\common\model\user;
use app\common\enum\user\UserEnum;
use app\common\model\BaseModel;
use app\common\service\FileService;
use think\model\concern\SoftDelete;
use app\common\model\DiagnosisViewRecord;
/**
* 用户模型
* Class User
* @package app\common\model\user
*/
class User extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 关联用户授权模型
* @return \think\model\relation\HasOne
* @author 段誉
* @date 2022/9/22 16:03
*/
public function userAuth()
{
return $this->hasOne(UserAuth::class, 'user_id');
}
/**
* @notes 搜索器-用户信息
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:12
*/
public function searchKeywordAttr($query, $value, $data)
{
if ($value) {
$query->where('sn|nickname|mobile|account', 'like', '%' . $value . '%');
}
}
/**
* @notes 搜索器-注册来源
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchChannelAttr($query, $value, $data)
{
if ($value) {
$query->where('channel', '=', $value);
}
}
/**
* @notes 搜索器-注册时间
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchCreateTimeStartAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '>=', strtotime($value));
}
}
/**
* @notes 搜索器-注册时间
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchCreateTimeEndAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '<=', strtotime($value));
}
}
/**
* @notes 头像获取器 - 用于头像地址拼接域名
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getAvatarAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取器-性别描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/9/7 15:15
*/
public function getSexAttr($value, $data)
{
return UserEnum::getSexDesc($value);
}
/**
* @notes 登录时间
* @param $value
* @return string
* @author 段誉
* @date 2022/9/23 18:15
*/
public function getLoginTimeAttr($value)
{
return $value ? date('Y-m-d H:i:s', $value) : '';
}
/**
* @notes 生成用户编码
* @param string $prefix
* @param int $length
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/16 10:33
*/
public static function createUserSn($prefix = '', $length = 8)
{
$rand_str = '';
for ($i = 0; $i < $length; $i++) {
$rand_str .= mt_rand(1, 9);
}
$sn = $prefix . $rand_str;
if (User::where(['sn' => $sn])->find()) {
return self::createUserSn($prefix, $length);
}
return $sn;
}
/**
* @notes 关联患者表
* @return \think\model\relation\HasOne
* @author 段誉
* @date 2022/9/22 16:03
*/
public function diagnosis()
{
return $this->belongsTo(DiagnosisViewRecord::class, 'id', 'user_id');
}
}
@@ -0,0 +1,30 @@
<?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\common\model\user;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 账户流水记录模型
* Class AccountLog
* @package app\common\model\user
*/
class UserAccountLog extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
+27
View File
@@ -0,0 +1,27 @@
<?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\common\model\user;
use app\common\model\BaseModel;
/**
* 用户授权表
* Class UserAuth
* @package app\common\model
*/
class UserAuth extends BaseModel
{
}
@@ -0,0 +1,28 @@
<?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\common\model\user;
use app\common\model\BaseModel;
/**
* 用户登录token信息
* Class UserSession
* @package app\common\model\user
*/
class UserSession extends BaseModel
{
}