243
This commit is contained in:
parent
f8e208077a
commit
83a54826b6
@ -16,7 +16,18 @@ type OrderPrescriptionDao struct {
|
|||||||
|
|
||||||
// GetById 获取处方-处方id
|
// GetById 获取处方-处方id
|
||||||
func (r *OrderPrescriptionDao) GetById(orderPrescriptionId int64) (m *model.OrderPrescription, err error) {
|
func (r *OrderPrescriptionDao) GetById(orderPrescriptionId int64) (m *model.OrderPrescription, err error) {
|
||||||
err = global.Db.First(&m, orderPrescriptionId).Error
|
query := global.Db.Model(&model.OrderPrescription{})
|
||||||
|
|
||||||
|
// 处方关联问诊表(抄方用)
|
||||||
|
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "doctor_id")
|
||||||
|
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "doctor_id")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
err = query.First(&m, orderPrescriptionId).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user