Files
simrsx-be/internal/domain/main-entities/procedure-report/dto.go
T
2025-12-06 09:54:05 +07:00

112 lines
3.9 KiB
Go

package procedurereport
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_Name string `json:"operator_name" validate:"required"`
Assistant_Name string `json:"assistant_name" validate:"required"`
Instrumentor_Name string `json:"instrumentor_name" validate:"required"`
Anesthesia_Doctor_Code *string `json:"anesthesia_doctor_code"`
Anesthesia_Nurse_Name *string `json:"anesthesia_nurse_name"`
Diagnose *string `json:"diagnose"`
Nurse_Name string `json:"nurse_name" validate:"required"`
ProcedureValue string `json:"procedure_value" validate:"required"`
ExecutionValue string `json:"execution_value" validate:"required"`
Type_Code string `json:"type_code" validate:"required"`
pa.AuthInfo
// PROPER
// 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"`
// Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code" validate:"required"`
// Anesthesia_Nurse_Employe_Id uint `json:"anesthesia_nurse_employe_id" validate:"required"`
// Nurse_Code string `json:"nurse_code" validate:"required"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Type_Code string `json:"type-code"`
}
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_Name string `json:"operator_name"`
Assistant_Name string `json:"assistant_name"`
Instrumentor_Name string `json:"instrumentor_name"`
Anesthesia_Doctor_Code *string `json:"anesthesia_doctor_code"`
Anesthesia_Nurse_Name *string `json:"anesthesia_nurse_name"`
Diagnose *string `json:"diagnose"`
Nurse_Name string `json:"nurse_name"`
ProcedureValue *string `json:"procedure_value"`
ExecutionValue *string `json:"execution_value"`
Type_Code string `json:"type_code"`
}
func (d ProcedureReport) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Date: d.Date,
Doctor_Code: d.Doctor_Code,
Operator_Name: d.Operator_Name,
Assistant_Name: d.Assistant_Name,
Instrumentor_Name: d.Instrumentor_Name,
Anesthesia_Doctor_Code: d.Anesthesia_Doctor_Code,
Anesthesia_Nurse_Name: d.Anesthesia_Nurse_Name,
Nurse_Name: d.Nurse_Name,
ProcedureValue: &d.ProcedureValue,
ExecutionValue: &d.ExecutionValue,
Type_Code: d.Type_Code,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ProcedureReport) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}