adjust table internalreference

This commit is contained in:
vanilia
2025-11-26 13:41:26 +07:00
parent 1067efb501
commit 94dbb8624f
4 changed files with 19 additions and 8 deletions
@@ -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;
+3 -2
View File
@@ -1,4 +1,4 @@
h1:u2pc+PayIbiG5HRFUzun7cApIwlt9SMNTl74DtPz1xg=
h1:U9vdficFramvwnH40psSuRxzUuq6EPJwLcr9MvVTq7s=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -129,4 +129,5 @@ h1:u2pc+PayIbiG5HRFUzun7cApIwlt9SMNTl74DtPz1xg=
20251120074415.sql h1:NNUeJVA03EeBHJhHqPXEZoDv/PnC6yK1/cRhmukyaJo=
20251121033803.sql h1:/vfvFX/3pzSCIHnSbMUT9EMBDykOpVkvyfeTEle9Vas=
20251124071457.sql h1:qg2dhCL9YwD13xnfJ175lW/p6MGfzFKaBqd908FByRc=
20251125125303.sql h1:P94UsZOeo7b0r2yLoSGBfj0+PcMTf4Y10lF+Rl9FxAE=
20251125125303.sql h1:4JSFv1Pmhbe9tqpLXgO63OwYnGsalStgUXKVWPyc1YE=
20251126064057.sql h1:+lByIo0zAsHVSFzQGVMuymFQajyl7fRNqgs9d/76y+E=
@@ -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"