This commit is contained in:
haomingming 2026-01-06 17:27:49 +08:00
parent fce126bbbd
commit 6a9688b34f
2 changed files with 10 additions and 3 deletions

View File

@ -459,7 +459,7 @@ func (r *OrderPrescriptionDao) GetOrderTransferPrescriptionExportListSearch(req
// 关联抄方医生对应的用户表(用于按用户姓名查询) // 关联抄方医生对应的用户表(用于按用户姓名查询)
query = query.Joins("LEFT JOIN " + userTable + " ON " + doctorTable + ".user_id = " + userTable + ".user_id") query = query.Joins("LEFT JOIN " + userTable + " ON " + doctorTable + ".user_id = " + userTable + ".user_id")
// 患者表 // 患者表
query = query.Preload("UserPatient", func(db *gorm.DB) *gorm.DB { query = query.Preload("UserPatient", func(db *gorm.DB) *gorm.DB {
return db.Omit("open_id", "union_id", "wx_session_key") return db.Omit("open_id", "union_id", "wx_session_key")
@ -483,6 +483,13 @@ func (r *OrderPrescriptionDao) GetOrderTransferPrescriptionExportListSearch(req
// 处方关联疾病表 // 处方关联疾病表
query = query.Preload("OrderPrescriptionIcd") query = query.Preload("OrderPrescriptionIcd")
// 处方关联问诊表(抄方用)
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")
})
})
// 患者家庭成员表 // 患者家庭成员表
query = query.Preload("PatientFamily") query = query.Preload("PatientFamily")

View File

@ -1830,9 +1830,9 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string,
DoctorAdvice: v.DoctorAdvice, DoctorAdvice: v.DoctorAdvice,
} }
if v.UserDoctor != nil { if v.OrderInquiry !=nil && v.OrderInquiry.UserDoctor != nil {
// 医生姓名 // 医生姓名
data.DoctorName = v.UserDoctor.UserName data.DoctorName = v.OrderInquiry.UserDoctor.UserName
} }
if v.UserPharmacist != nil { if v.UserPharmacist != nil {