新增简介审核-医生详情、简介审核-审核医生
This commit is contained in:
@@ -87,6 +87,36 @@ type UserDoctorPendingDto struct {
|
||||
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:女)
|
||||
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 []string `json:"doctor_expertise"` // 医生专长
|
||||
}
|
||||
|
||||
func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
||||
return &UserDoctorDto{
|
||||
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
||||
@@ -259,6 +289,68 @@ func GetUserDoctorPendingListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
||||
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 {
|
||||
@@ -279,6 +371,16 @@ func (r *UserDoctorPendingDto) LoadUser(m *model.User) *UserDoctorPendingDto {
|
||||
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 {
|
||||
@@ -306,6 +408,14 @@ func (r *UserDoctorDto) LoadHospital(m *model.Hospital) *UserDoctorDto {
|
||||
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
|
||||
@@ -364,6 +474,14 @@ func (r *UserDoctorDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorD
|
||||
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 {
|
||||
@@ -424,3 +542,38 @@ func (r *UserDoctorDto) LoadUserOnline(m *model.User) *UserDoctorDto {
|
||||
}
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user