73 lines
1.6 KiB
Go
73 lines
1.6 KiB
Go
package inpatient
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ei "simrs-vx/internal/domain/main-entities/infra"
|
|
|
|
ere "simrs-vx/internal/domain/references/encounter"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Class_Code ere.InpatientClassCode `json:"class_code" validate:"maxLength=10"`
|
|
Infra_Code *string `json:"infra_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Class_Code ere.InpatientClassCode `json:"class-code"`
|
|
Infra_Code *string `json:"infra-code"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint16 `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Class_Code ere.InpatientClassCode `json:"class_code"`
|
|
Infra_Code *string `json:"infra_code"`
|
|
Infra *ei.Infra `json:"infra,omitempty"`
|
|
}
|
|
|
|
func (d Inpatient) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Class_Code: d.Class_Code,
|
|
Infra_Code: d.Infra_Code,
|
|
Infra: d.Infra,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Inpatient) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|