Files
simrsx-be/internal/domain/main-entities/mcu-order/dto.go
T

118 lines
3.8 KiB
Go

package mcuorder
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 - references
ercl "simrs-vx/internal/domain/references/clinical"
erc "simrs-vx/internal/domain/references/common"
// internal - domain - main-entities
ed "simrs-vx/internal/domain/main-entities/doctor"
ee "simrs-vx/internal/domain/main-entities/encounter"
emoib "simrs-vx/internal/domain/main-entities/mcu-order-item/base"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Code *string `json:"doctor_code"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"`
Scope_Code ercl.McuScopeCode `json:"scope_code"`
pa.AuthInfo
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status-code" gorm:"not null;size:10"`
Doctor_Code *string `json:"doctor-code"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgency-level-code"`
Scope_Code ercl.McuUrgencyLevelCode `json:"scope-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
Includes string `json:"includes"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type SetScheduleDto struct {
Id uint `json:"id"`
ExaminationDate *time.Time `json:"examinationDate"`
}
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"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"`
Items []*emoib.McuOrderItem `json:"items"`
}
func (d McuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Status_Code: d.Status_Code,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
SpecimenPickTime: d.SpecimenPickTime,
ExaminationDate: d.ExaminationDate,
Number: d.Number,
Temperature: d.Temperature,
UrgencyLevel_Code: d.UrgencyLevel_Code,
Items: d.Items,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []McuOrder) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}