新增:获取服务包订单服务权益详情
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
// OrderServicePackageInquiryDto 服务包关联问诊订单表
|
||||
type OrderServicePackageInquiryDto struct {
|
||||
ServiceInquiryId string `json:"service_inquiry_id"` // 主键id
|
||||
OrderServiceId string `json:"order_service_id"` // 订单-服务包id
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
||||
OrderServiceNo string `json:"order_service_no"` // 服务包系统订单编号
|
||||
InquiryNo string `json:"inquiry_no"` // 问诊系统订单编号
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
OrderInquiry *OrderInquiryDto `json:"order_inquiry"` // 问诊订单
|
||||
}
|
||||
|
||||
// GetOrderServicePackageInquiryDto 服务包关联问诊订单详情
|
||||
func GetOrderServicePackageInquiryDto(m *model.OrderServicePackageInquiry) *OrderServicePackageInquiryDto {
|
||||
return &OrderServicePackageInquiryDto{
|
||||
ServiceInquiryId: fmt.Sprintf("%d", m.ServiceInquiryId),
|
||||
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||
OrderServiceNo: m.OrderServiceNo,
|
||||
InquiryNo: m.InquiryNo,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// GetOrderServicePackageInquiryListDto 服务包关联问诊订单列表
|
||||
func GetOrderServicePackageInquiryListDto(m []*model.OrderServicePackageInquiry) []*OrderServicePackageInquiryDto {
|
||||
// 处理返回值
|
||||
responses := make([]*OrderServicePackageInquiryDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &OrderServicePackageInquiryDto{
|
||||
ServiceInquiryId: fmt.Sprintf("%d", v.ServiceInquiryId),
|
||||
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||
OrderServiceNo: v.OrderServiceNo,
|
||||
InquiryNo: v.InquiryNo,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 加载问诊订单数据
|
||||
if v.OrderInquiry != nil {
|
||||
response = response.LoadOrderInquiry(v.OrderInquiry)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// LoadOrderInquiry 加载问诊订单数据
|
||||
func (r *OrderServicePackageInquiryDto) LoadOrderInquiry(m *model.OrderInquiry) *OrderServicePackageInquiryDto {
|
||||
if m != nil {
|
||||
d := GetOrderInquiryDto(m)
|
||||
|
||||
r.OrderInquiry = d
|
||||
}
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user