From 3cb3495eb618b138d221938bb2e30f87980c352f Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 24 Mar 2025 14:47:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=92=E5=8A=A8=E7=95=99=E8=A8=80=E5=8C=BB?= =?UTF-8?q?=E9=99=A2=E5=A7=93=E5=90=8D=E4=B8=BA=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/dao/CaseComment.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/api/dao/CaseComment.go b/api/dao/CaseComment.go index f5591fd..45b7d19 100644 --- a/api/dao/CaseComment.go +++ b/api/dao/CaseComment.go @@ -156,13 +156,17 @@ func (r *CaseCommentDao) GetCaseCommentPageSearch(req requests.GetCaseCommentPag // 执行组建 orQuery = orQuery.Or(gorm.Expr("user_id IN (?)", userSubQuery)) - // 病例名称 - caseSubQuery := global.Db.Model(&model.Case{}). - Select("case_id"). - Where("case_name LIKE ?", keyword) + // 医院名称 + basicHospitalSubQuery := global.Db.Model(&model.BasicHospital{}). + Select("hospital_id"). + Where("hospital_name LIKE ?", keyword) + + userHospitalIdSubQuery := global.Db.Model(&model.User{}). + Select("user_id"). + Where(gorm.Expr("hospital_id IN (?)", basicHospitalSubQuery)) // 执行组建 - orQuery = orQuery.Or(gorm.Expr("case_id IN (?)", caseSubQuery)) + orQuery = orQuery.Or(gorm.Expr("user_id IN (?)", userHospitalIdSubQuery)) query = query.Where(orQuery) }