| xqd
@@ -9,6 +9,7 @@
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
|
|
use App\Models\Order;
|
|
|
+use App\Models\OrderPack;
|
|
|
use App\Models\Patient;
|
|
|
|
|
|
class PatientController extends AuthController
|
| xqd
@@ -108,7 +109,10 @@ class PatientController extends AuthController
|
|
|
$data['patient'] = Patient::where('id', $req['patient_id'])->where('user_id', $user['id'])->first()->append(['order_num', 'pack_docter_num', 'perfectd_degree']);
|
|
|
|
|
|
$data['orders']['cases'] = Order::with(['docter.office', 'docter.qualification', 'organization.docter'])->where('user_id', $user['id'])->where('patient_id', $req['patient_id'])->whereIn('order_status', [2,3])->where('product_type', '<', 6)->orderBy('id', 'desc')->get();
|
|
|
- $data['orders']['service_packs'] = Order::with('orderPack')->where('user_id', $user['id'])->where('patient_id', $req['patient_id'])->whereIn('order_status', [2,3])->where('product_type', 6)->orderBy('id', 'desc')->get();
|
|
|
+
|
|
|
+ //只输出未过期的服务包
|
|
|
+ $orderIds = OrderPack::where('user_id', $user['id'])->where('end_time', '<=', time())->pluck('order_id')->toArray();
|
|
|
+ $data['orders']['service_packs'] = Order::with('orderPack')->whereIn('id', $orderIds)->where('user_id', $user['id'])->where('patient_id', $req['patient_id'])->whereIn('order_status', [2,3])->where('product_type', 6)->orderBy('id', 'desc')->get();
|
|
|
|
|
|
return out($data);
|
|
|
}
|