修正医生列表
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type UserDoctorDto struct {
|
||||
@@ -55,6 +56,7 @@ type UserDoctorDto struct {
|
||||
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
||||
DoctorExpertise []*DoctorExpertiseDto `json:"doctor_expertise"` // 医生专长
|
||||
DoctorBankCard *DoctorBankCardDto `json:"doctor_bank_card"` // 医生银行卡
|
||||
InquiryType string `json:"inquiry_type"` // 服务类型
|
||||
}
|
||||
|
||||
type UserDoctorPendingDto struct {
|
||||
@@ -176,6 +178,13 @@ func GetUserDoctorListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
||||
response = response.LoadUserCreatedBy(v.User)
|
||||
}
|
||||
|
||||
// 加载医生服务类型
|
||||
if v.User != nil {
|
||||
response = response.LoadDoctorInquiryType(v.DoctorInquiryConfig)
|
||||
} else {
|
||||
response.InquiryType = "暂无"
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
@@ -301,6 +310,40 @@ func (r *UserDoctorDto) LoadHospital(m *model.Hospital) *UserDoctorDto {
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadDoctorInquiryType 加载医生服务类型
|
||||
func (r *UserDoctorDto) LoadDoctorInquiryType(m []*model.DoctorInquiryConfig) *UserDoctorDto {
|
||||
var inquiryTypes []string
|
||||
|
||||
if len(m) > 0 {
|
||||
for _, v := range m {
|
||||
if v.InquiryType == 1 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "专家问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 2 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "快速问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 3 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "公益问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 4 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "问诊购药")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inquiryType := "暂无"
|
||||
|
||||
if len(inquiryTypes) > 0 {
|
||||
inquiryType = strings.Join(inquiryTypes, ", ")
|
||||
}
|
||||
|
||||
r.InquiryType = inquiryType
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadHospital 加载医院
|
||||
func (r *UserDoctorPendingDto) LoadHospital(m *model.Hospital) *UserDoctorPendingDto {
|
||||
if m != nil {
|
||||
|
||||
Reference in New Issue
Block a user