97 lines
2.7 KiB
Go
97 lines
2.7 KiB
Go
package vaccinedata
|
|
|
|
import (
|
|
// std
|
|
"time"
|
|
|
|
// internal - lib
|
|
erc "simrs-vx/internal/domain/references/clinical"
|
|
|
|
// internal - domain - base-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
// internal - domain - main-entities
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Type *erc.VaccineTypeCode `json:"type"`
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
BatchNumber *string `json:"batchNumber"`
|
|
Dose *float64 `json:"dose"`
|
|
DoseOrder *uint `json:"doseOrder"`
|
|
InjectionLocation *string `json:"injectionLocation"`
|
|
GivenDate *time.Time `json:"givenDate"`
|
|
ExpirationDate *time.Time `json:"expirationDate"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Type *erc.VaccineTypeCode `json:"type"`
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
BatchNumber *string `json:"batchNumber"`
|
|
Dose *float64 `json:"dose"`
|
|
DoseOrder *uint `json:"doseOrder"`
|
|
InjectionLocation *string `json:"injectionLocation"`
|
|
GivenDate *time.Time `json:"givenDate"`
|
|
ExpirationDate *time.Time `json:"expirationDate"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
Includes string `json:"includes"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
Type *erc.VaccineTypeCode `json:"type"`
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
BatchNumber *string `json:"batchNumber"`
|
|
Dose *float64 `json:"dose"`
|
|
DoseOrder *uint `json:"doseOrder"`
|
|
InjectionLocation *string `json:"injectionLocation"`
|
|
GivenDate *time.Time `json:"givenDate"`
|
|
ExpirationDate *time.Time `json:"expirationDate"`
|
|
}
|
|
|
|
func (d VaccineData) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Type: d.Type,
|
|
Encounter_Id: d.Encounter_Id,
|
|
BatchNumber: d.BatchNumber,
|
|
Dose: d.Dose,
|
|
DoseOrder: d.DoseOrder,
|
|
InjectionLocation: d.InjectionLocation,
|
|
GivenDate: d.GivenDate,
|
|
ExpirationDate: d.ExpirationDate,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []VaccineData) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|