Files
simrsx-be/internal/domain/main-entities/responsible-doctor-hist/dto.go
T

78 lines
1.8 KiB
Go

package responsible_doctor_hist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
"time"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Doctor_Code *string `json:"doctor_code"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Doctor_Code *string `json:"doctor-code"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
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 // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
func (d ResponsibleDoctorHist) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
StartedAt: d.StartedAt,
FinishedAt: d.FinishedAt,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ResponsibleDoctorHist) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}