117 lines
3.4 KiB
Go
117 lines
3.4 KiB
Go
package chemo
|
|
|
|
import (
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
|
ere "simrs-vx/internal/domain/references/encounter"
|
|
|
|
// std
|
|
"time"
|
|
|
|
// internal - lib
|
|
pa "simrs-vx/internal/lib/auth"
|
|
|
|
// 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"
|
|
eus "simrs-vx/internal/domain/main-entities/user"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
|
Specialist_Code *string `json:"specialist_code"`
|
|
Class_Code ere.ChemoClassCode `json:"class_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Status_Code *erc.DataVerifiedCode `json:"status-code"`
|
|
VerifiedBy_User_Id *uint `json:"verifiedBy-user-id"`
|
|
Specialist_Code *string `json:"specialist-code"`
|
|
Patient_Id *uint `json:"patient-id"`
|
|
Class_Code ere.ChemoClassCode `json:"class-code"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint `json:"id"`
|
|
Includes string `json:"includes"`
|
|
FilterDto
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type VerifyDto struct {
|
|
Id uint `json:"id"`
|
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
|
Bed *string `json:"bed"`
|
|
Needs *string `json:"needs"`
|
|
Doctor_Code *string `json:"doctor_code" validate:"required"`
|
|
NextChemoDate *time.Time `json:"nextChemoDate" validate:"required"`
|
|
|
|
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"`
|
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
|
VerifiedAt *time.Time `json:"verifiedAt"`
|
|
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
|
|
VerifiedBy *eus.User `json:"verifiedBy,omitempty"`
|
|
Specialist_Code *string `json:"specialist_code"`
|
|
Specialist *es.Specialist `json:"specialist,omitempty"`
|
|
Doctor_Code *string `json:"doctor_code"`
|
|
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
|
NextChemoDate *time.Time `json:"nextChemoDate"`
|
|
}
|
|
|
|
func (d Chemo) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Status_Code: d.Status_Code,
|
|
VerifiedAt: d.VerifiedAt,
|
|
VerifiedBy_User_Id: d.VerifiedBy_User_Id,
|
|
VerifiedBy: d.VerifiedBy,
|
|
Specialist_Code: d.Specialist_Code,
|
|
Specialist: d.Specialist,
|
|
Doctor_Code: d.Doctor_Code,
|
|
Doctor: d.Doctor,
|
|
NextChemoDate: d.NextChemoDate,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Chemo) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|