获取药品订单列表-分页1
This commit is contained in:
@@ -130,6 +130,29 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
query = query.Where(gorm.Expr("order_inquiry_id IN (?)", subQuery))
|
||||
}
|
||||
|
||||
// 药品名称
|
||||
if req.ProductName != "" {
|
||||
subQuery := global.Db.Model(&model.OrderProductItem{}).
|
||||
Select("order_product_id").
|
||||
Where("product_name LIKE ?", "%"+req.ProductName+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("order_product_id IN (?)", subQuery))
|
||||
}
|
||||
|
||||
// 药品通用名
|
||||
if req.CommonName != "" {
|
||||
// 患者
|
||||
productSubQuery := global.Db.Model(&model.Product{}).
|
||||
Select("product_id").
|
||||
Where("common_name LIKE ?", "%"+req.CommonName+"%")
|
||||
|
||||
subQuery := global.Db.Model(&model.OrderProductItem{}).
|
||||
Select("order_product_id").
|
||||
Where(gorm.Expr("product_id IN (?)", productSubQuery))
|
||||
|
||||
query = query.Where("order_product_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
query = query.Where("order_product_no = ?", req.OrderProductNo)
|
||||
|
||||
Reference in New Issue
Block a user