| xqd
@@ -24,4 +24,22 @@ class SchedulePeriod extends BaseModel
|
|
|
{
|
|
|
return $this->hasOne(Docter::class,'id','docter_id');
|
|
|
}
|
|
|
+
|
|
|
+ public function getOrderNumAttribute()
|
|
|
+ {
|
|
|
+ $map = [1 => 3, 2 => 4, 3 => 5];
|
|
|
+ $builder = Order::where('product_type', $map[$this->schedule_type]);
|
|
|
+ if ($this->schedule_type == 1) {
|
|
|
+ $builder->where('docter_id', $this->docter_id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $builder->where('organization_id', $this->organization_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ $timePeriod = TimePeriod::select(['start_time_period'])->where('id', $this->time_period_id)->first();
|
|
|
+ $appoint_start_time = strtotime($this->schedule_date.' '.$timePeriod['start_time_period'].':00');
|
|
|
+ $count = $builder->where('appoint_start_time', $appoint_start_time)->count();
|
|
|
+
|
|
|
+ return $count;
|
|
|
+ }
|
|
|
}
|