64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
package dao
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"hospital-admin-api/api/model"
|
|
"hospital-admin-api/global"
|
|
)
|
|
|
|
type SystemInquiryConfigDao struct {
|
|
}
|
|
|
|
// GetSystemInquiryConfigListByDoctorId 获取系统问诊配置数据列表-系统id
|
|
func (r *SystemInquiryConfigDao) GetSystemInquiryConfigListByDoctorId(systemInquiryConfigId int64) (m *model.SystemInquiryConfig, err error) {
|
|
err = global.Db.First(&m, systemInquiryConfigId).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// DeleteSystemInquiryConfig 删除系统问诊配置
|
|
func (r *SystemInquiryConfigDao) DeleteSystemInquiryConfig(tx *gorm.DB, maps interface{}) error {
|
|
err := tx.Where(maps).Delete(&model.SystemInquiryConfig{}).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EditSystemInquiryConfigById 修改系统问诊配置-问诊配置id
|
|
func (r *SystemInquiryConfigDao) EditSystemInquiryConfigById(tx *gorm.DB, systemInquiryConfigId int64, data interface{}) error {
|
|
err := tx.Model(&model.SystemInquiryConfig{}).Where("system_inquiry_config_id = ?", systemInquiryConfigId).Updates(data).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetSystemInquiryConfigList 获取系统问诊配置列表
|
|
func (r *SystemInquiryConfigDao) GetSystemInquiryConfigList(maps interface{}) (m []*model.SystemInquiryConfig, err error) {
|
|
err = global.Db.Where(maps).Find(&m).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// AddSystemInquiryConfig 新增系统问诊配置
|
|
func (r *SystemInquiryConfigDao) AddSystemInquiryConfig(tx *gorm.DB, model *model.SystemInquiryConfig) (*model.SystemInquiryConfig, error) {
|
|
if err := tx.Create(model).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
return model, nil
|
|
}
|
|
|
|
// GetSystemInquiryConfig 获取系统问诊配置
|
|
func (r *SystemInquiryConfigDao) GetSystemInquiryConfig(maps interface{}) (m *model.SystemInquiryConfig, err error) {
|
|
err = global.Db.Where(maps).First(&m).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|