新增系统问诊配置
This commit is contained in:
@@ -3,14 +3,15 @@ package dao
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type SystemInquiryConfigDao struct {
|
||||
}
|
||||
|
||||
// GetSystemInquiryConfigListByDoctorId 获取系统问诊配置数据列表-系统id
|
||||
func (r *SystemInquiryConfigDao) GetSystemInquiryConfigListByDoctorId(systemInquiryConfigId int64) (m *model.SystemInquiryConfig, err error) {
|
||||
// GetSystemInquiryConfigById 获取系统问诊配置数据列表-系统问诊配置id
|
||||
func (r *SystemInquiryConfigDao) GetSystemInquiryConfigById(systemInquiryConfigId int64) (m *model.SystemInquiryConfig, err error) {
|
||||
err = global.Db.First(&m, systemInquiryConfigId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -61,3 +62,35 @@ func (r *SystemInquiryConfigDao) GetSystemInquiryConfig(maps interface{}) (m *mo
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetSystemInquiryConfigPageSearch 获取系统问诊配置列表-分页
|
||||
func (r *SystemInquiryConfigDao) GetSystemInquiryConfigPageSearch(req requests.GetSystemInquiryConfigPage, page, pageSize int) (m []*model.SystemInquiryConfig, total int64, err error) {
|
||||
var totalRecords int64
|
||||
|
||||
// 构建查询条件
|
||||
query := global.Db.Model(&model.SystemInquiryConfig{})
|
||||
|
||||
// 问诊类型
|
||||
if req.InquiryType != nil {
|
||||
query = query.Where("inquiry_type = ?", req.InquiryType)
|
||||
}
|
||||
|
||||
// 问诊方式
|
||||
if req.InquiryMode != nil {
|
||||
query = query.Where("inquiry_mode = ?", req.InquiryMode)
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order("created_at desc")
|
||||
|
||||
// 查询总数量
|
||||
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