87 lines
2.0 KiB
Go
87 lines
2.0 KiB
Go
package screening
|
|
|
|
import (
|
|
// std
|
|
|
|
// internal - lib
|
|
pa "simrs-vx/internal/lib/auth"
|
|
|
|
// internal - domain - base-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
|
|
// internal - domain - main-entities
|
|
eem "simrs-vx/internal/domain/main-entities/employee"
|
|
|
|
erc "simrs-vx/internal/domain/references/clinical"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Employee_Id *uint `json:"-"`
|
|
Type erc.ScreeningFormTypeCode `json:"type"`
|
|
Value *string `json:"value"`
|
|
|
|
pa.AuthInfo
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Employee_Id *uint `json:"employee-id"`
|
|
Type erc.ScreeningFormTypeCode `json:"type"`
|
|
Value *string `json:"value"`
|
|
}
|
|
|
|
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"`
|
|
Employee_Id *uint `json:"employee_id"`
|
|
Employee *eem.Employee `json:"employee,omitempty"`
|
|
Type erc.ScreeningFormTypeCode `json:"type"`
|
|
Value *string `json:"value"`
|
|
}
|
|
|
|
func (d Screening) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Employee_Id: d.Employee_Id,
|
|
Employee: d.Employee,
|
|
Type: d.Type,
|
|
Value: d.Value,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Screening) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|