98 lines
2.2 KiB
Go
98 lines
2.2 KiB
Go
package consultation
|
|
|
|
import (
|
|
"time"
|
|
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
|
|
|
pa "simrs-vx/pkg/auth-helper"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Case *string `json:"case" validate:"maxLength=2048"`
|
|
Unit_Id *uint `json:"unit_id"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Preloads []string `json:"-"`
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Unit_Id *uint `json:"unit_id"`
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
NoPagination int `json:"no_pagination"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type ReplyDto struct {
|
|
Id uint `json:"id"`
|
|
Solution *string `json:"solution"`
|
|
|
|
pa.AuthInfo
|
|
}
|
|
|
|
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"`
|
|
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
|
Case *string `json:"case"`
|
|
Solution *string `json:"solution"`
|
|
Unit_Id *uint `json:"unit_id"`
|
|
Unit *eu.Unit `json:"unit,omitempty"`
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
|
RepliedAt *time.Time `json:"repliedAt"`
|
|
}
|
|
|
|
func (d Consultation) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Case: d.Case,
|
|
Solution: d.Solution,
|
|
Unit_Id: d.Unit_Id,
|
|
Unit: d.Unit,
|
|
Doctor_Id: d.Doctor_Id,
|
|
Doctor: d.Doctor,
|
|
RepliedAt: d.RepliedAt,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Consultation) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|