adjust entity ambulatory and encounter

This commit is contained in:
vanilia
2025-11-02 18:59:30 +07:00
parent a70e53f6f6
commit 32b2b287aa
6 changed files with 13 additions and 27 deletions
@@ -0,0 +1,2 @@
-- Modify "Ambulatory" table
ALTER TABLE "public"."Ambulatory" DROP CONSTRAINT "fk_Ambulatory_Encounter", ADD CONSTRAINT "fk_Encounter_Ambulatory" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
+3 -2
View File
@@ -1,4 +1,4 @@
h1:llqBiqOQF+QcCuZSeEWKfRzAd9gN8gE4uGgdKWkfGW4=
h1:eq9RCCa1ej2Ov+qYjL1Pb0AEE3q+W2sHsG2Gg+Qypeg=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -63,4 +63,5 @@ h1:llqBiqOQF+QcCuZSeEWKfRzAd9gN8gE4uGgdKWkfGW4=
20251027075128.sql h1:/iFQBM1sytjqpyQSOx61q33gnorMgxTiFVSuL6bQqsM=
20251027091406.sql h1:eCZGtUkxAzEAqpC9UsGpP8Df9mS0DEOqSl885LgqpvM=
20251031082443.sql h1:ajvi2G8OGvcmB2pJ1SoX/09ALHLWKNh84RSonVhJqAc=
20251031084657.sql h1:rsml3HJP+sXmciMBIkowwkyabKFWuQTci2lDjnf5km0=
20251031084657.sql h1:86mNMS/oMNhewetTvLMFvEz1J6AANePHkE0fOztqHTM=
20251102115856.sql h1:KPtFqdVIsrJq07q/bmyoNMBiZMC5XsQgxi43XmQj1YI=
@@ -1,17 +0,0 @@
package base
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ere "simrs-vx/internal/domain/references/encounter"
)
type Basic struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"`
VisitMode_Code ere.VisitModeCode `json:"visitMode_code"`
}
func (Basic) TableName() string {
return "Ambulatory"
}
@@ -2,7 +2,6 @@ package ambulatory
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ere "simrs-vx/internal/domain/references/encounter"
)
@@ -44,7 +43,6 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Class_Code ere.AmbulatoryClassCode `json:"class_code"`
}
@@ -1,11 +1,13 @@
package ambulatory
import (
ea "simrs-vx/internal/domain/main-entities/ambulatory/base"
ee "simrs-vx/internal/domain/main-entities/encounter"
ecore "simrs-vx/internal/domain/base-entities/core"
ere "simrs-vx/internal/domain/references/encounter"
)
type Ambulatory struct {
ea.Basic
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"`
VisitMode_Code ere.VisitModeCode `json:"visitMode_code"`
}
@@ -3,7 +3,7 @@ package encounter
import (
ecore "simrs-vx/internal/domain/base-entities/core"
evs "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
eam "simrs-vx/internal/domain/main-entities/ambulatory/base"
eam "simrs-vx/internal/domain/main-entities/ambulatory"
ea "simrs-vx/internal/domain/main-entities/appointment"
edc "simrs-vx/internal/domain/main-entities/death-cause"
ed "simrs-vx/internal/domain/main-entities/doctor"
@@ -65,7 +65,7 @@ type Encounter struct {
InternalReferences *[]eir.InternalReference `json:"internalReferences,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
DeathCause *edc.DeathCause `json:"deathCause,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
NewStatus bool `json:"newStatus"`
Ambulatory *eam.Basic `json:"ambulatory,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Ambulatory *eam.Ambulatory `json:"ambulatory,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Emergency *eem.Basic `json:"emergency,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Inpatient *eip.Basic `json:"inpatient,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Rehab *er.Basic `json:"rehab,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`