diff --git a/cmd/main-migration/migrations/20251027075128.sql b/cmd/main-migration/migrations/20251027075128.sql new file mode 100644 index 00000000..6d583866 --- /dev/null +++ b/cmd/main-migration/migrations/20251027075128.sql @@ -0,0 +1,2 @@ +-- Modify "Encounter" table +ALTER TABLE "public"."Encounter" ADD COLUMN "StartedAt" timestamptz NULL, ADD COLUMN "FinishedAt" timestamptz NULL, ADD COLUMN "RefType_Code" text NULL, ADD COLUMN "NewStatus" boolean NULL; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 33455810..a045414f 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:BeGFyPoCNw+Am00+prXp3+lNStrspn2VED1Mz+3IWpI= +h1:ziMZz2LperFyae6+OgAW10C4nB3cdUxwlYGRyT+L+yU= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -58,5 +58,6 @@ h1:BeGFyPoCNw+Am00+prXp3+lNStrspn2VED1Mz+3IWpI= 20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA= 20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI= 20251024074315.sql h1:EjAjelgi5qAfcRq/8vPTlGGYHvAKxNTllm8f0SzZDns= -20251025013451.sql h1:XTkUVKTZsZi9qphqhwXdVtHnhNNyJegbGYg+RKUXXag= -20251025013609.sql h1:Wlqjzsxm5Mb+sJPAyWsIrhwEx8oSSjfjYyHnAdkikzs= +20251025013451.sql h1:6hnuIiwYiG+6nLhOY/+Yyn+I6ZCFNRZxrJNqBV6HLqE= +20251025013609.sql h1:evPJaTD8WxYRMOJZHkSr7ONLx9PYxT+ankzQt9c/sJ0= +20251027075128.sql h1:bV1FEssEnGHBfBB4huqEHtIllIOJx+/l/WEJIlvKuK0= diff --git a/internal/domain/main-entities/encounter/entity.go b/internal/domain/main-entities/encounter/entity.go index fccbab41..37779409 100644 --- a/internal/domain/main-entities/encounter/entity.go +++ b/internal/domain/main-entities/encounter/entity.go @@ -32,10 +32,13 @@ type Encounter struct { Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` VisitDate time.Time `json:"visitDate"` + StartedAt *time.Time `json:"startedAt"` + FinishedAt *time.Time `json:"finishedAt"` PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"` InsuranceCompany_Id *uint `json:"insuranceCompany_id"` InsuranceCompany *ei.InsuranceCompany `json:"insuranceCompany,omitempty" gorm:"foreignKey:InsuranceCompany_Id;references:Id"` Member_Number *string `json:"memberNumber" gorm:"unique;size:20"` + RefType_Code *ere.RefTypeCode `json:"refType_code"` Ref_Number *string `json:"refNumber" gorm:"unique;size:20"` Trx_Number *string `json:"trxNumber" gorm:"unique;size:20"` Appointment_Doctor_Id *uint `json:"appointment_doctor_id"` @@ -57,6 +60,7 @@ type Encounter struct { 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"` + NewStatus bool `json:"newStatus"` } func (d Encounter) IsDone() bool { diff --git a/internal/domain/references/encounter/encounter.go b/internal/domain/references/encounter/encounter.go index 5b9515ec..eeccb8fe 100644 --- a/internal/domain/references/encounter/encounter.go +++ b/internal/domain/references/encounter/encounter.go @@ -15,6 +15,9 @@ type ( ChemoClassCode string AmbulanceFacilityCode string AmbulanceNeedsCode string + RefTypeCode string + AllPaymentMethodCode string + SEPRefTypeCode string ) const ( @@ -90,6 +93,19 @@ const ( ANCAssist AmbulanceNeedsCode = "assist" // Dengan Pendampingan ANCNonassist AmbulanceNeedsCode = "non-assist" // Tanpa Pendampingan + + RTCNone RefTypeCode = "none" // Tidak Ada + RTCGov RefTypeCode = "gov" // Pemerintah + RTCPrivate RefTypeCode = "private" // Swasta + RTCBpjs RefTypeCode = "bpjs" // BPJS + + APMCJkn AllPaymentMethodCode = "jkn" // JKN + APMCJkmm AllPaymentMethodCode = "jkmm" // JKMM + APMCSpm AllPaymentMethodCode = "spm" // SPM + APMCPks AllPaymentMethodCode = "pks" // PKS + + SRTCInternal SEPRefTypeCode = "internal" // Rujukan Internal + SRTCExternal SEPRefTypeCode = "external" // Faskes Lain ) func (ec EncounterClassCode) Code() string {