Merge branch 'migration-vanilia' of https://github.com/dikstub-rssa/simrs-be into feat/sync-from-simx-160

This commit is contained in:
vanilia
2025-12-01 16:46:07 +07:00
17 changed files with 204 additions and 11 deletions
@@ -0,0 +1,13 @@
-- Create "Screening" table
CREATE TABLE "public"."Screening" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Encounter_Id" bigint NULL,
"Employee_Id" bigint NULL,
"Type" text NULL,
"Value" text NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_Screening_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
+3 -2
View File
@@ -1,4 +1,4 @@
h1:U9vdficFramvwnH40psSuRxzUuq6EPJwLcr9MvVTq7s=
h1:6lWgIJo0vUBd7Bo4B3YMvyDpJsOTVzVfqRQ03ad9r1s=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -130,4 +130,5 @@ h1:U9vdficFramvwnH40psSuRxzUuq6EPJwLcr9MvVTq7s=
20251121033803.sql h1:/vfvFX/3pzSCIHnSbMUT9EMBDykOpVkvyfeTEle9Vas=
20251124071457.sql h1:qg2dhCL9YwD13xnfJ175lW/p6MGfzFKaBqd908FByRc=
20251125125303.sql h1:4JSFv1Pmhbe9tqpLXgO63OwYnGsalStgUXKVWPyc1YE=
20251126064057.sql h1:+lByIo0zAsHVSFzQGVMuymFQajyl7fRNqgs9d/76y+E=
20251126064057.sql h1:vAdhz5Nn/gGJy0UKZAEldeXv8HpHtJU/t8ygDVIbTsU=
20251201081333.sql h1:1946fD7iMnf18FjYzVNoHu6suWSDMfjaF2R7jx5gjo0=
@@ -0,0 +1,36 @@
-- Create "SoapiLink" table
CREATE TABLE "public"."SoapiLink" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Simx_Id" bigint NULL,
"Simgos_Id" bigint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_SoapiLink_Simgos_Id" UNIQUE ("Simgos_Id"),
CONSTRAINT "uni_SoapiLink_Simx_Id" UNIQUE ("Simx_Id")
);
-- Create "SoapiSimgosLog" table
CREATE TABLE "public"."SoapiSimgosLog" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Value" text NULL,
"Date" timestamptz NULL,
"Status" text NULL,
"ErrMessage" text NULL,
PRIMARY KEY ("Id")
);
-- Create "SoapiSimxLog" table
CREATE TABLE "public"."SoapiSimxLog" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Value" text NULL,
"Date" timestamptz NULL,
"Status" text NULL,
"ErrMessage" text NULL,
PRIMARY KEY ("Id")
);
@@ -1,7 +1,8 @@
h1:UdPzQZ17yyNN9HVuyrFFHj5KjLj4m6/e7s9frkdpQVU=
h1:6YZBXq/r79I5tuYyY1+CBzhZsSeukHSs8MyHCC5QuV4=
20251113035508.sql h1:rjDlu6yDdy5xv6nrCOr7NialrLSLT23pzduYNq29Hf0=
20251114071129.sql h1:Z0GQ5bJo3C+tplaWzxT8n3J9HLkEaVsRVp5nn7bmYow=
20251117041601.sql h1:l/RPG5mObqCSBjO4mzG+wTq2ieSycvlfOSz4czpUdWY=
20251118082246.sql h1:xLUwA+EvKWIg3X/TJvu7rqbtBzONiINfag5NJpMV29E=
20251118082915.sql h1:hP6FmUVFuADIN2cDg2Z1l7Wx7PQRb+IYQDvKD7J8VAM=
20251126115527.sql h1:+2bp2nWTTqaPpKKfy5ZYSr6b1nEUXFG3tIw4r3OEnAQ=
20251126115527.sql h1:Bvg+Y7k+h5s+/UaezUyJb7J7uzEJS7U5Z/RoCixcUtI=
20251201093443.sql h1:m18tksKG3OzbkxXkhfKUUqbkxnJ0VBPi3Cw34Tbywyc=
@@ -0,0 +1,86 @@
package screening
import (
// std
// internal - lib
pa "simrs-vx/internal/lib/auth"
// internal - domain - base-entities
ecore "simrs-vx/internal/domain/base-entities/core"
// internal - domain - main-entities
eem "simrs-vx/internal/domain/main-entities/employee"
erc "simrs-vx/internal/domain/references/clinical"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"-"`
Type erc.ScreeningFormTypeCode `json:"type"`
Value *string `json:"value"`
pa.AuthInfo
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Employee_Id *uint `json:"employee-id"`
Type erc.ScreeningFormTypeCode `json:"type"`
Value *string `json:"value"`
}
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"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty"`
Type erc.ScreeningFormTypeCode `json:"type"`
Value *string `json:"value"`
}
func (d Screening) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Employee_Id: d.Employee_Id,
Employee: d.Employee,
Type: d.Type,
Value: d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Screening) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,17 @@
package screening
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eem "simrs-vx/internal/domain/main-entities/employee"
erc "simrs-vx/internal/domain/references/clinical"
)
type Screening struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Employee *eem.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
Type erc.ScreeningFormTypeCode `json:"type"`
Value *string `json:"value"`
}
@@ -22,6 +22,7 @@ type (
LearnMethodCode string
LangClassCode string
TranslatorSrcCode string
ScreeningFormTypeCode string
)
const (
@@ -187,6 +188,9 @@ const (
TSCTeam TranslatorSrcCode = "team" // Tim Penerjemah
TSCFamily TranslatorSrcCode = "family" // Keluarga
SFTCA ScreeningFormTypeCode = "form-a" // Formu A
SFTCB ScreeningFormTypeCode = "form-b" // Formu B
)
type Soapi struct {
@@ -0,0 +1,29 @@
package Soapi
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/common"
"time"
)
type SoapiLink struct {
ecore.Main
Simx_Id uint `json:"simx_id" gorm:"unique"`
Simgos_Id uint `json:"simgos_id" gorm:"unique"`
}
type SoapiSimxLog struct {
ecore.Main
Value *string `json:"value"`
Date *time.Time `json:"date"`
Status erc.ProcessStatusCode `json:"status"`
ErrMessage *string `json:"errMessage"`
}
type SoapiSimgosLog struct {
ecore.Main
Value *string `json:"value"`
Date *time.Time `json:"date"`
Status erc.ProcessStatusCode `json:"status"`
ErrMessage *string `json:"errMessage"`
}
@@ -85,6 +85,7 @@ import (
resume "simrs-vx/internal/domain/main-entities/resume"
room "simrs-vx/internal/domain/main-entities/room"
sbar "simrs-vx/internal/domain/main-entities/sbar"
screening "simrs-vx/internal/domain/main-entities/screening"
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"
@@ -217,5 +218,6 @@ func getMainEntities() []any {
&vclaimsepcontrolletter.VclaimSepControlLetter{},
&resume.Resume{},
&vclaimreference.VclaimReference{},
&screening.Screening{},
}
}
@@ -7,6 +7,7 @@ import (
installation "simrs-vx/internal/domain/sync-entities/installation"
internalreference "simrs-vx/internal/domain/sync-entities/internal-reference"
patient "simrs-vx/internal/domain/sync-entities/patient"
soapi "simrs-vx/internal/domain/sync-entities/soapi"
specialist "simrs-vx/internal/domain/sync-entities/specialist"
subspecialist "simrs-vx/internal/domain/sync-entities/subspecialist"
unit "simrs-vx/internal/domain/sync-entities/unit"
@@ -38,5 +39,8 @@ func getSyncEntities() []any {
&internalreference.InternalReferenceLink{},
&internalreference.InternalReferenceSimxLog{},
&internalreference.InternalReferenceSimgosLog{},
&soapi.SoapiLink{},
&soapi.SoapiSimxLog{},
&soapi.SoapiSimgosLog{},
}
}