165 lines
12 KiB
Go
165 lines
12 KiB
Go
package userDoctorResponse
|
||
|
||
import (
|
||
"hospital-open-api/api/model"
|
||
"hospital-open-api/api/responses/v1/doctotInquiryConfigResponse"
|
||
"hospital-open-api/utils"
|
||
"strconv"
|
||
)
|
||
|
||
// GetMultiDoctor 获取多点执业医生详情
|
||
type GetMultiDoctor 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:认证失败)
|
||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||
Avatar string `json:"avatar"` // 头像
|
||
DoctorTitle string `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||
DepartmentCustomName string `json:"department_custom_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"` // 被关注数量
|
||
IsImgExpertReception int `json:"is_img_expert_reception"` // 是否参加专家图文接诊(0:否 1:是)
|
||
IsImgWelfareReception int `json:"is_img_welfare_reception"` // 是否参加公益图文问诊(0:否 1:是)
|
||
IsImgQuickReception int `json:"is_img_quick_reception"` // 是否参加快速图文接诊(0:否 1:是)
|
||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||
QrCode string `json:"qr_code"` // 分享二维码
|
||
BeGoodAt string `json:"be_good_at"` // 擅长
|
||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||
Mobile string `json:"mobile"` // 手机号
|
||
Age uint `json:"age"` // 年龄
|
||
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||
HospitalName string `json:"hospital_name"` // 医院名称
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||
}
|
||
|
||
// GetDoctor 获取医生详情
|
||
type GetDoctor 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:认证失败)
|
||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||
Avatar string `json:"avatar"` // 头像
|
||
DoctorTitle string `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||
DepartmentCustomName string `json:"department_custom_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"` // 被关注数量
|
||
IsImgExpertReception int `json:"is_img_expert_reception"` // 是否参加专家图文接诊(0:否 1:是)
|
||
IsImgWelfareReception int `json:"is_img_welfare_reception"` // 是否参加公益图文问诊(0:否 1:是)
|
||
IsImgQuickReception int `json:"is_img_quick_reception"` // 是否参加快速图文接诊(0:否 1:是)
|
||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||
QrCode string `json:"qr_code"` // 分享二维码
|
||
BeGoodAt string `json:"be_good_at"` // 擅长
|
||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||
Mobile string `json:"mobile"` // 手机号
|
||
Age uint `json:"age"` // 年龄
|
||
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||
HospitalName string `json:"hospital_name"` // 医院名称
|
||
DoctorInquiryConfig []*doctotInquiryConfigResponse.DoctorInquiryConfig `json:"doctor_inquiry_config"` // 医生问诊配置
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||
}
|
||
|
||
// GetMultiDoctorResponse 获取多点执业医生详情
|
||
func GetMultiDoctorResponse(userDoctor *model.UserDoctor) GetMultiDoctor {
|
||
res := GetMultiDoctor{
|
||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||
UserName: userDoctor.UserName,
|
||
Status: userDoctor.Status,
|
||
IDCardStatus: userDoctor.Status,
|
||
IdenAuthStatus: userDoctor.IdenAuthStatus,
|
||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||
DoctorTitle: utils.DoctorTitleToStr(userDoctor.DoctorTitle),
|
||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||
ServedPatientsNum: userDoctor.ServedPatientsNum,
|
||
PraiseRate: userDoctor.PraiseRate,
|
||
AvgResponseTime: userDoctor.AvgResponseTime,
|
||
NumberOfFans: userDoctor.NumberOfFans,
|
||
IsImgExpertReception: userDoctor.IsImgExpertReception,
|
||
IsImgWelfareReception: userDoctor.IsImgWelfareReception,
|
||
IsImgQuickReception: userDoctor.IsImgQuickReception,
|
||
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
|
||
IsEnterpriseDeepCooperation: userDoctor.IsEnterpriseDeepCooperation,
|
||
QrCode: utils.AddOssDomain(userDoctor.QrCode),
|
||
BeGoodAt: userDoctor.BeGoodAt,
|
||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||
CreatedAt: userDoctor.CreatedAt,
|
||
UpdatedAt: userDoctor.UpdatedAt,
|
||
}
|
||
|
||
if userDoctor.User != nil {
|
||
res.Mobile = userDoctor.User.Mobile
|
||
res.Age = userDoctor.User.Age
|
||
res.Sex = userDoctor.User.Sex
|
||
}
|
||
|
||
if userDoctor.Hospital != nil {
|
||
res.HospitalName = userDoctor.Hospital.HospitalName
|
||
}
|
||
|
||
return res
|
||
}
|
||
|
||
// GetDoctorResponse 获取医生详情
|
||
func GetDoctorResponse(userDoctor *model.UserDoctor) GetDoctor {
|
||
res := GetDoctor{
|
||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||
UserName: userDoctor.UserName,
|
||
Status: userDoctor.Status,
|
||
IDCardStatus: userDoctor.Status,
|
||
IdenAuthStatus: userDoctor.IdenAuthStatus,
|
||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||
DoctorTitle: utils.DoctorTitleToStr(userDoctor.DoctorTitle),
|
||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||
ServedPatientsNum: userDoctor.ServedPatientsNum,
|
||
PraiseRate: userDoctor.PraiseRate,
|
||
AvgResponseTime: userDoctor.AvgResponseTime,
|
||
NumberOfFans: userDoctor.NumberOfFans,
|
||
IsImgExpertReception: userDoctor.IsImgExpertReception,
|
||
IsImgWelfareReception: userDoctor.IsImgWelfareReception,
|
||
IsImgQuickReception: userDoctor.IsImgQuickReception,
|
||
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
|
||
IsEnterpriseDeepCooperation: userDoctor.IsEnterpriseDeepCooperation,
|
||
QrCode: utils.AddOssDomain(userDoctor.QrCode),
|
||
BeGoodAt: userDoctor.BeGoodAt,
|
||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||
CreatedAt: userDoctor.CreatedAt,
|
||
UpdatedAt: userDoctor.UpdatedAt,
|
||
}
|
||
|
||
// 用户数据
|
||
if userDoctor.User != nil {
|
||
res.Mobile = userDoctor.User.Mobile
|
||
res.Age = userDoctor.User.Age
|
||
res.Sex = userDoctor.User.Sex
|
||
}
|
||
|
||
// 医院名称
|
||
if userDoctor.Hospital != nil {
|
||
res.HospitalName = userDoctor.Hospital.HospitalName
|
||
}
|
||
|
||
// 问诊配置
|
||
if len(userDoctor.DoctorInquiryConfig) > 0 {
|
||
res.DoctorInquiryConfig = doctotInquiryConfigResponse.GetDoctorInquiryConfigListResponse(userDoctor.DoctorInquiryConfig)
|
||
}
|
||
|
||
return res
|
||
}
|