更新
This commit is contained in:
@@ -28,12 +28,12 @@ class Order extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联患者
|
||||
* @notes 关联患者(从诊单表)
|
||||
* @return \think\model\relation\BelongsTo
|
||||
*/
|
||||
public function patient()
|
||||
{
|
||||
return $this->belongsTo('app\common\model\user\User', 'patient_id', 'id');
|
||||
return $this->belongsTo('app\common\model\tcm\Diagnosis', 'patient_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class Order extends BaseModel
|
||||
*/
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo('app\common\model\admin\Admin', 'creator_id', 'id');
|
||||
return $this->belongsTo('app\common\model\auth\Admin', 'creator_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ class Order extends BaseModel
|
||||
{
|
||||
if ($value) {
|
||||
$query->whereHas('patient', function ($q) use ($value) {
|
||||
$q->where('nickname|mobile', 'like', '%' . $value . '%');
|
||||
$q->where('patient_name|patient_phone', 'like', '%' . $value . '%');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -133,8 +133,12 @@ class Order extends BaseModel
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
$patient = $this->patient()->find();
|
||||
return $patient ? $patient->nickname : '';
|
||||
try {
|
||||
$patient = $this->patient()->find();
|
||||
return $patient ? $patient->patient_name : '';
|
||||
} catch (\Exception $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,8 +149,12 @@ class Order extends BaseModel
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
$patient = $this->patient()->find();
|
||||
return $patient ? $patient->mobile : '';
|
||||
try {
|
||||
$patient = $this->patient()->find();
|
||||
return $patient ? $patient->patient_phone : '';
|
||||
} catch (\Exception $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +165,11 @@ class Order extends BaseModel
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
$creator = $this->creator()->find();
|
||||
return $creator ? $creator->name : '';
|
||||
try {
|
||||
$creator = $this->creator()->find();
|
||||
return $creator ? $creator->name : '';
|
||||
} catch (\Exception $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user