hospital-admin-api/api/dto/OrderPrescriptionIcd.go

53 lines
1.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
import (
"fmt"
"hospital-admin-api/api/model"
)
type OrderPrescriptionIcdDto struct {
PrescriptionIcdId string `json:"prescription_icd_id"` // 主键id
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id
IcdId string `json:"icd_id"` // 疾病idicd
IcdName string `json:"icd_name"` // 疾病名称(icd)
IcdCode string `json:"icd_code"` // icd编码
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
}
func GetOrderPrescriptionIcdDto(m *model.OrderPrescriptionIcd) *OrderPrescriptionIcdDto {
return &OrderPrescriptionIcdDto{
PrescriptionIcdId: fmt.Sprintf("%d", m.PrescriptionIcdId),
OrderPrescriptionId: fmt.Sprintf("%d", m.OrderPrescriptionId),
IcdId: fmt.Sprintf("%d", m.IcdId),
IcdName: m.IcdName,
IcdCode: m.IcdCode,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
}
}
func GetOrderPrescriptionIcdListDto(m []*model.OrderPrescriptionIcd) []OrderPrescriptionIcdDto {
// 处理返回值
responses := make([]OrderPrescriptionIcdDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := OrderPrescriptionIcdDto{
PrescriptionIcdId: fmt.Sprintf("%d", v.PrescriptionIcdId),
OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId),
IcdId: fmt.Sprintf("%d", v.IcdId),
IcdName: v.IcdName,
IcdCode: v.IcdCode,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}