新增医生列表
This commit is contained in:
parent
9796314616
commit
0078b06b40
@ -2,19 +2,13 @@ package controller
|
|||||||
|
|
||||||
// Api api接口
|
// Api api接口
|
||||||
type Api struct {
|
type Api struct {
|
||||||
Basic // 基础数据
|
Basic // 基础数据
|
||||||
Role // 角色数据
|
sysSetting // 系统设置
|
||||||
Menu // 菜单数据
|
userDoctorManage // 医生管理
|
||||||
User // 用户数据
|
|
||||||
AdminApi // 接口数据
|
|
||||||
Dept // 部门数据
|
|
||||||
Post // 岗位数据
|
|
||||||
UserDoctor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SysSetting 系统设置
|
// SysSetting 系统设置
|
||||||
type sysSetting struct {
|
type sysSetting struct {
|
||||||
Basic // 基础数据
|
|
||||||
Role // 角色数据
|
Role // 角色数据
|
||||||
Menu // 菜单数据
|
Menu // 菜单数据
|
||||||
User // 用户数据
|
User // 用户数据
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import (
|
|||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
"hospital-admin-api/api/responses/userResponse"
|
"hospital-admin-api/api/responses/adminUserResponse"
|
||||||
"hospital-admin-api/api/service"
|
"hospital-admin-api/api/service"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
@ -50,7 +50,7 @@ func (r *User) GetUserPage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
getUserPageResponses := userResponse.GetUserPageResponse(adminUser)
|
getUserPageResponses := adminUserResponse.GetUserPageResponse(adminUser)
|
||||||
|
|
||||||
result := make(map[string]interface{})
|
result := make(map[string]interface{})
|
||||||
result["page"] = UserRequest.GetUserPage.Page
|
result["page"] = UserRequest.GetUserPage.Page
|
||||||
@ -121,7 +121,7 @@ func (r *User) GetUser(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
getUserResponses := userResponse.GetUserResponse(adminUser)
|
getUserResponses := adminUserResponse.GetUserResponse(adminUser)
|
||||||
|
|
||||||
responses.OkWithData(getUserResponses, c)
|
responses.OkWithData(getUserResponses, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
|
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
)
|
)
|
||||||
@ -42,15 +42,13 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(total)
|
// 处理返回值
|
||||||
|
getUserDoctorPageResponses := userDoctorResponse.GetUserDoctorPageResponse(userDoctor)
|
||||||
|
|
||||||
// // 处理返回值
|
result := make(map[string]interface{})
|
||||||
// getUserPageResponses := userResponse.GetUserPageResponse(userDoctor)
|
result["page"] = userDoctorRequest.GetUserDoctorPage.Page
|
||||||
//
|
result["page_size"] = userDoctorRequest.GetUserDoctorPage.PageSize
|
||||||
// result := make(map[string]interface{})
|
result["total"] = total
|
||||||
// result["page"] = userDoctorRequest.GetUserDoctorPage.Page
|
result["data"] = getUserDoctorPageResponses
|
||||||
// result["page_size"] = userDoctorRequest.GetUserDoctorPage.PageSize
|
responses.OkWithData(result, c)
|
||||||
// result["total"] = total
|
|
||||||
// result["data"] = getUserPageResponses
|
|
||||||
responses.OkWithData(userDoctor, c)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,8 @@ func (r *UserDoctorDao) EditUserDoctor(tx *gorm.DB, maps interface{}, data inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EditUserDoctorById 修改医生-医生id
|
// EditUserDoctorById 修改医生-医生id
|
||||||
func (r *UserDoctorDao) EditUserDoctorById(tx *gorm.DB, userId int64, data interface{}) error {
|
func (r *UserDoctorDao) EditUserDoctorById(tx *gorm.DB, doctorId int64, data interface{}) error {
|
||||||
err := tx.Model(&model.UserDoctor{}).Where("doctor_id = ?", userId).Updates(data).Error
|
err := tx.Model(&model.UserDoctor{}).Where("doctor_id = ?", doctorId).Updates(data).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func (r *UserDoctorDao) GetUserDoctorDaoPageSearch(getUserDoctorPage requests.Ge
|
|||||||
|
|
||||||
// 医院
|
// 医院
|
||||||
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
||||||
return db.Select("hospital_id, hospital_name,hospital_level_name")
|
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
||||||
})
|
})
|
||||||
|
|
||||||
// 手机号
|
// 手机号
|
||||||
@ -92,7 +92,7 @@ func (r *UserDoctorDao) GetUserDoctorDaoPageSearch(getUserDoctorPage requests.Ge
|
|||||||
|
|
||||||
// 用户名称
|
// 用户名称
|
||||||
if getUserDoctorPage.UserName != "" {
|
if getUserDoctorPage.UserName != "" {
|
||||||
query = query.Where("user_name = ?", getUserDoctorPage.UserName)
|
query = query.Where("user_name LIKE ?", "%"+getUserDoctorPage.UserName+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
@ -138,6 +138,7 @@ func (r *UserDoctorDao) GetUserDoctorDaoPageSearch(getUserDoctorPage requests.Ge
|
|||||||
query = query.Where("doctor_title = ?", getUserDoctorPage.DoctorTitle)
|
query = query.Where("doctor_title = ?", getUserDoctorPage.DoctorTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 问诊类型
|
||||||
if getUserDoctorPage.InquiryService != "" {
|
if getUserDoctorPage.InquiryService != "" {
|
||||||
result := strings.Split(getUserDoctorPage.InquiryService, ",")
|
result := strings.Split(getUserDoctorPage.InquiryService, ",")
|
||||||
if len(result) > 0 {
|
if len(result) > 0 {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
// Hospital 医院表
|
// Hospital 医院表
|
||||||
type Hospital struct {
|
type Hospital struct {
|
||||||
HospitalId int64 `gorm:"column:hospital_id;type:bigint(19);primary_key;comment:主键id" json:"hospital_id"`
|
HospitalID int64 `gorm:"column:hospital_id;type:bigint(19);primary_key;comment:主键id" json:"hospital_id"`
|
||||||
HospitalName string `gorm:"column:hospital_name;type:varchar(255);comment:医院名称" json:"hospital_name"`
|
HospitalName string `gorm:"column:hospital_name;type:varchar(255);comment:医院名称" json:"hospital_name"`
|
||||||
HospitalStatus int `gorm:"column:hospital_status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"hospital_status"`
|
HospitalStatus int `gorm:"column:hospital_status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"hospital_status"`
|
||||||
HospitalLevelName string `gorm:"column:hospital_level_name;type:varchar(20);comment:医院等级名称" json:"hospital_level_name"`
|
HospitalLevelName string `gorm:"column:hospital_level_name;type:varchar(20);comment:医院等级名称" json:"hospital_level_name"`
|
||||||
|
|||||||
@ -23,7 +23,7 @@ type UserDoctor struct {
|
|||||||
DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);comment:科室id-自定义" json:"department_custom_id"`
|
DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);comment:科室id-自定义" json:"department_custom_id"`
|
||||||
DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称(如未自己输入,填入标准科室名称)" json:"department_custom_name"`
|
DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称(如未自己输入,填入标准科室名称)" json:"department_custom_name"`
|
||||||
DepartmentCustomMobile string `gorm:"column:department_custom_mobile;type:varchar(30);comment:科室电话" json:"department_custom_mobile"`
|
DepartmentCustomMobile string `gorm:"column:department_custom_mobile;type:varchar(30);comment:科室电话" json:"department_custom_mobile"`
|
||||||
HospitalId int64 `gorm:"column:hospital_id;type:bigint(19);comment:所属医院id" json:"hospital_id"`
|
HospitalID int64 `gorm:"column:hospital_id;type:bigint(19);comment:所属医院id" json:"hospital_id"`
|
||||||
ServedPatientsNum int `gorm:"column:served_patients_num;type:int(11);default:0;comment:服务患者数量(订单结束时统计)" json:"served_patients_num"`
|
ServedPatientsNum int `gorm:"column:served_patients_num;type:int(11);default:0;comment:服务患者数量(订单结束时统计)" json:"served_patients_num"`
|
||||||
PraiseRate float64 `gorm:"column:praise_rate;type:float(10,2);default:0.00;comment:好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)" json:"praise_rate"`
|
PraiseRate float64 `gorm:"column:praise_rate;type:float(10,2);default:0.00;comment:好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)" json:"praise_rate"`
|
||||||
AvgResponseTime float64 `gorm:"column:avg_response_time;type:float(10,2);default:0.00;comment:平均响应时间(分钟制)" json:"avg_response_time"`
|
AvgResponseTime float64 `gorm:"column:avg_response_time;type:float(10,2);default:0.00;comment:平均响应时间(分钟制)" json:"avg_response_time"`
|
||||||
@ -38,8 +38,8 @@ 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 *AdminPost `gorm:"foreignKey:UserId" json:"user"` // 用户
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
||||||
Hospital *AdminPost `gorm:"foreignKey:HospitalId" json:"hospital"` // 医院
|
Hospital *Hospital `gorm:"foreignKey:HospitalID;references:hospital_id" json:"hospital"` // 医院
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *UserDoctor) TableName() string {
|
func (m *UserDoctor) TableName() string {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package userResponse
|
package adminUserResponse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
102
api/responses/userDoctorResponse/userDoctor.go
Normal file
102
api/responses/userDoctorResponse/userDoctor.go
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
package userDoctorResponse
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/config"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// getUserDoctorPage 获取医生列表-分页
|
||||||
|
type getUserDoctorPage 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:认证失败)
|
||||||
|
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:住院医师)
|
||||||
|
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
||||||
|
DepartmentCustomMobile string `json:"department_custom_mobile"` // 科室电话
|
||||||
|
HospitalID string `json:"hospital_id"` // 所属医院id
|
||||||
|
HospitalName string `json:"hospital_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:是)
|
||||||
|
Mobile string `json:"mobile"` // 手机号
|
||||||
|
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 )
|
||||||
|
Age uint `json:"age"` // 年龄
|
||||||
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDoctorPageResponse 获取用户列表-分页
|
||||||
|
func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPage {
|
||||||
|
// 处理返回值
|
||||||
|
getUserPageResponses := make([]getUserDoctorPage, len(userDoctor))
|
||||||
|
|
||||||
|
if len(userDoctor) > 0 {
|
||||||
|
for i, v := range userDoctor {
|
||||||
|
// 将原始结构体转换为新结构体
|
||||||
|
getUserDoctorPageResponse := getUserDoctorPage{
|
||||||
|
DoctorID: strconv.Itoa(int(v.DoctorId)),
|
||||||
|
UserID: strconv.Itoa(int(v.UserId)),
|
||||||
|
UserName: v.UserName,
|
||||||
|
Status: v.Status,
|
||||||
|
IDCardStatus: v.Status,
|
||||||
|
IdenAuthStatus: v.IdenAuthStatus,
|
||||||
|
IdenAuthTime: v.IdenAuthTime,
|
||||||
|
IdenAuthFailReason: v.IdenAuthFailReason,
|
||||||
|
MultiPointStatus: v.MultiPointStatus,
|
||||||
|
MultiPointTime: v.MultiPointTime,
|
||||||
|
MultiPointFailReason: v.MultiPointFailReason,
|
||||||
|
IsBindBank: v.IsBindBank,
|
||||||
|
IsRecommend: v.IsRecommend,
|
||||||
|
Avatar: config.C.Oss.OssCustomDomainName + "/" + v.Avatar,
|
||||||
|
DoctorTitle: v.DoctorTitle,
|
||||||
|
DepartmentCustomName: v.DepartmentCustomName,
|
||||||
|
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
||||||
|
HospitalID: strconv.Itoa(int(v.HospitalID)),
|
||||||
|
ServedPatientsNum: v.ServedPatientsNum,
|
||||||
|
PraiseRate: v.PraiseRate,
|
||||||
|
AvgResponseTime: v.AvgResponseTime,
|
||||||
|
NumberOfFans: v.NumberOfFans,
|
||||||
|
IsImgExpertReception: v.IsImgExpertReception,
|
||||||
|
IsImgWelfareReception: v.IsImgWelfareReception,
|
||||||
|
IsImgQuickReception: v.IsImgQuickReception,
|
||||||
|
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.User != nil {
|
||||||
|
getUserDoctorPageResponse.Mobile = v.User.Mobile
|
||||||
|
getUserDoctorPageResponse.RegisterMethod = v.User.RegisterMethod
|
||||||
|
getUserDoctorPageResponse.Age = v.User.Age
|
||||||
|
getUserDoctorPageResponse.Sex = v.User.Sex
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.Hospital != nil {
|
||||||
|
getUserDoctorPageResponse.HospitalName = v.Hospital.HospitalName
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
getUserPageResponses[i] = getUserDoctorPageResponse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getUserPageResponses
|
||||||
|
}
|
||||||
@ -209,7 +209,7 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
doctorGroup := adminGroup.Group("/doctor")
|
doctorGroup := adminGroup.Group("/doctor")
|
||||||
{
|
{
|
||||||
// 获取医生列表-分页
|
// 获取医生列表-分页
|
||||||
doctorGroup.GET("", api.Post.GetPostPage)
|
doctorGroup.GET("", api.UserDoctor.GetUserDoctorPage)
|
||||||
|
|
||||||
// 新增医生
|
// 新增医生
|
||||||
doctorGroup.POST("", api.Post.AddPost)
|
doctorGroup.POST("", api.Post.AddPost)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user