新增医生详情

This commit is contained in:
2023-07-04 16:08:04 +08:00
parent 0078b06b40
commit 4848f9d957
12 changed files with 379 additions and 13 deletions
@@ -2,6 +2,9 @@ package userDoctorResponse
import (
"hospital-admin-api/api/model"
"hospital-admin-api/api/responses/hospitalResponse"
"hospital-admin-api/api/responses/userDoctorInfoResponse"
"hospital-admin-api/api/responses/userResponse"
"hospital-admin-api/config"
"strconv"
)
@@ -43,6 +46,50 @@ type getUserDoctorPage struct {
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// getUserDoctor 医生详情
type getUserDoctor struct {
DoctorID string `json:"doctor_id"` // 主键id
UserID string `json:"user_id"` // 用户id
UserName string `json:"user_name"` // 用户名称
OpenID string `json:"open_id"` // 微信open_id
UnionID string `json:"union_id"` // 微信开放平台唯一标识
WxSessionKey string `json:"wx_session_key"` // 微信会话密钥
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
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"` // 被关注数量
IsOnline int `json:"is_online"` // 是否在线(0:不在线 1:在线)
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"` // 医生简介
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
User *userResponse.User `json:"user"` // 用户
Hospital *hospitalResponse.Hospital `json:"hospital"` // 医院
UserDoctorInfo *userDoctorInfoResponse.UserDoctorInfo `json:"user_doctor_info"` // 医生详情
}
// GetUserDoctorPageResponse 获取用户列表-分页
func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPage {
// 处理返回值
@@ -100,3 +147,59 @@ func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPa
return getUserPageResponses
}
// GetUserDoctorResponse 医生详情
func GetUserDoctorResponse(userDoctor *model.UserDoctor) *getUserDoctor {
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
if userDoctor.UserDoctorInfo != nil {
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
}
// 医院
var hospital *hospitalResponse.Hospital
if userDoctor.Hospital != nil {
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
}
// 用户
var user *userResponse.User
if userDoctor.User != nil {
user = userResponse.UserResponse(userDoctor.User)
}
// 将原始结构体转换为新结构体
return &getUserDoctor{
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
UserID: strconv.Itoa(int(userDoctor.UserId)),
UserName: userDoctor.UserName,
Status: userDoctor.Status,
IDCardStatus: userDoctor.Status,
IdenAuthStatus: userDoctor.IdenAuthStatus,
IdenAuthTime: userDoctor.IdenAuthTime,
IdenAuthFailReason: userDoctor.IdenAuthFailReason,
MultiPointStatus: userDoctor.MultiPointStatus,
MultiPointTime: userDoctor.MultiPointTime,
MultiPointFailReason: userDoctor.MultiPointFailReason,
IsBindBank: userDoctor.IsBindBank,
IsRecommend: userDoctor.IsRecommend,
Avatar: config.C.Oss.OssCustomDomainName + "/" + userDoctor.Avatar,
DoctorTitle: userDoctor.DoctorTitle,
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
DepartmentCustomName: userDoctor.DepartmentCustomName,
DepartmentCustomMobile: userDoctor.DepartmentCustomMobile,
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
ServedPatientsNum: userDoctor.ServedPatientsNum,
PraiseRate: userDoctor.PraiseRate,
AvgResponseTime: userDoctor.AvgResponseTime,
NumberOfFans: userDoctor.NumberOfFans,
IsImgExpertReception: userDoctor.IsImgExpertReception,
IsImgWelfareReception: userDoctor.IsImgWelfareReception,
IsImgQuickReception: userDoctor.IsImgQuickReception,
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
CreatedAt: userDoctor.CreatedAt,
UpdatedAt: userDoctor.UpdatedAt,
User: user,
Hospital: hospital,
UserDoctorInfo: userDoctorInfo,
}
}