| xqd
@@ -16,4 +16,15 @@ class Patient extends BaseModel
|
|
|
{
|
|
|
return birthday_to_age($this->birthday);
|
|
|
}
|
|
|
+
|
|
|
+ public function getOrderNumAttribute()
|
|
|
+ {
|
|
|
+ return Order::where('patient_id', $this->id)->where('payment_status', 2)->where('product_type', '<', 6)->count();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getPackDocterNumAttribute()
|
|
|
+ {
|
|
|
+ $team_ids = OrderPack::join('order', 'order.id', '=', 'order_pack.order_id')->where('order.patient_id', $this->id)->where('order.payment_status', 2)->where('order.product_type', 7)->pluck('order_pack.team_id')->toArray();
|
|
|
+ return TeamDocter::whereIn('team_id', $team_ids)->count();
|
|
|
+ }
|
|
|
}
|