92 lines
2.4 KiB
Go
92 lines
2.4 KiB
Go
package chemo_protocol
|
|
|
|
import (
|
|
// std
|
|
"time"
|
|
|
|
// internal - domain - references
|
|
erc "simrs-vx/internal/domain/references/common"
|
|
|
|
// internal - domain - main-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Patient_Weight *float32 `json:"patient_weight"`
|
|
Patient_Height *float32 `json:"patient_height"`
|
|
Diagnoses *string `json:"diagnoses"`
|
|
Duration *uint `json:"duration"`
|
|
DurationUnit_Code *erc.TimeUnitCode `json:"durationUnit_code"`
|
|
StartDate *time.Time `json:"startDate"`
|
|
EndDate *time.Time `json:"endDate"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
Includes string `json:"includes"`
|
|
}
|
|
|
|
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"`
|
|
Patient_Weight *float32 `json:"patient_weight"`
|
|
Patient_Height *float32 `json:"patient_height"`
|
|
Diagnoses *string `json:"diagnoses"`
|
|
Duration *uint `json:"duration"`
|
|
DurationUnit_Code *erc.TimeUnitCode `json:"durationUnit_code"`
|
|
StartDate *time.Time `json:"startDate"`
|
|
EndDate *time.Time `json:"endDate"`
|
|
}
|
|
|
|
func (d ChemoProtocol) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Patient_Weight: d.Patient_Weight,
|
|
Patient_Height: d.Patient_Height,
|
|
Diagnoses: d.Diagnoses,
|
|
Duration: d.Duration,
|
|
DurationUnit_Code: d.DurationUnit_Code,
|
|
StartDate: d.StartDate,
|
|
EndDate: d.EndDate,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []ChemoProtocol) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|