91 lines
2.6 KiB
Go
91 lines
2.6 KiB
Go
package actionreport
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
|
"time"
|
|
|
|
pa "simrs-vx/internal/lib/auth"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Encounter_Id uint64 `json:"encounter_id" validate:"required"`
|
|
Date *time.Time `json:"date" validate:"required"`
|
|
Doctor_Code string `json:"doctor_code" validate:"required"`
|
|
Operator_Employe_Id uint `json:"operator_employe_id" validate:"required"`
|
|
Assistant_Employe_Id uint `json:"assistant_employe_id" validate:"required"`
|
|
Instrumentor_Employe_Id uint `json:"instrumentor_employe_id" validate:"required"`
|
|
Diagnose *string `json:"diagnose"`
|
|
Nurse_Code string `json:"nurse_code" validate:"required"`
|
|
Value string `json:"value" validate:"required"`
|
|
|
|
pa.AuthInfo
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
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 uint64 `json:"encounter_id"`
|
|
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
|
Date *time.Time `json:"date"`
|
|
Doctor_Code string `json:"doctor_code"`
|
|
Operator_Employe_Id uint `json:"operator_employe_id"`
|
|
Assistant_Employe_Id uint `json:"assistant_employe_id"`
|
|
Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"`
|
|
Diagnose *string `json:"diagnose"`
|
|
Nurse_Code string `json:"nurse_code"`
|
|
Value *string `json:"value"`
|
|
}
|
|
|
|
func (d ActionReport) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Encounter_Id: d.Encounter_Id,
|
|
Encounter: d.Encounter,
|
|
Date: d.Date,
|
|
Doctor_Code: d.Doctor_Code,
|
|
Operator_Employe_Id: d.Operator_Employe_Id,
|
|
Assistant_Employe_Id: d.Assistant_Employe_Id,
|
|
Instrumentor_Employe_Id: d.Instrumentor_Employe_Id,
|
|
Nurse_Code: d.Nurse_Code,
|
|
Value: &d.Value,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []ActionReport) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|