59 lines
2.0 KiB
Go
59 lines
2.0 KiB
Go
package dto
|
|
|
|
import (
|
|
"fmt"
|
|
"hospital-admin-api/api/model"
|
|
)
|
|
|
|
type DoctorInquiryTimeDto struct {
|
|
InquiryTimeId string `json:"inquiry_time_id"` // 主键id
|
|
DoctorId string `json:"doctor_id"` // 医生id
|
|
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
|
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
|
InquiryDate model.LocalTime `json:"inquiry_date"` // 日期(可为空)
|
|
StartTime string `json:"start_time"` // 开始时间
|
|
EndTime string `json:"end_time"` // 结束时间
|
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
|
}
|
|
|
|
func GetDoctorInquiryTimeDto(m *model.DoctorInquiryTime) *DoctorInquiryTimeDto {
|
|
return &DoctorInquiryTimeDto{
|
|
InquiryTimeId: fmt.Sprintf("%d", m.InquiryTimeId),
|
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
|
InquiryType: m.InquiryType,
|
|
InquiryMode: m.InquiryMode,
|
|
InquiryDate: m.InquiryDate,
|
|
StartTime: m.StartTime,
|
|
EndTime: m.EndTime,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
func GetDoctorInquiryTimeListDto(m []*model.DoctorInquiryTime) []*DoctorInquiryTimeDto {
|
|
// 处理返回值
|
|
responses := make([]*DoctorInquiryTimeDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := &DoctorInquiryTimeDto{
|
|
InquiryTimeId: fmt.Sprintf("%d", v.InquiryTimeId),
|
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
|
InquiryType: v.InquiryType,
|
|
InquiryMode: v.InquiryMode,
|
|
InquiryDate: v.InquiryDate,
|
|
StartTime: v.StartTime[:2] + ":" + v.StartTime[2:],
|
|
EndTime: v.EndTime[:2] + ":" + v.EndTime[2:],
|
|
CreatedAt: v.CreatedAt,
|
|
UpdatedAt: v.UpdatedAt,
|
|
}
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|