1
This commit is contained in:
parent
48fb8c541e
commit
45d14e44c3
@ -6,8 +6,10 @@ import (
|
|||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
"hospital-admin-api/api/responses/userPatientResponse"
|
"hospital-admin-api/api/responses/userPatientResponse"
|
||||||
|
"hospital-admin-api/api/service"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserPatient struct{}
|
type UserPatient struct{}
|
||||||
@ -52,3 +54,29 @@ func (r *UserPatient) GetUserPatientPage(c *gin.Context) {
|
|||||||
result["data"] = getUserDoctorPageResponses
|
result["data"] = getUserDoctorPageResponses
|
||||||
responses.OkWithData(result, c)
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@ -419,7 +419,7 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
patientGroup.GET("", api.UserPatient.GetUserPatientPage)
|
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)
|
patientGroup.PUT("/status/:patient_id", api.UserDoctor.GetUserDoctor)
|
||||||
|
|||||||
4
api/service/userPatient.go
Normal file
4
api/service/userPatient.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
type UserPatientService struct {
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user