新增患者详情
This commit is contained in:
@@ -3,10 +3,12 @@ package userPatientResponse
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/patientFamilyResponse"
|
||||
"hospital-admin-api/api/responses/userShipAddressResponse"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
// getUserPatientPage 获取医生列表-分页
|
||||
// getUserPatientPage 获取患者列表-分页
|
||||
type getUserPatientPage struct {
|
||||
PatientId string `json:"patient_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id;NOT NULL
|
||||
@@ -14,11 +16,26 @@ type getUserPatientPage struct {
|
||||
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
DisableReason string `json:"disable_reason"` // 禁用理由
|
||||
PatientFamilyCount int `json:"patient_family_count"` // 家庭成员数量
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatient 患者详情
|
||||
type GetUserPatient struct {
|
||||
PatientId string `json:"patient_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id;NOT NULL
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Status *int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
PatientFamily []*patientFamilyResponse.GetUserPatient `json:"patient_family"` // 家庭成员
|
||||
UserShipAddress []*userShipAddressResponse.UserShipAddress `json:"user_ship_address"` // 收货地址
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatientPageResponse 获取用户列表-分页
|
||||
func GetUserPatientPageResponse(userPatient []*model.UserPatient) []getUserPatientPage {
|
||||
// 处理返回值
|
||||
@@ -28,13 +45,14 @@ func GetUserPatientPageResponse(userPatient []*model.UserPatient) []getUserPatie
|
||||
for i, v := range userPatient {
|
||||
// 将原始结构体转换为新结构体
|
||||
response := getUserPatientPage{
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Status: v.Status,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Status: v.Status,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DisableReason: v.DisableReason,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
if v.PatientFamily != nil {
|
||||
|
||||
Reference in New Issue
Block a user