101 lines
2.4 KiB
Go
101 lines
2.4 KiB
Go
package consultation
|
|
|
|
import (
|
|
// std
|
|
"time"
|
|
|
|
// internal - lib
|
|
pa "simrs-vx/internal/lib/auth"
|
|
|
|
// internal - domain - base-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
|
|
// internal - domain - main-entities
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Date *time.Time `json:"date"`
|
|
Problem *string `json:"problem" validate:"maxLength=10240"`
|
|
Specialist_Code *string `json:"dstSpecialist_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Specialist_Code *string `json:"dstSpecialist-code"`
|
|
Doctor_Code *string `json:"doctor-code"`
|
|
}
|
|
|
|
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"`
|
|
Date *time.Time `json:"date"`
|
|
Problem *string `json:"problem"`
|
|
Solution *string `json:"solution"`
|
|
Specialist_Code *string `json:"specialist_code"`
|
|
Specialist *es.Specialist `json:"specialist,omitempty"`
|
|
Doctor_Code *string `json:"doctor_code"`
|
|
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,
|
|
Date: d.Date,
|
|
Problem: d.Problem,
|
|
Solution: d.Solution,
|
|
Specialist_Code: d.Specialist_Code,
|
|
Specialist: d.Specialist,
|
|
Doctor_Code: d.Doctor_Code,
|
|
Doctor: d.Doctor,
|
|
}
|
|
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
|
|
}
|