修正返回目录

This commit is contained in:
2023-09-28 08:40:43 +08:00
parent aedf61c31b
commit 70c35e0ce6
84 changed files with 3579 additions and 2007 deletions
@@ -1,11 +1,9 @@
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 获取患者列表-分页
@@ -36,38 +34,3 @@ type GetUserPatient struct {
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// GetUserPatientPageResponse 获取用户列表-分页
func GetUserPatientPageResponse(userPatient []*model.UserPatient) []getUserPatientPage {
// 处理返回值
responses := make([]getUserPatientPage, len(userPatient))
if len(userPatient) > 0 {
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),
DisableReason: v.DisableReason,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
if v.PatientFamily != nil {
response.PatientFamilyCount = len(v.PatientFamily)
}
if v.User != nil {
response.Mobile = utils.MaskPhoneStr(v.User.Mobile)
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}