Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into ss---db-migration-22

This commit is contained in:
dpurbosakti
2025-09-11 13:06:51 +07:00
45 changed files with 1257 additions and 213 deletions
+22
View File
@@ -0,0 +1,22 @@
data "external_schema" "gorm" {
program = [
"go",
"run",
"-mod=mod",
".",
]
}
env "gorm" {
src = data.external_schema.gorm.url
dev = "postgres://moko:password@localhost:5432/simrs_vx3?sslmode=disable"
migration {
dir = "file://migrations"
}
url = "postgres://moko:password@localhost:5432/simrs_vx1?sslmode=disable"
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
}
@@ -5,5 +5,5 @@ import (
)
func main() {
m.Migrate()
m.Migrate(m.Main)
}
@@ -0,0 +1,96 @@
-- Create "Appointment" table
CREATE TABLE "public"."Appointment" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"PracticeSchedule_Id" bigint NULL,
"Patient_Id" bigint NULL,
"Person_ResidentIdentityNumber" character varying(16) NULL,
"Person_Name" character varying(100) NULL,
"Person_PhoneNumber" character varying(30) NULL,
"PaymentMethod_Code" character varying(10) NULL,
"RefNumber" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Appointment_Patient" FOREIGN KEY ("Patient_Id") REFERENCES "public"."Patient" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Appointment_PracticeSchedule" FOREIGN KEY ("PracticeSchedule_Id") REFERENCES "public"."PracticeSchedule" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "Appointment_Doctor_Id" bigint NULL, ADD COLUMN "Appointment_Id" bigint NULL, ADD COLUMN "EarlyEducation" text NULL, ADD COLUMN "MedicalDischargeEducation" text NULL, ADD COLUMN "AdmDischargeEducation" text NULL, ADD COLUMN "DischargeReason" text NULL, ADD CONSTRAINT "fk_Encounter_Appointment" FOREIGN KEY ("Appointment_Id") REFERENCES "public"."Appointment" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Encounter_Appointment_Doctor" FOREIGN KEY ("Appointment_Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Create "Adime" table
CREATE TABLE "public"."Adime" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Employee_Id" bigint NULL,
"Time" timestamptz NULL,
"Value" text NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Adime_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Adime_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Ambulatory" table
CREATE TABLE "public"."Ambulatory" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Class_Code" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Ambulatory_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Emergency" table
CREATE TABLE "public"."Emergency" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Class_Code" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Emergency_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Inpatient" table
CREATE TABLE "public"."Inpatient" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Class_Code" character varying(10) NULL,
"Infra_Id" integer NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Inpatient_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Inpatient_Infra" FOREIGN KEY ("Infra_Id") REFERENCES "public"."Infra" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Sbar" table
CREATE TABLE "public"."Sbar" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Employee_Id" bigint NULL,
"Time" timestamptz NULL,
"Value" text NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Sbar_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Sbar_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "Soapi" table
CREATE TABLE "public"."Soapi" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Employee_Id" bigint NULL,
"Time" timestamptz NULL,
"Value" text NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Soapi_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Soapi_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" DROP COLUMN "Assignment_Doctor_Id";
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "DischargeMethod_Code" character varying(10) NULL;
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" DROP COLUMN "DischardeMethod_Code";
@@ -0,0 +1,2 @@
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "Status_Code" character varying(10) NULL;
+8
View File
@@ -0,0 +1,8 @@
h1:BLtMDgAdnqZbCj3HUbiTlyYtA87C4LcP/uquCbM6GSE=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
20250908062323.sql h1:oXl6Z143tOpIl4EfP4B8JNU8LrMvVmHEtCgAfiB4gs8=
20250908073811.sql h1:m2aNXfnGxnLq1+rVWrh4f60q7fhyhV3gEwNu/OIqQlE=
20250908073839.sql h1:cPk54xjLdMs26uY8ZHjNWLuyfAMzV7Zb0/9oJQrsw04=
20250910055902.sql h1:5xwjAV6QbtZT9empTJKfhyAjdknbHzb15B0Ku5dzqtQ=
-3
View File
@@ -1,3 +0,0 @@
h1:G2T3Gv3jMXqZDaBw/lSU8IhowMI3z//r+ZtHxndsLc4=
20250904105930.sql h1:Vv4vCurl7m7/ZB6TjRpkubHpQ4RYwSUn0QHdzfoGpzY=
20250904141448.sql h1:FYCHH9Os4KkrZMDu/jR8FMP+wLMRW+Mb0PkLU/9BRDg=
+22
View File
@@ -0,0 +1,22 @@
data "external_schema" "gorm" {
program = [
"go",
"run",
"-mod=mod",
".",
]
}
env "gorm" {
src = data.external_schema.gorm.url
dev = "postgres://moko:password@localhost:5432/satusehat_diff?sslmode=disable"
migration {
dir = "file://migrations"
}
url = "postgres://moko:password@localhost:5432/satusehat_main?sslmode=disable"
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
}
+22
View File
@@ -0,0 +1,22 @@
data "external_schema" "gorm" {
program = [
"go",
"run",
"-mod=mod",
".",
]
}
env "gorm" {
src = data.external_schema.gorm.url
dev = "" // dsn db to check the diff
migration {
dir = "file://migrations"
}
url = "" // dsn db to apply
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
}
@@ -0,0 +1,47 @@
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
loggerCfg:
hideTime:
hideLevel:
msCfg:
dsn:
langCfg:
active:
path:
fileName:
minioCfg:
endpoint:
region:
accessKey:
secretKey:
useSsl:
bucketName:
- patient
corsCfg:
allowedOrigin:
allowedMethod:
satuSehatCfg:
host: localhsot:8200
bpjsCfg:
host: localhsot:8200
+9
View File
@@ -0,0 +1,9 @@
package main
import (
m "simrs-vx/internal/interface/migration"
)
func main() {
m.Migrate(m.SatuSehat)
}
@@ -0,0 +1,9 @@
-- Create "Patient" table
CREATE TABLE "public"."Patient" (
"ResourceType" text NULL,
"Active" boolean NULL,
"Gender" text NULL,
"BirthDate" text NULL,
"DeceasedBool" boolean NULL,
"MultipleBirthInteger" bigint NULL
);
@@ -0,0 +1,2 @@
h1:dPpFMJ+ZSlHizKRHShYcjJZJNZXi4UuZXZUHME8zPb4=
20250911060006.sql h1:G3YiyY/tCTZijQWqyvyDAaMVCFkhh/gD3v/1gz/eBb8=
+3 -3
View File
@@ -8,16 +8,16 @@ require (
ariga.io/atlas-provider-gorm v0.5.6
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.6.0
github.com/karincake/apem v0.0.16-h
github.com/karincake/apem v0.0.17
github.com/karincake/dodol v0.0.1
github.com/karincake/getuk v0.1.0
github.com/karincake/hongkue v0.0.4
github.com/karincake/lepet v0.0.1
github.com/karincake/risoles v0.0.3
github.com/karincake/semprit v0.0.3
github.com/karincake/serabi v0.0.14
github.com/rs/zerolog v1.33.0
golang.org/x/crypto v0.41.0
gorm.io/driver/postgres v1.5.11
gorm.io/gorm v1.25.12
)
@@ -34,7 +34,6 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/karincake/serabi v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-sqlite3 v1.14.28 // indirect
@@ -46,6 +45,7 @@ require (
golang.org/x/text v0.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/mysql v1.5.7 // indirect
gorm.io/driver/postgres v1.5.11 // indirect
gorm.io/driver/sqlite v1.5.7 // indirect
gorm.io/driver/sqlserver v1.5.4 // indirect
)
+2 -2
View File
@@ -69,8 +69,8 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/karincake/apem v0.0.16-h h1:rfO444oDG4cWFf0PjUshA+0U8KI/u067Va273WeJhpU=
github.com/karincake/apem v0.0.16-h/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
github.com/karincake/apem v0.0.17 h1:y3WXCr9GWLFFFH4Qyq/VWlWWpijHh5zpTc3Lm96twa4=
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
github.com/karincake/getuk v0.1.0 h1:jcIsASrr0UDE528GN7Ua6n9UFyRgUypsWh8Or8wzCO0=
@@ -0,0 +1,76 @@
package adime
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
func (d Adime) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Employee_Id: d.Employee_Id,
Employee: d.Employee,
Time: d.Time,
Value: d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Adime) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package adime
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type Adime struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
@@ -0,0 +1,61 @@
package ambulatory
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ere "simrs-vx/internal/domain/references/encounter"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code" validate:"maxLength=10"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Class_Code ere.AmbulatoryClassCode `json:"class_code"`
}
func (d Ambulatory) ToResponse() ResponseDto {
resp := ResponseDto{}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Ambulatory) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,15 @@
package ambulatory
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ere "simrs-vx/internal/domain/references/encounter"
)
type Ambulatory struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"`
}
@@ -0,0 +1,88 @@
package appointment
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ep "simrs-vx/internal/domain/main-entities/patient"
eps "simrs-vx/internal/domain/main-entities/practice-schedule"
erc "simrs-vx/internal/domain/references/common"
)
type CreateDto struct {
PracticeSchedule_Id *uint `json:"practiceSchedule_id"`
Patient_Id *uint `json:"patient_id"`
Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"`
Person_Name string `json:"person_name"`
Person_PhoneNumber string `json:"person_phoneNumber"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"`
RefNumber string `json:"refNumber"`
}
type ReadListDto struct {
PracticeSchedule_Id *uint `json:"practiceSchedule_id"`
Patient_Id *uint `json:"patient_id"`
Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"`
Person_Name string `json:"person_name"`
Person_PhoneNumber string `json:"person_phoneNumber"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"`
RefNumber string `json:"refNumber"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
PracticeSchedule_Id *uint `json:"practiceSchedule_id"`
PracticeSchedule *eps.PracticeSchedule `json:"practiceSchedule,omitempty"`
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"`
Person_Name string `json:"person_name"`
Person_PhoneNumber string `json:"person_phoneNumber"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"`
RefNumber string `json:"refNumber"`
}
func (d Appointment) ToResponse() ResponseDto {
resp := ResponseDto{
PracticeSchedule_Id: d.PracticeSchedule_Id,
PracticeSchedule: d.PracticeSchedule,
Patient_Id: d.Patient_Id,
Patient: d.Patient,
Person_ResidentIdentityNumber: d.Person_ResidentIdentityNumber,
Person_Name: d.Person_Name,
Person_PhoneNumber: d.Person_PhoneNumber,
PaymentMethod_Code: d.PaymentMethod_Code,
RefNumber: d.RefNumber,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Appointment) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,21 @@
package appointment
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ep "simrs-vx/internal/domain/main-entities/patient"
eps "simrs-vx/internal/domain/main-entities/practice-schedule"
erc "simrs-vx/internal/domain/references/common"
)
type Appointment struct {
ecore.Main // adjust this according to the needs
PracticeSchedule_Id *uint `json:"practiceSchedule_id"`
PracticeSchedule *eps.PracticeSchedule `json:"practiceSchedule,omitempty" gorm:"foreignKey:PracticeSchedule_Id;references:Id"`
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"`
Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber" gorm:"size:16"`
Person_Name string `json:"person_name" gorm:"size:100"`
Person_PhoneNumber string `json:"person_phoneNumber" gorm:"size:30"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"`
RefNumber string `json:"refNumber" gorm:"size:20"`
}
@@ -0,0 +1,61 @@
package emergency
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ere "simrs-vx/internal/domain/references/encounter"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.EmergencyClassCode `json:"class_code" validate:"maxLength=10"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.EmergencyClassCode `json:"class_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Class_Code ere.EmergencyClassCode `json:"class_code"`
}
func (d Emergency) ToResponse() ResponseDto {
resp := ResponseDto{}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Emergency) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,15 @@
package emergency
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ere "simrs-vx/internal/domain/references/encounter"
)
type Emergency struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Class_Code ere.EmergencyClassCode `json:"class_code" gorm:"size:10"`
}
+82 -62
View File
@@ -2,6 +2,7 @@ package encounter
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ea "simrs-vx/internal/domain/main-entities/appointment"
ed "simrs-vx/internal/domain/main-entities/doctor"
ep "simrs-vx/internal/domain/main-entities/patient"
es "simrs-vx/internal/domain/main-entities/specialist"
@@ -12,18 +13,23 @@ import (
)
type CreateDto struct {
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Appointment_Id *uint `json:"appointment_id"`
EarlyEducation *string `json:"earlyEducation"`
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
}
type ReadListDto struct {
@@ -33,18 +39,23 @@ type ReadListDto struct {
}
type FilterDto struct {
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Appointment_Id *uint `json:"appointment_id"`
EarlyEducation *string `json:"earlyEducation"`
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -52,10 +63,7 @@ type FilterDto struct {
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
Id uint16 `json:"id"`
}
type UpdateDto struct {
@@ -75,44 +83,56 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist *es.Specialist `json:"specialist,omitempty"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
Unit *eu.Unit `json:"unit,omitempty"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code`
RefSource_Name *string `json:"refSource_name"`
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist *es.Specialist `json:"specialist,omitempty"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
Unit *eu.Unit `json:"unit,omitempty"`
VisitDate time.Time `json:"visitDate"`
Appointment_Doctor_Id *uint `json:"assignment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code"`
RefSource_Name *string `json:"refSource_name"`
Appointment_Id *uint `json:"appointment_id"`
Appointment *ea.Appointment `json:"appointment,omitempty"`
EarlyEducation *string `json:"earlyEducation"`
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
}
func (d Encounter) ToResponse() ResponseDto {
resp := ResponseDto{
Patient_Id: d.Patient_Id,
Patient: d.Patient,
RegisteredAt: d.RegisteredAt,
Class_Code: d.Class_Code,
Unit_Id: d.Unit_Id,
Unit: d.Unit,
Specialist_Id: d.Specialist_Id,
Specialist: d.Specialist,
Subspecialist_Id: d.Subspecialist_Id,
Subspecialist: d.Subspecialist,
VisitDate: d.VisitDate,
Assignment_Doctor_Id: d.Assignment_Doctor_Id,
Assignment_Doctor: d.Assignment_Doctor,
Responsible_Doctor_Id: d.Responsible_Doctor_Id,
Responsible_Doctor: d.Responsible_Doctor,
DischardeMethod_Code: d.DischardeMethod_Code,
RefSource_Name: d.RefSource_Name,
Patient_Id: d.Patient_Id,
Patient: d.Patient,
RegisteredAt: d.RegisteredAt,
Class_Code: d.Class_Code,
Unit_Id: d.Unit_Id,
Unit: d.Unit,
Specialist_Id: d.Specialist_Id,
Specialist: d.Specialist,
Subspecialist_Id: d.Subspecialist_Id,
Subspecialist: d.Subspecialist,
VisitDate: d.VisitDate,
Appointment_Doctor_Id: d.Appointment_Doctor_Id,
Appointment_Doctor: d.Appointment_Doctor,
Responsible_Doctor_Id: d.Responsible_Doctor_Id,
Responsible_Doctor: d.Responsible_Doctor,
DischargeMethod_Code: d.DischargeMethod_Code,
RefSource_Name: d.RefSource_Name,
Appointment_Id: d.Appointment_Id,
Appointment: d.Appointment,
EarlyEducation: d.EarlyEducation,
MedicalDischargeEducation: d.MedicalDischargeEducation,
AdmDischargeEducation: d.AdmDischargeEducation,
DischargeReason: d.DischargeReason,
}
resp.Main = d.Main
return resp
@@ -2,32 +2,41 @@ package encounter
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ea "simrs-vx/internal/domain/main-entities/appointment"
ed "simrs-vx/internal/domain/main-entities/doctor"
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"
)
type Encounter struct {
ecore.Main // adjust this according to the needs
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" gorm:"not null;size:10"`
Unit_Id *uint `json:"unit_id"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
VisitDate time.Time `json:"visitDate"`
Assignment_Doctor_Id *uint `json:"assignment_doctor_id"`
Assignment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty" gorm:"foreignKey:Assignment_Doctor_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"`
DischardeMethod_Code ere.DischargeMethodCode `json:"dischardeMethod_code" gorm:"size:10"`
RefSource_Name *string `json:"refSource_name" gorm:"size:100"`
ecore.Main // adjust this according to the needs
Patient_Id *uint `json:"patient_id"`
Patient *ep.Patient `json:"patient,omitempty" gorm:"foreignKey:Patient_Id;references:Id"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" gorm:"not null;size:10"`
Unit_Id *uint `json:"unit_id"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
VisitDate time.Time `json:"visitDate"`
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty" gorm:"foreignKey:Appointment_Doctor_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:10"`
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"`
EarlyEducation *string `json:"earlyEducation"`
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"size:10"`
}
@@ -0,0 +1,72 @@
package inpatient
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ei "simrs-vx/internal/domain/main-entities/infra"
ere "simrs-vx/internal/domain/references/encounter"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code" validate:"maxLength=10"`
Infra_Id *uint16 `json:"infra_id"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code"`
Infra_Id *uint16 `json:"infra_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Class_Code ere.InpatientClassCode `json:"class_code"`
Infra_Id *uint16 `json:"infra_id"`
Infra *ei.Infra `json:"infra,omitempty"`
}
func (d Inpatient) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Class_Code: d.Class_Code,
Infra_Id: d.Infra_Id,
Infra: d.Infra,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Inpatient) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package inpatient
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
ei "simrs-vx/internal/domain/main-entities/infra"
ere "simrs-vx/internal/domain/references/encounter"
)
type Inpatient struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Class_Code ere.InpatientClassCode `json:"class_code" gorm:"size:10"`
Infra_Id *uint16 `json:"infra_id"`
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
}
+76
View File
@@ -0,0 +1,76 @@
package sbar
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
func (d Sbar) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Employee_Id: d.Employee_Id,
Employee: d.Employee,
Time: d.Time,
Value: d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Sbar) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package sbar
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type Sbar struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
@@ -0,0 +1,76 @@
package soapi
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
type ReadListDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
func (d Soapi) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Employee_Id: d.Employee_Id,
Employee: d.Employee,
Time: d.Time,
Value: d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Soapi) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,18 @@
package soapi
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type Soapi struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
@@ -1,9 +1,11 @@
// Package clinical mostly about SOAPI
package clinical
type (
SubjectCode string
ObjectCode string
AssessmentCode string
PlanCode string
InstructionCode string
)
@@ -31,6 +33,8 @@ const (
ACLateDiag AssessmentCode = "late-diag" // Diagnosis Akhir
ACSecDiag AssessmentCode = "sec-diag" // Diagnosis Sekunder
PCPlan PlanCode = "plan" // Rencana
ICDetail InstructionCode = "detail" // Detail instruksi
ICMedAct InstructionCode = "med-act" // Tindakan medis
ICMedication InstructionCode = "medication" // Obat
@@ -9,17 +9,14 @@ type (
EmergencyClassCode string
OutpatientClassCode string
CheckupScopeCode string
AmbulatoryClassCode string
InpatientClassCode string
)
const (
ECOutpatient EncounterClassCode = "outpatient"
ECAmbulatory EncounterClassCode = "ambulatory"
ECEmergency EncounterClassCode = "emergency"
ECInpatient EncounterClassCode = "inpatient"
ECDraft EncounterClassCode = "draft"
ECDone EncounterClassCode = "done"
ECCancel EncounterClassCode = "cancel"
ECSkip EncounterClassCode = "skip"
QSCWait QueueStatusCode = "wait" // Tunggu
QSCProc QueueStatusCode = "proc" // Proses
@@ -27,8 +24,13 @@ const (
QSCCancel QueueStatusCode = "cancel" // Dibatalkan
QSCSkip QueueStatusCode = "skip" // Dilewati
DMCHome DischargeMethodCode = "home" // Rumah
DMCHomeReq DischargeMethodCode = "home-request" // Rumah (Dibutuhkan)
DMCHome DischargeMethodCode = "home" // Rumah
DMCHomeReq DischargeMethodCode = "home-request" // Rumah (Dibutuhkan)
DMCConsulation DischargeMethodCode = "consulation" // Konsultasi Lanjutan
DMCInpatient DischargeMethodCode = "inpatient" // Inpatient
DMCExtRef DischargeMethodCode = "external-ref" // Rujuk Eksternal
DMCIntRef DischargeMethodCode = "internal-ref" // Rujuk Internal
DMCDeath DischargeMethodCode = "death" // Meninggal
TCAmbulance TransportationCode = "ambulance"
TCCar TransportationCode = "car"
@@ -55,11 +57,18 @@ const (
CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium
CSCRad CheckupScopeCode = "radiology" // Radiology
ACCReg AmbulatoryClassCode = "reg" // Regular
ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
ICCIp InpatientClassCode = "ip" // Regular Rawat Inap
ICCICU InpatientClassCode = "icu" // ICU
ICCHCU InpatientClassCode = "hcu" // HCU
ICCVK InpatientClassCode = "vk" // Verlos kamer
)
func (ec EncounterClassCode) Code() string {
switch ec {
case ECAmbulatory, ECOutpatient:
case ECAmbulatory:
return "AMB"
case ECInpatient:
return "IMP"
@@ -0,0 +1,92 @@
package patient
type Patient struct {
ResourceType string `json:"resourceType"`
// Meta Meta `json:"meta"`
// Identifier []Identifier `json:"identifier"`
Active bool `json:"active"`
// Name []HumanName `json:"name"`
// Telecom []ContactPoint `json:"telecom"`
Gender string `json:"gender"`
BirthDate string `json:"birthDate"`
DeceasedBool bool `json:"deceasedBoolean"`
// Address []Address `json:"address"`
// MaritalStatus MaritalStatus `json:"maritalStatus"`
MultipleBirthInteger int `json:"multipleBirthInteger"`
// Contact []Contact `json:"contact"`
// Communication []Communication `json:"communication"`
// Extension []Extension `json:"extension"`
}
type Meta struct {
Profile []string `json:"profile"`
}
type Identifier struct {
Use string `json:"use"`
System string `json:"system"`
Value string `json:"value"`
}
type HumanName struct {
Use string `json:"use"`
Text string `json:"text"`
}
type ContactPoint struct {
System string `json:"system"`
Value string `json:"value"`
Use string `json:"use"`
}
type Address struct {
Use string `json:"use"`
Line []string `json:"line"`
City string `json:"city"`
PostalCode string `json:"postalCode"`
Country string `json:"country"`
Extension []Extension `json:"extension"`
}
type Extension struct {
URL string `json:"url"`
Extension []SubExtension `json:"extension,omitempty"`
ValueCode string `json:"valueCode,omitempty"`
ValueAddress *Address `json:"valueAddress,omitempty"`
}
type SubExtension struct {
URL string `json:"url"`
ValueCode string `json:"valueCode"`
}
type MaritalStatus struct {
Coding []Coding `json:"coding"`
Text string `json:"text"`
}
type Coding struct {
System string `json:"system"`
Code string `json:"code"`
Display string `json:"display,omitempty"`
}
type Contact struct {
Relationship []Relationship `json:"relationship"`
Name HumanName `json:"name"`
Telecom []ContactPoint `json:"telecom"`
}
type Relationship struct {
Coding []Coding `json:"coding"`
}
type Communication struct {
Language Language `json:"language"`
Preferred bool `json:"preferred"`
}
type Language struct {
Coding []Coding `json:"coding"`
Text string `json:"text"`
}
+1 -1
View File
@@ -5,5 +5,5 @@ import (
)
func SetInstance() {
I = dg.IS["satu-sehat"]
I = dg.IS["satusehat"]
}
@@ -0,0 +1,121 @@
package migration
import (
adime "simrs-vx/internal/domain/main-entities/adime"
ambulatory "simrs-vx/internal/domain/main-entities/ambulatory"
appointment "simrs-vx/internal/domain/main-entities/appointment"
counter "simrs-vx/internal/domain/main-entities/counter"
device "simrs-vx/internal/domain/main-entities/device"
diagnosesrc "simrs-vx/internal/domain/main-entities/diagnose-src"
district "simrs-vx/internal/domain/main-entities/district"
division "simrs-vx/internal/domain/main-entities/division"
divisionposition "simrs-vx/internal/domain/main-entities/division-position"
doctor "simrs-vx/internal/domain/main-entities/doctor"
doctorfee "simrs-vx/internal/domain/main-entities/doctor-fee"
emergency "simrs-vx/internal/domain/main-entities/emergency"
employee "simrs-vx/internal/domain/main-entities/employee"
encounter "simrs-vx/internal/domain/main-entities/encounter"
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
infra "simrs-vx/internal/domain/main-entities/infra"
inpatient "simrs-vx/internal/domain/main-entities/inpatient"
installation "simrs-vx/internal/domain/main-entities/installation"
insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company"
item "simrs-vx/internal/domain/main-entities/item"
itemprice "simrs-vx/internal/domain/main-entities/item-price"
laborant "simrs-vx/internal/domain/main-entities/laborant"
language "simrs-vx/internal/domain/main-entities/language"
material "simrs-vx/internal/domain/main-entities/material"
mcusrc "simrs-vx/internal/domain/main-entities/mcu-src"
mcusrccategory "simrs-vx/internal/domain/main-entities/mcu-src-category"
medicalactionsrc "simrs-vx/internal/domain/main-entities/medical-action-src"
medicalactionsrcitem "simrs-vx/internal/domain/main-entities/medical-action-src-item"
medicine "simrs-vx/internal/domain/main-entities/medicine"
medicinegroup "simrs-vx/internal/domain/main-entities/medicine-group"
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
nurse "simrs-vx/internal/domain/main-entities/nurse"
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
patient "simrs-vx/internal/domain/main-entities/patient"
person "simrs-vx/internal/domain/main-entities/person"
personaddress "simrs-vx/internal/domain/main-entities/person-address"
personcontact "simrs-vx/internal/domain/main-entities/person-contact"
personrelative "simrs-vx/internal/domain/main-entities/person-relative"
pharmacist "simrs-vx/internal/domain/main-entities/pharmacist"
pharmacycompany "simrs-vx/internal/domain/main-entities/pharmacy-company"
practiceschedule "simrs-vx/internal/domain/main-entities/practice-schedule"
proceduresrc "simrs-vx/internal/domain/main-entities/procedure-src"
province "simrs-vx/internal/domain/main-entities/province"
regency "simrs-vx/internal/domain/main-entities/regency"
room "simrs-vx/internal/domain/main-entities/room"
sbar "simrs-vx/internal/domain/main-entities/sbar"
soapi "simrs-vx/internal/domain/main-entities/soapi"
specialist "simrs-vx/internal/domain/main-entities/specialist"
specialistintern "simrs-vx/internal/domain/main-entities/specialist-intern"
subspecialist "simrs-vx/internal/domain/main-entities/subspecialist"
unit "simrs-vx/internal/domain/main-entities/unit"
uom "simrs-vx/internal/domain/main-entities/uom"
user "simrs-vx/internal/domain/main-entities/user"
village "simrs-vx/internal/domain/main-entities/village"
)
func getMainEntities() []any {
return []any{
&user.User{},
&division.Division{},
&divisionposition.DivisionPosition{},
&installation.Installation{},
&unit.Unit{},
&village.Village{},
&district.District{},
&regency.Regency{},
&province.Province{},
&person.Person{},
&personaddress.PersonAddress{},
&personcontact.PersonContact{},
&pharmacycompany.PharmacyCompany{},
&diagnosesrc.DiagnoseSrc{},
&proceduresrc.ProcedureSrc{},
&employee.Employee{},
&doctor.Doctor{},
&nurse.Nurse{},
&nutritionist.Nutritionist{},
&pharmacist.Pharmacist{},
&counter.Counter{},
&practiceschedule.PracticeSchedule{},
&uom.Uom{},
&item.Item{},
&itemprice.ItemPrice{},
&infra.Infra{},
&medicinegroup.MedicineGroup{},
&medicinemethod.MedicineMethod{},
&mcusrccategory.McuSrcCategory{},
&mcusrc.McuSrc{},
&ethnic.Ethnic{},
&insurancecompany.InsuranceCompany{},
&medicine.Medicine{},
&medicinemix.MedicineMix{},
&medicinemixitem.MedicineMixItem{},
&medicalactionsrc.MedicalActionSrc{},
&medicalactionsrcitem.MedicalActionSrcItem{},
&material.Material{},
&device.Device{},
&doctorfee.DoctorFee{},
&language.Language{},
&personrelative.PersonRelative{},
&patient.Patient{},
&appointment.Appointment{},
&encounter.Encounter{},
&laborant.Laborant{},
&specialist.Specialist{},
&subspecialist.Subspecialist{},
&specialistintern.SpecialistIntern{},
&room.Room{},
&soapi.Soapi{},
&sbar.Sbar{},
&adime.Adime{},
&emergency.Emergency{},
&inpatient.Inpatient{},
&ambulatory.Ambulatory{},
}
}
+11 -115
View File
@@ -5,80 +5,20 @@ import (
"io"
"os"
"os/exec"
counter "simrs-vx/internal/domain/main-entities/counter"
device "simrs-vx/internal/domain/main-entities/device"
diagnosesrc "simrs-vx/internal/domain/main-entities/diagnose-src"
district "simrs-vx/internal/domain/main-entities/district"
division "simrs-vx/internal/domain/main-entities/division"
divisionposition "simrs-vx/internal/domain/main-entities/division-position"
doctor "simrs-vx/internal/domain/main-entities/doctor"
doctorfee "simrs-vx/internal/domain/main-entities/doctor-fee"
employee "simrs-vx/internal/domain/main-entities/employee"
encounter "simrs-vx/internal/domain/main-entities/encounter"
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
infra "simrs-vx/internal/domain/main-entities/infra"
installation "simrs-vx/internal/domain/main-entities/installation"
insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company"
item "simrs-vx/internal/domain/main-entities/item"
itemprice "simrs-vx/internal/domain/main-entities/item-price"
laborant "simrs-vx/internal/domain/main-entities/laborant"
language "simrs-vx/internal/domain/main-entities/language"
material "simrs-vx/internal/domain/main-entities/material"
mcusrc "simrs-vx/internal/domain/main-entities/mcu-src"
mcusrccategory "simrs-vx/internal/domain/main-entities/mcu-src-category"
medicalactionsrc "simrs-vx/internal/domain/main-entities/medical-action-src"
medicalactionsrcitem "simrs-vx/internal/domain/main-entities/medical-action-src-item"
medicine "simrs-vx/internal/domain/main-entities/medicine"
medicinegroup "simrs-vx/internal/domain/main-entities/medicine-group"
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
nurse "simrs-vx/internal/domain/main-entities/nurse"
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
patient "simrs-vx/internal/domain/main-entities/patient"
person "simrs-vx/internal/domain/main-entities/person"
personaddress "simrs-vx/internal/domain/main-entities/person-address"
personcontact "simrs-vx/internal/domain/main-entities/person-contact"
personrelative "simrs-vx/internal/domain/main-entities/person-relative"
pharmacist "simrs-vx/internal/domain/main-entities/pharmacist"
pharmacycompany "simrs-vx/internal/domain/main-entities/pharmacy-company"
practiceschedule "simrs-vx/internal/domain/main-entities/practice-schedule"
proceduresrc "simrs-vx/internal/domain/main-entities/procedure-src"
province "simrs-vx/internal/domain/main-entities/province"
regency "simrs-vx/internal/domain/main-entities/regency"
room "simrs-vx/internal/domain/main-entities/room"
specialist "simrs-vx/internal/domain/main-entities/specialist"
specialistintern "simrs-vx/internal/domain/main-entities/specialist-intern"
subspecialist "simrs-vx/internal/domain/main-entities/subspecialist"
unit "simrs-vx/internal/domain/main-entities/unit"
uom "simrs-vx/internal/domain/main-entities/uom"
user "simrs-vx/internal/domain/main-entities/user"
village "simrs-vx/internal/domain/main-entities/village"
"ariga.io/atlas-provider-gorm/gormschema"
"gorm.io/gorm"
"gorm.io/gorm/schema"
)
type Config struct {
DbCfg DbConf `yaml:"dbCfg"`
}
type DbConf struct {
DSN string `yaml:"dsn"`
MaxOpenConns int `yaml:"maxOpenConns"`
MaxIdleConns int `yaml:"maxIdleConns"`
MaxIdleTime int `yaml:"maxIdleTime"`
}
func Loader() {
func loader(input string) {
gormCfg := &gorm.Config{
NamingStrategy: schema.NamingStrategy{
SingularTable: true,
NoLowerCase: true,
},
}
stmts, err := gormschema.New("postgres", gormschema.WithConfig(gormCfg)).Load(GetEntities()...)
stmts, err := gormschema.New("postgres", gormschema.WithConfig(gormCfg)).Load(getEntities(input)...)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to load gorm schema: %v\n", err)
os.Exit(1)
@@ -86,58 +26,14 @@ func Loader() {
_, _ = io.WriteString(os.Stdout, stmts)
}
func GetEntities() []any {
return []any{
&user.User{},
&division.Division{},
&divisionposition.DivisionPosition{},
&installation.Installation{},
&unit.Unit{},
&village.Village{},
&district.District{},
&regency.Regency{},
&province.Province{},
&person.Person{},
&personaddress.PersonAddress{},
&personcontact.PersonContact{},
&pharmacycompany.PharmacyCompany{},
&diagnosesrc.DiagnoseSrc{},
&proceduresrc.ProcedureSrc{},
&employee.Employee{},
&doctor.Doctor{},
&nurse.Nurse{},
&nutritionist.Nutritionist{},
&pharmacist.Pharmacist{},
&counter.Counter{},
&practiceschedule.PracticeSchedule{},
&uom.Uom{},
&item.Item{},
&itemprice.ItemPrice{},
&infra.Infra{},
&medicinegroup.MedicineGroup{},
&medicinemethod.MedicineMethod{},
&mcusrccategory.McuSrcCategory{},
&mcusrc.McuSrc{},
&ethnic.Ethnic{},
&insurancecompany.InsuranceCompany{},
&medicine.Medicine{},
&medicinemix.MedicineMix{},
&medicinemixitem.MedicineMixItem{},
&medicalactionsrc.MedicalActionSrc{},
&medicalactionsrcitem.MedicalActionSrcItem{},
&material.Material{},
&device.Device{},
&doctorfee.DoctorFee{},
&language.Language{},
&personrelative.PersonRelative{},
&patient.Patient{},
&encounter.Encounter{},
&laborant.Laborant{},
&specialist.Specialist{},
&subspecialist.Subspecialist{},
&specialistintern.SpecialistIntern{},
&room.Room{},
func getEntities(input string) []any {
switch input {
case "main":
return getMainEntities()
case "satusehat":
return getSatuSehatEntities()
}
return nil
}
func runAtlas(args ...string) error {
@@ -151,8 +47,8 @@ func logMsg(msg string) {
fmt.Fprintln(os.Stderr, msg)
}
func Migrate() {
Loader()
func Migrate(input string) {
loader(input)
logMsg("Running atlas migrate diff...")
if err := runAtlas("migrate", "diff", "--env", "gorm"); err != nil {
logMsg(fmt.Sprintf("Failed to run diff: %v", err))
@@ -0,0 +1,11 @@
package migration
import (
patient "simrs-vx/internal/domain/satusehat-entities/patient"
)
func getSatuSehatEntities() []any {
return []any{
&patient.Patient{},
}
}
+7
View File
@@ -0,0 +1,7 @@
/* Package migration is used to migrate the database */
package migration
const (
Main = "main"
SatuSehat = "satusehat"
)