新增药品订单详情
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package orderProductItemResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type OrderProductItem struct {
|
||||
ProductItemId string `json:"product_item_id"` // 主键id
|
||||
OrderProductId string `json:"order_product_id"` // 订单-商品订单id
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
||||
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id
|
||||
ProductId string `json:"product_id"` // 商品id
|
||||
ProductName string `json:"product_name"` // 商品名称
|
||||
ProductPrice float64 `json:"product_price"` // 商品价格
|
||||
ProductPlatformCode string `json:"product_platform_code"` // 商品处方平台编码
|
||||
Amount int `json:"amount"` // 数量
|
||||
Manufacturer string `json:"manufacturer"` // 生产厂家
|
||||
ProductCoverImg string `json:"product_cover_img"` // 商品封面图
|
||||
ProductSpec string `json:"product_spec"` // 商品规格
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// GetOrderProductItemListResponse 获取订单商品列表
|
||||
func GetOrderProductItemListResponse(u []*model.OrderProductItem) []*OrderProductItem {
|
||||
// 处理返回值
|
||||
orderProductItemResponses := make([]*OrderProductItem, len(u))
|
||||
|
||||
if len(u) > 0 {
|
||||
for i, v := range u {
|
||||
// 将原始结构体转换为新结构体
|
||||
orderProductItemResponse := &OrderProductItem{
|
||||
ProductItemId: strconv.Itoa(int(v.ProductItemId)),
|
||||
OrderProductId: strconv.Itoa(int(v.OrderProductId)),
|
||||
OrderInquiryId: strconv.Itoa(int(v.OrderInquiryId)),
|
||||
OrderPrescriptionId: strconv.Itoa(int(v.OrderPrescriptionId)),
|
||||
ProductId: strconv.Itoa(int(v.ProductId)),
|
||||
ProductName: v.ProductName,
|
||||
ProductPrice: v.ProductPrice,
|
||||
ProductPlatformCode: v.ProductPlatformCode,
|
||||
Amount: v.Amount,
|
||||
Manufacturer: v.Manufacturer,
|
||||
ProductCoverImg: utils.AddOssDomain(v.ProductCoverImg),
|
||||
ProductSpec: v.ProductSpec,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
orderProductItemResponses[i] = orderProductItemResponse
|
||||
}
|
||||
}
|
||||
|
||||
return orderProductItemResponses
|
||||
}
|
||||
Reference in New Issue
Block a user