修正返回目录
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
package patientFamilyResponse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/userResponse"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type PatientFamily struct {
|
||||
@@ -99,60 +97,3 @@ type GetPatientFamily struct {
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatientResponse 获取患者详情
|
||||
func GetUserPatientResponse(patientFamilys []*model.PatientFamily) []*GetUserPatient {
|
||||
// 处理返回值
|
||||
items := make([]*GetUserPatient, len(patientFamilys))
|
||||
|
||||
if len(patientFamilys) > 0 {
|
||||
for i, v := range patientFamilys {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &GetUserPatient{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: v.Relation,
|
||||
Status: &v.Status,
|
||||
IsDefault: &v.IsDefault,
|
||||
CardNameMask: v.CardNameMask,
|
||||
IdNumberMask: v.IdNumberMask,
|
||||
Sex: &v.Sex,
|
||||
Age: v.Age,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
// GetPatientFamilyPageResponse 获取用户列表-分页
|
||||
func GetPatientFamilyPageResponse(patientFamily []*model.PatientFamily) []getPatientFamilyPage {
|
||||
// 处理返回值
|
||||
patientFamilyResponses := make([]getPatientFamilyPage, len(patientFamily))
|
||||
|
||||
if len(patientFamily) > 0 {
|
||||
for i, v := range patientFamily {
|
||||
// 将原始结构体转换为新结构体
|
||||
patientFamilyResponse := getPatientFamilyPage{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: v.Relation,
|
||||
Status: &v.Status,
|
||||
CardName: v.CardName,
|
||||
MobileMask: utils.MaskPhoneStr(v.UserPatient.User.Mobile),
|
||||
UserName: v.UserPatient.UserName,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
patientFamilyResponses[i] = patientFamilyResponse
|
||||
}
|
||||
}
|
||||
return patientFamilyResponses
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user