新增医生详情
This commit is contained in:
parent
0078b06b40
commit
4848f9d957
@ -8,6 +8,7 @@ import (
|
|||||||
"hospital-admin-api/api/responses/userDoctorResponse"
|
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserDoctor struct{}
|
type UserDoctor struct{}
|
||||||
@ -52,3 +53,32 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
|||||||
result["data"] = getUserDoctorPageResponses
|
result["data"] = getUserDoctorPageResponses
|
||||||
responses.OkWithData(result, c)
|
responses.OkWithData(result, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPostUserDoctor 医生详情
|
||||||
|
func (r *UserDoctor) GetPostUserDoctor(c *gin.Context) {
|
||||||
|
id := c.Param("doctor_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
doctorId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生数据
|
||||||
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
|
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage("用户数据错误", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
getUserDoctorResponses := userDoctorResponse.GetUserDoctorResponse(userDoctor)
|
||||||
|
|
||||||
|
responses.OkWithData(getUserDoctorResponses, c)
|
||||||
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
@ -20,6 +21,15 @@ func (r *UserDoctorDao) GetUserDoctorById(doctorId int64) (m *model.UserDoctor,
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPreloadById 获取医生数据-加载全部关联-医生id
|
||||||
|
func (r *UserDoctorDao) GetUserDoctorPreloadById(doctorId int64) (m *model.UserDoctor, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, doctorId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteUserDoctor 删除医生
|
// DeleteUserDoctor 删除医生
|
||||||
func (r *UserDoctorDao) DeleteUserDoctor(tx *gorm.DB, maps interface{}) error {
|
func (r *UserDoctorDao) DeleteUserDoctor(tx *gorm.DB, maps interface{}) error {
|
||||||
err := tx.Where(maps).Delete(&model.UserDoctor{}).Error
|
err := tx.Where(maps).Delete(&model.UserDoctor{}).Error
|
||||||
|
|||||||
@ -6,7 +6,7 @@ type AdminMenu struct {
|
|||||||
MenuId int64 `gorm:"column:menu_id;type:bigint(19);primary_key;comment:主键id" json:"menu_id"`
|
MenuId int64 `gorm:"column:menu_id;type:bigint(19);primary_key;comment:主键id" json:"menu_id"`
|
||||||
MenuName string `gorm:"column:menu_name;type:varchar(30);comment:菜单名称" json:"menu_name"`
|
MenuName string `gorm:"column:menu_name;type:varchar(30);comment:菜单名称" json:"menu_name"`
|
||||||
MenuTitle string `gorm:"column:menu_title;menu_title:varchar(30);comment:菜单名称" json:"menu_title"`
|
MenuTitle string `gorm:"column:menu_title;menu_title:varchar(30);comment:菜单名称" json:"menu_title"`
|
||||||
ParentId int64 `gorm:"column:parent_id;type:int(10);default:0;comment:父菜单ID(0表示一级)" json:"parent_id"`
|
ParentId int64 `gorm:"column:parent_id;type:bigint(19);default:0;comment:父菜单ID(0表示一级)" json:"parent_id"`
|
||||||
MenuStatus int `gorm:"column:menu_status;type:tinyint(1);default:1;comment:菜单状态(0:隐藏 1:正常)此优先级最高" json:"menu_status"`
|
MenuStatus int `gorm:"column:menu_status;type:tinyint(1);default:1;comment:菜单状态(0:隐藏 1:正常)此优先级最高" json:"menu_status"`
|
||||||
MenuType int `gorm:"column:menu_type;type:tinyint(1);comment:菜单类型(1:模块 2:菜单 3:按钮)" json:"menu_type"`
|
MenuType int `gorm:"column:menu_type;type:tinyint(1);comment:菜单类型(1:模块 2:菜单 3:按钮)" json:"menu_type"`
|
||||||
Permission string `gorm:"column:permission;type:varchar(255);comment:标识" json:"permission"`
|
Permission string `gorm:"column:permission;type:varchar(255);comment:标识" json:"permission"`
|
||||||
|
|||||||
@ -38,8 +38,9 @@ type UserDoctor struct {
|
|||||||
BeGoodAt string `gorm:"column:be_good_at;type:text;comment:擅长" json:"be_good_at"`
|
BeGoodAt string `gorm:"column:be_good_at;type:text;comment:擅长" json:"be_good_at"`
|
||||||
BriefIntroduction string `gorm:"column:brief_introduction;type:text;comment:医生简介" json:"brief_introduction"`
|
BriefIntroduction string `gorm:"column:brief_introduction;type:text;comment:医生简介" json:"brief_introduction"`
|
||||||
Model
|
Model
|
||||||
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
||||||
Hospital *Hospital `gorm:"foreignKey:HospitalID;references:hospital_id" json:"hospital"` // 医院
|
Hospital *Hospital `gorm:"foreignKey:HospitalID;references:hospital_id" json:"hospital"` // 医院
|
||||||
|
UserDoctorInfo *UserDoctorInfo `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor_info"` // 详情
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *UserDoctor) TableName() string {
|
func (m *UserDoctor) TableName() string {
|
||||||
|
|||||||
26
api/model/userDoctorInfo.go
Normal file
26
api/model/userDoctorInfo.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
// UserDoctorInfo 用户-医生详情表
|
||||||
|
type UserDoctorInfo struct {
|
||||||
|
DoctorInfoId int64 `gorm:"column:doctor_info_id;type:bigint(19);primary_key;comment:主键" json:"doctor_info_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
|
||||||
|
CardType int `gorm:"column:card_type;type:tinyint(1);comment:类型(1:身份证 2:护照 3:港澳通行证 4:台胞证);NOT NULL" json:"card_type"`
|
||||||
|
CardName string `gorm:"column:card_name;type:varchar(50);comment:证件姓名" json:"card_name"`
|
||||||
|
CardNameMask string `gorm:"column:card_name_mask;type:varchar(50);comment:证件姓名(掩码)" json:"card_name_mask"`
|
||||||
|
CardNum string `gorm:"column:card_num;type:varchar(30);comment:证件号码" json:"card_num"`
|
||||||
|
CardNumMask string `gorm:"column:card_num_mask;type:varchar(50);comment:证件号码(掩码)" json:"card_num_mask"`
|
||||||
|
LicenseCert string `gorm:"column:license_cert;type:varchar(255);comment:医师执业证(逗号分隔)" json:"license_cert"`
|
||||||
|
QualificationCert string `gorm:"column:qualification_cert;type:varchar(255);comment:医师资格证(逗号分隔)" json:"qualification_cert"`
|
||||||
|
QualificationCertNum string `gorm:"column:qualification_cert_num;type:varchar(255);comment:医师资格证号(逗号分隔)" json:"qualification_cert_num"`
|
||||||
|
WorkCert string `gorm:"column:work_cert;type:varchar(255);comment:医师工作证(逗号分隔)" json:"work_cert"`
|
||||||
|
MultiPointImages string `gorm:"column:multi_point_images;type:varchar(255);comment:多点执业备案信息(逗号分隔)" json:"multi_point_images"`
|
||||||
|
IdCardFront string `gorm:"column:id_card_front;type:varchar(255);comment:身份证正面图片" json:"id_card_front"`
|
||||||
|
IdCardBack string `gorm:"column:id_card_back;type:varchar(255);comment:身份证背面图片" json:"id_card_back"`
|
||||||
|
SignImage string `gorm:"column:sign_image;type:varchar(255);comment:签名图片" json:"sign_image"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserDoctorInfo) TableName() string {
|
||||||
|
return "gdxz_user_doctor_info"
|
||||||
|
}
|
||||||
@ -10,7 +10,7 @@ type MenuRequest struct {
|
|||||||
type AddMenu struct {
|
type AddMenu struct {
|
||||||
MenuName string `json:"menu_name" form:"menu_name" validate:"required" label:"菜单名称"`
|
MenuName string `json:"menu_name" form:"menu_name" validate:"required" label:"菜单名称"`
|
||||||
MenuTitle string `json:"menu_title" form:"menu_title" validate:"required" label:"菜单名称"`
|
MenuTitle string `json:"menu_title" form:"menu_title" validate:"required" label:"菜单名称"`
|
||||||
ParentId string `json:"parent_id" form:"parent_id" validate:"required,numeric" label:"父菜单ID"` // (0表示一级)
|
ParentId string `json:"parent_id" form:"parent_id" validate:"required" label:"父菜单ID"` // (0表示一级)
|
||||||
MenuStatus int `json:"menu_status" form:"menu_status" validate:"oneof=0 1" label:"菜单状态"` // (0:隐藏 1:正常)此优先级最高
|
MenuStatus int `json:"menu_status" form:"menu_status" validate:"oneof=0 1" label:"菜单状态"` // (0:隐藏 1:正常)此优先级最高
|
||||||
MenuType int `json:"menu_type" form:"menu_type" validate:"required,oneof=1 2 3" label:"菜单类型"` // 菜单类型(1:模块 2:菜单 3:按钮)
|
MenuType int `json:"menu_type" form:"menu_type" validate:"required,oneof=1 2 3" label:"菜单类型"` // 菜单类型(1:模块 2:菜单 3:按钮)
|
||||||
Permission string `json:"permission" form:"permission" label:"标识"` // 标识
|
Permission string `json:"permission" form:"permission" label:"标识"` // 标识
|
||||||
|
|||||||
51
api/responses/hospitalResponse/hospital.go
Normal file
51
api/responses/hospitalResponse/hospital.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package hospitalResponse
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Hospital struct {
|
||||||
|
HospitalID string `json:"hospital_id"` // 主键id
|
||||||
|
HospitalName string `json:"hospital_name"` // 医院名称
|
||||||
|
HospitalStatus int `json:"hospital_status"` // 状态(0:禁用 1:正常 2:删除)
|
||||||
|
HospitalLevelName string `json:"hospital_level_name"` // 医院等级名称
|
||||||
|
PostCode string `json:"post_code"` // 邮政编码
|
||||||
|
Telephone string `json:"telephone"` // 电话
|
||||||
|
ProvinceID int `json:"province_id"` // 省份id
|
||||||
|
Province string `json:"province"` // 省份
|
||||||
|
CityID int `json:"city_id"` // 城市id
|
||||||
|
City string `json:"city"` // 城市
|
||||||
|
CountyID int `json:"county_id"` // 区县id
|
||||||
|
County string `json:"county"` // 区县
|
||||||
|
Address string `json:"address"` // 地址
|
||||||
|
Latitude string `json:"latitude"` // 纬度
|
||||||
|
Longitude string `json:"longitude"` // 经度
|
||||||
|
Description string `json:"description"` // 简介
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// HospitalResponse 医院
|
||||||
|
func HospitalResponse(hospital *model.Hospital) *Hospital {
|
||||||
|
return &Hospital{
|
||||||
|
HospitalID: strconv.FormatInt(hospital.HospitalID, 10),
|
||||||
|
HospitalName: hospital.HospitalName,
|
||||||
|
HospitalStatus: hospital.HospitalStatus,
|
||||||
|
HospitalLevelName: hospital.HospitalLevelName,
|
||||||
|
PostCode: hospital.PostCode,
|
||||||
|
Telephone: hospital.HospitalName,
|
||||||
|
ProvinceID: hospital.ProvinceId,
|
||||||
|
Province: hospital.Province,
|
||||||
|
CityID: hospital.CityId,
|
||||||
|
City: hospital.City,
|
||||||
|
CountyID: hospital.CountyId,
|
||||||
|
County: hospital.County,
|
||||||
|
Address: hospital.Address,
|
||||||
|
Latitude: hospital.Lat,
|
||||||
|
Longitude: hospital.HospitalName,
|
||||||
|
Description: hospital.Desc,
|
||||||
|
CreatedAt: hospital.CreatedAt,
|
||||||
|
UpdatedAt: hospital.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
92
api/responses/userDoctorInfoResponse/userDoctorInfo.go
Normal file
92
api/responses/userDoctorInfoResponse/userDoctorInfo.go
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
package userDoctorInfoResponse
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/config"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserDoctorInfo struct {
|
||||||
|
DoctorInfoId string `json:"doctor_info_id"` // 主键
|
||||||
|
UserId string `json:"user_id"` // 用户id
|
||||||
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
CardType int `json:"card_type"` // 类型(1:身份证 2:护照 3:港澳通行证 4:台胞证);NOT NULL
|
||||||
|
CardName string `json:"card_name"` // 证件姓名
|
||||||
|
CardNameMask string `json:"card_name_mask"` // 证件姓名(掩码)
|
||||||
|
CardNumMask string `json:"card_num_mask"` // 证件号码(掩码)
|
||||||
|
LicenseCert []string `json:"license_cert"` // 医师执业证(逗号分隔)
|
||||||
|
QualificationCert []string `json:"qualification_cert"` // 医师资格证(逗号分隔)
|
||||||
|
QualificationCertNum string `json:"qualification_cert_num"` // 医师资格证号(逗号分隔)
|
||||||
|
WorkCert []string `json:"work_cert"` // 医师工作证(逗号分隔)
|
||||||
|
MultiPointImages []string `json:"multi_point_images"` // 多点执业备案信息(逗号分隔)
|
||||||
|
IdCardFront string `json:"id_card_front"` // 身份证正面图片
|
||||||
|
IdCardBack string `json:"id_card_back"` // 身份证背面图片
|
||||||
|
SignImage string `json:"sign_image"` // 签名图片
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserDoctorInfoResponse 医生详情
|
||||||
|
func UserDoctorInfoResponse(userDoctorInfo *model.UserDoctorInfo) *UserDoctorInfo {
|
||||||
|
var licenseCert []string
|
||||||
|
if userDoctorInfo.LicenseCert != "" {
|
||||||
|
result := strings.Split(userDoctorInfo.LicenseCert, ",")
|
||||||
|
if len(result) > 0 {
|
||||||
|
for _, v := range result {
|
||||||
|
v = config.C.Oss.OssCustomDomainName + v
|
||||||
|
licenseCert = append(licenseCert, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var qualificationCert []string
|
||||||
|
if userDoctorInfo.QualificationCert != "" {
|
||||||
|
result := strings.Split(userDoctorInfo.QualificationCert, ",")
|
||||||
|
if len(result) > 0 {
|
||||||
|
for _, v := range result {
|
||||||
|
v = config.C.Oss.OssCustomDomainName + v
|
||||||
|
qualificationCert = append(qualificationCert, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var workCert []string
|
||||||
|
if userDoctorInfo.WorkCert != "" {
|
||||||
|
result := strings.Split(userDoctorInfo.WorkCert, ",")
|
||||||
|
if len(result) > 0 {
|
||||||
|
for _, v := range result {
|
||||||
|
v = config.C.Oss.OssCustomDomainName + v
|
||||||
|
workCert = append(workCert, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var multiPointImages []string
|
||||||
|
if userDoctorInfo.MultiPointImages != "" {
|
||||||
|
result := strings.Split(userDoctorInfo.MultiPointImages, ",")
|
||||||
|
if len(result) > 0 {
|
||||||
|
for _, v := range result {
|
||||||
|
multiPointImages = append(multiPointImages, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &UserDoctorInfo{
|
||||||
|
DoctorInfoId: strconv.FormatInt(userDoctorInfo.DoctorInfoId, 10),
|
||||||
|
UserId: strconv.FormatInt(userDoctorInfo.UserId, 10),
|
||||||
|
DoctorId: strconv.FormatInt(userDoctorInfo.DoctorId, 10),
|
||||||
|
CardType: userDoctorInfo.CardType,
|
||||||
|
CardName: userDoctorInfo.CardName,
|
||||||
|
CardNameMask: userDoctorInfo.CardNameMask,
|
||||||
|
CardNumMask: userDoctorInfo.CardNumMask,
|
||||||
|
LicenseCert: licenseCert,
|
||||||
|
QualificationCert: qualificationCert,
|
||||||
|
QualificationCertNum: userDoctorInfo.QualificationCertNum,
|
||||||
|
WorkCert: workCert,
|
||||||
|
MultiPointImages: multiPointImages,
|
||||||
|
IdCardFront: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.IdCardFront,
|
||||||
|
IdCardBack: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.IdCardBack,
|
||||||
|
SignImage: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.SignImage,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,9 @@ package userDoctorResponse
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"hospital-admin-api/api/model"
|
"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"
|
"hospital-admin-api/config"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@ -43,6 +46,50 @@ type getUserDoctorPage struct {
|
|||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
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 获取用户列表-分页
|
// GetUserDoctorPageResponse 获取用户列表-分页
|
||||||
func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPage {
|
func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPage {
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
@ -100,3 +147,59 @@ func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPa
|
|||||||
|
|
||||||
return getUserPageResponses
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
46
api/responses/userResponse/user.go
Normal file
46
api/responses/userResponse/user.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package userResponse
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/config"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
UserID string `json:"user_id"` // 主键
|
||||||
|
UserName string `json:"user_name"` // 用户名称
|
||||||
|
UserAccount string `json:"user_account"` // 账号
|
||||||
|
Mobile string `json:"mobile"` // 手机号
|
||||||
|
WxMobile string `json:"wx_mobile"` // 微信手机号
|
||||||
|
UserType int `json:"user_type"` // 用户类型(1:患者 2:医师 3:药师)
|
||||||
|
UserStatus int `json:"user_status"` // 状态(0:禁用 1:正常 2:删除)
|
||||||
|
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序)
|
||||||
|
Age uint `json:"age"` // 年龄
|
||||||
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||||
|
Avatar string `json:"avatar"` // 头像
|
||||||
|
LoginIP string `json:"login_ip"` // 登陆ip
|
||||||
|
LastLoginAt model.LocalTime `json:"last_login_at"` // 最后登陆时间
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserResponse 用户详情
|
||||||
|
func UserResponse(user *model.User) *User {
|
||||||
|
return &User{
|
||||||
|
UserID: strconv.FormatInt(user.UserId, 10),
|
||||||
|
UserName: user.UserName,
|
||||||
|
UserAccount: user.UserAccount,
|
||||||
|
Mobile: user.Mobile,
|
||||||
|
WxMobile: user.WxMobile,
|
||||||
|
UserType: user.UserType,
|
||||||
|
UserStatus: user.UserStatus,
|
||||||
|
RegisterMethod: user.RegisterMethod,
|
||||||
|
Age: user.Age,
|
||||||
|
Sex: user.Sex,
|
||||||
|
Avatar: config.C.Oss.OssCustomDomainName + "/" + user.Avatar,
|
||||||
|
LoginIP: user.LoginIp,
|
||||||
|
LastLoginAt: user.LastLoginAt,
|
||||||
|
CreatedAt: user.CreatedAt,
|
||||||
|
UpdatedAt: user.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -211,16 +211,19 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
// 获取医生列表-分页
|
// 获取医生列表-分页
|
||||||
doctorGroup.GET("", api.UserDoctor.GetUserDoctorPage)
|
doctorGroup.GET("", api.UserDoctor.GetUserDoctorPage)
|
||||||
|
|
||||||
// 新增医生
|
|
||||||
doctorGroup.POST("", api.Post.AddPost)
|
|
||||||
|
|
||||||
// 医生详情
|
// 医生详情
|
||||||
doctorGroup.GET("/:post_id", api.Post.GetPost)
|
doctorGroup.GET("/:doctor_id", api.UserDoctor.GetPostUserDoctor)
|
||||||
|
|
||||||
// 删除医生-批量
|
// // 新增医生
|
||||||
doctorGroup.DELETE("", api.Post.DeletePost)
|
// doctorGroup.POST("", api.Post.AddPost)
|
||||||
|
//
|
||||||
// 修改医生
|
// // 医生详情
|
||||||
doctorGroup.PUT("/:post_id", api.Post.PutPost)
|
// doctorGroup.GET("/:post_id", api.Post.GetPost)
|
||||||
|
//
|
||||||
|
// // 删除医生-批量
|
||||||
|
// doctorGroup.DELETE("", api.Post.DeletePost)
|
||||||
|
//
|
||||||
|
// // 修改医生
|
||||||
|
// doctorGroup.PUT("/:post_id", api.Post.PutPost)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
api/service/userDoctor.go
Normal file
4
api/service/userDoctor.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
type UserDoctorService struct {
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user