新增获取处方列表-分页
This commit is contained in:
+14
-8
@@ -2,14 +2,15 @@ package controller
|
||||
|
||||
// Api api接口
|
||||
type Api struct {
|
||||
sysSetting // 系统设置
|
||||
userDoctorManage // 医生管理
|
||||
Admin // 公共方法-验证权限
|
||||
Public // 公共方法-不验证权限
|
||||
basic // 基础数据
|
||||
order // 订单管理
|
||||
userPatientManage // 患者管理
|
||||
caseManage // 病例管理
|
||||
sysSetting // 系统设置
|
||||
userDoctorManage // 医生管理
|
||||
Admin // 公共方法-验证权限
|
||||
Public // 公共方法-不验证权限
|
||||
basic // 基础数据
|
||||
order // 订单管理
|
||||
userPatientManage // 患者管理
|
||||
caseManage // 病例管理
|
||||
orderPrescriptionManage // 处方管理
|
||||
}
|
||||
|
||||
// SysSetting 系统设置
|
||||
@@ -53,3 +54,8 @@ type userPatientManage struct {
|
||||
type caseManage struct {
|
||||
Case // 患者列表
|
||||
}
|
||||
|
||||
// 处方管理
|
||||
type orderPrescriptionManage struct {
|
||||
OrderPrescription // 处方列表
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
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/orderPrescriptionResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type OrderPrescription struct{}
|
||||
|
||||
// GetOrderPrescriptionPage 获取处方列表-分页
|
||||
func (r *OrderPrescription) GetOrderPrescriptionPage(c *gin.Context) {
|
||||
req := requests.OrderPrescriptionRequest{}
|
||||
if err := c.ShouldBind(&req.GetOrderPrescriptionPage); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req.GetOrderPrescriptionPage); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.GetOrderPrescriptionPage.Page == 0 {
|
||||
req.GetOrderPrescriptionPage.Page = 1
|
||||
}
|
||||
|
||||
if req.GetOrderPrescriptionPage.PageSize == 0 {
|
||||
req.GetOrderPrescriptionPage.PageSize = 20
|
||||
}
|
||||
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, total, err := orderPrescriptionDao.GetOrderPrescriptionPageSearch(req.GetOrderPrescriptionPage, req.GetOrderPrescriptionPage.Page, req.GetOrderPrescriptionPage.PageSize)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
GetOrderPrescriptionPage := orderPrescriptionResponse.GetOrderPrescriptionPageResponse(orderPrescription)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.GetOrderPrescriptionPage.Page
|
||||
result["page_size"] = req.GetOrderPrescriptionPage.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = GetOrderPrescriptionPage
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// // GetOrderPrescription 处方详情
|
||||
// func (r *OrderPrescription) GetOrderPrescription(c *gin.Context) {
|
||||
// id := c.Param("family_id")
|
||||
// if id == "" {
|
||||
// responses.FailWithMessage("缺少参数", c)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // 将 id 转换为 int64 类型
|
||||
// familyId, err := strconv.ParseInt(id, 10, 64)
|
||||
// if err != nil {
|
||||
// responses.Fail(c)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // 业务处理
|
||||
// patientFamilyService := service.PrescriptionService{}
|
||||
// getPrescriptionResponse, err := patientFamilyService.GetPrescription(familyId)
|
||||
// if err != nil {
|
||||
// responses.FailWithMessage(err.Error(), c)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// responses.OkWithData(getPrescriptionResponse, c)
|
||||
// }
|
||||
Reference in New Issue
Block a user