This commit is contained in:
2023-11-28 13:54:31 +08:00
parent 056de43bc7
commit cc2470a781
8 changed files with 190 additions and 9 deletions
+11 -1
View File
@@ -7,6 +7,7 @@ namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\DbConnection\Db;
use Hyperf\Snowflake\Concern\Snowflake;
@@ -68,6 +69,14 @@ class PatientPathography extends Model
protected string $primaryKey = "pathography_id";
/**
* 关联问诊订单表
*/
public function OrderInquiry(): HasOne
{
return $this->hasOne(OrderInquiry::class, 'order_inquiry_id', 'order_inquiry_id');
}
/**
* 获取信息-单条
* @param array $params
@@ -132,7 +141,8 @@ class PatientPathography extends Model
*/
public static function getPatientPathographyPage(array $params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$result = self::where($params)
$result = self::with(['OrderInquiry'])
->where($params)
->orderBy("created_at",'desc')
->paginate($per_page, $fields, "page", $page);