新增系统问诊配置
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type SystemInquiryConfigDto struct {
|
||||
SystemInquiryConfigId string `json:"system_inquiry_config_id"` // 主键id
|
||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
MaxWorkNumDay int `json:"max_work_num_day"` // 每日最大接诊数量
|
||||
InquiryPrice string `json:"inquiry_price"` // 接诊价格
|
||||
MinInquiryPrice *float64 `json:"min_inquiry_price"` // 最低接诊价格(专家问诊)
|
||||
MaxInquiryPrice *float64 `json:"max_inquiry_price"` // 最高接诊价格(专家问诊)
|
||||
TimesNumber int `json:"times_number"` // 沟通次数(0为不限制次数)
|
||||
Duration int `json:"duration"` // 沟通时长(分钟,0为不限制时长)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
func GetSystemInquiryConfigDto(m *model.SystemInquiryConfig) *SystemInquiryConfigDto {
|
||||
MinInquiryPrice := &m.MinInquiryPrice
|
||||
MaxInquiryPrice := &m.MaxInquiryPrice
|
||||
if m.InquiryType == 2 || m.InquiryType == 3 || m.InquiryType == 4 {
|
||||
MinInquiryPrice = nil
|
||||
MaxInquiryPrice = nil
|
||||
}
|
||||
|
||||
return &SystemInquiryConfigDto{
|
||||
SystemInquiryConfigId: fmt.Sprintf("%d", m.SystemInquiryConfigId),
|
||||
InquiryType: m.InquiryType,
|
||||
InquiryMode: m.InquiryMode,
|
||||
MaxWorkNumDay: m.MaxWorkNumDay,
|
||||
InquiryPrice: m.InquiryPrice,
|
||||
MinInquiryPrice: MinInquiryPrice,
|
||||
MaxInquiryPrice: MaxInquiryPrice,
|
||||
TimesNumber: m.TimesNumber,
|
||||
Duration: m.Duration,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func GetSystemInquiryConfigListDto(m []*model.SystemInquiryConfig) []*SystemInquiryConfigDto {
|
||||
// 处理返回值
|
||||
responses := make([]*SystemInquiryConfigDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
MinInquiryPrice := &v.MinInquiryPrice
|
||||
MaxInquiryPrice := &v.MaxInquiryPrice
|
||||
if v.InquiryType == 2 || v.InquiryType == 3 || v.InquiryType == 4 {
|
||||
MinInquiryPrice = nil
|
||||
MaxInquiryPrice = nil
|
||||
}
|
||||
|
||||
response := &SystemInquiryConfigDto{
|
||||
SystemInquiryConfigId: fmt.Sprintf("%d", v.SystemInquiryConfigId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
MaxWorkNumDay: v.MaxWorkNumDay,
|
||||
InquiryPrice: v.InquiryPrice,
|
||||
MinInquiryPrice: MinInquiryPrice,
|
||||
MaxInquiryPrice: MaxInquiryPrice,
|
||||
TimesNumber: v.TimesNumber,
|
||||
Duration: v.Duration,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
Reference in New Issue
Block a user