revise upload
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package encounter_document
|
||||
|
||||
import (
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath string `json:"filePath"`
|
||||
Filename string `json:"-"`
|
||||
Upload_Employee_Id *uint `form:"upload_employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
Type_Code eru.UploadCode `json:"type-code"`
|
||||
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
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 *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d EncounterDocument) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Type_Code: d.Type_Code,
|
||||
Name: d.Name,
|
||||
FilePath: d.FilePath,
|
||||
FileName: d.FileName,
|
||||
Upload_Employee_Id: d.Upload_Employee_Id,
|
||||
Upload_Employee: d.Upload_Employee,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []EncounterDocument) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
eam "simrs-vx/internal/domain/main-entities/ambulatory"
|
||||
edc "simrs-vx/internal/domain/main-entities/death-cause"
|
||||
eem "simrs-vx/internal/domain/main-entities/emergency"
|
||||
eed "simrs-vx/internal/domain/main-entities/encounter-document"
|
||||
eip "simrs-vx/internal/domain/main-entities/inpatient"
|
||||
eir "simrs-vx/internal/domain/main-entities/internal-reference"
|
||||
er "simrs-vx/internal/domain/main-entities/rehab/base"
|
||||
@@ -188,6 +189,7 @@ type ResponseDto struct {
|
||||
Inpatient *eip.Inpatient `json:"inpatient,omitempty"`
|
||||
Rehab *er.Basic `json:"rehab,omitempty"`
|
||||
RehabChildren *[]er.Basic `json:"rehabChildren,omitempty"`
|
||||
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty"`
|
||||
}
|
||||
|
||||
func (d Encounter) ToResponse() ResponseDto {
|
||||
@@ -234,6 +236,7 @@ func (d Encounter) ToResponse() ResponseDto {
|
||||
Inpatient: d.Inpatient,
|
||||
Rehab: d.Rehab,
|
||||
RehabChildren: d.RehabChildren,
|
||||
EncounterDocuments: d.EncounterDocuments,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
+19
-27
@@ -1,12 +1,10 @@
|
||||
package file_attachment
|
||||
package upload
|
||||
|
||||
import (
|
||||
"mime/multipart"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -19,7 +17,7 @@ type CreateDto struct {
|
||||
|
||||
File multipart.File `json:"-"`
|
||||
FileHeader *multipart.FileHeader `json:"-"`
|
||||
Filename string `json:"-"`
|
||||
Filename string `json:"filename"`
|
||||
Size int64 `json:"-"`
|
||||
MimeType string `json:"-"`
|
||||
}
|
||||
@@ -37,7 +35,7 @@ type FilterDto struct {
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *string `json:"upload-employee-id"`
|
||||
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -61,36 +59,30 @@ type MetaDto struct {
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
EntityType_Code eru.EntityTypeCode `json:"entityType_code"`
|
||||
Ref_Id *uint `json:"ref_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty"`
|
||||
EntityType_Code eru.EntityTypeCode `json:"entityType_code"`
|
||||
Ref_Id *uint `json:"ref_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
FilePath string `json:"filePath"`
|
||||
Filename string `json:"filename"`
|
||||
FileHeader *multipart.FileHeader `json:"fileHeader"`
|
||||
Size int64 `json:"size"`
|
||||
MimeType string `json:"mimeType"`
|
||||
}
|
||||
|
||||
func (d FileAttachment) ToResponse() ResponseDto {
|
||||
func (d CreateDto) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
EntityType_Code: d.EntityType_Code,
|
||||
Ref_Id: d.Ref_Id,
|
||||
Type_Code: d.Type_Code,
|
||||
Name: d.Name,
|
||||
FilePath: d.FilePath,
|
||||
FileName: d.FileName,
|
||||
Upload_Employee_Id: d.Upload_Employee_Id,
|
||||
Upload_Employee: d.Upload_Employee,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []FileAttachment) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
FilePath: d.FilePath,
|
||||
Filename: d.Filename,
|
||||
FileHeader: d.FileHeader,
|
||||
Size: d.Size,
|
||||
MimeType: d.MimeType,
|
||||
}
|
||||
return resp
|
||||
}
|
||||
Reference in New Issue
Block a user