新增 获取患者问诊订单列表 接口

This commit is contained in:
2023-08-01 15:45:52 +08:00
parent 2068019145
commit 15738f0c5a
4 changed files with 163 additions and 0 deletions
+29
View File
@@ -109,4 +109,33 @@ class OrderDetection extends Model
{
return self::where($params)->whereIn('detection_status',[1,2,3])->first($fields);
}
/**
* 获取问诊订单分页
* 已结束
* @param array $params
* @param array $detection_status_params
* @param array $fields
* @param int|null $page
* @param int|null $per_page
* @return array
*/
public static function getPatientOrderDetectionPage(array $params, array $detection_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$raw = self::where($params)
->when($detection_status_params, function ($query, $detection_status_params) {
$query->whereIn('detection_status', $detection_status_params);
})
->orderBy('created_at', 'desc')
->paginate($per_page, $fields, "page", $page);
$data = array();
$data['current_page'] = $raw->currentPage();// 当前页码
$data['total'] = $raw->total();//数据总数
$data['data'] = $raw->items();//数据
$data['per_page'] = $raw->perPage();//每页个数
$data['last_page'] = $raw->lastPage();//最后一页
return $data;
}
}