药品订单列表新增厨房变好

This commit is contained in:
wucongxing 2023-09-14 15:22:15 +08:00
parent e1887b52e7
commit 3113f2471b
3 changed files with 54 additions and 43 deletions

View File

@ -96,6 +96,11 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
}
// 处方
query = query.Preload("OrderPrescription", func(db *gorm.DB) *gorm.DB {
return db.Select("order_prescription_id", "prescription_code")
})
// 问诊订单
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age")

View File

@ -51,6 +51,7 @@ type OrderProduct struct {
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 问诊
UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"` // 患者
OrderPrescription *OrderPrescription `gorm:"foreignKey:OrderPrescriptionId;references:order_prescription_id" json:"order_prescription"` // 处方
Model
}

View File

@ -35,6 +35,7 @@ type getOrderProductPage struct {
Remarks string `json:"remarks"` // 订单备注
RefundStatus int `json:"refund_status"` // 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态0:未上报 1:已上报 2:上报失败))
PrescriptionCode string `json:"prescription_code"` // 处方编号
ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码)
ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码)
DoctorName string `json:"doctor_name"` // 医生姓名
@ -154,6 +155,10 @@ func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderP
res.PatientAge = v.OrderInquiry.PatientAge
}
if v.OrderPrescription != nil {
res.PrescriptionCode = v.OrderPrescription.PrescriptionCode
}
// 将转换后的结构体添加到新切片中
getOrderProductPages[i] = res
}