新增解密收货人

This commit is contained in:
wucongxing 2023-09-11 17:29:39 +08:00
parent 615982cd19
commit a05fd1d50d
4 changed files with 69 additions and 2 deletions

View File

@ -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)
}

View File

@ -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,
}
}

View File

@ -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)
}
}

View File

@ -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
}