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
+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');
}
}