zilong 4 vuotta sitten
vanhempi
commit
6871f1c8a8

+ 2 - 0
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd
@@ -230,6 +230,7 @@ class DocterController extends AuthController
             }
         }
 
+        $data['can_appoint_days'] = $per_page;
         return out($data);
     }
 
@@ -271,6 +272,7 @@ class DocterController extends AuthController
         }
 
         $data['data'] = array_values($data['data']);
+        $data['can_appoint_days'] = $per_page;
 
         return out($data);
     }

+ 3 - 1
app/Http/Controllers/Api/V1/OrderController.php

xqd xqd xqd
@@ -196,6 +196,7 @@ class OrderController extends AuthController
 
         DB::beginTransaction();
         try {
+            $timePeriod = TimePeriod::where('id', $req['time_period_id'])->first();
             //保存订单数据
             $create = [
                 'user_id' => $user['id'],
@@ -210,6 +211,8 @@ class OrderController extends AuthController
                 'payment_amount' => $payment_amount,
                 'discount_amount' => $discount_amount,
                 'payment_time' => $payment_time,
+                'appoint_start_time' => strtotime($req['schedule_date'].' '.$timePeriod['start_time_period'].':00'),
+                'appoint_end_time' => strtotime($req['schedule_date'].' '.$timePeriod['end_time_period'].':00'),
             ];
             if ($req['payment_type'] == 3) {
                 $create['pay_order_pack_id'] = $req['order_pack_id'];
@@ -223,7 +226,6 @@ class OrderController extends AuthController
             $addPatient['patient_id'] = $req['patient_id'];
             $addPatient['organization_id'] = $req['organization_id'];
             $addPatient['time_period_id'] = $req['time_period_id'];
-            $timePeriod = TimePeriod::where('id', $req['time_period_id'])->first();
             $addPatient['appoint_start_time'] = strtotime($req['schedule_date'].' '.$timePeriod['start_time_period'].':00');
             $addPatient['appoint_end_time'] = strtotime($req['schedule_date'].' '.$timePeriod['end_time_period'].':00');
             $orderPatient = OrderPatient::create($addPatient);

+ 8 - 1
app/Models/Docter.php

xqd xqd
@@ -13,7 +13,7 @@ class Docter extends BaseModel
     protected $casts = [
         'label' => 'json',
     ];
-    protected $appends = ['is_collect', 'label_texts', 'is_can_phone', 'is_can_chat'];
+    protected $appends = ['is_collect', 'label_texts', 'is_can_phone', 'is_can_chat', 'can_appoint_days'];
 
     public function office()
     {
@@ -134,4 +134,11 @@ class Docter extends BaseModel
 
         return $this->phone_minutes;
     }
+
+    public function getCanAppointDaysAttribute()
+    {
+        $show_days = DocterSetting::where('docter_id', $this->id)->where('type', 1)->value('show_days');
+
+        return !empty($show_days) ? $show_days : 0;
+    }
 }

+ 14 - 0
app/Models/Organization.php

xqd xqd
@@ -12,6 +12,8 @@ class Organization extends BaseModel
 {
     CONST HOSPITOAL = 1, ORGANIZATION = 2, CLINC = 3;
 
+    protected $appends = ['can_vaccine_days', 'can_nurse_days'];
+
     protected static $_getType = [
         self::HOSPITOAL => '医院',
         self::ORGANIZATION => '机构',
@@ -54,4 +56,16 @@ class Organization extends BaseModel
     {
         return $this->hasMany(DocterOrganization::class)->where('state', 1)->where('authentication_end_time', '>', time());
     }
+
+    public function getCanVaccineDaysAttribute()
+    {
+        $show_days = DocterSetting::where('org_id', $this->id)->where('type', 2)->value('show_days');
+        return !empty($show_days) ? $show_days : 0;
+    }
+
+    public function getCanNurseDaysAttribute()
+    {
+        $show_days = DocterSetting::where('org_id', $this->id)->where('type', 3)->value('show_days');
+        return !empty($show_days) ? $show_days : 0;
+    }
 }