@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\adminapi\lists\order;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\adminapi\service\order\PaymentPrescriptionOrderService;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\Traits\HasDataScopeFilter;
|
||||
use app\common\model\Order;
|
||||
@@ -218,12 +219,20 @@ class OrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
|
||||
$query = Order::where($where);
|
||||
$this->applyDataScopeByOwner($query, 'creator_id');
|
||||
return $query
|
||||
$rows = $query
|
||||
->with(['patient', 'creator'])
|
||||
->order(['create_time' => 'desc'])
|
||||
->limit($this->limitOffset, $this->pageSize)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$prescriptionOrders = PaymentPrescriptionOrderService::forPaymentIds(array_column($rows, 'id'));
|
||||
foreach ($rows as &$row) {
|
||||
$row['prescription_orders'] = $prescriptionOrders[(int) $row['id']] ?? [];
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user