修改 获取医生评价 接口
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasMany;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,14 @@ class OrderEvaluation extends Model
|
||||
|
||||
protected string $primaryKey = "evaluation_id";
|
||||
|
||||
/**
|
||||
* 关联问诊订单表
|
||||
*/
|
||||
public function OrderInquiry(): \Hyperf\Database\Model\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(OrderInquiry::class, 'order_inquiry_id','order_inquiry_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评价列表-分页
|
||||
* @param array $params 条件
|
||||
@@ -50,7 +59,10 @@ class OrderEvaluation extends Model
|
||||
*/
|
||||
public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)->orderBy('created_at','desc')->paginate($per_page, $fields, "page", $page);
|
||||
$raw = self::with(['OrderInquiry'])
|
||||
->where($params)
|
||||
->orderBy('created_at','desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
$data = array();
|
||||
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||
$data['total'] = $raw->total();//数据总数
|
||||
@@ -72,7 +84,8 @@ class OrderEvaluation extends Model
|
||||
*/
|
||||
public static function getScorePage(array $params, array $avg_score_params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)
|
||||
$raw = self::with(['OrderInquiry'])
|
||||
->where($params)
|
||||
->whereBetween('avg_score',$avg_score_params)
|
||||
->orderBy('created_at','desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
Reference in New Issue
Block a user