590 lines
26 KiB
Go
590 lines
26 KiB
Go
package dto
|
|
|
|
import (
|
|
"fmt"
|
|
"hospital-admin-api/api/dao"
|
|
"hospital-admin-api/api/model"
|
|
"hospital-admin-api/utils"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
type UserDoctorDto struct {
|
|
DoctorID string `json:"doctor_id"` // 主键id
|
|
UserID string `json:"user_id"` // 用户id
|
|
UserName string `json:"user_name"` // 用户名称
|
|
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
|
IDCardStatus int `json:"idcard_status"` // 实名认证状态(0:未认证 1:认证通过 2:认证失败)
|
|
IdenAuthStatus int `json:"iden_auth_status"` // 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
|
IdenAuthTime model.LocalTime `json:"iden_auth_time"` // 审核时间
|
|
IdenAuthFailReason string `json:"iden_auth_fail_reason"` // 身份认证失败原因
|
|
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
|
MultiPointTime model.LocalTime `json:"multi_point_time"` // 审核时间
|
|
MultiPointFailReason string `json:"multi_point_fail_reason"` // 多点执业认证失败原因
|
|
IsBindBank int `json:"is_bind_bank"` // 是否已绑定结算银行卡(0:否 1:是)
|
|
IsRecommend int `json:"is_recommend"` // 是否首页推荐(0:否 1:是)
|
|
Avatar string `json:"avatar"` // 头像
|
|
DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
|
DepartmentCustomID string `json:"department_custom_id"` // 科室id-自定义
|
|
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
|
DepartmentCustomMobile string `json:"department_custom_mobile"` // 科室电话
|
|
HospitalID string `json:"hospital_id"` // 所属医院id
|
|
HospitalName string `json:"hospital_name"` // 医院名称
|
|
ServedPatientsNum int `json:"served_patients_num"` // 服务患者数量(订单结束时统计)
|
|
PraiseRate float64 `json:"praise_rate"` // 好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)
|
|
AvgResponseTime float64 `json:"avg_response_time"` // 平均响应时间(分钟制)
|
|
NumberOfFans uint `json:"number_of_fans"` // 被关注数量
|
|
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
|
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
|
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation"` // 是否先思达合作医生(0:否 1:是)
|
|
IsTransferPrescription int `json:"is_transfer_prescription"` // 是否接受抄方(0:否 1:是)
|
|
QrCode string `json:"qr_code"` // 分享二维码
|
|
BeGoodAt string `json:"be_good_at"` // 擅长
|
|
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
|
Mobile string `json:"mobile"` // 手机号
|
|
Age uint `json:"age"` // 年龄
|
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
|
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 2:后台添加 )
|
|
CreatedBy string `json:"created_by"` // 创建者
|
|
User *UserDto `json:"user"` // 用户
|
|
Hospital *HospitalDto `json:"hospital"` // 医院
|
|
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
|
DoctorExpertise []*DoctorExpertiseDto `json:"doctor_expertise"` // 医生专长
|
|
DoctorPharmacy []*DoctorPharmacyDto `json:"doctor_pharmacy"` // 医生药房
|
|
DoctorBankCard *DoctorBankCardDto `json:"doctor_bank_card"` // 医生银行卡
|
|
InquiryType string `json:"inquiry_type"` // 服务类型
|
|
UserCaCert *UserCaCertDto `json:"user_ca_cert"` // ca监管证书
|
|
IsOnline int `json:"is_online"` // 是否在线(0:不在线 1:在线)
|
|
}
|
|
|
|
type UserDoctorPendingDto struct {
|
|
DoctorID string `json:"doctor_id"` // 主键id
|
|
UserID string `json:"user_id"` // 用户id
|
|
UserName string `json:"user_name"` // 用户名称
|
|
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
|
IDCardStatus int `json:"idcard_status"` // 实名认证状态(0:未认证 1:认证通过 2:认证失败)
|
|
IdenAuthStatus int `json:"iden_auth_status"` // 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
|
IdenAuthTime model.LocalTime `json:"iden_auth_time"` // 审核时间
|
|
IdenAuthFailReason *IdenAuthFailReasonDto `json:"iden_auth_fail_reason"` // 身份认证失败原因
|
|
Avatar string `json:"avatar"` // 头像
|
|
DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
|
DepartmentCustomID string `json:"department_custom_id"` // 科室id-自定义
|
|
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
|
DepartmentCustomMobile string `json:"department_custom_mobile"` // 科室电话
|
|
HospitalID string `json:"hospital_id"` // 所属医院id
|
|
BeGoodAt string `json:"be_good_at"` // 擅长
|
|
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
|
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
|
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
|
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation"` // 是否先思达合作医生(0:否 1:是)
|
|
IsTransferPrescription int `json:"is_transfer_prescription"` // 是否接受抄方(0:否 1:是)
|
|
IsRecommend int `json:"is_recommend"` // 是否首页推荐(0:否 1:是)
|
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
|
User *UserDto `json:"user"` // 用户
|
|
Hospital *HospitalDto `json:"hospital"` // 医院
|
|
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
|
DoctorExpertise []*DoctorExpertiseDto `json:"doctor_expertise"` // 医生专长
|
|
UserCaCert *UserCaCertDto `json:"user_ca_cert"` // ca监管证书
|
|
}
|
|
|
|
// UserDoctorIntroductionDto 简介
|
|
type UserDoctorIntroductionDto struct {
|
|
DoctorID string `json:"doctor_id"` // 主键id
|
|
UserID string `json:"user_id"` // 用户id
|
|
UserName string `json:"user_name"` // 用户名称
|
|
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
|
IntroductionStatus int `json:"introduction_status"` // 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)
|
|
IntroductionTime model.LocalTime `json:"introduction_time"` // 审核时间
|
|
Avatar string `json:"avatar"` // 头像
|
|
DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
|
DepartmentCustomID string `json:"department_custom_id"` // 科室id-自定义
|
|
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
|
DepartmentCustomMobile string `json:"department_custom_mobile"` // 科室电话
|
|
HospitalID string `json:"hospital_id"` // 所属医院id
|
|
HospitalName string `json:"hospital_name"` // 医院名称
|
|
Mobile string `json:"mobile"` // 手机号
|
|
Age uint `json:"age"` // 年龄
|
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
|
Email string `json:"email"` // 邮箱
|
|
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 2:后台添加 )
|
|
ApplyTime model.LocalTime `json:"apply_time"` // 申请时间
|
|
BeGoodAt string `json:"be_good_at"` // 擅长
|
|
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
|
User *UserDto `json:"user"` // 用户
|
|
Hospital *HospitalDto `json:"hospital"` // 医院
|
|
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
|
DoctorExpertise []*DiseaseClassExpertiseDto `json:"doctor_expertise"` // 医生专长
|
|
}
|
|
|
|
func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
|
return &UserDoctorDto{
|
|
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
|
UserID: fmt.Sprintf("%d", m.UserId),
|
|
UserName: m.UserName,
|
|
Status: m.Status,
|
|
IDCardStatus: m.Status,
|
|
IdenAuthStatus: m.IdenAuthStatus,
|
|
IdenAuthTime: m.IdenAuthTime,
|
|
IdenAuthFailReason: m.IdenAuthFailReason,
|
|
MultiPointStatus: m.MultiPointStatus,
|
|
MultiPointTime: m.MultiPointTime,
|
|
MultiPointFailReason: m.MultiPointFailReason,
|
|
IsBindBank: m.IsBindBank,
|
|
IsRecommend: m.IsRecommend,
|
|
Avatar: utils.AddOssDomain(m.Avatar),
|
|
DoctorTitle: m.DoctorTitle,
|
|
DepartmentCustomID: fmt.Sprintf("%d", m.DepartmentCustomId),
|
|
DepartmentCustomName: m.DepartmentCustomName,
|
|
DepartmentCustomMobile: m.DepartmentCustomMobile,
|
|
HospitalID: fmt.Sprintf("%d", m.HospitalID),
|
|
ServedPatientsNum: m.ServedPatientsNum,
|
|
PraiseRate: m.PraiseRate,
|
|
AvgResponseTime: m.AvgResponseTime,
|
|
NumberOfFans: m.NumberOfFans,
|
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
|
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
|
IsTransferPrescription: m.IsTransferPrescription,
|
|
QrCode: utils.AddOssDomain(m.QrCode),
|
|
BeGoodAt: m.BeGoodAt,
|
|
BriefIntroduction: m.BriefIntroduction,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
func GetUserDoctorListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
|
// 处理返回值
|
|
responses := make([]*UserDoctorDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := &UserDoctorDto{
|
|
DoctorID: fmt.Sprintf("%d", v.DoctorId),
|
|
UserID: fmt.Sprintf("%d", v.UserId),
|
|
UserName: v.UserName,
|
|
Status: v.Status,
|
|
IDCardStatus: v.IdcardStatus,
|
|
IdenAuthStatus: v.IdenAuthStatus,
|
|
IdenAuthTime: v.IdenAuthTime,
|
|
IdenAuthFailReason: v.IdenAuthFailReason,
|
|
MultiPointStatus: v.MultiPointStatus,
|
|
MultiPointTime: v.MultiPointTime,
|
|
MultiPointFailReason: v.MultiPointFailReason,
|
|
IsBindBank: v.IsBindBank,
|
|
IsRecommend: v.IsRecommend,
|
|
Avatar: utils.AddOssDomain(v.Avatar),
|
|
DoctorTitle: v.DoctorTitle,
|
|
DepartmentCustomName: v.DepartmentCustomName,
|
|
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
|
HospitalID: fmt.Sprintf("%d", v.HospitalID),
|
|
ServedPatientsNum: v.ServedPatientsNum,
|
|
PraiseRate: v.PraiseRate,
|
|
AvgResponseTime: v.AvgResponseTime,
|
|
NumberOfFans: v.NumberOfFans,
|
|
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
|
IsEnterpriseDeepCooperation: v.IsEnterpriseDeepCooperation,
|
|
IsTransferPrescription: v.IsTransferPrescription,
|
|
CreatedAt: v.CreatedAt,
|
|
UpdatedAt: v.UpdatedAt,
|
|
}
|
|
|
|
// 加载用户属性
|
|
if v.User != nil {
|
|
response = response.LoadUserAttr(v.User)
|
|
}
|
|
|
|
// 加载医院名称
|
|
if v.Hospital != nil {
|
|
response = response.LoadHospitalName(v.Hospital)
|
|
}
|
|
|
|
if v.User != nil {
|
|
// 加载创建者
|
|
response = response.LoadUserCreatedBy(v.User)
|
|
|
|
// 加载用户在线状态
|
|
response.LoadUserOnline(v.User)
|
|
}
|
|
|
|
// 加载医生服务类型
|
|
if v.DoctorInquiryConfig != nil {
|
|
response = response.LoadDoctorInquiryType(v.DoctorInquiryConfig)
|
|
} else {
|
|
response.InquiryType = "暂无"
|
|
}
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|
|
|
|
// GetUserDoctorPendingDto 审核详情
|
|
func GetUserDoctorPendingDto(m *model.UserDoctor) *UserDoctorPendingDto {
|
|
return &UserDoctorPendingDto{
|
|
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
|
UserID: fmt.Sprintf("%d", m.UserId),
|
|
UserName: m.UserName,
|
|
Status: m.Status,
|
|
IDCardStatus: m.Status,
|
|
IdenAuthStatus: m.IdenAuthStatus,
|
|
IdenAuthTime: m.IdenAuthTime,
|
|
Avatar: utils.AddOssDomain(m.Avatar),
|
|
DoctorTitle: m.DoctorTitle,
|
|
DepartmentCustomID: fmt.Sprintf("%d", m.DepartmentCustomId),
|
|
DepartmentCustomName: m.DepartmentCustomName,
|
|
DepartmentCustomMobile: m.DepartmentCustomMobile,
|
|
HospitalID: fmt.Sprintf("%d", m.HospitalID),
|
|
BeGoodAt: m.BeGoodAt,
|
|
BriefIntroduction: m.BriefIntroduction,
|
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
|
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
|
IsTransferPrescription: m.IsTransferPrescription,
|
|
IsRecommend: m.IsRecommend,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
// GetUserDoctorPendingListDto 审核列表
|
|
func GetUserDoctorPendingListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
|
// 处理返回值
|
|
responses := make([]*UserDoctorDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := &UserDoctorDto{
|
|
DoctorID: fmt.Sprintf("%d", v.DoctorId),
|
|
UserID: fmt.Sprintf("%d", v.UserId),
|
|
UserName: v.UserName,
|
|
Status: v.Status,
|
|
IDCardStatus: v.Status,
|
|
IdenAuthStatus: v.IdenAuthStatus,
|
|
IdenAuthTime: v.IdenAuthTime,
|
|
IdenAuthFailReason: v.IdenAuthFailReason,
|
|
Avatar: utils.AddOssDomain(v.Avatar),
|
|
DoctorTitle: v.DoctorTitle,
|
|
DepartmentCustomName: v.DepartmentCustomName,
|
|
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
|
HospitalID: fmt.Sprintf("%d", v.HospitalID),
|
|
CreatedAt: v.CreatedAt,
|
|
UpdatedAt: v.UpdatedAt,
|
|
}
|
|
|
|
// 加载用户属性
|
|
if v.User != nil {
|
|
response = response.LoadUserAttr(v.User)
|
|
}
|
|
|
|
// 加载医院名称
|
|
if v.Hospital != nil {
|
|
response = response.LoadHospitalName(v.Hospital)
|
|
}
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|
|
|
|
// GetUserDoctorIntroductionListDto 简介审核列表
|
|
func GetUserDoctorIntroductionListDto(m []*model.UserDoctor) []*UserDoctorIntroductionDto {
|
|
// 处理返回值
|
|
responses := make([]*UserDoctorIntroductionDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := &UserDoctorIntroductionDto{
|
|
DoctorID: fmt.Sprintf("%d", v.DoctorId),
|
|
UserID: fmt.Sprintf("%d", v.UserId),
|
|
UserName: v.UserName,
|
|
Status: v.Status,
|
|
IntroductionStatus: v.IntroductionStatus,
|
|
IntroductionTime: v.IntroductionTime,
|
|
DoctorTitle: v.DoctorTitle,
|
|
DepartmentCustomName: v.DepartmentCustomName,
|
|
HospitalID: fmt.Sprintf("%d", v.HospitalID),
|
|
}
|
|
|
|
// 加载医院名称
|
|
if v.Hospital != nil {
|
|
response = response.LoadHospitalName(v.Hospital)
|
|
}
|
|
|
|
// 加载用户属性
|
|
if v.User != nil {
|
|
response = response.LoadUserAttr(v.User)
|
|
}
|
|
|
|
// 加载简介申请时间
|
|
response = response.LoadDoctorIntroductionApplyTime(v.IntroductionStatus)
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|
|
|
|
// GetUserDoctorIntroductionDto 简介审核详情
|
|
func GetUserDoctorIntroductionDto(m *model.UserDoctor) *UserDoctorIntroductionDto {
|
|
return &UserDoctorIntroductionDto{
|
|
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
|
UserID: fmt.Sprintf("%d", m.UserId),
|
|
UserName: m.UserName,
|
|
Status: m.Status,
|
|
IntroductionStatus: m.IntroductionStatus,
|
|
IntroductionTime: m.IntroductionTime,
|
|
Avatar: utils.AddOssDomain(m.Avatar),
|
|
DoctorTitle: m.DoctorTitle,
|
|
DepartmentCustomID: fmt.Sprintf("%d", m.DepartmentCustomId),
|
|
DepartmentCustomName: m.DepartmentCustomName,
|
|
DepartmentCustomMobile: m.DepartmentCustomMobile,
|
|
HospitalID: fmt.Sprintf("%d", m.HospitalID),
|
|
BeGoodAt: m.BeGoodAt,
|
|
BriefIntroduction: m.BriefIntroduction,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
// LoadUser 加载用户
|
|
func (r *UserDoctorDto) LoadUser(m *model.User) *UserDoctorDto {
|
|
if m != nil {
|
|
userDto := GetUserDto(m)
|
|
|
|
r.User = userDto
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUser 加载用户
|
|
func (r *UserDoctorPendingDto) LoadUser(m *model.User) *UserDoctorPendingDto {
|
|
if m != nil {
|
|
userDto := GetUserDto(m)
|
|
|
|
r.User = userDto
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUser 加载用户
|
|
func (r *UserDoctorIntroductionDto) LoadUser(m *model.User) *UserDoctorIntroductionDto {
|
|
if m != nil {
|
|
userDto := GetUserDto(m)
|
|
|
|
r.User = userDto
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserAttr 加载用户属性
|
|
func (r *UserDoctorDto) LoadUserAttr(m *model.User) *UserDoctorDto {
|
|
if m != nil {
|
|
r.Mobile = m.Mobile
|
|
r.RegisterMethod = m.RegisterMethod
|
|
r.Age = m.Age
|
|
r.Sex = m.Sex
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadHospitalName 加载医院名称
|
|
func (r *UserDoctorDto) LoadHospitalName(m *model.Hospital) *UserDoctorDto {
|
|
if m != nil {
|
|
r.HospitalName = m.HospitalName
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadHospital 加载医院
|
|
func (r *UserDoctorDto) LoadHospital(m *model.Hospital) *UserDoctorDto {
|
|
if m != nil {
|
|
r.Hospital = GetHospitalDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadHospital 加载医院
|
|
func (r *UserDoctorIntroductionDto) LoadHospital(m *model.Hospital) *UserDoctorIntroductionDto {
|
|
if m != nil {
|
|
r.Hospital = GetHospitalDto(m)
|
|
}
|
|
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 {
|
|
r.Hospital = GetHospitalDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadDoctorBankCard 加载医生银行卡
|
|
func (r *UserDoctorDto) LoadDoctorBankCard(m *model.DoctorBankCard) *UserDoctorDto {
|
|
if m != nil {
|
|
r.DoctorBankCard = GetDoctorBankCardDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserDoctorInfo 加载医生详情
|
|
func (r *UserDoctorDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorDto {
|
|
if m != nil {
|
|
r.UserDoctorInfo = GetUserDoctorInfoDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserDoctorInfo 加载医生详情
|
|
func (r *UserDoctorIntroductionDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorIntroductionDto {
|
|
if m != nil {
|
|
r.UserDoctorInfo = GetUserDoctorInfoDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserCaCert 加载医生云证书详情
|
|
func (r *UserDoctorDto) LoadUserCaCert(m *model.UserCaCert) *UserDoctorDto {
|
|
if m != nil {
|
|
r.UserCaCert = GetUserCaCertDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserCaCert 加载医生云证书详情
|
|
func (r *UserDoctorPendingDto) LoadUserCaCert(m *model.UserCaCert) *UserDoctorPendingDto {
|
|
if m != nil {
|
|
r.UserCaCert = GetUserCaCertDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserDoctorInfo 加载医生详情
|
|
func (r *UserDoctorPendingDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorPendingDto {
|
|
if m != nil {
|
|
r.UserDoctorInfo = GetUserDoctorInfoDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserCreatedBy 加载创建者
|
|
func (r *UserDoctorDto) LoadUserCreatedBy(m *model.User) *UserDoctorDto {
|
|
if m.CreatedBy != "" {
|
|
if m.RegisterMethod == 1 {
|
|
// 注册方式-微信小程序
|
|
r.CreatedBy = m.UserName
|
|
} else {
|
|
// 注册方式-后台添加
|
|
userId, err := strconv.ParseInt(m.CreatedBy, 10, 64)
|
|
if err != nil {
|
|
return r
|
|
}
|
|
|
|
// 获取用户详情
|
|
AdminUserDao := dao.AdminUserDao{}
|
|
adminUser, err := AdminUserDao.GetAdminUserFirstById(userId)
|
|
if err != nil || adminUser == nil {
|
|
return r
|
|
}
|
|
|
|
r.CreatedBy = adminUser.NickName
|
|
}
|
|
} else {
|
|
// 注册方式-微信小程序
|
|
r.CreatedBy = m.UserName
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserOnline 加载用户在线状态
|
|
func (r *UserDoctorDto) LoadUserOnline(m *model.User) *UserDoctorDto {
|
|
if m != nil {
|
|
r.IsOnline = m.IsOnline
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadHospitalName 加载医院名称
|
|
func (r *UserDoctorIntroductionDto) LoadHospitalName(m *model.Hospital) *UserDoctorIntroductionDto {
|
|
if m != nil {
|
|
r.HospitalName = m.HospitalName
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadUserAttr 加载用户属性
|
|
func (r *UserDoctorIntroductionDto) LoadUserAttr(m *model.User) *UserDoctorIntroductionDto {
|
|
if m != nil {
|
|
r.Mobile = utils.MaskPhoneStr(m.Mobile)
|
|
r.RegisterMethod = m.RegisterMethod
|
|
r.Age = m.Age
|
|
r.Sex = m.Sex
|
|
r.Email = m.Email
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadDoctorIntroductionApplyTime 加载简介申请时间
|
|
func (r *UserDoctorIntroductionDto) LoadDoctorIntroductionApplyTime(IntroductionStatus int) *UserDoctorIntroductionDto {
|
|
if IntroductionStatus == 2 || IntroductionStatus == 3 {
|
|
doctorIntroductionRecordDao := dao.DoctorIntroductionRecordDao{}
|
|
maps := make(map[string]interface{})
|
|
maps["doctor_id"] = r.DoctorID
|
|
maps["introduction_status"] = IntroductionStatus
|
|
doctorIntroductionRecord, _ := doctorIntroductionRecordDao.GetDoctorIntroductionRecordLast(maps)
|
|
if doctorIntroductionRecord != nil {
|
|
r.ApplyTime = doctorIntroductionRecord.CreatedAt
|
|
}
|
|
}
|
|
|
|
return r
|
|
}
|