Merge pull request #170 from dikstub-rssa/migration-vanilia

Migration vanilia
This commit is contained in:
vaniliacahya
2025-11-27 11:23:12 +07:00
committed by GitHub
10 changed files with 98 additions and 11 deletions
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "Responsible_Nurse_Code" character varying(20) NULL, ADD CONSTRAINT "fk_Encounter_Responsible_Nurse" FOREIGN KEY ("Responsible_Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,2 @@
-- Modify "InternalReference" table
ALTER TABLE "public"."InternalReference" ADD COLUMN "SrcDoctor_Code" character varying(20) NULL, ADD COLUMN "SrcNurse_Code" character varying(20) NULL, ADD COLUMN "Nurse_Code" character varying(20) NULL, ADD CONSTRAINT "fk_InternalReference_Nurse" FOREIGN KEY ("Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_InternalReference_SrcDoctor" FOREIGN KEY ("SrcDoctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_InternalReference_SrcNurse" FOREIGN KEY ("SrcNurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
+4 -2
View File
@@ -1,4 +1,4 @@
h1:87NyL1nIRuVvOiLbfdC1+PF+v2R/joAnBYyh2CrlGdU=
h1:U9vdficFramvwnH40psSuRxzUuq6EPJwLcr9MvVTq7s=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -128,4 +128,6 @@ h1:87NyL1nIRuVvOiLbfdC1+PF+v2R/joAnBYyh2CrlGdU=
20251120005512.sql h1:Ek6qpacAI/qVuTYxKno+uJyzn7s5z9pf3t7VA8gTzm4=
20251120074415.sql h1:NNUeJVA03EeBHJhHqPXEZoDv/PnC6yK1/cRhmukyaJo=
20251121033803.sql h1:/vfvFX/3pzSCIHnSbMUT9EMBDykOpVkvyfeTEle9Vas=
20251124071457.sql h1:HBaNJQIzUe6wK8CgBxamuKor7ZiAASzgkkXzL6kWsjY=
20251124071457.sql h1:qg2dhCL9YwD13xnfJ175lW/p6MGfzFKaBqd908FByRc=
20251125125303.sql h1:4JSFv1Pmhbe9tqpLXgO63OwYnGsalStgUXKVWPyc1YE=
20251126064057.sql h1:+lByIo0zAsHVSFzQGVMuymFQajyl7fRNqgs9d/76y+E=
@@ -0,0 +1,36 @@
-- Create "InternalReferenceLink" table
CREATE TABLE "public"."InternalReferenceLink" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Simx_Id" bigint NULL,
"Simgos_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_InternalReferenceLink_Simgos_Id" UNIQUE ("Simgos_Id"),
CONSTRAINT "uni_InternalReferenceLink_Simx_Id" UNIQUE ("Simx_Id")
);
-- Create "InternalReferenceSimgosLog" table
CREATE TABLE "public"."InternalReferenceSimgosLog" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Value" text NULL,
"Date" timestamptz NULL,
"Status" text NULL,
"ErrMessage" text NULL,
PRIMARY KEY ("Id")
);
-- Create "InternalReferenceSimxLog" table
CREATE TABLE "public"."InternalReferenceSimxLog" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Value" text NULL,
"Date" timestamptz NULL,
"Status" text NULL,
"ErrMessage" text NULL,
PRIMARY KEY ("Id")
);
@@ -1,6 +1,7 @@
h1:keVmwgYtvwxSqkq+7nB0BA25JFYRAVBpBBu5eA4Q9Hw=
h1:UdPzQZ17yyNN9HVuyrFFHj5KjLj4m6/e7s9frkdpQVU=
20251113035508.sql h1:rjDlu6yDdy5xv6nrCOr7NialrLSLT23pzduYNq29Hf0=
20251114071129.sql h1:Z0GQ5bJo3C+tplaWzxT8n3J9HLkEaVsRVp5nn7bmYow=
20251117041601.sql h1:l/RPG5mObqCSBjO4mzG+wTq2ieSycvlfOSz4czpUdWY=
20251118082246.sql h1:VFnYls2DBC8tJm2aw0iBcbWGLsKezYdOHJJV9iS7MjI=
20251118082915.sql h1:tAm67fXrH+8IJCjKbJroIqc1uQyqCnuGJnQtLmw7D20=
20251118082246.sql h1:xLUwA+EvKWIg3X/TJvu7rqbtBzONiINfag5NJpMV29E=
20251118082915.sql h1:hP6FmUVFuADIN2cDg2Z1l7Wx7PQRb+IYQDvKD7J8VAM=
20251126115527.sql h1:+2bp2nWTTqaPpKKfy5ZYSr6b1nEUXFG3tIw4r3OEnAQ=
@@ -20,6 +20,7 @@ import (
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"
en "simrs-vx/internal/domain/main-entities/nurse"
ep "simrs-vx/internal/domain/main-entities/patient"
er "simrs-vx/internal/domain/main-entities/rehab/base"
es "simrs-vx/internal/domain/main-entities/specialist"
@@ -77,6 +78,8 @@ type Encounter struct {
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
GeneralConsents *[]egc.GeneralConsent `json:"generalConsents,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
VclaimReference *evr.VclaimReference `json:"vclaimReference,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Responsible_Nurse_Code *string `json:"responsible_nurse_code"`
Responsible_Nurse *en.Nurse `json:"responsible_nurse,omitempty" gorm:"foreignKey:Responsible_Nurse_Code;references:Code"`
}
func (d Encounter) IsDone() bool {
@@ -5,15 +5,22 @@ import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
en "simrs-vx/internal/domain/main-entities/nurse"
eu "simrs-vx/internal/domain/main-entities/unit"
)
type InternalReference struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code *erc.DataApprovalCode `json:"status_code"`
Encounter_Id *uint `json:"encounter_id"`
Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code *erc.DataApprovalCode `json:"status_code"`
SrcDoctor_Code *string `json:"srcDoctor_code"`
SrcDoctor *ed.Doctor `json:"srcDoctor,omitempty" gorm:"foreignKey:SrcDoctor_Code;references:Code"`
SrcNurse_Code *string `json:"srcNurse_code"`
SrcNurse *en.Nurse `json:"srcNurse,omitempty" gorm:"foreignKey:SrcNurse_Code;references:Code"`
Nurse_Code *string `json:"nurse_code"`
Nurse *en.Nurse `json:"nurse,omitempty" gorm:"foreignKey:Nurse_Code;references:Code"`
}
@@ -106,6 +106,7 @@ const (
DACNew DataApprovalCode = "new"
DACApproved DataApprovalCode = "approved"
DACRejected DataApprovalCode = "rejected"
DACCanceled DataApprovalCode = "canceled"
PSCSuccess ProcessStatusCode = "success"
PSCFailed ProcessStatusCode = "failed"
@@ -0,0 +1,29 @@
package internal_reference
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/common"
"time"
)
type InternalReferenceLink struct {
ecore.Main
Simx_Id uint `json:"simx_id" gorm:"unique"`
Simgos_Id uint `json:"simgos_id" gorm:"unique"`
}
type InternalReferenceSimxLog struct {
ecore.Main
Value *string `json:"value"`
Date *time.Time `json:"date"`
Status erc.ProcessStatusCode `json:"status"`
ErrMessage *string `json:"errMessage"`
}
type InternalReferenceSimgosLog struct {
ecore.Main
Value *string `json:"value"`
Date *time.Time `json:"date"`
Status erc.ProcessStatusCode `json:"status"`
ErrMessage *string `json:"errMessage"`
}
@@ -5,6 +5,7 @@ import (
division "simrs-vx/internal/domain/sync-entities/division"
encounter "simrs-vx/internal/domain/sync-entities/encounter"
installation "simrs-vx/internal/domain/sync-entities/installation"
internalreference "simrs-vx/internal/domain/sync-entities/internal-reference"
patient "simrs-vx/internal/domain/sync-entities/patient"
specialist "simrs-vx/internal/domain/sync-entities/specialist"
subspecialist "simrs-vx/internal/domain/sync-entities/subspecialist"
@@ -34,5 +35,8 @@ func getSyncEntities() []any {
&encounter.EncounterLink{},
&encounter.EncounterSimxLog{},
&encounter.EncounterSimgosLog{},
&internalreference.InternalReferenceLink{},
&internalreference.InternalReferenceSimxLog{},
&internalreference.InternalReferenceSimgosLog{},
}
}