merge migration

This commit is contained in:
vanilia
2025-10-15 14:15:38 +07:00
19 changed files with 303 additions and 4 deletions
+66
View File
@@ -0,0 +1,66 @@
appCfg:
fullName: BPJS Bridge
codeName: simrs-vx
version: 0.1.0
env: development
lang: en
httpCfg:
host:
port:
dbCfg:
dsn:
maxOpenConns: 5
maxIdleConns: 5
maxIdleTime: 100
multiDbCfg:
- dbs :
name:
dsn:
maxOpenConns:
maxIdleConns:
maxIdleTime:
- bpjs
name: bpjs
dsn:
maxOpenConns:
maxIdleConns:
maxIdleTime:
loggerCfg:
hideTime:
hideLevel:
msCfg:
dsn:
langCfg:
active:
path:
fileName:
minioCfg:
endpoint:
region:
accessKey:
secretKey:
useSsl:
bucketName:
- patient
corsCfg:
allowedOrigin:
allowedMethod:
satuSehatCfg:
host: localhost:8200
bpjsCfg:
host: localhost:8200
corsCfg:
allowedOrigins:
- http://example.com
allowedMethod:
+14
View File
@@ -0,0 +1,14 @@
package main
import (
a "github.com/karincake/apem"
d "github.com/karincake/apem/db-gorm-pg"
l "github.com/karincake/apem/logger-zerolog"
m "github.com/karincake/apem/ms-redis"
h "simrs-vx/internal/interface/main-handler"
)
func main() {
a.Run(h.SetRoutes(), &l.O, &m.O, &d.O)
}
@@ -0,0 +1,16 @@
-- Create "InternalReference" table
CREATE TABLE "public"."InternalReference" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Unit_Id" integer NULL,
"Doctor_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_InternalReference_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_InternalReference_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_InternalReference_Unit" FOREIGN KEY ("Unit_Id") REFERENCES "public"."Unit" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Drop "CheckoutPolies" table
DROP TABLE "public"."CheckoutPolies";
@@ -0,0 +1,36 @@
-- Create "VClaimSepHist" table
CREATE TABLE "public"."VClaimSepHist" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"RequestPayload" text NULL,
"ResponseBody" text NULL,
"Message" text NULL,
PRIMARY KEY ("Id")
);
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "PaymentMethod_Code" character varying(10) NULL, ADD COLUMN "InsuranceCompany_Id" bigint NULL, ADD COLUMN "Member_Number" character varying(20) NULL, ADD COLUMN "Ref_Number" character varying(20) NULL, ADD COLUMN "Trx_Number" character varying(20) NULL, ADD COLUMN "Adm_Employee_Id" bigint NULL, ADD CONSTRAINT "uni_Encounter_Member_Number" UNIQUE ("Member_Number"), ADD CONSTRAINT "uni_Encounter_Ref_Number" UNIQUE ("Ref_Number"), ADD CONSTRAINT "uni_Encounter_Trx_Number" UNIQUE ("Trx_Number"), ADD CONSTRAINT "fk_Encounter_Adm_Employee" FOREIGN KEY ("Adm_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Encounter_InsuranceCompany" FOREIGN KEY ("InsuranceCompany_Id") REFERENCES "public"."InsuranceCompany" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Create "VClaimSep" table
CREATE TABLE "public"."VClaimSep" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Number" character varying(19) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_VClaimSep_Number" UNIQUE ("Number"),
CONSTRAINT "fk_Encounter_VclaimSep" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "VClaimSepPrint" table
CREATE TABLE "public"."VClaimSepPrint" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"VclaimSep_Number" character varying(19) NULL,
"Counter" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_VClaimSepPrint_VclaimSep" FOREIGN KEY ("VclaimSep_Number") REFERENCES "public"."VClaimSep" ("Number") ON UPDATE NO ACTION ON DELETE NO ACTION
);
@@ -0,0 +1,16 @@
-- Create "VclaimSep" table
CREATE TABLE "public"."VclaimSep" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Number" character varying(19) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_VclaimSep_Number" UNIQUE ("Number"),
CONSTRAINT "fk_Encounter_VclaimSep" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Modify "VClaimSepPrint" table
ALTER TABLE "public"."VClaimSepPrint" DROP CONSTRAINT "fk_VClaimSepPrint_VclaimSep", ADD CONSTRAINT "fk_VClaimSepPrint_VclaimSep" FOREIGN KEY ("VclaimSep_Number") REFERENCES "public"."VclaimSep" ("Number") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Drop "VClaimSep" table
DROP TABLE "public"."VClaimSep";
@@ -0,0 +1,26 @@
-- Create "VclaimSepHist" table
CREATE TABLE "public"."VclaimSepHist" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"RequestPayload" text NULL,
"ResponseBody" text NULL,
"Message" text NULL,
PRIMARY KEY ("Id")
);
-- Create "VclaimSepPrint" table
CREATE TABLE "public"."VclaimSepPrint" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"VclaimSep_Number" character varying(19) NULL,
"Counter" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_VclaimSepPrint_VclaimSep" FOREIGN KEY ("VclaimSep_Number") REFERENCES "public"."VclaimSep" ("Number") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Drop "VClaimSepHist" table
DROP TABLE "public"."VClaimSepHist";
-- Drop "VClaimSepPrint" table
DROP TABLE "public"."VClaimSepPrint";
@@ -0,0 +1,2 @@
-- Modify "Chemo" table
ALTER TABLE "public"."Chemo" ADD COLUMN "ClassCode" text NULL;
+7 -2
View File
@@ -1,4 +1,4 @@
h1:0s0nd0srbuZbIdiQHvRt1PALWD+XDaCk7Qg/iAk4wY0=
h1:Y15nC3Bp3DWNym7hAvXkF9zFwkHh8nQDpxcNrxQgYhE=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -38,4 +38,9 @@ h1:0s0nd0srbuZbIdiQHvRt1PALWD+XDaCk7Qg/iAk4wY0=
20251010070721.sql h1:5NQUk/yOV6sABLCB7swx++YIOyJe6MnU+yt1nRzde5w=
20251010072711.sql h1:ZJNqR2piyu8xJhBvVABSlnGEoKSKae3wuEs+wshPe4k=
20251013044536.sql h1:0Xjw8fNILiT8nnfrJDZgQnPf3dntmIoilbapnih8AE4=
20251013051438.sql h1:aREcqpdUTiA2T9/f1HOtfa4BUiPRa50RATZ4ETu1syk=
20251013051438.sql h1:lfSuw5mgJnePBJamvhZ81osFIouXeiIEiSZ/evdwo48=
20251013081808.sql h1:ijgjNX08G6GBjA/ks8EKtb7P7Y7Cg7zbhqEOruGnv6M=
20251014060047.sql h1:0jqj49WTtneEIMQDBoo4c095ZGi8sCrA8NnHBrPU6D8=
20251014063537.sql h1:VZLXol0PTsTW21Epg6vBPsztWkDtcxup9F/z88EGgIg=
20251014063720.sql h1:2HVUyCV0ud3BJJDH2GEKZN/+IWLFPCsN1KqhP6csO14=
20251015045455.sql h1:v120CzYYiFWmW81VmKWsjmjRiBIv5aFnPZXwQaQxqes=
@@ -0,0 +1 @@
package vclaimsephist
@@ -0,0 +1,12 @@
package vclaimsephist
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type VclaimSepHist struct {
ecore.Main
RequestPayload *string `json:"requestPayload"`
ResponseBody *string `json:"responseBody"`
Message *string `json:"message"`
}
@@ -0,0 +1 @@
package vclaimsepprint
@@ -0,0 +1,13 @@
package vclaimsepprint
import (
ecore "simrs-vx/internal/domain/base-entities/core"
evs "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
)
type VclaimSepPrint struct {
ecore.Main
VclaimSep_Number *string `json:"vclaimSep_number"`
VclaimSep *evs.VclaimSep `json:"vclaimSep,omitempty" gorm:"foreignKey:VclaimSep_Number;references:Number"`
Counter *uint `json:"counter"`
}
@@ -0,0 +1 @@
package vclaimsep
@@ -0,0 +1,11 @@
package vclaimsep
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type VclaimSep struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Number *string `json:"number" gorm:"unique;size:19"`
}
@@ -9,6 +9,7 @@ import (
eus "simrs-vx/internal/domain/main-entities/user"
erc "simrs-vx/internal/domain/references/common"
ere "simrs-vx/internal/domain/references/encounter"
)
type Chemo struct {
@@ -19,6 +20,7 @@ type Chemo struct {
VerifiedAt *time.Time `json:"verifiedAt"`
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
VerifiedBy *eus.User `json:"verifiedBy,omitempty" gorm:"foreignKey:VerifiedBy_User_Id;references:Id"`
SrcUnit_Id *uint `json:"srcUnit_id"`
SrcUnit *eun.Unit `json:"srcUnit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
SrcUnit_Id *uint `json:"src_unit_id"`
SrcUnit *eun.Unit `json:"src_unit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
Class_Code ere.ChemoClassCode `json:"class_code"`
}
@@ -2,12 +2,16 @@ package encounter
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"
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"
ep "simrs-vx/internal/domain/main-entities/patient"
es "simrs-vx/internal/domain/main-entities/specialist"
ess "simrs-vx/internal/domain/main-entities/subspecialist"
eu "simrs-vx/internal/domain/main-entities/unit"
erc "simrs-vx/internal/domain/references/common"
ere "simrs-vx/internal/domain/references/encounter"
"time"
@@ -26,8 +30,16 @@ 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"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"`
InsuranceCompany_Id *uint `json:"insuranceCompany_id"`
Member_Number *string `json:"memberNumber" gorm:"unique;size:20"`
Ref_Number *string `json:"refNumber" gorm:"unique;size:20"`
Trx_Number *string `json:"trxNumber" gorm:"unique;size:20"`
InsuranceCompany *ei.InsuranceCompany `json:"insuranceCompany,omitempty" gorm:"foreignKey:InsuranceCompany_Id;references:Id"`
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty" gorm:"foreignKey:Appointment_Doctor_Id;references:Id"`
Adm_Employee_Id *uint `json:"admEmployee_id"`
Adm_Employee *ee.Employee `json:"admEmployee,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"`
@@ -39,6 +51,7 @@ type Encounter struct {
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"size:10"`
VclaimSep *evs.VclaimSep `json:"vclaimSep,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
}
func (d Encounter) IsDone() bool {
@@ -12,6 +12,7 @@ type (
AmbulatoryClassCode string
InpatientClassCode string
UploadCode string
ChemoClassCode string
)
const (
@@ -78,6 +79,9 @@ const (
UCPP UploadCode = "person-passport" // Person Passport
UCPFC UploadCode = "person-family-card" // Person Family Card
UCMIR UploadCode = "mcu-item-result" // Mcu Item Result
CCCAdm ChemoClassCode = "adm" // Administrasi
CCCAct ChemoClassCode = "act" // Tindakan
)
func (ec EncounterClassCode) Code() string {
@@ -0,0 +1,52 @@
package bpjshandler
import (
"net/http"
/******************** main / transaction ********************/
/******************** actor ********************/
/******************** external ********************/
a "github.com/karincake/apem"
/******************** infra ********************/
gs "simrs-vx/internal/infra/gorm-setting"
minio "simrs-vx/internal/infra/minio"
ssdb "simrs-vx/internal/infra/ss-db"
/******************** pkg ********************/
cmw "simrs-vx/pkg/cors-manager-mw"
lh "simrs-vx/pkg/lang-helper"
handlerlogger "simrs-vx/pkg/middleware/handler-logger"
mh "simrs-vx/pkg/minio-helper"
zlc "simrs-vx/pkg/zerolog-ctx"
/******************** sources ********************/
///// Internal
validation "simrs-vx/internal/interface/main-handler/helper/validation"
"simrs-vx/internal/interface/main-handler/home"
)
// One place route to relatively easier to manage, ESPECIALLY in tracking
func SetRoutes() http.Handler {
/////
a.RegisterExtCall(gs.Adjust)
a.RegisterExtCall(zlc.Adjust)
a.RegisterExtCall(ssdb.SetInstance)
a.RegisterExtCall(lh.Populate)
a.RegisterExtCall(minio.Connect)
a.RegisterExtCall(mh.I.SetClient)
a.RegisterExtCall(validation.RegisterValidation)
r := http.NewServeMux()
/******************** Main ********************/
r.HandleFunc("/", home.Home)
/******************** actor ********************/
/******************** sources ********************/
return cmw.SetCors(handlerlogger.SetLog(r))
}
@@ -75,6 +75,11 @@ import (
uom "simrs-vx/internal/domain/main-entities/uom"
user "simrs-vx/internal/domain/main-entities/user"
village "simrs-vx/internal/domain/main-entities/village"
///BPJS
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"
)
func getMainEntities() []any {
@@ -123,6 +128,7 @@ func getMainEntities() []any {
&personrelative.PersonRelative{},
&patient.Patient{},
&appointment.Appointment{},
&vclaimsep.VclaimSep{},
&encounter.Encounter{},
&laborant.Laborant{},
&specialist.Specialist{},
@@ -153,5 +159,7 @@ func getMainEntities() []any {
&midwife.Midwife{},
&postalregion.PostalRegion{},
&internalreference.InternalReference{},
&vclaimsephist.VclaimSepHist{},
&vclaimsepprint.VclaimSepPrint{},
}
}