From deb9a25f97022209deaaf97a12c0c23f6a71760d Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Tue, 21 May 2024 11:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=8D=AF=E5=93=81=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8-=E5=88=86=E9=A1=B51?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/dao/orderProduct.go | 23 +++++++++++++++++++++++ api/requests/orderProduct.go | 2 ++ api/service/export.go | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) 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},