新增上报处方平台接口
This commit is contained in:
@@ -7,11 +7,11 @@ import (
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type HospitalDepartmentCustom struct {
|
||||
type HospitalDepartmentCustomDao struct {
|
||||
}
|
||||
|
||||
// GetHospitalDepartmentCustomById 获取自定义科室数据-自定义科室id
|
||||
func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomById(departmentCustomId int64) (m *model.HospitalDepartmentCustom, err error) {
|
||||
func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomById(departmentCustomId int64) (m *model.HospitalDepartmentCustom, err error) {
|
||||
err = global.Db.First(&m, departmentCustomId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -20,7 +20,7 @@ func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomById(departmentCus
|
||||
}
|
||||
|
||||
// AddHospitalDepartmentCustom 新增自定义科室
|
||||
func (r *HospitalDepartmentCustom) AddHospitalDepartmentCustom(tx *gorm.DB, model *model.HospitalDepartmentCustom) (*model.HospitalDepartmentCustom, error) {
|
||||
func (r *HospitalDepartmentCustomDao) AddHospitalDepartmentCustom(tx *gorm.DB, model *model.HospitalDepartmentCustom) (*model.HospitalDepartmentCustom, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func (r *HospitalDepartmentCustom) AddHospitalDepartmentCustom(tx *gorm.DB, mode
|
||||
}
|
||||
|
||||
// GetHospitalDepartmentCustomList 获取自定义科室列表
|
||||
func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomList(maps interface{}) (m []*model.HospitalDepartmentCustom, err error) {
|
||||
func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomList(maps interface{}) (m []*model.HospitalDepartmentCustom, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -37,7 +37,7 @@ func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomList(maps interfac
|
||||
}
|
||||
|
||||
// DeleteHospitalDepartmentCustomById 删除自定义科室-自定义科室id
|
||||
func (r *HospitalDepartmentCustom) DeleteHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64) error {
|
||||
func (r *HospitalDepartmentCustomDao) DeleteHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64) error {
|
||||
if err := tx.Delete(&model.HospitalDepartmentCustom{}, departmentCustomId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func (r *HospitalDepartmentCustom) DeleteHospitalDepartmentCustomById(tx *gorm.D
|
||||
}
|
||||
|
||||
// EditHospitalDepartmentCustomById 修改自定义科室-自定义科室id
|
||||
func (r *HospitalDepartmentCustom) EditHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64, data interface{}) error {
|
||||
func (r *HospitalDepartmentCustomDao) EditHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64, data interface{}) error {
|
||||
err := tx.Model(&model.HospitalDepartmentCustom{}).Where("department_custom_id = ?", departmentCustomId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -54,7 +54,7 @@ func (r *HospitalDepartmentCustom) EditHospitalDepartmentCustomById(tx *gorm.DB,
|
||||
}
|
||||
|
||||
// GetHospitalDepartmentCustomListByMaps 获取自定义科室列表
|
||||
func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomListByMaps(departmentRequest requests.GetDepartmentCustomList) (m []*model.HospitalDepartmentCustom, err error) {
|
||||
func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomListByMaps(departmentRequest requests.GetDepartmentCustomList) (m []*model.HospitalDepartmentCustom, err error) {
|
||||
result := global.Db
|
||||
if departmentRequest.DepartmentId != "" {
|
||||
result = result.Where("department_id = ?", departmentRequest.DepartmentId)
|
||||
|
||||
Reference in New Issue
Block a user