修改了返回数据的处理文件,修正为dto表示返回。新增了获取医生列表-分页接口。重构了获取医生详情、获取多点执业医生详情接口
This commit is contained in:
parent
9996a2a749
commit
7a1ed10dd8
@ -3,9 +3,10 @@ package v1
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"hospital-open-api/api/dao"
|
"hospital-open-api/api/dao"
|
||||||
"hospital-open-api/api/requests/v1"
|
dtoV1 "hospital-open-api/api/dto/v1"
|
||||||
|
requestsV1 "hospital-open-api/api/requests/v1"
|
||||||
"hospital-open-api/api/responses"
|
"hospital-open-api/api/responses"
|
||||||
"hospital-open-api/api/responses/v1/userDoctorResponse"
|
serviceV1 "hospital-open-api/api/service/v1"
|
||||||
"hospital-open-api/global"
|
"hospital-open-api/global"
|
||||||
"hospital-open-api/utils"
|
"hospital-open-api/utils"
|
||||||
)
|
)
|
||||||
@ -14,54 +15,96 @@ type UserDoctor struct{}
|
|||||||
|
|
||||||
// GetMultiDoctor 获取多点执业医生详情
|
// GetMultiDoctor 获取多点执业医生详情
|
||||||
func (r *UserDoctor) GetMultiDoctor(c *gin.Context) {
|
func (r *UserDoctor) GetMultiDoctor(c *gin.Context) {
|
||||||
req := v1.UserDoctorRequest{}
|
userDoctorRequest := requestsV1.UserDoctorRequest{}
|
||||||
if err := c.ShouldBind(&req.GetMultiDoctor); err != nil {
|
req := userDoctorRequest.GetMultiDoctor
|
||||||
|
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(req.GetMultiDoctor); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据
|
// 业务处理
|
||||||
userDoctorDao := dao.UserDoctorDao{}
|
userDoctorService := serviceV1.UserDoctorService{}
|
||||||
userDoctor, err := userDoctorDao.GetMultiUserDoctor(req.GetMultiDoctor)
|
getMultiDoctorResponses, err := userDoctorService.GetMultiDoctor(req)
|
||||||
if err != nil && userDoctor == nil {
|
if err != nil {
|
||||||
responses.Ok(c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回值
|
responses.OkWithData(getMultiDoctorResponses, c)
|
||||||
getMultiDoctorResponse := userDoctorResponse.GetMultiDoctorResponse(userDoctor)
|
|
||||||
responses.OkWithData(getMultiDoctorResponse, c)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDoctor 获取医生详情
|
// GetDoctor 获取医生详情
|
||||||
func (r *UserDoctor) GetDoctor(c *gin.Context) {
|
func (r *UserDoctor) GetDoctor(c *gin.Context) {
|
||||||
req := v1.UserDoctorRequest{}
|
userDoctorRequest := requestsV1.UserDoctorRequest{}
|
||||||
if err := c.ShouldBind(&req.GetDoctor); err != nil {
|
req := userDoctorRequest.GetDoctor
|
||||||
|
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(req.GetDoctor); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据
|
// 业务处理
|
||||||
|
userDoctorService := serviceV1.UserDoctorService{}
|
||||||
|
getDoctorResponses, err := userDoctorService.GetDoctor(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getDoctorResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPage 获取医生列表-分页
|
||||||
|
func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
||||||
|
userDoctorRequest := requestsV1.UserDoctorRequest{}
|
||||||
|
req := userDoctorRequest.GetUserDoctorPage
|
||||||
|
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.Page == 0 {
|
||||||
|
req.Page = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.PageSize == 0 {
|
||||||
|
req.PageSize = 20
|
||||||
|
}
|
||||||
|
|
||||||
userDoctorDao := dao.UserDoctorDao{}
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
userDoctor, err := userDoctorDao.GetUserDoctor(req.GetDoctor)
|
userDoctor, total, err := userDoctorDao.GetUserDoctorPageSearch(req, req.Page, req.PageSize)
|
||||||
if err != nil && userDoctor == nil {
|
if err != nil {
|
||||||
responses.Ok(c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
getMultiDoctorResponse := userDoctorResponse.GetDoctorResponse(userDoctor)
|
getUserDoctorPageResponses := dtoV1.GetUserDoctorPageListDto(userDoctor)
|
||||||
responses.OkWithData(getMultiDoctorResponse, c)
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = getUserDoctorPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,9 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"hospital-open-api/api/model"
|
"hospital-open-api/api/model"
|
||||||
"hospital-open-api/api/requests/v1"
|
requestsV1 "hospital-open-api/api/requests/v1"
|
||||||
"hospital-open-api/global"
|
"hospital-open-api/global"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserDoctorDao struct {
|
type UserDoctorDao struct {
|
||||||
@ -30,55 +31,7 @@ func (r *UserDoctorDao) GetUserDoctorPreloadById(doctorId int64) (m *model.UserD
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetMultiUserDoctor 获取多点医生详情
|
// GetMultiUserDoctor 获取多点医生详情
|
||||||
func (r *UserDoctorDao) GetMultiUserDoctor(req v1.GetMultiDoctor) (m *model.UserDoctor, err error) {
|
func (r *UserDoctorDao) GetMultiUserDoctor(req requestsV1.GetMultiDoctor) (m *model.UserDoctor, err error) {
|
||||||
// 构建查询条件
|
|
||||||
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
|
||||||
|
|
||||||
// 用户
|
|
||||||
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
|
||||||
return db.Omit("user_password", "salt")
|
|
||||||
})
|
|
||||||
|
|
||||||
// 医院
|
|
||||||
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
|
||||||
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
|
||||||
})
|
|
||||||
|
|
||||||
// 状态
|
|
||||||
query = query.Where("status = ?", 1)
|
|
||||||
|
|
||||||
// 实名认证状态
|
|
||||||
query = query.Where("idcard_status = ?", 1)
|
|
||||||
|
|
||||||
// 身份认证状态
|
|
||||||
query = query.Where("iden_auth_status = ?", 1)
|
|
||||||
|
|
||||||
// 是否已绑定结算银行卡
|
|
||||||
query = query.Where("is_bind_bank = ?", 1)
|
|
||||||
|
|
||||||
// 姓名
|
|
||||||
if req.UserName != "" {
|
|
||||||
query = query.Where("user_name = ?", req.UserName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 手机号
|
|
||||||
if req.Mobile != "" {
|
|
||||||
subQuery := global.Db.Model(&model.User{}).
|
|
||||||
Select("user_id").
|
|
||||||
Where("mobile = ?", req.Mobile)
|
|
||||||
|
|
||||||
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
|
||||||
}
|
|
||||||
|
|
||||||
err = query.First(&m).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUserDoctor 获取医生详情
|
|
||||||
func (r *UserDoctorDao) GetUserDoctor(req v1.GetDoctor) (m *model.UserDoctor, err error) {
|
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
|
||||||
@ -127,3 +80,159 @@ func (r *UserDoctorDao) GetUserDoctor(req v1.GetDoctor) (m *model.UserDoctor, er
|
|||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserDoctor 获取医生详情
|
||||||
|
func (r *UserDoctorDao) GetUserDoctor(req requestsV1.GetDoctor) (m *model.UserDoctor, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 医院
|
||||||
|
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 问诊配置
|
||||||
|
query = query.Preload("DoctorInquiryConfig")
|
||||||
|
|
||||||
|
// 状态
|
||||||
|
query = query.Where("status = ?", 1)
|
||||||
|
|
||||||
|
// 实名认证状态
|
||||||
|
query = query.Where("idcard_status = ?", 1)
|
||||||
|
|
||||||
|
// 身份认证状态
|
||||||
|
query = query.Where("iden_auth_status = ?", 1)
|
||||||
|
|
||||||
|
// 是否已绑定结算银行卡
|
||||||
|
query = query.Where("is_bind_bank = ?", 1)
|
||||||
|
|
||||||
|
// 姓名
|
||||||
|
if req.UserName != "" {
|
||||||
|
query = query.Where("user_name = ?", req.UserName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
subQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPageSearch 获取医生列表-分页
|
||||||
|
func (r *UserDoctorDao) GetUserDoctorPageSearch(req requestsV1.GetUserDoctorPage, page, pageSize int) (m []*model.UserDoctor, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
|
||||||
|
query = query.Where("status = ?", 1)
|
||||||
|
query = query.Where("idcard_status = ?", 1)
|
||||||
|
query = query.Where("iden_auth_status = ?", 1)
|
||||||
|
query = query.Where("is_bind_bank = ?", 1)
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 医院
|
||||||
|
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 医生问诊配置
|
||||||
|
query = query.Preload("DoctorInquiryConfig")
|
||||||
|
|
||||||
|
// 医生问诊配置
|
||||||
|
if req.InquiryType != "" && req.InquiryMode != "" {
|
||||||
|
inquiryType := strings.Split(req.InquiryType, ",")
|
||||||
|
inquiryMode := strings.Split(req.InquiryMode, ",")
|
||||||
|
|
||||||
|
if len(inquiryType) > 0 {
|
||||||
|
subQuery := global.Db.Model(&model.DoctorInquiryConfig{}).
|
||||||
|
Where("gdxz_doctor_inquiry_config.doctor_id = gdxz_user_doctor.doctor_id").
|
||||||
|
Where("gdxz_doctor_inquiry_config.inquiry_type IN (?)", inquiryType).
|
||||||
|
Where("gdxz_doctor_inquiry_config.inquiry_mode IN (?)", inquiryMode).
|
||||||
|
Where("gdxz_doctor_inquiry_config.is_enable = ?", 1).Select("1")
|
||||||
|
|
||||||
|
query = query.Where("EXISTS (?)", subQuery)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
subQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile LIKE ?", "%"+req.Mobile+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户名称
|
||||||
|
if req.UserName != "" {
|
||||||
|
query = query.Where("user_name LIKE ?", "%"+req.UserName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 医院名称
|
||||||
|
if req.HospitalName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.Hospital{}).
|
||||||
|
Select("hospital_id").
|
||||||
|
Where("hospital_name LIKE ?", "%"+req.HospitalName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("hospital_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 科室名称
|
||||||
|
if req.DepartmentCustomName != "" {
|
||||||
|
query = query.Where("department_custom_name = ?", req.DepartmentCustomName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否首页推荐
|
||||||
|
if req.IsRecommend != nil {
|
||||||
|
query = query.Where("is_recommend = ?", req.IsRecommend)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.DoctorTitle != nil {
|
||||||
|
query = query.Where("doctor_title = ?", req.DoctorTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
if req.IsEnterpriseDeepCooperation != nil {
|
||||||
|
query = query.Where("is_enterprise_deep_cooperation = ?", req.IsEnterpriseDeepCooperation)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.IsPlatformDeepCooperation != nil {
|
||||||
|
query = query.Where("is_platform_deep_cooperation = ?", req.IsPlatformDeepCooperation)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.IsSysDiagnoCooperation != nil {
|
||||||
|
query = query.Where("is_sys_diagno_cooperation = ?", req.IsSysDiagnoCooperation)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package doctotInquiryConfigResponse
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hospital-open-api/api/model"
|
"hospital-open-api/api/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DoctorInquiryConfig struct {
|
type DoctorInquiryConfigDto struct {
|
||||||
InquiryConfigId string `json:"inquiry_config_id"` // 主键id
|
InquiryConfigId string `json:"inquiry_config_id"` // 主键id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL
|
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL
|
||||||
@ -23,13 +23,13 @@ type DoctorInquiryConfig struct {
|
|||||||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDoctorInquiryConfigListResponse(m []*model.DoctorInquiryConfig) []*DoctorInquiryConfig {
|
func GetDoctorInquiryConfigListDto(m []*model.DoctorInquiryConfig) []*DoctorInquiryConfigDto {
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
responses := make([]*DoctorInquiryConfig, len(m))
|
responses := make([]*DoctorInquiryConfigDto, len(m))
|
||||||
|
|
||||||
if len(m) > 0 {
|
if len(m) > 0 {
|
||||||
for i, v := range m {
|
for i, v := range m {
|
||||||
response := &DoctorInquiryConfig{
|
response := &DoctorInquiryConfigDto{
|
||||||
InquiryConfigId: fmt.Sprintf("%d", v.InquiryConfigId),
|
InquiryConfigId: fmt.Sprintf("%d", v.InquiryConfigId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
InquiryType: v.InquiryType,
|
InquiryType: v.InquiryType,
|
||||||
286
api/dto/v1/UserDoctor.go
Normal file
286
api/dto/v1/UserDoctor.go
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-open-api/api/model"
|
||||||
|
"hospital-open-api/utils"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserDoctorDto 医生详情
|
||||||
|
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:认证失败)
|
||||||
|
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 []*DoctorInquiryConfigDto `json:"doctor_inquiry_config"` // 医生问诊配置
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// MultiUserDoctorDto 多点执业医生详情
|
||||||
|
type MultiUserDoctorDto 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"` // 更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserDoctorPageDto 获取医生列表-分页
|
||||||
|
type UserDoctorPageDto struct {
|
||||||
|
DoctorID string `json:"doctor_id"` // 主键id
|
||||||
|
UserID string `json:"user_id"` // 用户id
|
||||||
|
UserName string `json:"user_name"` // 用户名称
|
||||||
|
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"` // 被关注数量
|
||||||
|
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"` // 医生简介
|
||||||
|
Age uint `json:"age"` // 年龄
|
||||||
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
|
HospitalName string `json:"hospital_name"` // 医院名称
|
||||||
|
HospitalLevelName string `json:"hospital_level_name"` // 医院等级
|
||||||
|
IsOnline int `json:"is_online"` // 是否在线(0:不在线 1:在线)
|
||||||
|
DoctorInquiryConfig []*DoctorInquiryConfigDto `json:"doctor_inquiry_config"` // 医生问诊配置
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMultiDoctorDto 获取多点执业医生详情
|
||||||
|
func GetMultiDoctorDto(m *model.UserDoctor) *MultiUserDoctorDto {
|
||||||
|
res := &MultiUserDoctorDto{
|
||||||
|
DoctorID: strconv.Itoa(int(m.DoctorId)),
|
||||||
|
UserID: strconv.Itoa(int(m.UserId)),
|
||||||
|
UserName: m.UserName,
|
||||||
|
Status: m.Status,
|
||||||
|
IDCardStatus: m.Status,
|
||||||
|
IdenAuthStatus: m.IdenAuthStatus,
|
||||||
|
MultiPointStatus: m.MultiPointStatus,
|
||||||
|
Avatar: utils.AddOssDomain(m.Avatar),
|
||||||
|
DoctorTitle: utils.DoctorTitleToStr(m.DoctorTitle),
|
||||||
|
DepartmentCustomName: m.DepartmentCustomName,
|
||||||
|
ServedPatientsNum: m.ServedPatientsNum,
|
||||||
|
PraiseRate: m.PraiseRate,
|
||||||
|
AvgResponseTime: m.AvgResponseTime,
|
||||||
|
NumberOfFans: m.NumberOfFans,
|
||||||
|
IsImgExpertReception: m.IsImgExpertReception,
|
||||||
|
IsImgWelfareReception: m.IsImgWelfareReception,
|
||||||
|
IsImgQuickReception: m.IsImgQuickReception,
|
||||||
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||||
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||||
|
QrCode: utils.AddOssDomain(m.QrCode),
|
||||||
|
BeGoodAt: m.BeGoodAt,
|
||||||
|
BriefIntroduction: m.BriefIntroduction,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorDto 获取医生详情
|
||||||
|
func GetDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
||||||
|
res := &UserDoctorDto{
|
||||||
|
DoctorID: strconv.Itoa(int(m.DoctorId)),
|
||||||
|
UserID: strconv.Itoa(int(m.UserId)),
|
||||||
|
UserName: m.UserName,
|
||||||
|
Status: m.Status,
|
||||||
|
IDCardStatus: m.Status,
|
||||||
|
IdenAuthStatus: m.IdenAuthStatus,
|
||||||
|
MultiPointStatus: m.MultiPointStatus,
|
||||||
|
Avatar: utils.AddOssDomain(m.Avatar),
|
||||||
|
DoctorTitle: utils.DoctorTitleToStr(m.DoctorTitle),
|
||||||
|
DepartmentCustomName: m.DepartmentCustomName,
|
||||||
|
ServedPatientsNum: m.ServedPatientsNum,
|
||||||
|
PraiseRate: m.PraiseRate,
|
||||||
|
AvgResponseTime: m.AvgResponseTime,
|
||||||
|
NumberOfFans: m.NumberOfFans,
|
||||||
|
IsImgExpertReception: m.IsImgExpertReception,
|
||||||
|
IsImgWelfareReception: m.IsImgWelfareReception,
|
||||||
|
IsImgQuickReception: m.IsImgQuickReception,
|
||||||
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||||
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||||
|
QrCode: utils.AddOssDomain(m.QrCode),
|
||||||
|
BeGoodAt: m.BeGoodAt,
|
||||||
|
BriefIntroduction: m.BriefIntroduction,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPageListDto 获取医生列表-分页
|
||||||
|
func GetUserDoctorPageListDto(m []*model.UserDoctor) []*UserDoctorPageDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*UserDoctorPageDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &UserDoctorPageDto{
|
||||||
|
DoctorID: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
UserID: fmt.Sprintf("%d", v.UserId),
|
||||||
|
UserName: v.UserName,
|
||||||
|
MultiPointStatus: v.MultiPointStatus,
|
||||||
|
Avatar: utils.AddOssDomain(v.Avatar),
|
||||||
|
DoctorTitle: utils.DoctorTitleToStr(v.DoctorTitle),
|
||||||
|
DepartmentCustomName: v.DepartmentCustomName,
|
||||||
|
ServedPatientsNum: v.ServedPatientsNum,
|
||||||
|
PraiseRate: v.PraiseRate,
|
||||||
|
AvgResponseTime: v.AvgResponseTime,
|
||||||
|
NumberOfFans: v.NumberOfFans,
|
||||||
|
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
QrCode: utils.AddOssDomain(v.QrCode),
|
||||||
|
BeGoodAt: v.BeGoodAt,
|
||||||
|
BriefIntroduction: v.BriefIntroduction,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载用户属性
|
||||||
|
if v.User != nil {
|
||||||
|
response = response.LoadUserAttr(v.User)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载医院属性数据
|
||||||
|
if v.Hospital != nil {
|
||||||
|
response = response.LoadHospitalAttr(v.Hospital)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载问诊配置数据
|
||||||
|
if v.Hospital != nil {
|
||||||
|
response = response.LoadDoctorInquiryConfig(v.DoctorInquiryConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserAttr 加载用户属性数据
|
||||||
|
func (r *UserDoctorDto) LoadUserAttr(m *model.User) *UserDoctorDto {
|
||||||
|
if m != nil {
|
||||||
|
r.Mobile = m.Mobile
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorInquiryConfig 加载问诊配置数据
|
||||||
|
func (r *UserDoctorDto) LoadDoctorInquiryConfig(m []*model.DoctorInquiryConfig) *UserDoctorDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
r.DoctorInquiryConfig = GetDoctorInquiryConfigListDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserAttr 加载用户属性数据
|
||||||
|
func (r *MultiUserDoctorDto) LoadUserAttr(m *model.User) *MultiUserDoctorDto {
|
||||||
|
if m != nil {
|
||||||
|
r.Mobile = m.Mobile
|
||||||
|
r.Age = m.Age
|
||||||
|
r.Sex = m.Sex
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadHospitalName 加载医院名称
|
||||||
|
func (r *MultiUserDoctorDto) LoadHospitalName(m *model.Hospital) *MultiUserDoctorDto {
|
||||||
|
if m != nil {
|
||||||
|
r.HospitalName = m.HospitalName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserAttr 加载用户属性数据
|
||||||
|
func (r *UserDoctorPageDto) LoadUserAttr(m *model.User) *UserDoctorPageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.Age = m.Age
|
||||||
|
r.Sex = m.Sex
|
||||||
|
r.IsOnline = m.IsOnline
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadHospitalAttr 加载医院属性数据
|
||||||
|
func (r *UserDoctorPageDto) LoadHospitalAttr(m *model.Hospital) *UserDoctorPageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.HospitalName = m.HospitalName
|
||||||
|
r.HospitalLevelName = m.HospitalLevelName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorInquiryConfig 加载问诊配置数据
|
||||||
|
func (r *UserDoctorPageDto) LoadDoctorInquiryConfig(m []*model.DoctorInquiryConfig) *UserDoctorPageDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
r.DoctorInquiryConfig = GetDoctorInquiryConfigListDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ package v1
|
|||||||
type UserDoctorRequest struct {
|
type UserDoctorRequest struct {
|
||||||
GetMultiDoctor // 获取多点执业医生详情
|
GetMultiDoctor // 获取多点执业医生详情
|
||||||
GetDoctor // 获取医生详情
|
GetDoctor // 获取医生详情
|
||||||
|
GetUserDoctorPage // 获取医生列表-分页
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMultiDoctor 获取多点执业医生详情
|
// GetMultiDoctor 获取多点执业医生详情
|
||||||
@ -16,3 +17,20 @@ type GetDoctor struct {
|
|||||||
Mobile string `json:"mobile" form:"mobile" validate:"required,Mobile" label:"手机号"`
|
Mobile string `json:"mobile" form:"mobile" validate:"required,Mobile" label:"手机号"`
|
||||||
UserName string `json:"user_name" form:"user_name" validate:"required" label:"用户名"`
|
UserName string `json:"user_name" form:"user_name" validate:"required" label:"用户名"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPage 获取医生列表-分页
|
||||||
|
type GetUserDoctorPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
|
UserName string `json:"user_name" form:"user_name" label:"用户名"`
|
||||||
|
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称"`
|
||||||
|
DepartmentCustomName string `json:"department_custom_name" form:"department_custom_name" label:"科室名称"`
|
||||||
|
IsRecommend *int `json:"is_recommend" form:"is_recommend" label:"是否推荐"` // (0:否 1:是)
|
||||||
|
DoctorTitle *int `json:"doctor_title" form:"doctor_title" label:"医生职称"` // (1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||||
|
InquiryType string `json:"inquiry_type" form:"inquiry_type" label:"接诊类型" validate:"required"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||||
|
InquiryMode string `json:"inquiry_mode" form:"inquiry_mode" label:"接诊方式" validate:"required"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠 8 // :健康包 9:随访包)
|
||||||
|
IsEnterpriseDeepCooperation *int `json:"is_enterprise_deep_cooperation" form:"is_enterprise_deep_cooperation" label:"是否企业深度合作"` // (0:否 1:是)
|
||||||
|
IsPlatformDeepCooperation *int `json:"is_platform_deep_cooperation" form:"is_platform_deep_cooperation" label:"平台深度合作医生"` // 是否平台深度合作医生(0:否 1:是)
|
||||||
|
IsSysDiagnoCooperation *int `json:"is_sys_diagno_cooperation" form:"is_sys_diagno_cooperation" label:"是否先思达合作医生"` // (0:否 1:是)
|
||||||
|
}
|
||||||
|
|||||||
@ -1,164 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
@ -91,6 +91,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
|
|
||||||
// 获取多点执业医生详情
|
// 获取多点执业医生详情
|
||||||
doctorGroup.GET("/multi", api.V1.UserDoctor.GetMultiDoctor)
|
doctorGroup.GET("/multi", api.V1.UserDoctor.GetMultiDoctor)
|
||||||
|
|
||||||
|
// 获取医生列表-分页
|
||||||
|
doctorGroup.GET("/page", api.V1.UserDoctor.GetUserDoctorPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,5 +103,15 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
// 生成页面加密scheme码
|
// 生成页面加密scheme码
|
||||||
wechatGroup.POST("/scheme", api.V1.WeChat.GetScheme)
|
wechatGroup.POST("/scheme", api.V1.WeChat.GetScheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 优惠卷
|
||||||
|
couponGroup := v1Group.Group("/coupon")
|
||||||
|
{
|
||||||
|
// 查询用户某一优惠卷领取状态
|
||||||
|
couponGroup.GET("", api.V1.UserDoctor.GetDoctor)
|
||||||
|
|
||||||
|
// 领取某一优惠卷
|
||||||
|
couponGroup.POST("", api.V1.UserDoctor.GetDoctor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
61
api/service/v1/UserDoctor.go
Normal file
61
api/service/v1/UserDoctor.go
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-open-api/api/dao"
|
||||||
|
dtoV1 "hospital-open-api/api/dto/v1"
|
||||||
|
requestsV1 "hospital-open-api/api/requests/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserDoctorService 医生
|
||||||
|
type UserDoctorService struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctor 获取医生详情
|
||||||
|
func (r *UserDoctorService) GetDoctor(req requestsV1.GetDoctor) (g *dtoV1.UserDoctorDto, err error) {
|
||||||
|
// 获取数据
|
||||||
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
|
userDoctor, err := userDoctorDao.GetUserDoctor(req)
|
||||||
|
if err != nil && userDoctor == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
g = dtoV1.GetDoctorDto(userDoctor)
|
||||||
|
|
||||||
|
// 加载用户数据
|
||||||
|
g.LoadUserAttr(userDoctor.User)
|
||||||
|
|
||||||
|
// 加载医院名称
|
||||||
|
g.LoadHospitalName(userDoctor.Hospital)
|
||||||
|
|
||||||
|
// 加载问诊配置数据
|
||||||
|
g.LoadDoctorInquiryConfig(userDoctor.DoctorInquiryConfig)
|
||||||
|
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMultiDoctor 获取多点执业医生详情
|
||||||
|
func (r *UserDoctorService) GetMultiDoctor(req requestsV1.GetMultiDoctor) (g *dtoV1.MultiUserDoctorDto, err error) {
|
||||||
|
// 获取数据
|
||||||
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
|
userDoctor, err := userDoctorDao.GetMultiUserDoctor(req)
|
||||||
|
if err != nil && userDoctor == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
g = dtoV1.GetMultiDoctorDto(userDoctor)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载用户数据
|
||||||
|
g.LoadUserAttr(userDoctor.User)
|
||||||
|
|
||||||
|
// 加载医院名称
|
||||||
|
g.LoadHospitalName(userDoctor.Hospital)
|
||||||
|
|
||||||
|
// 维护是否多点执业字段
|
||||||
|
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user