This commit is contained in:
wucongxing 2023-09-15 17:21:11 +08:00
parent 48fb8c541e
commit 45d14e44c3
3 changed files with 33 additions and 1 deletions

View File

@ -6,8 +6,10 @@ import (
"hospital-admin-api/api/requests"
"hospital-admin-api/api/responses"
"hospital-admin-api/api/responses/userPatientResponse"
"hospital-admin-api/api/service"
"hospital-admin-api/global"
"hospital-admin-api/utils"
"strconv"
)
type UserPatient struct{}
@ -52,3 +54,29 @@ func (r *UserPatient) GetUserPatientPage(c *gin.Context) {
result["data"] = getUserDoctorPageResponses
responses.OkWithData(result, c)
}
// GetUserPatient 患者详情
func (r *UserPatient) GetUserPatient(c *gin.Context) {
id := c.Param("patient_id")
if id == "" {
responses.FailWithMessage("缺少参数", c)
return
}
// 将 id 转换为 int64 类型
patientId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
responses.Fail(c)
return
}
// 业务处理
userDoctorService := service.UserDoctorService{}
getUserDoctorResponses, err := userDoctorService.GetUserDoctor(patientId)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.OkWithData(getUserDoctorResponses, c)
}

View File

@ -419,7 +419,7 @@ func privateRouter(r *gin.Engine, api controller.Api) {
patientGroup.GET("", api.UserPatient.GetUserPatientPage)
// 患者详情
patientGroup.GET("/:patient_id", api.UserDoctor.GetUserDoctor)
patientGroup.GET("/:patient_id", api.UserPatient.GetUserPatient)
// 修改患者状态
patientGroup.PUT("/status/:patient_id", api.UserDoctor.GetUserDoctor)

View File

@ -0,0 +1,4 @@
package service
type UserPatientService struct {
}