2023-11-02 04:34:46 +08:00
|
|
|
|
package response
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"miniapp/model/app"
|
|
|
|
|
"miniapp/model/common/constant"
|
|
|
|
|
"miniapp/model/types"
|
|
|
|
|
"miniapp/utils"
|
|
|
|
|
"strconv"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type UserItem struct {
|
|
|
|
|
Id string `json:"id"`
|
|
|
|
|
Phone string `json:"phone"` // 手机号
|
|
|
|
|
Nickname string `json:"nickname"` // 用户名
|
|
|
|
|
CreateAt string `json:"createAt"` // 创建时间
|
|
|
|
|
Avatar string `json:"avatar"` // 头像
|
|
|
|
|
LastLoginAt string `json:"lastLoginAt"` // 最后登录时间
|
|
|
|
|
Status constant.UserStatus `json:"status"` // 状态:1-正常,2-禁用
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserVO struct {
|
|
|
|
|
Id string `json:"id"`
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
Email string `json:"email"`
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
Phone string `json:"phone"`
|
|
|
|
|
Status constant.UserStatus `json:"status"`
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
LastLoginAt *types.DateTime `json:"lastLoginAt"`
|
|
|
|
|
LastLoginIp *string `json:"lastLoginIp"`
|
|
|
|
|
CreatedAt types.DateTime `json:"createdAt"`
|
|
|
|
|
TimeNote string `json:"timeNote"`
|
2023-12-11 18:56:19 +08:00
|
|
|
|
IsSurgery int `json:"isSurgery" gorm:"default:0;comment:是否已经手术 0未手术 1已手术"`
|
|
|
|
|
IsInfo int `json:"isInfo" gorm:"default:0;comment:是否已经填写信息 0未填写 1已填写"`
|
|
|
|
|
HospitalId int `json:"hospital_id" gorm:"comment:手术医院"`
|
|
|
|
|
SurgeryTime *types.DateTime `json:"surgery_time" gorm:"comment:手术时间"`
|
2023-11-02 04:34:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (auv *UserVO) ParseOrdinary(u app.User) {
|
|
|
|
|
auv.Id = strconv.Itoa(int(u.ID))
|
|
|
|
|
auv.Phone = utils.Desensitization().Phone(u.Phone)
|
|
|
|
|
auv.Nickname = u.Nickname
|
|
|
|
|
auv.Status = u.Status
|
|
|
|
|
auv.LastLoginAt = u.LastLoginAt
|
|
|
|
|
auv.Avatar = u.Avatar
|
|
|
|
|
auv.CreatedAt = types.DateTime(u.CreatedAt)
|
2023-12-11 18:56:19 +08:00
|
|
|
|
auv.IsSurgery = u.IsSurgery
|
|
|
|
|
auv.IsInfo = u.IsInfo
|
|
|
|
|
auv.HospitalId = u.HospitalId
|
|
|
|
|
auv.SurgeryTime = u.SurgeryTime
|
2023-11-02 04:34:46 +08:00
|
|
|
|
|
|
|
|
|
if u.IsSurgery == 1 {
|
|
|
|
|
auv.TimeNote = "距离下次复查时间还剩:"
|
|
|
|
|
} else {
|
|
|
|
|
auv.TimeNote = "距离手术时间还剩:"
|
|
|
|
|
}
|
|
|
|
|
}
|