新增问诊病例,患者列表(未完成)
This commit is contained in:
+17
-5
@@ -2,11 +2,13 @@ package controller
|
||||
|
||||
// Api api接口
|
||||
type Api struct {
|
||||
sysSetting // 系统设置
|
||||
userDoctorManage // 医生管理
|
||||
Admin // 公共方法
|
||||
basic // 基础数据
|
||||
order // 订单管理
|
||||
sysSetting // 系统设置
|
||||
userDoctorManage // 医生管理
|
||||
Admin // 公共方法
|
||||
basic // 基础数据
|
||||
order // 订单管理
|
||||
userPatientManage // 患者管理
|
||||
caseManage // 病例管理
|
||||
}
|
||||
|
||||
// SysSetting 系统设置
|
||||
@@ -39,3 +41,13 @@ type order struct {
|
||||
OrderInquiry // 问诊订单
|
||||
OrderProduct // 药品订单
|
||||
}
|
||||
|
||||
// 患者管理
|
||||
type userPatientManage struct {
|
||||
UserPatient // 患者列表
|
||||
}
|
||||
|
||||
// 病例管理
|
||||
type caseManage struct {
|
||||
Case // 患者列表
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package controller 病例管理
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/responses"
|
||||
"hospital-admin-api/api/service"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Case struct{}
|
||||
|
||||
// GetOrderInquiryCase 问诊病例详情
|
||||
func (r *Case) GetOrderInquiryCase(c *gin.Context) {
|
||||
id := c.Param("inquiry_case_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
InquiryCaseId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
caseService := service.CaseService{}
|
||||
getUserDoctorResponses, err := caseService.GetOrderInquiryCaseByInquiryCaseId(InquiryCaseId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(getUserDoctorResponses, c)
|
||||
}
|
||||
@@ -1,3 +1,54 @@
|
||||
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/userPatientResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type UserPatient struct{}
|
||||
|
||||
// GetUserPatientPage 获取患者列表-分页
|
||||
func (r *UserPatient) GetUserPatientPage(c *gin.Context) {
|
||||
userPatientRequest := requests.UserPatientRequest{}
|
||||
if err := c.ShouldBind(&userPatientRequest.GetUserPatientPage); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(userPatientRequest.GetUserPatientPage); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if userPatientRequest.GetUserPatientPage.Page == 0 {
|
||||
userPatientRequest.GetUserPatientPage.Page = 1
|
||||
}
|
||||
|
||||
if userPatientRequest.GetUserPatientPage.PageSize == 0 {
|
||||
userPatientRequest.GetUserPatientPage.PageSize = 20
|
||||
}
|
||||
|
||||
userPatientDao := dao.UserPatientDao{}
|
||||
userPatient, total, err := userPatientDao.GetUserPatientPageSearch(userPatientRequest.GetUserPatientPage, userPatientRequest.GetUserPatientPage.Page, userPatientRequest.GetUserPatientPage.PageSize)
|
||||
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getUserDoctorPageResponses := userPatientResponse.GetUserPatientPageResponse(userPatient)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = userPatientRequest.GetUserPatientPage.Page
|
||||
result["page_size"] = userPatientRequest.GetUserPatientPage.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = getUserDoctorPageResponses
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user