90 lines
2.0 KiB
Go
90 lines
2.0 KiB
Go
package medicationitem
|
|
|
|
import (
|
|
// std
|
|
"time"
|
|
|
|
// internal - lib
|
|
pa "simrs-vx/internal/lib/auth"
|
|
|
|
// internal - domain - base-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
|
|
// internal - domain - main-entities
|
|
emi "simrs-vx/internal/domain/main-entities/medication-item"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
MedicationItem_Id *uint `json:"medicationItem_id"`
|
|
DateTime *time.Time `json:"dateTime"`
|
|
Remain float64 `json:"remain"`
|
|
Nurse_Code *string `json:"nurse_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
MedicationItem_Id *uint `json:"medicationItem-id"`
|
|
DateTime *time.Time `json:"dateTime"`
|
|
Remain float64 `json:"remain"`
|
|
Nurse_Code *string `json:"nurse-code"`
|
|
}
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint16 `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type ConsumeDto struct {
|
|
Id uint16 `json:"id"`
|
|
Usage float64 `json:"usage"`
|
|
|
|
pa.AuthInfo
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
MedicationItem_Id *uint `json:"medicationItem_id"`
|
|
MedicationItem *emi.MedicationItem `json:"medicationItem,omitempty"`
|
|
DateTime *time.Time `json:"dateTime"`
|
|
Remain float64 `json:"remain"`
|
|
Nurse_Code *string `json:"nurse_code"`
|
|
}
|
|
|
|
func (d MedicationItemDist) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
MedicationItem_Id: d.MedicationItem_Id,
|
|
MedicationItem: d.MedicationItem,
|
|
DateTime: d.DateTime,
|
|
Remain: d.Remain,
|
|
Nurse_Code: d.Nurse_Code,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []MedicationItemDist) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|