新增上报处方平台接口
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)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type OrderPrescriptionIcdDao struct {
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionIcdById 获取处方关联疾病数据-处方关联疾病id
|
||||
func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdById(PrescriptionIcdId int64) (m *model.OrderPrescriptionIcd, err error) {
|
||||
err = global.Db.First(&m, PrescriptionIcdId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdByOrderPrescriptionId(orderPrescriptionId int64) (m *model.OrderPrescriptionIcd, err error) {
|
||||
err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdListByOrderPrescriptionId(orderPrescriptionId int64) (m []*model.OrderPrescriptionIcd, err error) {
|
||||
err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionIcdPreloadById 获取处方关联疾病数据-加载全部关联-处方关联疾病id
|
||||
func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdPreloadById(PrescriptionIcdId int64) (m *model.OrderPrescriptionIcd, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, PrescriptionIcdId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteOrderPrescriptionIcd 删除处方关联疾病
|
||||
func (r *OrderPrescriptionIcdDao) DeleteOrderPrescriptionIcd(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.OrderPrescriptionIcd{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderPrescriptionIcd 修改处方关联疾病
|
||||
func (r *OrderPrescriptionIcdDao) EditOrderPrescriptionIcd(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.OrderPrescriptionIcd{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderPrescriptionIcdByOrderPrescriptionId 修改处方关联疾病-处方关联疾病id
|
||||
func (r *OrderPrescriptionIcdDao) EditOrderPrescriptionIcdByOrderPrescriptionId(tx *gorm.DB, PrescriptionIcdId int64, data interface{}) error {
|
||||
err := tx.Model(&model.OrderPrescriptionIcd{}).Where("order_prescription_id = ?", PrescriptionIcdId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionIcdList 获取处方关联疾病列表
|
||||
func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdList(maps interface{}) (m []*model.OrderPrescriptionIcd, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddOrderPrescriptionIcd 新增处方关联疾病
|
||||
func (r *OrderPrescriptionIcdDao) AddOrderPrescriptionIcd(tx *gorm.DB, model *model.OrderPrescriptionIcd) (*model.OrderPrescriptionIcd, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type ProductDao struct {
|
||||
}
|
||||
|
||||
// GetProductById 获取商品数据-商品id
|
||||
func (r *ProductDao) GetProductById(productId int64) (m *model.Product, err error) {
|
||||
err = global.Db.First(&m, productId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetProductPreloadById 获取商品数据-加载全部关联-商品id
|
||||
func (r *ProductDao) GetProductPreloadById(productId int64) (m *model.Product, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, productId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteProduct 删除商品
|
||||
func (r *ProductDao) DeleteProduct(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.Product{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditProduct 修改商品
|
||||
func (r *ProductDao) EditProduct(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.Product{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditProductByUserId 修改商品-商品id
|
||||
func (r *ProductDao) EditProductByUserId(tx *gorm.DB, productId int64, data interface{}) error {
|
||||
err := tx.Model(&model.Product{}).Where("product_id = ?", productId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetProductList 获取商品列表
|
||||
func (r *ProductDao) GetProductList(maps interface{}) (m []*model.Product, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddProduct 新增商品
|
||||
func (r *ProductDao) AddProduct(tx *gorm.DB, model *model.Product) (*model.Product, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type UserPharmacistDao struct {
|
||||
}
|
||||
|
||||
// GetUserPharmacistById 获取药师数据-药师id
|
||||
func (r *UserPharmacistDao) GetUserPharmacistById(pharmacistId int64) (m *model.UserPharmacist, err error) {
|
||||
err = global.Db.First(&m, pharmacistId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *UserPharmacistDao) GetUserPharmacistByUserId(userId int64) (m *model.UserPharmacist, err error) {
|
||||
err = global.Db.Where("user_id = ?", userId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetUserPharmacistPreloadById 获取药师数据-加载全部关联-药师id
|
||||
func (r *UserPharmacistDao) GetUserPharmacistPreloadById(pharmacistId int64) (m *model.UserPharmacist, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, pharmacistId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteUserPharmacist 删除药师
|
||||
func (r *UserPharmacistDao) DeleteUserPharmacist(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.UserPharmacist{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditUserPharmacist 修改药师
|
||||
func (r *UserPharmacistDao) EditUserPharmacist(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.UserPharmacist{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditUserPharmacistByUserId 修改药师-药师id
|
||||
func (r *UserPharmacistDao) EditUserPharmacistByUserId(tx *gorm.DB, userId int64, data interface{}) error {
|
||||
err := tx.Model(&model.UserPharmacist{}).Where("user_id = ?", userId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserPharmacistList 获取药师列表
|
||||
func (r *UserPharmacistDao) GetUserPharmacistList(maps interface{}) (m []*model.UserPharmacist, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddUserPharmacist 新增药师
|
||||
func (r *UserPharmacistDao) AddUserPharmacist(tx *gorm.DB, model *model.UserPharmacist) (*model.UserPharmacist, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type UserPharmacistInfoDao struct {
|
||||
}
|
||||
|
||||
// GetUserPharmacistInfoById 获取药师详情数据-药师详情id
|
||||
func (r *UserPharmacistInfoDao) GetUserPharmacistInfoById(infoId int64) (m *model.UserPharmacistInfo, err error) {
|
||||
err = global.Db.First(&m, infoId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *UserPharmacistInfoDao) GetUserPharmacistInfoByUserId(userId int64) (m *model.UserPharmacistInfo, err error) {
|
||||
err = global.Db.Where("user_id = ?", userId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *UserPharmacistInfoDao) GetUserPharmacistInfoByPharmacistId(pharmacistId int64) (m *model.UserPharmacistInfo, err error) {
|
||||
err = global.Db.Where("pharmacist_id = ?", pharmacistId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetUserPharmacistInfoPreloadById 获取药师详情数据-加载全部关联-药师详情id
|
||||
func (r *UserPharmacistInfoDao) GetUserPharmacistInfoPreloadById(infoId int64) (m *model.UserPharmacistInfo, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, infoId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteUserPharmacistInfo 删除药师详情
|
||||
func (r *UserPharmacistInfoDao) DeleteUserPharmacistInfo(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.UserPharmacistInfo{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditUserPharmacistInfo 修改药师详情
|
||||
func (r *UserPharmacistInfoDao) EditUserPharmacistInfo(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.UserPharmacistInfo{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditUserPharmacistInfoByUserId 修改药师详情-药师详情id
|
||||
func (r *UserPharmacistInfoDao) EditUserPharmacistInfoByUserId(tx *gorm.DB, userId int64, data interface{}) error {
|
||||
err := tx.Model(&model.UserPharmacistInfo{}).Where("user_id = ?", userId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditUserPharmacistInfoByPharmacistId 修改药师详情-药师详情id
|
||||
func (r *UserPharmacistInfoDao) EditUserPharmacistInfoByPharmacistId(tx *gorm.DB, pharmacistId int64, data interface{}) error {
|
||||
err := tx.Model(&model.UserPharmacistInfo{}).Where("pharmacist_id = ?", pharmacistId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserPharmacistInfoList 获取药师详情列表
|
||||
func (r *UserPharmacistInfoDao) GetUserPharmacistInfoList(maps interface{}) (m []*model.UserPharmacistInfo, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddUserPharmacistInfo 新增药师详情
|
||||
func (r *UserPharmacistInfoDao) AddUserPharmacistInfo(tx *gorm.DB, model *model.UserPharmacistInfo) (*model.UserPharmacistInfo, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
Reference in New Issue
Block a user