新增了服务包订单导出、商品列表增加了商品id搜索条件
This commit is contained in:
@@ -282,6 +282,34 @@ type OrderProductData struct {
|
||||
CreatedAt time.Time // 创建时间
|
||||
}
|
||||
|
||||
// OrderServicePackageDto 订单-服务包
|
||||
type OrderServicePackageDto struct {
|
||||
OrderServiceNo string // 系统订单编号
|
||||
DoctorName string // 医生姓名
|
||||
PatientName string // 患者姓名-就诊人
|
||||
PatientSex string // 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
PatientAge int // 患者年龄-就诊人
|
||||
PatientMobile string // 患者电话
|
||||
EscrowTradeNo string // 第三方支付流水号
|
||||
OrderServiceType string // 服务包类型(1:健康包 2:随访包)
|
||||
OrderServiceStatus string // 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||
PayChannel string // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
PayStatus string // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
CancelReason string // 取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)
|
||||
AmountTotal float64 // 订单金额
|
||||
PaymentAmountTotal float64 // 实际付款金额
|
||||
PayTime time.Time // 支付时间
|
||||
StartTime time.Time // 开始服务时间
|
||||
FinishTime time.Time // 结束服务时间
|
||||
RefundStatus string // 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||
CancelTime time.Time // 订单取消时间
|
||||
CancelRemarks string // 取消订单备注
|
||||
AddFinishStatus string // 添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)
|
||||
AddFinishTime time.Time // 添加完成订单延迟队列时间
|
||||
AddFinishFailReason string // 添加完成订单延迟队列失败原因
|
||||
CreatedAt time.Time // 创建时间
|
||||
}
|
||||
|
||||
// OrderPrescriptionData 处方
|
||||
type OrderPrescriptionData struct {
|
||||
DoctorName string // 医生姓名
|
||||
@@ -1641,6 +1669,121 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
|
||||
return ossPath, nil
|
||||
}
|
||||
|
||||
// OrderServicePackage 服务包订单
|
||||
func (r *ExportService) OrderServicePackage(d []*model.OrderServicePackage) (string, error) {
|
||||
header := []utils.HeaderCellData{
|
||||
{Value: "系统订单编号", CellType: "string", NumberFmt: "", ColWidth: 25},
|
||||
{Value: "医生姓名", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "患者姓名-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "患者性别-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "患者年龄-就诊人", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "患者电话", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "第三方支付流水号", CellType: "string", NumberFmt: "", ColWidth: 35},
|
||||
{Value: "服务包类型", CellType: "string", NumberFmt: "", ColWidth: 25},
|
||||
{Value: "订单状态", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "支付渠道", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "支付状态", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "订单取消原因", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "订单金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18},
|
||||
{Value: "实际付款金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18},
|
||||
{Value: "支付时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "开始服务时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "结束服务时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "退款状态", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "订单取消时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "订单取消备注", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "添加完成订单延迟队列状态", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "添加完成订单延迟队列时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "添加完成订单延迟队列失败原因", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "创建时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
}
|
||||
|
||||
var dataSlice []interface{}
|
||||
for _, v := range d {
|
||||
data := OrderServicePackageDto{
|
||||
OrderServiceNo: v.OrderServiceNo,
|
||||
PatientName: v.PatientName,
|
||||
PatientSex: utils.SexToString(v.PatientSex),
|
||||
PatientAge: v.PatientAge,
|
||||
EscrowTradeNo: v.EscrowTradeNo,
|
||||
OrderServiceType: utils.OrderServiceTypeToString(v.OrderServiceType),
|
||||
OrderServiceStatus: utils.OrderServiceStatusToString(v.OrderServiceStatus),
|
||||
PayChannel: utils.PayChannelToString(v.PayChannel),
|
||||
PayStatus: utils.PayStatusToString(v.PayStatus),
|
||||
CancelReason: utils.OrderServicePackageCancelReasonToString(v.CancelReason),
|
||||
AmountTotal: v.AmountTotal,
|
||||
PaymentAmountTotal: v.AmountTotal,
|
||||
RefundStatus: utils.RefundStatusToString(v.RefundStatus),
|
||||
CancelRemarks: v.CancelRemarks,
|
||||
AddFinishStatus: utils.AddFinishStatusToString(v.AddFinishStatus),
|
||||
AddFinishFailReason: v.AddFinishFailReason,
|
||||
}
|
||||
|
||||
if v.UserDoctor != nil {
|
||||
// 医生姓名
|
||||
data.DoctorName = v.UserDoctor.UserName
|
||||
}
|
||||
|
||||
if v.UserPatient != nil {
|
||||
if v.UserPatient.User != nil {
|
||||
data.PatientMobile = v.UserPatient.User.Mobile
|
||||
}
|
||||
}
|
||||
|
||||
if v.PayTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.PayTime)
|
||||
data.PayTime = t
|
||||
}
|
||||
|
||||
if v.StartTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.StartTime)
|
||||
data.StartTime = t
|
||||
}
|
||||
|
||||
if v.FinishTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.FinishTime)
|
||||
data.FinishTime = t
|
||||
}
|
||||
|
||||
if v.CancelTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.CancelTime)
|
||||
data.CancelTime = t
|
||||
}
|
||||
|
||||
if v.AddFinishTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.AddFinishTime)
|
||||
data.AddFinishTime = t
|
||||
}
|
||||
|
||||
if v.CreatedAt != (model.LocalTime{}) {
|
||||
t := time.Time(v.CreatedAt)
|
||||
data.CreatedAt = t
|
||||
}
|
||||
|
||||
dataSlice = append(dataSlice, data)
|
||||
}
|
||||
|
||||
file, err := utils.Export(header, dataSlice)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 设置文件名字
|
||||
now := time.Now()
|
||||
dateTimeString := now.Format("20060102150405") // 当前时间字符串
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // 设置随机数
|
||||
ossPath := "admin/export/服务包订单" + dateTimeString + fmt.Sprintf("%d", rand.Intn(9000)+1000) + ".xlsx"
|
||||
|
||||
// 上传oss
|
||||
_, err = aliyun.PutObjectByte(ossPath, file.Bytes())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ossPath = utils.AddOssDomain("/" + ossPath)
|
||||
return ossPath, nil
|
||||
}
|
||||
|
||||
// OrderPrescription 处方
|
||||
func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string, error) {
|
||||
header := []utils.HeaderCellData{
|
||||
|
||||
Reference in New Issue
Block a user