34 lines
707 B
PHP
Executable File
34 lines
707 B
PHP
Executable File
<?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']] ?? '未知';
|
|
}
|
|
}
|