Merge branch 'migration-vanilia' of https://github.com/dikstub-rssa/simrs-be into feat/encounter-checkin

This commit is contained in:
vanilia
2025-10-27 14:55:49 +07:00
12 changed files with 84 additions and 24 deletions
@@ -0,0 +1,4 @@
-- Modify "Patient" table
ALTER TABLE "public"."Patient" ADD COLUMN "RegisteredBy_User_Name" character varying(100) NULL;
-- Modify "Person" table
ALTER TABLE "public"."Person" ADD COLUMN "Confidence" character varying(512) NULL, ADD COLUMN "MaritalStatus_Code" character varying(10) NULL;
@@ -0,0 +1,12 @@
-- Create "VclaimMember" table
CREATE TABLE "public"."VclaimMember" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"CardNumber" character varying(20) NULL,
"Person_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_VclaimMember_CardNumber" UNIQUE ("CardNumber"),
CONSTRAINT "fk_Person_VclaimMember" FOREIGN KEY ("Person_Id") REFERENCES "public"."Person" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
@@ -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;
+4 -1
View File
@@ -1,4 +1,4 @@
h1:ieMeKh35/dro1YBBO11ZP0nZan9aJ5aFSqnEAi+T+WQ=
h1:ziMZz2LperFyae6+OgAW10C4nB3cdUxwlYGRyT+L+yU=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -58,3 +58,6 @@ h1:ieMeKh35/dro1YBBO11ZP0nZan9aJ5aFSqnEAi+T+WQ=
20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA=
20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI=
20251024074315.sql h1:EjAjelgi5qAfcRq/8vPTlGGYHvAKxNTllm8f0SzZDns=
20251025013451.sql h1:6hnuIiwYiG+6nLhOY/+Yyn+I6ZCFNRZxrJNqBV6HLqE=
20251025013609.sql h1:evPJaTD8WxYRMOJZHkSr7ONLx9PYxT+ankzQt9c/sJ0=
20251027075128.sql h1:bV1FEssEnGHBfBB4huqEHtIllIOJx+/l/WEJIlvKuK0=
@@ -0,0 +1 @@
package vclaimmember
@@ -0,0 +1,9 @@
package vclaimmember
import ecore "simrs-vx/internal/domain/base-entities/core"
type VclaimMember struct {
ecore.Main
CardNumber *string `json:"cardNumber" gorm:"unique;size:20"`
Person_Id *uint `json:"person_id"`
}
@@ -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 {
@@ -8,11 +8,12 @@ import (
)
type Patient struct {
ecore.Main // adjust this according to the needs
Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
NewBornStatus bool `json:"newBornStatus"`
RegisteredAt *time.Time `json:"registeredAt"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
Number *string `json:"number" gorm:"unique;size:15"`
ecore.Main // adjust this according to the needs
Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
NewBornStatus bool `json:"newBornStatus"`
RegisteredAt *time.Time `json:"registeredAt"`
RegisteredBy_User_Name *string `json:"registeredBy_user_name" gorm:"size:100"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
Number *string `json:"number" gorm:"unique;size:15"`
}
@@ -2,6 +2,7 @@ package person
import (
ecore "simrs-vx/internal/domain/base-entities/core"
evm "simrs-vx/internal/domain/bpjs-entities/vclaim-member"
ee "simrs-vx/internal/domain/main-entities/ethnic"
el "simrs-vx/internal/domain/main-entities/language"
epa "simrs-vx/internal/domain/main-entities/person-address"
@@ -28,9 +29,11 @@ type Person struct {
PassportNumber *string `json:"passportNumber" gorm:"unique;size:20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" gorm:"unique;size:20"`
Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"`
Confidence *string `json:"confidence" gorm:"size:512"`
Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
MaritalStatus_Code *erp.MaritalStatusCode `json:"maritalStatus_code" gorm:"size:10"`
Nationality *string `json:"nationality": gorm:"size:50"`
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
@@ -46,6 +49,7 @@ type Person struct {
Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"`
Relatives *[]epr.PersonRelative `json:"relatives" gorm:"foreignKey:Person_Id"`
Insurances *[]epi.PersonInsurance `json:"insurances" gorm:"foreignKey:Person_Id"`
VclaimMember *evm.VclaimMember `json:"vclaimMember,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
}
func (d Person) IsSameResidentIdentityNumber(input *string) bool {
@@ -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 {
+18 -16
View File
@@ -30,10 +30,10 @@ const (
BTCOPositive BloodTypeCode = "O+"
BTCONegative BloodTypeCode = "O-"
MSCBelumKawin MaritalStatusCode = "S"
MSCKawin MaritalStatusCode = "M"
MSCCeraiHidup MaritalStatusCode = "D"
MSCCeraiMati MaritalStatusCode = "W"
MaritalStatusSingle MaritalStatusCode = "S" // Single (Belum Kawin)
MaritalStatusMarried MaritalStatusCode = "M" // Married (Kawin)
MaritalStatusDivorced MaritalStatusCode = "D" // Divorced (Cerai Hidup)
MaritalStatusWidowed MaritalStatusCode = "W" // Widowed (Cerai Mati)
RCIslam ReligionCode = "islam"
RCProtestan ReligionCode = "protestan"
@@ -42,18 +42,20 @@ const (
RCBudha ReligionCode = "budha"
RCKonghucu ReligionCode = "konghucu"
ECTS EducationCode = "TS"
ECTK EducationCode = "TK"
ECSD EducationCode = "SD"
ECSLTP EducationCode = "SMP"
ECSLTA EducationCode = "SMA"
ECD1 EducationCode = "D1"
ECD2 EducationCode = "D2"
ECD3 EducationCode = "D3"
ECD4 EducationCode = "D4"
ECS1 EducationCode = "S1"
ECS2 EducationCode = "S2"
ECS3 EducationCode = "S3"
ECTS EducationCode = "TS"
ECTK EducationCode = "TK"
ECSD EducationCode = "SD"
ECSLTP EducationCode = "SMP"
ECSLTA EducationCode = "SMA"
ECD1 EducationCode = "D1"
ECD2 EducationCode = "D2"
ECD3 EducationCode = "D3"
ECD4 EducationCode = "D4"
ECS1 EducationCode = "S1"
ECS2 EducationCode = "S2"
ECS3 EducationCode = "S3"
ECOther EducationCode = "other"
ECUnkown EducationCode = "unknown"
OCTidakBekerja OcupationCode = "tidak-bekerja"
OCPns OcupationCode = "pns"
@@ -92,6 +92,7 @@ import (
village "simrs-vx/internal/domain/main-entities/village"
///BPJS
vclaimmember "simrs-vx/internal/domain/bpjs-entities/vclaim-member"
vclaimsep "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
vclaimsephist "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-hist"
vclaimsepprint "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-print"
@@ -191,5 +192,6 @@ func getMainEntities() []any {
&subspecialistposition.SubspecialistPosition{},
&responsibledoctorhist.ResponsibleDoctorHist{},
&admemployeehist.AdmEmployeeHist{},
&vclaimmember.VclaimMember{},
}
}