adjustment fileattachemnt to encounterDocument

This commit is contained in:
vanilia
2025-11-11 18:10:50 +07:00
parent 34267255b6
commit 4f07f7f2a4
7 changed files with 40 additions and 39 deletions
@@ -1,16 +0,0 @@
-- Create "FileAttachment" table
CREATE TABLE "public"."FileAttachment" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"EntityType_Code" text NULL,
"Ref_Id" bigint NULL,
"Type_Code" text NULL,
"Name" text NULL,
"FilePath" text NULL,
"FileName" text NULL,
"Upload_Employee_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_FileAttachment_Upload_Employee" FOREIGN KEY ("Upload_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
@@ -0,0 +1,16 @@
-- Create "EncounterDocument" table
CREATE TABLE "public"."EncounterDocument" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Type_Code" text NULL,
"Name" text NULL,
"FilePath" text NULL,
"FileName" text NULL,
"Upload_Employee_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_EncounterDocument_Upload_Employee" FOREIGN KEY ("Upload_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Encounter_EncounterDocuments" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
+2 -2
View File
@@ -1,4 +1,4 @@
h1:SAwbbwLaFxoG+YGdeC3/EzQ+sb+CbZ4HEYhp5XOI918=
h1:G7XwMRXjqZGaTeOozryI7WRd+FUJqE+DYsSfura7viU=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -113,4 +113,4 @@ h1:SAwbbwLaFxoG+YGdeC3/EzQ+sb+CbZ4HEYhp5XOI918=
20251111074148.sql h1:95Ui1eo1P68itOz5kZDNFi2ha0ZhUF4gMYiYVcip6fo=
20251111074652.sql h1:vUZbN0qgktRQ2GAlCpdYrbld2grPiSbvcMePEQMfxPs=
20251111082257.sql h1:Zr3Xg5n+p4C8F6Evqm5PVC0pqUvPTBcq692PiUEJlT8=
20251111100633.sql h1:0z4WE0KP18j10gCd7nCltnP6u4NcLNJD5k9vTjq7J50=
20251111111017.sql h1:RNLwrUNguAy/m2h3oYwMd5VuL1juRJMS1Taqujvye08=
@@ -0,0 +1,18 @@
package encounter_document
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
eru "simrs-vx/internal/domain/references/upload"
)
type EncounterDocument 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" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
}
@@ -9,6 +9,7 @@ import (
ed "simrs-vx/internal/domain/main-entities/doctor"
eem "simrs-vx/internal/domain/main-entities/emergency"
ee "simrs-vx/internal/domain/main-entities/employee"
eed "simrs-vx/internal/domain/main-entities/encounter-document"
eip "simrs-vx/internal/domain/main-entities/inpatient"
ei "simrs-vx/internal/domain/main-entities/insurance-company"
eir "simrs-vx/internal/domain/main-entities/internal-reference"
@@ -70,6 +71,7 @@ type Encounter struct {
Inpatient *eip.Inpatient `json:"inpatient,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Rehab *er.Basic `json:"rehab,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
RehabChildren *[]er.Basic `json:"rehabChildren,omitempty" gorm:"foreignKey:Parent_Encounter_Id;references:Id"`
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
}
func (d Encounter) IsDone() bool {
@@ -1,19 +0,0 @@
package file_attachment
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
eru "simrs-vx/internal/domain/references/upload"
)
type FileAttachment 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" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
}
@@ -28,8 +28,8 @@ import (
emergency "simrs-vx/internal/domain/main-entities/emergency"
employee "simrs-vx/internal/domain/main-entities/employee"
encounter "simrs-vx/internal/domain/main-entities/encounter"
fileattachemnt "simrs-vx/internal/domain/main-entities/encounter-document"
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
fileattachemnt "simrs-vx/internal/domain/main-entities/file-attachment"
generalconsent "simrs-vx/internal/domain/main-entities/general-consent"
infra "simrs-vx/internal/domain/main-entities/infra"
inpatient "simrs-vx/internal/domain/main-entities/inpatient"
@@ -208,6 +208,6 @@ func getMainEntities() []any {
&controlletter.ControlLetter{},
&rehab.Rehab{},
&chemoprotocol.ChemoProtocol{},
&fileattachemnt.FileAttachment{},
&fileattachemnt.EncounterDocument{},
}
}