fix import cycle encounter related
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
-- Rename a column from "DischargeMethod_Code" to "Discharge_Method_Code"
|
||||
ALTER TABLE "public"."Encounter" RENAME COLUMN "DischargeMethod_Code" TO "Discharge_Method_Code";
|
||||
-- Modify "Encounter" table
|
||||
ALTER TABLE "public"."Encounter" ADD COLUMN "Discharge_Date" timestamptz NULL;
|
||||
-- Modify "DeathCause" table
|
||||
ALTER TABLE "public"."DeathCause" DROP CONSTRAINT "fk_DeathCause_Encounter", ADD CONSTRAINT "fk_Encounter_DeathCause" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "InternalReference" table
|
||||
ALTER TABLE "public"."InternalReference" DROP CONSTRAINT "fk_InternalReference_Encounter", ADD CONSTRAINT "fk_Encounter_InternalReferences" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -1,4 +1,4 @@
|
||||
h1:zICJO08EuquqIcIfyqTkv+GpOZ22zFBOogzkklwngEQ=
|
||||
h1:5zzKM5mZWg7boY0OYotYXr6yCVyHsJYrwx+WHnYZ25A=
|
||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||
@@ -51,4 +51,5 @@ h1:zICJO08EuquqIcIfyqTkv+GpOZ22zFBOogzkklwngEQ=
|
||||
20251017082207.sql h1:8vLG1l/saRRMHXkyA4nelJyjaSddhZd6r7R+Uo4JS/c=
|
||||
20251019093915.sql h1:vWqTEc9bZpnAj53DLNKaTYbEoiSqdQJ9Mx4Qv9zmXU8=
|
||||
20251020062553.sql h1:TMlFzG+6P/rqIDzF6y8OLrWy4vusEDonVHhfRwRhrqw=
|
||||
20251021041042.sql h1:2aeUaTJzswayaHg8FC0hQkR0tyKENYHWJygALq7Cuco=
|
||||
20251021041042.sql h1:jeEBAgnfPZpkfe5wDE7oG37JpF74IXAeYCbAx7zzRro=
|
||||
20251021075552.sql h1:vokB4CkMSWJ3eexhYRfuX0PQZ4AYU5Yc3bFM+2R0Wuk=
|
||||
|
||||
@@ -2,12 +2,10 @@ package death_cause
|
||||
|
||||
import (
|
||||
"simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
|
||||
type DeathCause struct {
|
||||
core.Main
|
||||
Encounter_Id *uint `json:"encounter_id" gorm:"not null"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Value *string `json:"value"`
|
||||
Encounter_Id *uint `json:"encounter_id" gorm:"not null"`
|
||||
Value *string `json:"value"`
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ type ResponseDto struct {
|
||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
|
||||
Adm_Employee_Id *uint `json:"adm_employee_id"`
|
||||
Adm_Employee *ee.Employee `json:"adm_employee,omitempty"`
|
||||
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code"`
|
||||
Discharge_Method_Code *ere.DischargeMethodCode `json:"discharge_method_code"`
|
||||
RefSource_Name *string `json:"refSource_name"`
|
||||
Appointment_Id *uint `json:"appointment_id"`
|
||||
Appointment *ea.Appointment `json:"appointment,omitempty"`
|
||||
@@ -161,7 +161,7 @@ func (d Encounter) ToResponse() ResponseDto {
|
||||
Adm_Employee: d.Adm_Employee,
|
||||
Responsible_Doctor_Id: d.Responsible_Doctor_Id,
|
||||
Responsible_Doctor: d.Responsible_Doctor,
|
||||
DischargeMethod_Code: d.DischargeMethod_Code,
|
||||
Discharge_Method_Code: d.Discharge_Method_Code,
|
||||
RefSource_Name: d.RefSource_Name,
|
||||
Appointment_Id: d.Appointment_Id,
|
||||
Appointment: d.Appointment,
|
||||
|
||||
@@ -4,9 +4,11 @@ import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
evs "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
|
||||
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"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
ei "simrs-vx/internal/domain/main-entities/insurance-company"
|
||||
eir "simrs-vx/internal/domain/main-entities/internal-reference"
|
||||
ep "simrs-vx/internal/domain/main-entities/patient"
|
||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
@@ -42,7 +44,7 @@ type Encounter struct {
|
||||
Adm_Employee *ee.Employee `json:"adm_employee,omitempty" gorm:"foreignKey:Adm_Employee_Id;references:Id"`
|
||||
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
|
||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references:Id"`
|
||||
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code" gorm:"size:16"`
|
||||
Discharge_Method_Code *ere.DischargeMethodCode `json:"discharge_method_code" gorm:"size:16"`
|
||||
RefSource_Name *string `json:"refSource_name" gorm:"size:100"`
|
||||
Appointment_Id *uint `json:"appointment_id"`
|
||||
Appointment *ea.Appointment `json:"appointment,omitempty" gorm:"foreignKey:Appointment_Id;references:Id"`
|
||||
@@ -53,6 +55,8 @@ type Encounter struct {
|
||||
Status_Code erc.DataStatusCode `json:"status_code" gorm:"size:10"`
|
||||
VclaimSep *evs.VclaimSep `json:"vclaimSep,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Discharge_Date *time.Time `json:"discharge_date"`
|
||||
InternalReferences *[]eir.InternalReference `json:"internalReferences,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
DeathCause *edc.DeathCause `json:"deathCause,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (d Encounter) IsDone() bool {
|
||||
|
||||
@@ -3,12 +3,11 @@ package internal_reference
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter_Id *uint `json:"-"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Doctor_Id *uint `json:"doctor_Id"`
|
||||
}
|
||||
@@ -47,18 +46,16 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
}
|
||||
|
||||
func (d InternalReference) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Encounter: d.Encounter,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
Doctor_Id: d.Doctor_Id,
|
||||
|
||||
@@ -3,16 +3,14 @@ package internal_reference
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
)
|
||||
|
||||
type InternalReference struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user