diff --git a/api/dao/orderProduct.go b/api/dao/orderProduct.go index a79f693..e72d137 100644 --- a/api/dao/orderProduct.go +++ b/api/dao/orderProduct.go @@ -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) diff --git a/api/requests/orderProduct.go b/api/requests/orderProduct.go index b34a675..272fb75 100644 --- a/api/requests/orderProduct.go +++ b/api/requests/orderProduct.go @@ -31,6 +31,8 @@ type GetOrderProductPage struct { ConsigneeTel string `json:"consignee_tel" form:"cancel_reason" label:"收货人电话"` PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"` Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"` + ProductName string `json:"product_name" form:"product_name" label:"药品名称"` + CommonName string `json:"common_name" form:"common_name" label:"药品通用名"` } // CancelOrderProduct 取消药品订单 diff --git a/api/service/export.go b/api/service/export.go index a7fa1c8..61cd5f5 100644 --- a/api/service/export.go +++ b/api/service/export.go @@ -1335,8 +1335,8 @@ func (r *ExportService) OrderInquiry(d []*model.OrderInquiry) (string, error) { {Value: "优惠卷总金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18}, {Value: "实际付款金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18}, {Value: "医生收益", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18}, - {Value: "支付时间", CellType: "string", NumberFmt: "", ColWidth: 30}, - {Value: "接诊时间", CellType: "string", NumberFmt: "string", ColWidth: 30}, + {Value: "支付时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30}, + {Value: "接诊时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30}, {Value: "订单完成时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30}, {Value: "订单结束时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30}, {Value: "订单统计状态", CellType: "string", NumberFmt: "", ColWidth: 18},