新增获取就诊人列表-分页

This commit is contained in:
2023-09-18 16:48:22 +08:00
parent 913e1647fb
commit 9d21730305
12 changed files with 389 additions and 54 deletions
@@ -53,6 +53,19 @@ type GetUserPatient struct {
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// 获取就诊人列表-分页
type getPatientFamilyPage struct {
FamilyId string `json:"family_id"` // 主键id
PatientId string `json:"patient_id"` // 患者id
Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他)
Status *int `json:"status"` // 状态(1:正常 2:删除)
CardName string `json:"card_name"` // 姓名
MobileMask string `json:"mobile_mask"` // 电话(掩码)
UserName string `json:"user_name"` // 账号名称
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// GetUserPatientResponse 获取患者详情
func GetUserPatientResponse(patientFamilys []*model.PatientFamily) []*GetUserPatient {
// 处理返回值
@@ -82,3 +95,31 @@ func GetUserPatientResponse(patientFamilys []*model.PatientFamily) []*GetUserPat
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: v.MobileMask,
UserName: v.UserPatient.UserName,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
patientFamilyResponses[i] = patientFamilyResponse
}
}
return patientFamilyResponses
}