新增简介审核-医生详情、简介审核-审核医生

This commit is contained in:
2024-02-19 10:28:11 +08:00
parent 3a81941cca
commit 6a4db0422e
9 changed files with 717 additions and 0 deletions
+50
View File
@@ -555,3 +555,53 @@ func (r *UserDoctorDao) GetUserDoctorExportListSearch(req requests.UserDoctorExp
}
return m, nil
}
// GetDoctorIntroductionPageSearch 简介审核-获取医生列表-分页
func (r *UserDoctorDao) GetDoctorIntroductionPageSearch(req requests.GetDoctorIntroductionPage, 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 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.IntroductionStatus == nil {
query = query.Where("introduction_status in (?)", []string{"2"})
} else {
query = query.Where("introduction_status = ?", req.IntroductionStatus)
}
// 查询总数量
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
}