diff --git a/api/service/export.go b/api/service/export.go index 60a4dad..101992a 100644 --- a/api/service/export.go +++ b/api/service/export.go @@ -298,6 +298,7 @@ type OrderPrescriptionData struct { ExpiredTime time.Time // 处方过期时间 IsDelete string // 是否删除(0:否 1:是) PrescriptionCode string // 处方编号 + ProductNames string // 药品列表 PatientName string // 患者姓名-就诊人 PatientSex string // 患者性别-就诊人(1:男 2:女) PatientAge string // 患者年龄-就诊人 @@ -437,8 +438,8 @@ func (r *ExportService) DoctorWithdrawal(doctorWithdrawals []*model.DoctorWithdr // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/提现记录" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -557,8 +558,8 @@ func (r *ExportService) DoctorWithdrawalOrder(doctorWithdrawalOrders []*model.Do // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/提现记录-关联订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -877,8 +878,8 @@ func (r *ExportService) UserDoctor(userDoctors []*model.UserDoctor) (string, err // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/医生列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -943,8 +944,8 @@ func (r *ExportService) UserDoctorBankCard(d []*model.DoctorBankCard) (string, e // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/医生银行卡列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1009,8 +1010,8 @@ func (r *ExportService) DoctorAccount(d []*model.DoctorAccount) (string, error) // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/医生账户" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1157,8 +1158,8 @@ func (r *ExportService) OrderInquiryForAccount(d []*model.OrderInquiry) (string, // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/医生账户-关联订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1214,8 +1215,8 @@ func (r *ExportService) UserPatient(d []*model.UserPatient) (string, error) { // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/患者列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1298,8 +1299,8 @@ func (r *ExportService) PatientFamily(d []*model.PatientFamily) (string, error) // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/就诊人列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1446,8 +1447,8 @@ func (r *ExportService) OrderInquiry(d []*model.OrderInquiry) (string, error) { // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/问诊订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1584,11 +1585,11 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) { var products []string for _, v := range orderProductItems { amount := fmt.Sprintf("%d", v.Amount) - product := v.ProductName + "(数量:" + amount + ")" + product := v.ProductName + "(N:" + amount + ")" products = append(products, product) } - data.ProductNames = strings.Join(products, ";") + data.ProductNames = strings.Join(products, "; ") } dataSlice = append(dataSlice, data) @@ -1601,8 +1602,8 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) { // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/药品订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss @@ -1632,6 +1633,7 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string, {Value: "处方过期时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30}, {Value: "是否删除", CellType: "string", NumberFmt: "", ColWidth: 18}, {Value: "处方编号", CellType: "string", NumberFmt: "", ColWidth: 28}, + {Value: "药品", CellType: "string", NumberFmt: "", ColWidth: 35}, {Value: "患者姓名-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18}, {Value: "患者性别-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18}, {Value: "患者年龄-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18}, @@ -1709,6 +1711,20 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string, data.CreatedAt = t } + // 处理厨房药品列表 + orderPrescriptionProductDao := dao.OrderPrescriptionProductDao{} + orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(v.OrderPrescriptionId) + if err == nil && len(orderPrescriptionProducts) > 0 { + var products []string + for _, v := range orderPrescriptionProducts { + prescriptionProductNum := fmt.Sprintf("%d", v.PrescriptionProductNum) + product := v.ProductName + "(N:" + prescriptionProductNum + ")" + products = append(products, product) + } + + data.ProductNames = strings.Join(products, "; ") + } + dataSlice = append(dataSlice, data) } @@ -1719,8 +1735,8 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string, // 设置文件名字 now := time.Now() - dateTimeString := now.Format("20060102150405") // 当前时间字符串 - rand.Seed(time.Now().UnixNano()) // 设置随机数 + dateTimeString := now.Format("20060102150405") // 当前时间字符串 + rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数 ossPath := "admin/export/处方" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx" // 上传oss