72 lines
1.8 KiB
Go
72 lines
1.8 KiB
Go
package controller
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"hospital-admin-api/api/dao"
|
|
"hospital-admin-api/api/requests"
|
|
"hospital-admin-api/api/responses"
|
|
"hospital-admin-api/global"
|
|
"hospital-admin-api/utils"
|
|
)
|
|
|
|
// Export 导出
|
|
type Export struct{}
|
|
|
|
// DoctorWithdrawal 提现记录
|
|
func (r *Export) DoctorWithdrawal(c *gin.Context) {
|
|
doctorWithdrawalRequest := requests.DoctorWithdrawalRequest{}
|
|
req := doctorWithdrawalRequest.DoctorWithdrawalExportList
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
responses.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
|
|
// 参数验证
|
|
if err := global.Validate.Struct(req); err != nil {
|
|
responses.FailWithMessage(utils.Translate(err), c)
|
|
return
|
|
}
|
|
|
|
if req.Page == 0 {
|
|
req.Page = 1
|
|
}
|
|
|
|
if req.PageSize == 0 {
|
|
req.PageSize = 20
|
|
}
|
|
|
|
doctorWithdrawalDao := dao.DoctorWithdrawalDao{}
|
|
doctorWithdrawal, total, err := doctorWithdrawalDao.GetDoctorWithdrawalExportListSearch(req, req.Page, req.PageSize)
|
|
if err != nil {
|
|
responses.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
|
|
fmt.Println(doctorWithdrawal)
|
|
fmt.Println(total)
|
|
|
|
header := []utils.CellData{
|
|
{Value: "医生姓名", CellType: "string", NumberFmt: "", ColWidth: 18},
|
|
{Value: "医生手机号", CellType: "string", NumberFmt: "", ColWidth: 18},
|
|
{Value: "申请提现金额", CellType: "float", NumberFmt: "0.0000", ColWidth: 18},
|
|
{Value: "审核日期", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
|
}
|
|
|
|
_, err = utils.Export(header)
|
|
if err != nil {
|
|
responses.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
|
|
// 处理返回值
|
|
// res := dto.GetDoctorWithdrawalListDto(doctorWithdrawal)
|
|
//
|
|
// result := make(map[string]interface{})
|
|
// result["page"] = req.Page
|
|
// result["page_size"] = req.PageSize
|
|
// result["total"] = total
|
|
// result["data"] = res
|
|
responses.Ok(c)
|
|
}
|