hospital-admin-api/api/dto/HospitalDepartmentCustom.go
2023-09-28 08:40:43 +08:00

40 lines
1.3 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 (
"hospital-admin-api/api/model"
"strconv"
)
type HospitalDepartmentCustomDto struct {
DepartmentCustomId string `json:"department_custom_id"` // 主键
DepartmentId string `json:"department_id"` // 医院科室-标准id
DepartmentCustomName string `json:"department_custom_name"` // 科室名称-自定义
DepartmentName string `json:"department_name"` // 科室名称-标准
DepartmentCode string `json:"department_code"` // 科室编码-标准
DepartmentStatus int `json:"department_status"` // 状态1:正常 2:删除)
}
func GetHospitalDepartmentCustomListDto(m []*model.HospitalDepartmentCustom) []HospitalDepartmentCustomDto {
// 处理返回值
responses := make([]HospitalDepartmentCustomDto, len(m))
if len(m) > 0 {
for i, v := range m {
// 将原始结构体转换为新结构体
response := HospitalDepartmentCustomDto{
DepartmentCustomId: strconv.FormatInt(v.DepartmentCustomId, 10),
DepartmentId: strconv.FormatInt(v.DepartmentId, 10),
DepartmentCustomName: v.DepartmentCustomName,
DepartmentName: v.DepartmentName,
DepartmentCode: v.DepartmentCode,
DepartmentStatus: v.DepartmentStatus,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}