新增问诊管理-问诊配置-医生问诊配置-获取开启问诊配置医生列表-分页接口

This commit is contained in:
2023-10-13 10:48:13 +08:00
parent 62b58d0c7a
commit 43ae46ba15
8 changed files with 286 additions and 65 deletions
+132
View File
@@ -0,0 +1,132 @@
package dto
import (
"fmt"
"hospital-admin-api/api/model"
"hospital-admin-api/utils"
)
type DoctorInquiryConfigDto struct {
InquiryConfigId string `json:"inquiry_config_id"` // 主键id
DoctorId string `json:"doctor_id"` // 医生id
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL
IsEnable int `json:"is_enable"` // 是否启用(0:否 1:是)
LastEnableMethod int `json:"last_enable_method"` // 最后开启方式(1:自己 2:后台)
WorkNumDay int `json:"work_num_day"` // 每日接诊数量
InquiryPrice float64 `json:"inquiry_price"` // 接诊价格(专家问诊-公益问诊)
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
DoctorName string `json:"doctor_name"` // 医生姓名
MobileMask string `json:"mobile_mask"` // 医生电话(掩码)
DepartmentCustomName string `json:"department_custom_name"` // 科室名称
DoctorTitle *int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
}
func GetDoctorInquiryConfigDto(m *model.DoctorInquiryConfig) *DoctorInquiryConfigDto {
return &DoctorInquiryConfigDto{
InquiryConfigId: fmt.Sprintf("%d", m.InquiryConfigId),
DoctorId: fmt.Sprintf("%d", m.DoctorId),
InquiryType: m.InquiryType,
InquiryMode: m.InquiryMode,
IsEnable: m.IsEnable,
LastEnableMethod: m.LastEnableMethod,
WorkNumDay: m.WorkNumDay,
InquiryPrice: m.InquiryPrice,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
}
}
func GetDoctorInquiryConfigListDto(m []*model.DoctorInquiryConfig) []*DoctorInquiryConfigDto {
// 处理返回值
responses := make([]*DoctorInquiryConfigDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := &DoctorInquiryConfigDto{
InquiryConfigId: fmt.Sprintf("%d", v.InquiryConfigId),
DoctorId: fmt.Sprintf("%d", v.DoctorId),
InquiryType: v.InquiryType,
InquiryMode: v.InquiryMode,
IsEnable: v.IsEnable,
LastEnableMethod: v.LastEnableMethod,
WorkNumDay: v.WorkNumDay,
InquiryPrice: v.InquiryPrice,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 加载医生名称
if v.UserDoctor != nil {
response.LoadDoctorName(v.UserDoctor)
}
// 加载医生电话
if v.UserDoctor.User != nil {
response.LoadDoctorMaskMobile(v.UserDoctor.User)
}
// 加载医生科室名称
if v.UserDoctor != nil {
response.LoadDoctorDepartmentCustomName(v.UserDoctor)
}
// 加载医生职称
if v.UserDoctor != nil {
response.LoadDoctorTitle(v.UserDoctor)
}
// 加载医生多点执业认证状态
if v.UserDoctor != nil {
response.LoadDoctorMultiPointStatus(v.UserDoctor)
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}
// LoadDoctorName 加载医生名称
func (r *DoctorInquiryConfigDto) LoadDoctorName(m *model.UserDoctor) *DoctorInquiryConfigDto {
if m != nil {
r.DoctorName = m.UserName
}
return r
}
// LoadDoctorMaskMobile 加载医生电话
func (r *DoctorInquiryConfigDto) LoadDoctorMaskMobile(m *model.User) *DoctorInquiryConfigDto {
if m != nil {
r.MobileMask = utils.MaskPhoneStr(m.Mobile)
}
return r
}
// LoadDoctorDepartmentCustomName 加载医生科室名称
func (r *DoctorInquiryConfigDto) LoadDoctorDepartmentCustomName(m *model.UserDoctor) *DoctorInquiryConfigDto {
if m != nil {
r.DepartmentCustomName = m.DepartmentCustomName
}
return r
}
// LoadDoctorTitle 加载医生职称
func (r *DoctorInquiryConfigDto) LoadDoctorTitle(m *model.UserDoctor) *DoctorInquiryConfigDto {
if m != nil {
r.DoctorTitle = &m.DoctorTitle
}
return r
}
// LoadDoctorMultiPointStatus 加载医生多点执业认证状态
func (r *DoctorInquiryConfigDto) LoadDoctorMultiPointStatus(m *model.UserDoctor) *DoctorInquiryConfigDto {
if m != nil {
r.MultiPointStatus = m.MultiPointStatus
}
return r
}