新增医生详情
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type UserDoctor struct{}
|
||||
@@ -52,3 +53,32 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
||||
result["data"] = getUserDoctorPageResponses
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetPostUserDoctor 医生详情
|
||||
func (r *UserDoctor) GetPostUserDoctor(c *gin.Context) {
|
||||
id := c.Param("doctor_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
doctorId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage("用户数据错误", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getUserDoctorResponses := userDoctorResponse.GetUserDoctorResponse(userDoctor)
|
||||
|
||||
responses.OkWithData(getUserDoctorResponses, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user