医生列表-导出
This commit is contained in:
+370
-35
@@ -8,6 +8,8 @@ import (
|
||||
"hospital-admin-api/extend/aliyun"
|
||||
"hospital-admin-api/utils"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -37,6 +39,7 @@ type DoctorWithdrawalData struct {
|
||||
CreatedAt time.Time // 创建时间
|
||||
}
|
||||
|
||||
// DoctorWithdrawalOrderData 提现记录-关联订单
|
||||
type DoctorWithdrawalOrderData struct {
|
||||
DoctorName string // 医生姓名
|
||||
PatientName string // 患者姓名-就诊人
|
||||
@@ -55,6 +58,59 @@ type DoctorWithdrawalOrderData struct {
|
||||
|
||||
}
|
||||
|
||||
// UserDoctorData 医生列表
|
||||
type UserDoctorData struct {
|
||||
UserName string // 用户名称
|
||||
Status string // 状态(0:禁用 1:正常 2:删除)
|
||||
IdcardStatus string // 实名认证状态(0:未认证 1:认证通过 2:认证失败)
|
||||
IdenAuthStatus string // 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
IdenAuthTime time.Time // 审核时间
|
||||
IdenAuthFailReason string // 身份认证失败原因
|
||||
MultiPointStatus string // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
MultiPointTime time.Time // 审核时间
|
||||
MultiPointFailReason string // 多点执业认证失败原因
|
||||
IsRecommend string // 是否首页推荐(0:否 1:是)
|
||||
Avatar string // 头像
|
||||
DoctorTitle string // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
DepartmentCustomName string // 科室名称(如未自己输入,填入标准科室名称)
|
||||
DepartmentCustomMobile string // 科室电话
|
||||
HospitalName string // 医院名称
|
||||
ServedPatientsNum string // 服务患者数量(订单结束时统计)
|
||||
PraiseRate float64 // 好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)
|
||||
AvgResponseTime float64 // 平均响应时间(分钟制)
|
||||
NumberOfFans string // 被关注数量
|
||||
IsOnline string // 是否在线(0:不在线 1:在线)
|
||||
IsPlatformDeepCooperation string // 是否平台深度合作医生(0:否 1:是)
|
||||
IsEnterpriseDeepCooperation string // 是否企业深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation string // 是否先思达合作医生(0:否 1:是)
|
||||
QrCode string // 分享二维码
|
||||
BeGoodAt string // 擅长
|
||||
BriefIntroduction string // 医生简介
|
||||
CreatedAt time.Time // 创建时间
|
||||
Mobile string // 手机号
|
||||
Age string // 年龄
|
||||
Sex string // 性别(0:未知 1:男 2:女)
|
||||
RegisterMethod string // 注册方式(1:微信小程序 2:后台添加 )
|
||||
CreatedBy string // 创建者
|
||||
InquiryType string // 服务类型
|
||||
CardType string // 类型(1:身份证 2:护照 3:港澳通行证 4:台胞证);NOT NULL
|
||||
CardName string // 证件姓名
|
||||
CardNum string // 证件号码
|
||||
LicenseCert string // 医师执业证(逗号分隔)
|
||||
QualificationCert string // 医师资格证(逗号分隔)
|
||||
QualificationCertNum string // 医师资格证号(逗号分隔)
|
||||
WorkCert string // 医师工作证(逗号分隔)
|
||||
MultiPointImages string // 多点执业备案信息(逗号分隔)
|
||||
IdCardFront string // 身份证正面图片
|
||||
IdCardBack string // 身份证背面图片
|
||||
SignImage string // 签名图片
|
||||
CertApplicationTime time.Time // ca证书申请时间
|
||||
CertExpireTime time.Time // ca证书过期时间
|
||||
BankName string // 开户银行名称
|
||||
BankCardCode string // 开户银行卡号
|
||||
BankCardAddress string // 开户银行地址
|
||||
}
|
||||
|
||||
// DoctorWithdrawal 提现记录
|
||||
func (r *ExportService) DoctorWithdrawal(doctorWithdrawals []*model.DoctorWithdrawal) (string, error) {
|
||||
header := []utils.HeaderCellData{
|
||||
@@ -81,14 +137,7 @@ func (r *ExportService) DoctorWithdrawal(doctorWithdrawals []*model.DoctorWithdr
|
||||
var interfaceSlice []interface{}
|
||||
for _, v := range doctorWithdrawals {
|
||||
// 审核状态
|
||||
examineStatus := "未知"
|
||||
if v.ExamineStatus == 1 {
|
||||
examineStatus = "审核中"
|
||||
} else if v.ExamineStatus == 2 {
|
||||
examineStatus = "审核通过"
|
||||
} else if v.ExamineStatus == 3 {
|
||||
examineStatus = "审核未通过"
|
||||
}
|
||||
examineStatus := utils.WithdrawalExamineStatusToString(v.ExamineStatus)
|
||||
|
||||
// 审核人员
|
||||
examineBy := ""
|
||||
@@ -250,11 +299,8 @@ func (r *ExportService) DoctorWithdrawalOrder(doctorWithdrawalOrders []*model.Do
|
||||
if v.OrderInquiry != nil {
|
||||
patientName = v.OrderInquiry.PatientName
|
||||
|
||||
if v.OrderInquiry.PatientSex == 1 {
|
||||
patientSex = "男"
|
||||
} else if v.OrderInquiry.PatientSex == 2 {
|
||||
patientSex = "女"
|
||||
}
|
||||
// 患者性别
|
||||
patientSex = utils.SexToString(v.OrderInquiry.PatientSex)
|
||||
|
||||
// 患者年龄
|
||||
patientAge = fmt.Sprintf("%d", v.OrderInquiry.PatientAge)
|
||||
@@ -265,32 +311,13 @@ func (r *ExportService) DoctorWithdrawalOrder(doctorWithdrawalOrders []*model.Do
|
||||
}
|
||||
|
||||
// 支付渠道
|
||||
if v.OrderInquiry.InquiryPayChannel == 1 {
|
||||
payChannel = "小程序支付"
|
||||
} else if v.OrderInquiry.InquiryPayChannel == 2 {
|
||||
payChannel = "微信扫码支付"
|
||||
} else if v.OrderInquiry.InquiryPayChannel == 3 {
|
||||
payChannel = "模拟支付"
|
||||
}
|
||||
payChannel = utils.PayChannelToString(v.OrderInquiry.InquiryPayChannel)
|
||||
|
||||
inquiryNo = v.OrderInquiry.InquiryNo
|
||||
escrowTradeNo = v.OrderInquiry.EscrowTradeNo
|
||||
|
||||
if v.OrderInquiry.InquiryStatus == 1 {
|
||||
inquiryStatus = "待支付"
|
||||
} else if v.OrderInquiry.InquiryStatus == 2 {
|
||||
inquiryStatus = "待分配"
|
||||
} else if v.OrderInquiry.InquiryStatus == 3 {
|
||||
inquiryStatus = "待接诊"
|
||||
} else if v.OrderInquiry.InquiryStatus == 4 {
|
||||
inquiryStatus = "已接诊"
|
||||
} else if v.OrderInquiry.InquiryStatus == 5 {
|
||||
inquiryStatus = "已完成"
|
||||
} else if v.OrderInquiry.InquiryStatus == 6 {
|
||||
inquiryStatus = "已结束"
|
||||
} else if v.OrderInquiry.InquiryStatus == 7 {
|
||||
inquiryStatus = "已取消"
|
||||
}
|
||||
// 问诊订单状态
|
||||
inquiryStatus = utils.InquiryStatusToString(v.OrderInquiry.InquiryStatus)
|
||||
|
||||
amountTotal = v.OrderInquiry.AmountTotal
|
||||
couponAmountTotal = v.OrderInquiry.CouponAmountTotal
|
||||
@@ -347,3 +374,311 @@ func (r *ExportService) DoctorWithdrawalOrder(doctorWithdrawalOrders []*model.Do
|
||||
ossPath = utils.AddOssDomain("/" + ossPath)
|
||||
return ossPath, nil
|
||||
}
|
||||
|
||||
// UserDoctor 医生列表
|
||||
func (r *ExportService) UserDoctor(userDoctors []*model.UserDoctor) (string, error) {
|
||||
header := []utils.HeaderCellData{
|
||||
{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: "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: 25},
|
||||
{Value: "首页推荐", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "头像", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{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: 18},
|
||||
{Value: "好评率(百分制)", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{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: 50},
|
||||
{Value: "擅长", CellType: "string", NumberFmt: "", ColWidth: 40},
|
||||
{Value: "医生简介", CellType: "string", NumberFmt: "", ColWidth: 40},
|
||||
{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: "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: 18},
|
||||
{Value: "证件号码", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "医师执业证", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "医师资格证", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "医师资格证号", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "医师工作证", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "多点执业备案信息", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "身份证正面图片", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "身份证背面图片", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "签名图片", CellType: "string", NumberFmt: "", ColWidth: 50},
|
||||
{Value: "ca证书申请时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "ca证书过期时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
{Value: "银行名称", CellType: "string", NumberFmt: "", ColWidth: 25},
|
||||
{Value: "银行卡号", CellType: "string", NumberFmt: "", ColWidth: 27},
|
||||
{Value: "银行地址", CellType: "string", NumberFmt: "", ColWidth: 46},
|
||||
}
|
||||
|
||||
var interfaceSlice []interface{}
|
||||
for _, v := range userDoctors {
|
||||
userDoctorData := UserDoctorData{
|
||||
UserName: v.UserName,
|
||||
Status: utils.UserDoctorStatusToString(v.Status),
|
||||
IdcardStatus: utils.IdcardStatusToString(v.IdcardStatus),
|
||||
IdenAuthStatus: utils.IdenAuthStatusToString(v.IdenAuthStatus),
|
||||
IdenAuthFailReason: v.IdenAuthFailReason,
|
||||
MultiPointStatus: utils.MultiPointStatusToString(v.MultiPointStatus),
|
||||
MultiPointFailReason: v.MultiPointFailReason,
|
||||
IsRecommend: utils.IsRecommendToString(v.IsRecommend),
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DoctorTitle: utils.DoctorTitleToString(v.DoctorTitle),
|
||||
DepartmentCustomName: v.DepartmentCustomName,
|
||||
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
||||
ServedPatientsNum: fmt.Sprintf("%d", v.ServedPatientsNum),
|
||||
PraiseRate: v.PraiseRate,
|
||||
AvgResponseTime: v.AvgResponseTime,
|
||||
NumberOfFans: fmt.Sprintf("%d", v.NumberOfFans),
|
||||
IsOnline: utils.IsOnlineToString(v.IsOnline),
|
||||
IsPlatformDeepCooperation: utils.IsPlatformDeepCooperationToString(v.IsPlatformDeepCooperation),
|
||||
IsEnterpriseDeepCooperation: utils.IsEnterpriseDeepCooperationToString(v.IsEnterpriseDeepCooperation),
|
||||
IsSysDiagnoCooperation: utils.IsSysDiagnoCooperationToString(v.IsSysDiagnoCooperation),
|
||||
QrCode: utils.AddOssDomain(v.QrCode),
|
||||
BeGoodAt: v.BeGoodAt,
|
||||
BriefIntroduction: v.BriefIntroduction,
|
||||
}
|
||||
|
||||
if v.User != nil {
|
||||
// 性别
|
||||
userDoctorData.Sex = utils.SexToString(v.User.Sex)
|
||||
|
||||
// 注册方式
|
||||
userDoctorData.RegisterMethod = utils.RegisterMethodToString(v.User.RegisterMethod)
|
||||
|
||||
// 手机号
|
||||
userDoctorData.Mobile = v.User.Mobile
|
||||
|
||||
// 年龄
|
||||
userDoctorData.Age = fmt.Sprintf("%d", v.User.Age)
|
||||
|
||||
// 性别
|
||||
userDoctorData.Sex = utils.SexToString(v.User.Sex)
|
||||
|
||||
// 创建者
|
||||
if v.User.CreatedBy != "" {
|
||||
if v.User.RegisterMethod == 1 {
|
||||
// 注册方式-微信小程序
|
||||
userDoctorData.CreatedBy = v.User.UserName
|
||||
} else {
|
||||
// 注册方式-后台添加
|
||||
userId, err := strconv.ParseInt(v.User.CreatedBy, 10, 64)
|
||||
if err == nil {
|
||||
// 获取用户详情
|
||||
AdminUserDao := dao.AdminUserDao{}
|
||||
adminUser, _ := AdminUserDao.GetAdminUserFirstById(userId)
|
||||
if adminUser != nil {
|
||||
userDoctorData.CreatedBy = adminUser.NickName
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// 注册方式-微信小程序
|
||||
userDoctorData.CreatedBy = v.User.UserName
|
||||
}
|
||||
}
|
||||
|
||||
if v.UserDoctorInfo != nil {
|
||||
// 身份类型
|
||||
userDoctorData.CardType = utils.CardTypeToString(v.UserDoctorInfo.CardType)
|
||||
|
||||
// 证件姓名
|
||||
userDoctorData.CardName = v.UserDoctorInfo.CardName
|
||||
|
||||
// 证件号码
|
||||
userDoctorData.CardNum = v.UserDoctorInfo.CardNum
|
||||
|
||||
// 医师执业证
|
||||
var licenseCertSlice []string
|
||||
if v.UserDoctorInfo.LicenseCert != "" {
|
||||
result := strings.Split(v.UserDoctorInfo.LicenseCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = utils.AddOssDomain(v)
|
||||
licenseCertSlice = append(licenseCertSlice, v)
|
||||
}
|
||||
|
||||
userDoctorData.LicenseCert = strings.Join(licenseCertSlice, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// 医师资格证
|
||||
var QualificationCertSlice []string
|
||||
if v.UserDoctorInfo.QualificationCert != "" {
|
||||
result := strings.Split(v.UserDoctorInfo.QualificationCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = utils.AddOssDomain(v)
|
||||
QualificationCertSlice = append(QualificationCertSlice, v)
|
||||
}
|
||||
|
||||
userDoctorData.QualificationCert = strings.Join(QualificationCertSlice, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// 医师资格证号
|
||||
userDoctorData.QualificationCertNum = v.UserDoctorInfo.QualificationCertNum
|
||||
|
||||
// 医师工作证
|
||||
var WorkCertSlice []string
|
||||
if v.UserDoctorInfo.QualificationCert != "" {
|
||||
result := strings.Split(v.UserDoctorInfo.QualificationCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = utils.AddOssDomain(v)
|
||||
WorkCertSlice = append(WorkCertSlice, v)
|
||||
}
|
||||
|
||||
userDoctorData.WorkCert = strings.Join(WorkCertSlice, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// 多点执业备案信息
|
||||
var MultiPointImagesSlice []string
|
||||
if v.UserDoctorInfo.MultiPointImages != "" {
|
||||
result := strings.Split(v.UserDoctorInfo.MultiPointImages, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = utils.AddOssDomain(v)
|
||||
MultiPointImagesSlice = append(MultiPointImagesSlice, v)
|
||||
}
|
||||
|
||||
userDoctorData.MultiPointImages = strings.Join(MultiPointImagesSlice, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// 身份证正面图片
|
||||
userDoctorData.IdCardFront = utils.AddOssDomain(v.UserDoctorInfo.IdCardFront)
|
||||
|
||||
// 身份证背面图片
|
||||
userDoctorData.IdCardBack = utils.AddOssDomain(v.UserDoctorInfo.IdCardBack)
|
||||
|
||||
// 签名图片
|
||||
userDoctorData.SignImage = utils.AddOssDomain(v.UserDoctorInfo.SignImage)
|
||||
}
|
||||
|
||||
// 医院名称
|
||||
if v.Hospital != nil {
|
||||
userDoctorData.HospitalName = v.Hospital.HospitalName
|
||||
}
|
||||
|
||||
// 获取银行卡数据
|
||||
doctorBankCardDao := dao.DoctorBankCardDao{}
|
||||
doctorBankCard, _ := doctorBankCardDao.GetDoctorBankCardByDoctorId(v.DoctorId)
|
||||
if doctorBankCard != nil {
|
||||
basicBankDao := dao.BasicBankDao{}
|
||||
basicBank, _ := basicBankDao.GetBasicBankById(doctorBankCard.BankId)
|
||||
if basicBank != nil {
|
||||
// 银行名称
|
||||
userDoctorData.BankName = basicBank.BankName
|
||||
}
|
||||
|
||||
// 银行卡号
|
||||
userDoctorData.BankCardCode = doctorBankCard.BankCardCode
|
||||
|
||||
// 开户行地址
|
||||
userDoctorData.BankCardAddress = doctorBankCard.Province + doctorBankCard.City + doctorBankCard.County
|
||||
}
|
||||
|
||||
// 身份审核时间
|
||||
if v.IdenAuthTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.IdenAuthTime)
|
||||
userDoctorData.IdenAuthTime = t
|
||||
}
|
||||
|
||||
// 多点审核时间
|
||||
if v.MultiPointTime != (model.LocalTime{}) {
|
||||
t := time.Time(v.MultiPointTime)
|
||||
userDoctorData.MultiPointTime = t
|
||||
}
|
||||
|
||||
// 创建时间
|
||||
if v.CreatedAt != (model.LocalTime{}) {
|
||||
t := time.Time(v.CreatedAt)
|
||||
userDoctorData.CreatedAt = t
|
||||
}
|
||||
|
||||
// 获取ca证书
|
||||
userCaCertDao := dao.UserCaCertDao{}
|
||||
userCaCert, _ := userCaCertDao.GetUserCaCertByUserId(v.UserId)
|
||||
if userCaCert != nil {
|
||||
// ca证书申请时间
|
||||
if userCaCert.CertApplicationTime != (model.LocalTime{}) {
|
||||
t := time.Time(userCaCert.CertApplicationTime)
|
||||
userDoctorData.CertApplicationTime = t
|
||||
}
|
||||
|
||||
// ca证书过期时间
|
||||
if userCaCert.CertExpireTime != (model.LocalTime{}) {
|
||||
t := time.Time(userCaCert.CertExpireTime)
|
||||
userDoctorData.CertExpireTime = t
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.DoctorInquiryConfig) > 0 {
|
||||
var inquiryTypes []string
|
||||
for _, v := range v.DoctorInquiryConfig {
|
||||
if v.InquiryType == 1 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "专家问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 2 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "快速问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 3 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "公益问诊")
|
||||
}
|
||||
|
||||
if v.InquiryType == 4 && v.InquiryMode == 1 && v.IsEnable == 1 {
|
||||
inquiryTypes = append(inquiryTypes, "问诊购药")
|
||||
}
|
||||
}
|
||||
|
||||
if len(inquiryTypes) > 0 {
|
||||
// 服务类型
|
||||
userDoctorData.InquiryType = strings.Join(inquiryTypes, ",")
|
||||
}
|
||||
}
|
||||
interfaceSlice = append(interfaceSlice, userDoctorData)
|
||||
}
|
||||
|
||||
file, err := utils.Export(header, interfaceSlice)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 设置文件名字
|
||||
now := time.Now()
|
||||
dateTimeString := now.Format("20060102150405") // 当前时间字符串
|
||||
rand.Seed(time.Now().UnixNano()) // 设置随机数
|
||||
ossPath := "admin/export/output" + 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user