87 lines
2.1 KiB
Go
87 lines
2.1 KiB
Go
package deviceorder
|
|
|
|
import (
|
|
// internal - lib
|
|
pa "simrs-vx/internal/lib/auth"
|
|
|
|
// internal - domain - base-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
|
|
// internal - domain - references
|
|
erc "simrs-vx/internal/domain/references/common"
|
|
|
|
// internal - domain - main-entities
|
|
edoi "simrs-vx/internal/domain/main-entities/device-order-item/base"
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Status_Code erc.DataStatusCode `json:"status_code"`
|
|
Doctor_Code *string `json:"doctor_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"`
|
|
Doctor_Code *string `json:"doctor-code"`
|
|
}
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
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"`
|
|
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
|
Doctor_Code *string `json:"doctor_code"`
|
|
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
|
Status_Code erc.DataStatusCode `json:"status_code"`
|
|
Items []edoi.DeviceOrderItem `json:"items"`
|
|
}
|
|
|
|
func (d DeviceOrder) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Doctor_Code: d.Doctor_Code,
|
|
Doctor: d.Doctor,
|
|
Status_Code: d.Status_Code,
|
|
Items: d.Items,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []DeviceOrder) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|