2c432a7bef
+ moved pkg/auth-helper to internal/lib/auth + update AuthInfo + cleaning
112 lines
3.6 KiB
Go
112 lines
3.6 KiB
Go
package mcuorder
|
|
|
|
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 - references
|
|
ercl "simrs-vx/internal/domain/references/clinical"
|
|
erc "simrs-vx/internal/domain/references/common"
|
|
|
|
// internal - domain - main-entities
|
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id *uint `json:"encounter_id"`
|
|
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
SpecimenPickTime *time.Time `json:"specimenPickTime"`
|
|
ExaminationDate *time.Time `json:"examinationDate"`
|
|
Number uint8 `json:"number"`
|
|
Temperature float64 `json:"temperature"`
|
|
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code"`
|
|
|
|
pa.AuthInfo
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Encounter_Id *uint `json:"encounter-id"`
|
|
Status_Code erc.DataStatusCode `json:"status-code" gorm:"not null;size:10"`
|
|
Doctor_Id *uint `json:"doctor-id"`
|
|
SpecimenPickTime *time.Time `json:"specimenPickTime"`
|
|
ExaminationDate *time.Time `json:"examinationDate"`
|
|
Number uint8 `json:"number"`
|
|
Temperature float64 `json:"temperature"`
|
|
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel-code"`
|
|
}
|
|
type ReadDetailDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type SetScheduleDto struct {
|
|
Id uint `json:"id"`
|
|
ExaminationDate *time.Time `json:"examinationDate"`
|
|
}
|
|
|
|
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.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
|
SpecimenPickTime *time.Time `json:"specimenPickTime"`
|
|
ExaminationDate *time.Time `json:"examinationDate"`
|
|
Number uint8 `json:"number"`
|
|
Temperature float64 `json:"temperature"`
|
|
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
|
|
}
|
|
|
|
func (d McuOrder) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Status_Code: d.Status_Code,
|
|
Doctor_Id: d.Doctor_Id,
|
|
Doctor: d.Doctor,
|
|
SpecimenPickTime: d.SpecimenPickTime,
|
|
ExaminationDate: d.ExaminationDate,
|
|
Number: d.Number,
|
|
Temperature: d.Temperature,
|
|
McuUrgencyLevel_Code: d.McuUrgencyLevel_Code,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []McuOrder) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|