93 lines
2.1 KiB
Go
93 lines
2.1 KiB
Go
package soapi
|
|
|
|
import (
|
|
"time"
|
|
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
eem "simrs-vx/internal/domain/main-entities/employee"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
|
|
erc "simrs-vx/internal/domain/references/clinical"
|
|
|
|
pa "simrs-vx/internal/lib/auth"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Employee_Id *uint `json:"-"`
|
|
Time *time.Time `json:"time"`
|
|
TypeCode erc.SoapiTypeCode `json:"typeCode"`
|
|
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"`
|
|
Time *time.Time `json:"time"`
|
|
TypeCode erc.SoapiTypeCode `json:"type-code"`
|
|
Value *string `json:"value"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint `json:"id"`
|
|
Includes string `json:"includes"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
pa.AuthInfo
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
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"`
|
|
Employee_Id *uint `json:"employee_id"`
|
|
Employee *eem.Employee `json:"employee,omitempty"`
|
|
Time *time.Time `json:"time"`
|
|
TypeCode erc.SoapiTypeCode `json:"type-code"`
|
|
Value *string `json:"value"`
|
|
}
|
|
|
|
func (d Soapi) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Employee_Id: d.Employee_Id,
|
|
Employee: d.Employee,
|
|
Time: d.Time,
|
|
TypeCode: d.TypeCode,
|
|
Value: d.Value,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Soapi) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|