新增审核-医生列表-详情
This commit is contained in:
+59
-2
@@ -74,8 +74,8 @@ func (r *UserDoctorDao) GetUserDoctorList(maps interface{}) (m []*model.UserDoct
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetUserDoctorDaoPageSearch 获取医生列表-分页
|
||||
func (r *UserDoctorDao) GetUserDoctorDaoPageSearch(getUserDoctorPage requests.GetUserDoctorPage, page, pageSize int) (m []*model.UserDoctor, total int64, err error) {
|
||||
// GetUserDoctorPageSearch 获取医生列表-分页
|
||||
func (r *UserDoctorDao) GetUserDoctorPageSearch(getUserDoctorPage requests.GetUserDoctorPage, page, pageSize int) (m []*model.UserDoctor, total int64, err error) {
|
||||
var totalRecords int64
|
||||
|
||||
// 构建查询条件
|
||||
@@ -211,3 +211,60 @@ func (r *UserDoctorDao) AddUserDoctor(tx *gorm.DB, model *model.UserDoctor) (*mo
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// GetUserDoctorPendingPageSearch 审核-获取医生列表-分页
|
||||
func (r *UserDoctorDao) GetUserDoctorPendingPageSearch(p requests.GetUserDoctorPendingPage, 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.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")
|
||||
})
|
||||
|
||||
// 手机号
|
||||
if p.Mobile != "" {
|
||||
subQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile LIKE ?", "%"+p.Mobile+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||
}
|
||||
|
||||
// 用户名称
|
||||
if p.UserName != "" {
|
||||
query = query.Where("user_name LIKE ?", "%"+p.UserName+"%")
|
||||
}
|
||||
|
||||
// 身份认证状态
|
||||
if p.IdenAuthStatus != 0 {
|
||||
query = query.Where("iden_auth_status = ?", p.IdenAuthStatus)
|
||||
}
|
||||
|
||||
// 医院名称
|
||||
if p.HospitalName != "" {
|
||||
subQuery := global.Db.Model(&model.Hospital{}).
|
||||
Select("hospital_id").
|
||||
Where("hospital_name LIKE ?", "%"+p.HospitalName+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("hospital_id IN (?)", subQuery))
|
||||
}
|
||||
|
||||
// 查询总数量
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user