62 lines
2.3 KiB
Go
62 lines
2.3 KiB
Go
package dto
|
||
|
||
import (
|
||
"fmt"
|
||
"hospital-admin-api/api/model"
|
||
)
|
||
|
||
type DoctorInquiryConfigServiceDto struct {
|
||
ConfigServiceId string `json:"config_service_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:会员 6:疑难会诊 7:附赠)
|
||
ServiceContent string `json:"service_content"` // 服务内容
|
||
ServiceProcess string `json:"service_process"` // 服务流程
|
||
ServicePeriod uint `json:"service_period"` // 服务周期
|
||
ServiceRounds uint `json:"service_rounds"` // 服务回合数(0表示不限次)
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||
}
|
||
|
||
func GetDoctorInquiryConfigServiceDto(m *model.DoctorInquiryConfigService) *DoctorInquiryConfigServiceDto {
|
||
return &DoctorInquiryConfigServiceDto{
|
||
ConfigServiceId: fmt.Sprintf("%d", m.ConfigServiceId),
|
||
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||
InquiryType: m.InquiryType,
|
||
InquiryMode: m.InquiryMode,
|
||
ServiceContent: m.ServiceContent,
|
||
ServiceProcess: m.ServiceProcess,
|
||
ServicePeriod: m.ServicePeriod,
|
||
ServiceRounds: m.ServiceRounds,
|
||
CreatedAt: m.CreatedAt,
|
||
UpdatedAt: m.UpdatedAt,
|
||
}
|
||
}
|
||
|
||
func GetDoctorInquiryConfigServiceListDto(m []*model.DoctorInquiryConfigService) []*DoctorInquiryConfigServiceDto {
|
||
// 处理返回值
|
||
responses := make([]*DoctorInquiryConfigServiceDto, len(m))
|
||
|
||
if len(m) > 0 {
|
||
for i, v := range m {
|
||
response := &DoctorInquiryConfigServiceDto{
|
||
ConfigServiceId: fmt.Sprintf("%d", v.ConfigServiceId),
|
||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||
InquiryType: v.InquiryType,
|
||
InquiryMode: v.InquiryMode,
|
||
ServiceContent: v.ServiceContent,
|
||
ServiceProcess: v.ServiceProcess,
|
||
ServicePeriod: v.ServicePeriod,
|
||
ServiceRounds: v.ServiceRounds,
|
||
CreatedAt: v.CreatedAt,
|
||
UpdatedAt: v.UpdatedAt,
|
||
}
|
||
|
||
// 将转换后的结构体添加到新切片中
|
||
responses[i] = response
|
||
}
|
||
}
|
||
|
||
return responses
|
||
}
|