Merge pull request #73 from dikstub-rssa/feat/encounter-enhancement
Feat/encounter enhancement
This commit is contained in:
@@ -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:
|
||||||
@@ -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;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
h1:0s0nd0srbuZbIdiQHvRt1PALWD+XDaCk7Qg/iAk4wY0=
|
h1:Y15nC3Bp3DWNym7hAvXkF9zFwkHh8nQDpxcNrxQgYhE=
|
||||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||||
@@ -38,4 +38,9 @@ h1:0s0nd0srbuZbIdiQHvRt1PALWD+XDaCk7Qg/iAk4wY0=
|
|||||||
20251010070721.sql h1:5NQUk/yOV6sABLCB7swx++YIOyJe6MnU+yt1nRzde5w=
|
20251010070721.sql h1:5NQUk/yOV6sABLCB7swx++YIOyJe6MnU+yt1nRzde5w=
|
||||||
20251010072711.sql h1:ZJNqR2piyu8xJhBvVABSlnGEoKSKae3wuEs+wshPe4k=
|
20251010072711.sql h1:ZJNqR2piyu8xJhBvVABSlnGEoKSKae3wuEs+wshPe4k=
|
||||||
20251013044536.sql h1:0Xjw8fNILiT8nnfrJDZgQnPf3dntmIoilbapnih8AE4=
|
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"
|
eus "simrs-vx/internal/domain/main-entities/user"
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Chemo struct {
|
type Chemo struct {
|
||||||
@@ -19,6 +20,7 @@ type Chemo struct {
|
|||||||
VerifiedAt *time.Time `json:"verifiedAt"`
|
VerifiedAt *time.Time `json:"verifiedAt"`
|
||||||
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
|
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
|
||||||
VerifiedBy *eus.User `json:"verifiedBy,omitempty" gorm:"foreignKey:VerifiedBy_User_Id;references:Id"`
|
VerifiedBy *eus.User `json:"verifiedBy,omitempty" gorm:"foreignKey:VerifiedBy_User_Id;references:Id"`
|
||||||
SrcUnit_Id *uint `json:"srcUnit_id"`
|
SrcUnit_Id *uint `json:"src_unit_id"`
|
||||||
SrcUnit *eun.Unit `json:"srcUnit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
|
SrcUnit *eun.Unit `json:"src_unit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
|
||||||
|
Class_Code ere.ChemoClassCode `json:"class_code"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ type UpdateDto struct {
|
|||||||
CreateDto
|
CreateDto
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UpdateStatusDto struct {
|
||||||
|
Id uint16 `json:"id"`
|
||||||
|
StatusCode erc.DataStatusCode `json:"status_code"`
|
||||||
|
}
|
||||||
|
|
||||||
type DeleteDto struct {
|
type DeleteDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ package encounter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
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"
|
ea "simrs-vx/internal/domain/main-entities/appointment"
|
||||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
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"
|
ep "simrs-vx/internal/domain/main-entities/patient"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
ere "simrs-vx/internal/domain/references/encounter"
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
"time"
|
"time"
|
||||||
@@ -26,8 +30,16 @@ type Encounter struct {
|
|||||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||||
VisitDate time.Time `json:"visitDate"`
|
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_Id *uint `json:"appointment_doctor_id"`
|
||||||
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty" gorm:"foreignKey:Appointment_Doctor_Id;references: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_Id *uint `json:"responsible_doctor_id"`
|
||||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references: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"`
|
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code" gorm:"size:16"`
|
||||||
@@ -39,6 +51,7 @@ type Encounter struct {
|
|||||||
AdmDischargeEducation *string `json:"admDischargeEducation"`
|
AdmDischargeEducation *string `json:"admDischargeEducation"`
|
||||||
DischargeReason *string `json:"dischargeReason"`
|
DischargeReason *string `json:"dischargeReason"`
|
||||||
Status_Code erc.DataStatusCode `json:"status_code" gorm:"size:10"`
|
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 {
|
func (d Encounter) IsDone() bool {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type (
|
|||||||
AmbulatoryClassCode string
|
AmbulatoryClassCode string
|
||||||
InpatientClassCode string
|
InpatientClassCode string
|
||||||
UploadCode string
|
UploadCode string
|
||||||
|
ChemoClassCode string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -78,6 +79,9 @@ const (
|
|||||||
UCPP UploadCode = "person-passport" // Person Passport
|
UCPP UploadCode = "person-passport" // Person Passport
|
||||||
UCPFC UploadCode = "person-family-card" // Person Family Card
|
UCPFC UploadCode = "person-family-card" // Person Family Card
|
||||||
UCMIR UploadCode = "mcu-item-result" // Mcu Item Result
|
UCMIR UploadCode = "mcu-item-result" // Mcu Item Result
|
||||||
|
|
||||||
|
CCCAdm ChemoClassCode = "adm" // Administrasi
|
||||||
|
CCCAct ChemoClassCode = "act" // Tindakan
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ec EncounterClassCode) Code() string {
|
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))
|
||||||
|
}
|
||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
|
|
||||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
u "simrs-vx/internal/use-case/main-use-case/encounter"
|
u "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type myBase struct{}
|
type myBase struct{}
|
||||||
@@ -83,3 +85,63 @@ func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.CheckOut(dto)
|
res, err := u.CheckOut(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Process(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateStatusDto{
|
||||||
|
Id: uint16(id),
|
||||||
|
StatusCode: erc.DSCProcess,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Cancel(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateStatusDto{
|
||||||
|
Id: uint16(id),
|
||||||
|
StatusCode: erc.DSCCancel,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateStatusDto{
|
||||||
|
Id: uint16(id),
|
||||||
|
StatusCode: erc.DSCRejected,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Skip(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateStatusDto{
|
||||||
|
Id: uint16(id),
|
||||||
|
StatusCode: erc.DSCSkipped,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ func SetRoutes() http.Handler {
|
|||||||
"PATCH /{id}": encounter.O.Update,
|
"PATCH /{id}": encounter.O.Update,
|
||||||
"DELETE /{id}": encounter.O.Delete,
|
"DELETE /{id}": encounter.O.Delete,
|
||||||
"PATCH /{id}/checkout": encounter.O.CheckOut,
|
"PATCH /{id}/checkout": encounter.O.CheckOut,
|
||||||
|
"PATCH /{id}/proccess": encounter.O.Process,
|
||||||
|
"PATCH /{id}/cancel": encounter.O.Cancel,
|
||||||
|
"PATCH /{id}/reject": encounter.O.Reject,
|
||||||
|
"PATCH /{id}/skip": encounter.O.Skip,
|
||||||
})
|
})
|
||||||
hk.GroupRoutes("/v1/medication", r, auth.GuardMW, hk.MapHandlerFunc{
|
hk.GroupRoutes("/v1/medication", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||||
"GET /": medication.O.GetList,
|
"GET /": medication.O.GetList,
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ import (
|
|||||||
uom "simrs-vx/internal/domain/main-entities/uom"
|
uom "simrs-vx/internal/domain/main-entities/uom"
|
||||||
user "simrs-vx/internal/domain/main-entities/user"
|
user "simrs-vx/internal/domain/main-entities/user"
|
||||||
village "simrs-vx/internal/domain/main-entities/village"
|
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 {
|
func getMainEntities() []any {
|
||||||
@@ -123,6 +128,7 @@ func getMainEntities() []any {
|
|||||||
&personrelative.PersonRelative{},
|
&personrelative.PersonRelative{},
|
||||||
&patient.Patient{},
|
&patient.Patient{},
|
||||||
&appointment.Appointment{},
|
&appointment.Appointment{},
|
||||||
|
&vclaimsep.VclaimSep{},
|
||||||
&encounter.Encounter{},
|
&encounter.Encounter{},
|
||||||
&laborant.Laborant{},
|
&laborant.Laborant{},
|
||||||
&specialist.Specialist{},
|
&specialist.Specialist{},
|
||||||
@@ -153,5 +159,7 @@ func getMainEntities() []any {
|
|||||||
&midwife.Midwife{},
|
&midwife.Midwife{},
|
||||||
&postalregion.PostalRegion{},
|
&postalregion.PostalRegion{},
|
||||||
&internalreference.InternalReference{},
|
&internalreference.InternalReference{},
|
||||||
|
&vclaimsephist.VclaimSepHist{},
|
||||||
|
&vclaimsepprint.VclaimSepPrint{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -421,3 +421,69 @@ func CheckOut(input e.DischargeDto) (*d.Data, error) {
|
|||||||
Data: data.ToResponse(),
|
Data: data.ToResponse(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateStatusCode(input e.UpdateStatusDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.Encounter
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Update Status Code",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "update")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.IsDone() {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-state-mismatch",
|
||||||
|
Detail: "encounter is done",
|
||||||
|
Raw: errors.New("encounter is done"),
|
||||||
|
}
|
||||||
|
return pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunUpdateMiddleware(readDetailPreMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := UpdateStatusData(input, data, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunUpdateMiddleware(readDetailPostMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "updated",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Encounter) {
|
|||||||
data.Responsible_Doctor_Id = inputSrc.Responsible_Doctor_Id
|
data.Responsible_Doctor_Id = inputSrc.Responsible_Doctor_Id
|
||||||
data.RefSource_Name = inputSrc.RefSource_Name
|
data.RefSource_Name = inputSrc.RefSource_Name
|
||||||
data.Appointment_Id = inputSrc.Appointment_Id
|
data.Appointment_Id = inputSrc.Appointment_Id
|
||||||
data.Status_Code = erc.DSCNew
|
data.Status_Code = erc.DSCProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
func setDataUpdate(src e.UpdateDto, dst *e.Encounter) {
|
func setDataUpdate(src e.UpdateDto, dst *e.Encounter) {
|
||||||
@@ -308,3 +308,7 @@ func getMcuOrders(encounter_id uint, event *pl.Event, tx *gorm.DB) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setDataUpdateStatus(src e.UpdateStatusDto, dst *e.Encounter) {
|
||||||
|
dst.Status_Code = src.StatusCode
|
||||||
|
}
|
||||||
|
|||||||
@@ -187,3 +187,28 @@ func IsDone(encounter_id uint, event *pl.Event, dbx ...*gorm.DB) bool {
|
|||||||
pl.SetLogInfo(event, nil, "complete")
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
return data.IsDone()
|
return data.IsDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateStatusData(input e.UpdateStatusDto, data *e.Encounter, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBUpdate")
|
||||||
|
setDataUpdateStatus(input, data)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Save(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-update-fail",
|
||||||
|
Detail: "Database update failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user