新增 获取问诊订单列表-分页,修正取消问诊订单
This commit is contained in:
@@ -2,8 +2,13 @@ package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses"
|
||||
"hospital-admin-api/api/responses/orderInquiryResponse"
|
||||
"hospital-admin-api/api/service"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -11,7 +16,47 @@ type OrderInquiry struct{}
|
||||
|
||||
// GetOrderInquiryPage 获取问诊订单列表-分页
|
||||
func (r *OrderInquiry) GetOrderInquiryPage(c *gin.Context) {
|
||||
responses.Ok(c)
|
||||
req := requests.OrderInquiryRequest{}
|
||||
if err := c.ShouldBind(&req.GetOrderInquiryPage); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req.GetOrderInquiryPage); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.GetOrderInquiryPage.Page == 0 {
|
||||
req.GetOrderInquiryPage.Page = 1
|
||||
}
|
||||
|
||||
if req.GetOrderInquiryPage.PageSize == 0 {
|
||||
req.GetOrderInquiryPage.PageSize = 20
|
||||
}
|
||||
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, total, err := orderInquiryDao.GetOrderInquiryPageSearch(req.GetOrderInquiryPage, req.GetOrderInquiryPage.Page, req.GetOrderInquiryPage.PageSize)
|
||||
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
GetOrderInquiryPageResponses := orderInquiryResponse.GetOrderInquiryPageResponse(orderInquiry)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.GetOrderInquiryPage.Page
|
||||
result["page_size"] = req.GetOrderInquiryPage.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = GetOrderInquiryPageResponses
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetOrderInquiry 问诊订单详情
|
||||
|
||||
Reference in New Issue
Block a user