75 lines
1.6 KiB
Go
75 lines
1.6 KiB
Go
package internal_reference
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"-"`
|
|
Unit_Id *uint16 `json:"unit_id"`
|
|
Doctor_Id *uint `json:"doctor_Id"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Unit_Id *uint `json:"unit-id"`
|
|
Doctor_Id *uint `json:"doctor-id"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
Includes string `json:"includes"`
|
|
}
|
|
|
|
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"`
|
|
Unit_Id *uint16 `json:"unit_id"`
|
|
Unit *eu.Unit `json:"unit,omitempty"`
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
|
}
|
|
|
|
func (d InternalReference) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Unit_Id: d.Unit_Id,
|
|
Unit: d.Unit,
|
|
Doctor_Id: d.Doctor_Id,
|
|
Doctor: d.Doctor,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []InternalReference) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|