药品、处方列表关联药房信息
This commit is contained in:
@@ -27,6 +27,9 @@ func (r *OrderPrescriptionDao) GetById(orderPrescriptionId int64) (m *model.Orde
|
||||
})
|
||||
})
|
||||
|
||||
// 药房
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
err = query.First(&m, orderPrescriptionId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -100,6 +103,9 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
||||
query = query.Where("gdxz_order_inquiry.annual_review_hide = ?", req.AnnualReviewHide)
|
||||
}
|
||||
|
||||
// 药房表
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 患者表
|
||||
query = query.Preload("UserPatient", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
@@ -130,6 +136,17 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where("prescription_code = ?", req.PrescriptionCode)
|
||||
@@ -311,6 +328,20 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionTransferPageSearch(req reques
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 药房表
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where(prescriptionTable+".prescription_code = ?", req.PrescriptionCode)
|
||||
@@ -504,8 +535,22 @@ func (r *OrderPrescriptionDao) GetOrderTransferPrescriptionExportListSearch(req
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 药房表
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 当前搜索数据
|
||||
if req.Type == 1 {
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where(prescriptionTable+".pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where("prescription_code = ?", req.PrescriptionCode)
|
||||
@@ -687,8 +732,22 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionExportListSearch(req requests
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 药房表
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 当前搜索数据
|
||||
if req.Type == 1 {
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where("gdxz_order_prescription.pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where("prescription_code = ?", req.PrescriptionCode)
|
||||
|
||||
@@ -132,6 +132,20 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
// 药品数据
|
||||
query = query.Preload("OrderProductItem")
|
||||
|
||||
// 药房数据
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 医生
|
||||
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
@@ -463,8 +477,22 @@ func (r *OrderProductDao) GetOrderProductExportListSearch(req requests.OrderProd
|
||||
// 药品列表-药品
|
||||
query = query.Preload("OrderProductItem.Product")
|
||||
|
||||
// 药房数据
|
||||
query = query.Preload("Pharmacy")
|
||||
|
||||
// 当前搜索数据
|
||||
if req.Type == 1 {
|
||||
// 药房筛选
|
||||
if req.PharmacyId != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_id = ?", req.PharmacyId)
|
||||
}
|
||||
if req.PharmacyCode != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_code LIKE ?", "%"+req.PharmacyCode+"%")
|
||||
}
|
||||
if req.PharmacyName != "" {
|
||||
query = query.Where("gdxz_order_product.pharmacy_name LIKE ?", "%"+req.PharmacyName+"%")
|
||||
}
|
||||
|
||||
// 医生姓名 - 同时查询原医生和抄方医生
|
||||
if req.DoctorName != "" {
|
||||
// 原医生查询条件
|
||||
|
||||
Reference in New Issue
Block a user