新增获取就诊人列表-分页
This commit is contained in:
@@ -80,3 +80,41 @@ func (r *UserPatient) GetUserPatient(c *gin.Context) {
|
||||
|
||||
responses.OkWithData(getUserPatientResponses, c)
|
||||
}
|
||||
|
||||
// PutUserDoctorStatus 修改患者状态
|
||||
func (r *UserPatient) PutUserDoctorStatus(c *gin.Context) {
|
||||
userPatientRequest := requests.UserPatientRequest{}
|
||||
if err := c.ShouldBind(&userPatientRequest.PutUserDoctorStatus); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(userPatientRequest.PutUserDoctorStatus); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
userPatientService := service.UserPatientService{}
|
||||
_, err = userPatientService.PutUserDoctorStatus(patientId, userPatientRequest.PutUserDoctorStatus)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.Ok(c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user