diff --git a/api/controller/admin.go b/api/controller/admin.go index aafc373..5e1ad3e 100644 --- a/api/controller/admin.go +++ b/api/controller/admin.go @@ -140,3 +140,24 @@ func (b *Admin) GetDecryptBank(c *gin.Context) { userCardNum, _ := userService.GetUserBankNumByDoctorId(doctorId) responses.OkWithData(userCardNum, c) } + +// GetDecryptOrderProductConsignee 解密药品订单收货人数据 +func (b *Admin) GetDecryptOrderProductConsignee(c *gin.Context) { + id := c.Param("order_product_id") + if id == "" { + responses.FailWithMessage("缺少参数", c) + return + } + + // 将 id 转换为 int64 类型 + orderProductId, err := strconv.ParseInt(id, 10, 64) + if err != nil { + responses.Fail(c) + return + } + + // 获取药品订单收货人数据 + orderProductService := service.OrderProductService{} + OrderProductConsignee, _ := orderProductService.GetOrderProductConsignee(orderProductId) + responses.OkWithData(OrderProductConsignee, c) +} diff --git a/api/responses/orderProductResponse/orderProduct.go b/api/responses/orderProductResponse/orderProduct.go index 7340cfd..fc962d0 100644 --- a/api/responses/orderProductResponse/orderProduct.go +++ b/api/responses/orderProductResponse/orderProduct.go @@ -90,6 +90,19 @@ type GetOrderProduct struct { OrderInquiryCase *orderInquiryCaseResponse.OrderInquiryCase `json:"order_inquiry_case"` // 问诊病例 } +// GetOrderProductConsignee 获取药品订单收货人数据 +type GetOrderProductConsignee struct { + ProvinceId int `json:"province_id"` // 省份id + Province string `json:"province"` // 省份 + CityId int `json:"city_id"` // 城市id + City string `json:"city"` // 城市 + CountyId int `json:"county_id"` // county_id + County string `json:"county"` // 区县 + Address string `json:"address"` // 详细地址 + ConsigneeName string `json:"consignee_name"` // 收货人姓名 + ConsigneeTel string `json:"consignee_tel"` // 收货人电话 +} + // GetOrderProductPageResponse 获取药品订单列表-分页 func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderProductPage { // 处理返回值 @@ -144,3 +157,18 @@ func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderP return getOrderProductPages } + +// GetOrderProductConsigneeResponse 获取药品订单收货人数据 +func GetOrderProductConsigneeResponse(orderProduct *model.OrderProduct) *GetOrderProductConsignee { + return &GetOrderProductConsignee{ + ProvinceId: orderProduct.ProvinceId, + Province: orderProduct.Province, + CityId: orderProduct.CityId, + City: orderProduct.City, + CountyId: orderProduct.CountyId, + County: orderProduct.County, + Address: orderProduct.Address, + ConsigneeName: orderProduct.ConsigneeName, + ConsigneeTel: orderProduct.ConsigneeTel, + } +} diff --git a/api/router/router.go b/api/router/router.go index 026981d..da3e062 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -94,12 +94,15 @@ func adminRouter(r *gin.Engine, api controller.Api) { { cardGroup := decryptGroup.Group("/card") { - // 获取解密身份证号 + // 解密身份证号 cardGroup.GET("/num", api.Admin.GetDecryptCardNum) } - // 获取解密银行卡号 + // 解密银行卡号 decryptGroup.GET("/bank/:doctor_id", api.Admin.GetDecryptBank) + + // 解密药品订单收货人数据 + decryptGroup.GET("/order/product/consignee/:order_product_id", api.Admin.GetDecryptOrderProductConsignee) } } diff --git a/api/service/orderProduct.go b/api/service/orderProduct.go index b407f88..af88864 100644 --- a/api/service/orderProduct.go +++ b/api/service/orderProduct.go @@ -276,3 +276,18 @@ func (r *OrderProductService) CancelOrderProduct(orderProductId int64) (bool, er return true, nil } + +// GetOrderProductConsignee 获取药品订单收货人数据 +func (r *OrderProductService) GetOrderProductConsignee(orderProductId int64) (*orderProductResponse.GetOrderProductConsignee, error) { + // 获取药品订单数据 + orderProductDao := dao.OrderProductDao{} + orderProduct, err := orderProductDao.GetOrderProductById(orderProductId) + if err != nil || orderProduct == nil { + return nil, errors.New(err.Error()) + } + + // 处理返回值 + u := orderProductResponse.GetOrderProductConsigneeResponse(orderProduct) + + return u, nil +}