hepa-calc-api/api/dto/UserCase.go

49 lines
2.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
import (
"fmt"
"hepa-calc-api/api/model"
)
// UserCaseDto 用户表-病例
type UserCaseDto struct {
UserCaseId string `json:"user_case_id"` // 主键id
UserId string `json:"user_id"` // 用户id
IsHospital *int `json:"is_hospital"` // 是否医院就诊0:否 1:是)
LiverStatus string `json:"liver_status"` // 肝脏状态
IsMedication *int `json:"is_medication"` // 是否服药0:否 1:是)
Medication string `json:"medication"` // 服药名称
ChronicDisease string `json:"chronic_disease"` // 慢性疾病名称(逗号分隔)
IsAllergyHistory *int `json:"is_allergy_history"` // 过敏史0:否 1:是)
AllergyHistory string `json:"allergy_history"` // 过敏史描述
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
UserCaseDiseaseItem []*UserCaseDiseaseItemDto `json:"user_case_disease_item"` // 所患疾病列表
}
// GetUserCaseDto 详情
func GetUserCaseDto(m *model.UserCase) *UserCaseDto {
return &UserCaseDto{
UserCaseId: fmt.Sprintf("%d", m.UserCaseId),
UserId: fmt.Sprintf("%d", m.UserId),
IsHospital: m.IsHospital,
LiverStatus: m.LiverStatus,
IsMedication: m.IsMedication,
Medication: m.Medication,
ChronicDisease: m.ChronicDisease,
IsAllergyHistory: m.IsAllergyHistory,
AllergyHistory: m.AllergyHistory,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
}
}
// LoadUserCaseDiseaseItem 加载数据-疾病列表
func (r *UserCaseDto) LoadUserCaseDiseaseItem(m []*model.UserCaseDiseaseItem) *UserCaseDto {
if len(m) > 0 {
r.UserCaseDiseaseItem = GetUserCaseDiseaseItemListDto(m)
}
return r
}