12
This commit is contained in:
parent
542a8f71ad
commit
efc60d1244
@ -2,13 +2,14 @@ package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/global"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
type OrderProductDao struct {
|
||||
@ -148,8 +149,11 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
Where(gorm.Expr("transfer_doctor_id IN (?)", transferDoctorSubQuery))
|
||||
|
||||
// 使用 OR 条件:原医生匹配 OR 抄方医生匹配
|
||||
query = query.Where(gorm.Expr("doctor_id IN (?)", originalDoctorSubQuery)).
|
||||
// 使用闭包函数确保 OR 条件正确分组
|
||||
query = query.Where(func(db *gorm.DB) *gorm.DB {
|
||||
return db.Where(gorm.Expr("doctor_id IN (?)", originalDoctorSubQuery)).
|
||||
Or(gorm.Expr("order_inquiry_id IN (?)", inquirySubQuery))
|
||||
})
|
||||
}
|
||||
|
||||
// 处方
|
||||
@ -373,9 +377,12 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
Where(gorm.Expr("transfer_doctor_id IN (?)", transferDoctorSubQuery))
|
||||
|
||||
// 使用 OR 条件:患者匹配 OR 原医生匹配 OR 抄方医生匹配
|
||||
query = query.Where("patient_id IN (?)", patientSubQuery).
|
||||
// 使用闭包函数确保 OR 条件正确分组
|
||||
query = query.Where(func(db *gorm.DB) *gorm.DB {
|
||||
return db.Where("patient_id IN (?)", patientSubQuery).
|
||||
Or("doctor_id IN (?)", originalDoctorSubQuery).
|
||||
Or(gorm.Expr("order_inquiry_id IN (?)", inquirySubQuery))
|
||||
})
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user