处方列表导出

This commit is contained in:
wucongxing8150 2024-02-27 17:27:10 +08:00
parent 882fcb9a55
commit f11895c113

View File

@ -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 // 患者年龄-就诊人
@ -438,7 +439,7 @@ func (r *ExportService) DoctorWithdrawal(doctorWithdrawals []*model.DoctorWithdr
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/提现记录" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -558,7 +559,7 @@ func (r *ExportService) DoctorWithdrawalOrder(doctorWithdrawalOrders []*model.Do
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/提现记录-关联订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -878,7 +879,7 @@ func (r *ExportService) UserDoctor(userDoctors []*model.UserDoctor) (string, err
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/医生列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -944,7 +945,7 @@ func (r *ExportService) UserDoctorBankCard(d []*model.DoctorBankCard) (string, e
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/医生银行卡列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -1010,7 +1011,7 @@ func (r *ExportService) DoctorAccount(d []*model.DoctorAccount) (string, error)
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/医生账户" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -1158,7 +1159,7 @@ func (r *ExportService) OrderInquiryForAccount(d []*model.OrderInquiry) (string,
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/医生账户-关联订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -1215,7 +1216,7 @@ func (r *ExportService) UserPatient(d []*model.UserPatient) (string, error) {
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/患者列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -1299,7 +1300,7 @@ func (r *ExportService) PatientFamily(d []*model.PatientFamily) (string, error)
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/就诊人列表" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss
@ -1447,7 +1448,7 @@ func (r *ExportService) OrderInquiry(d []*model.OrderInquiry) (string, error) {
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
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)
@ -1602,7 +1603,7 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
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)
}
@ -1720,7 +1736,7 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string,
// 设置文件名字
now := time.Now()
dateTimeString := now.Format("20060102150405") // 当前时间字符串
rand.Seed(time.Now().UnixNano()) // 设置随机数
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
ossPath := "admin/export/处方" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
// 上传oss