package dto import ( "fmt" "hospital-admin-api/api/model" ) type OrderEvaluationDto struct { EvaluationId string `json:"evaluation_id"` // 主键id DoctorId string `json:"doctor_id"` // 医生id;NOT NULL PatientId string `json:"patient_id"` // 患者id;NOT NULL OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL NameMask string `json:"name_mask"` // 患者姓名(掩码) ReplyQuality float64 `json:"reply_quality"` // 回复质量(百分制) ServiceAttitude float64 `json:"service_attitude"` // 服务态度(百分制) ReplyProgress float64 `json:"reply_progress"` // 回复速度(百分制) AvgScore float64 `json:"avg_score"` // 平均得分(百分制,回复质量占4、服务态度占3、回复速度占3,计算公式:每个得分 * 占比 相加) Type int `json:"type"` // 类型(1:默认评价 2:主动评价) Content string `json:"content"` // 评价内容 CreatedAt model.LocalTime `json:"created_at"` // 创建时间 UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 } func GetOrderEvaluationDto(m *model.OrderEvaluation) *OrderEvaluationDto { return &OrderEvaluationDto{ EvaluationId: fmt.Sprintf("%d", m.EvaluationId), DoctorId: fmt.Sprintf("%d", m.DoctorId), PatientId: fmt.Sprintf("%d", m.PatientId), OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId), NameMask: m.NameMask, ReplyQuality: m.ReplyQuality, ServiceAttitude: m.ServiceAttitude, ReplyProgress: m.ReplyProgress, AvgScore: m.AvgScore, Type: m.Type, Content: m.Content, CreatedAt: m.CreatedAt, UpdatedAt: m.UpdatedAt, } } func GetOrderEvaluationListDto(m []*model.OrderEvaluation) []OrderEvaluationDto { // 处理返回值 responses := make([]OrderEvaluationDto, len(m)) if len(m) > 0 { for i, v := range m { response := OrderEvaluationDto{ EvaluationId: fmt.Sprintf("%d", v.EvaluationId), DoctorId: fmt.Sprintf("%d", v.DoctorId), PatientId: fmt.Sprintf("%d", v.PatientId), OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId), NameMask: v.NameMask, ReplyQuality: v.ReplyQuality, ServiceAttitude: v.ServiceAttitude, ReplyProgress: v.ReplyProgress, AvgScore: v.AvgScore, Type: v.Type, Content: v.Content, CreatedAt: v.CreatedAt, UpdatedAt: v.UpdatedAt, } // 将转换后的结构体添加到新切片中 responses[i] = response } } return responses }