49 lines
2.1 KiB
Go
49 lines
2.1 KiB
Go
package dto
|
||
|
||
import (
|
||
"fmt"
|
||
"hepa-calc-admin-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
|
||
}
|