新增功能

This commit is contained in:
Your Name
2026-03-04 15:32:30 +08:00
parent a07e844c47
commit ab77f5488d
2266 changed files with 177942 additions and 3444 deletions
@@ -0,0 +1,98 @@
<?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 => '已完成',
];
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']);
}
}
+63
View File
@@ -0,0 +1,63 @@
<?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)
{
return $data['period'] == 'morning' ? '上午' : '下午';
}
/**
* @notes 日期格式化
* @param $value
* @param $data
* @return string
*/
public function getDateTextAttr($value, $data)
{
return $data['date'] ?? '';
}
}
@@ -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']] ?? '未知';
}
}
+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\tcm;
use app\common\model\BaseModel;
/**
* 中医辨房病因诊单模型
* Class Diagnosis
* @package app\common\model\tcm
*/
class Diagnosis extends BaseModel
{
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']) : [];
}
}
@@ -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();
}
}