40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
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
|
||
}
|