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 DoctorInquiryConfigDao struct {
|
|
}
|
|
|
|
// GetDoctorInquiryConfigListByDoctorId 获取医生问诊配置数据列表-医生id
|
|
func (r *DoctorInquiryConfigDao) GetDoctorInquiryConfigListByDoctorId(doctorId int64) (m []*model.DoctorInquiryConfig, err error) {
|
|
err = global.Db.Where("doctor_id = ?", doctorId).Find(&m).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// DeleteDoctorInquiryConfig 删除医生问诊配置
|
|
func (r *DoctorInquiryConfigDao) DeleteDoctorInquiryConfig(tx *gorm.DB, maps interface{}) error {
|
|
err := tx.Where(maps).Delete(&model.DoctorInquiryConfig{}).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EditDoctorInquiryConfigById 修改医生问诊配置-问诊配置id
|
|
func (r *DoctorInquiryConfigDao) EditDoctorInquiryConfigById(tx *gorm.DB, inquiryConfigId int64, data interface{}) error {
|
|
err := tx.Model(&model.DoctorInquiryConfig{}).Where("inquiry_config_id = ?", inquiryConfigId).Updates(data).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetDoctorInquiryConfigList 获取医生问诊配置列表
|
|
func (r *DoctorInquiryConfigDao) GetDoctorInquiryConfigList(maps interface{}) (m []*model.DoctorInquiryConfig, err error) {
|
|
err = global.Db.Where(maps).Find(&m).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// AddDoctorInquiryConfig 新增医生问诊配置
|
|
func (r *DoctorInquiryConfigDao) AddDoctorInquiryConfig(tx *gorm.DB, model *model.DoctorInquiryConfig) (*model.DoctorInquiryConfig, error) {
|
|
if err := tx.Create(model).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
return model, nil
|
|
}
|
|
|
|
// GetDoctorInquiryConfig 获取医生问诊配置
|
|
func (r *DoctorInquiryConfigDao) GetDoctorInquiryConfig(maps interface{}) (m *model.DoctorInquiryConfig, err error) {
|
|
err = global.Db.Where(maps).First(&m).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|