diff --git a/cmd/main-migration/migrations/20250929034321.sql b/cmd/main-migration/migrations/20250929034321.sql new file mode 100644 index 00000000..bfdc5021 --- /dev/null +++ b/cmd/main-migration/migrations/20250929034321.sql @@ -0,0 +1,2 @@ +-- Modify "Soapi" table +ALTER TABLE "public"."Soapi" ADD COLUMN "TypeCode" text NULL; diff --git a/cmd/main-migration/migrations/20250929034428.sql b/cmd/main-migration/migrations/20250929034428.sql new file mode 100644 index 00000000..84a214a5 --- /dev/null +++ b/cmd/main-migration/migrations/20250929034428.sql @@ -0,0 +1,2 @@ +-- Modify "Soapi" table +ALTER TABLE "public"."Soapi" ALTER COLUMN "TypeCode" TYPE character varying(11); diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 829eae6d..7d3543b4 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,19 +1,21 @@ -h1:eOZHhYflqYtiRTD78THsLwQxQbS9eIvsRFQBtcsT670= -20250904105930.sql h1:Vv4vCurl7m7/ZB6TjRpkubHpQ4RYwSUn0QHdzfoGpzY= -20250904141448.sql h1:FYCHH9Os4KkrZMDu/jR8FMP+wLMRW+Mb0PkLU/9BRDg= -20250908062237.sql h1:oanBpKZd+akPu2I/xYhUSbd0G5tAFbXzKLER/Zs8ENI= -20250908062323.sql h1:miNG9COddXkD1jGTgaROMAZ618eT6oiLGiJhXWnQwhE= -20250908073811.sql h1:gOi5cnGG1htlpfizybYmUIT0vYjZTBfXiI0nPSYK2u8= -20250908073839.sql h1:cWNDA4YikjoOteAJuNLFILjQUJPFB6o8Wxreiek4QyI= -20250910055902.sql h1:nxxOGnU0BbH/v3IPgeIOXOwH8d3tKomw7h6FTeMnnBs= -20250915123412.sql h1:mz7SiWfrdf0qE1VTSAAnA/147d6gyp6ry5vZ2bR9SH0= -20250916043819.sql h1:RHXVtmMkB6wfv06HfPyHMBmUfIpFt1xveafNz0kwKnE= -20250917040616.sql h1:MYVDht+akBlzQGKNu2hTTTLPEcH1bxT/Q8MK6WEtuhs= -20250917040751.sql h1:J79YyS2JzWgh5oKXMTgh67uo3gLxKaAsxRiZmSIfjBs= -20250917045138.sql h1:/SM1N4O8X3yxpoJgMEARmS1uOkuLKsTOy4PLsRCOKaQ= -20250917093645.sql h1:PNBTGZ7s10e5b5+Tie8YfVQBN0zKtJ5T34oK1iOUEb4= -20250918073552.sql h1:jG7+g3i8ODYaJdcdZz12v3nbsZ5mB9wG6kWnGyTQIRI= -20250918073742.sql h1:j+rgw7puxE7s+phqPVZHmPk0af3rcaA56Itp86y1suY= -20250918074745.sql h1:rPmP4DXs6OnY4Vp+xO/z9jFpJt/RrJ52SJJjIIxeDvc= -20250923025134.sql h1:2r6pcwnBSU5Y9Czk1OHBoh4yZXiMtEca9X8843fTEX0= -20250924051317.sql h1:iUAk2gsGoEGIPQ0lEEUp8maMSId8emNbP+kP712ABIA= +h1:UQi1THfG0QI80rmHgbXNK/vgQv+5eUA5VRy3zqfWdbI= +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= +20250915123412.sql h1:D83xaU2YlDEd21HLup/YQpQ2easMToYCyy/oK6AFgQs= +20250916043819.sql h1:ekoTJsBqQZ8G8n0qJ03d13+eoNoc7sAUEQGA5D/CCxk= +20250917040616.sql h1:zoCnmcXuM7AVv85SmN7RmFglCgJnoDmpRWExH0LAc9Q= +20250917040751.sql h1:J1xyRrh32y1+lezwAyNwPcUQ6ABBSgbvzNLva4SVdQU= +20250917045138.sql h1:jKe1Z0uOLG4SGBYM+S/3P+/zMPztmgoderD5swnMuCg= +20250917093645.sql h1:cNI3Pbz1R3LxvIXLuexafJFCXUXrmuFCgXXJ2sG+FW0= +20250918073552.sql h1:RJ1SvMzP6aeWnoPVD3eVAmIQOkcp6Php8z3QRri6v4g= +20250918073742.sql h1:+cEsnJTJFybe2fR69ZoOiX2R6c6iITl4m6WTZ1hjyzY= +20250918074745.sql h1:2hNVQCXF/dVYXAh+T/7oBFgERGWxzVb2FXJjwkFWGCI= +20250923025134.sql h1:Ykz/qpHiGDXPsCsWTjydQFVSibZP2D+h2fIeb2h2JGA= +20250924051317.sql h1:yQuW6SwJxIOM5fcxeAaie5lSm1oLysU/C2hH2xNCVoQ= +20250929034321.sql h1:101FJ8VH12mrZWlt/X1gvKUGOhoiF8tFbjiapAjnHzg= +20250929034428.sql h1:i+pROD9p+g5dOmmZma6WF/0Hw5g3Ha28NN85iTo1K34= diff --git a/internal/domain/main-entities/soapi/dto.go b/internal/domain/main-entities/soapi/dto.go index 6aac522e..172b38b2 100644 --- a/internal/domain/main-entities/soapi/dto.go +++ b/internal/domain/main-entities/soapi/dto.go @@ -1,19 +1,23 @@ package soapi import ( + "time" + ecore "simrs-vx/internal/domain/base-entities/core" eem "simrs-vx/internal/domain/main-entities/employee" ee "simrs-vx/internal/domain/main-entities/encounter" + erc "simrs-vx/internal/domain/references/clinical" + pa "simrs-vx/pkg/auth-helper" - "time" ) type CreateDto struct { - Encounter_Id *uint `json:"encounter_id"` - Employee_Id *uint `json:"-"` - Time *time.Time `json:"time"` - Value *string `json:"value"` + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"-"` + Time *time.Time `json:"time"` + TypeCode erc.SoapiTypeCode `json:"typeCode"` + Value *string `json:"value"` pa.AuthInfo } @@ -25,10 +29,11 @@ type ReadListDto struct { } type FilterDto struct { - Encounter_Id *uint `json:"encounter_id"` - Employee_Id *uint `json:"employee_id"` - Time *time.Time `json:"time"` - Value *string `json:"value"` + Encounter_Id *uint `json:"encounter_id"` + Employee_Id *uint `json:"employee_id"` + Time *time.Time `json:"time"` + TypeCode erc.SoapiTypeCode `json:"typeCode"` + Value *string `json:"value"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -56,12 +61,13 @@ type MetaDto struct { 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"` + 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"` + TypeCode erc.SoapiTypeCode `json:"typeCode"` + Value *string `json:"value"` } func (d Soapi) ToResponse() ResponseDto { @@ -71,6 +77,7 @@ func (d Soapi) ToResponse() ResponseDto { Employee_Id: d.Employee_Id, Employee: d.Employee, Time: d.Time, + TypeCode: d.TypeCode, Value: d.Value, } resp.Main = d.Main diff --git a/internal/domain/main-entities/soapi/entity.go b/internal/domain/main-entities/soapi/entity.go index f6c6b5e9..7e457ca9 100644 --- a/internal/domain/main-entities/soapi/entity.go +++ b/internal/domain/main-entities/soapi/entity.go @@ -1,18 +1,22 @@ package soapi import ( + "time" + 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" + + erc "simrs-vx/internal/domain/references/clinical" ) 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"` + 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"` + TypeCode erc.SoapiTypeCode `json:"type_code" gorm:"size:11"` + Value *string `json:"value"` } diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go index 373049f2..6420d2a1 100644 --- a/internal/domain/references/clinical/clinical.go +++ b/internal/domain/references/clinical/clinical.go @@ -8,11 +8,12 @@ type ( PlanCode string InstructionCode string McuUrgencyLevelCode string + SoapiTypeCode string ) const ( - SCPrimaryComplaint SubjectCode = "pri-compl" // Keluhan Utama - SCSecComplaint SubjectCode = "sec-compl" // Secondary Complaint + SCPrimaryComplaint SubjectCode = "pri-complain" // Keluhan Utama + SCSecComplaint SubjectCode = "sec-complain" // Secondary Complaint SCCurrentDiseaseHistory SubjectCode = "cur-disea-hist" // Current Disease History SCPastDiseaseHistory SubjectCode = "pas-disea-hist" // Past Disease History SCFamilyDiseaseHistory SubjectCode = "fam-disea-hist" // Family Disease History @@ -47,6 +48,10 @@ const ( MULCBG McuUrgencyLevelCode = "blood-gas" MULCPF McuUrgencyLevelCode = "priority-form" MULCRT McuUrgencyLevelCode = "routine" + + STCEarly SoapiTypeCode = "early" // Kajian Awal Medis + STCERehab SoapiTypeCode = "early-rehab" // Kajian Awal Rehab Medik + STCFunc SoapiTypeCode = "function" // Assessment Fungsi ) type Soapi struct { diff --git a/internal/domain/references/organization/organization.go b/internal/domain/references/organization/organization.go index 1f655466..db2afe55 100644 --- a/internal/domain/references/organization/organization.go +++ b/internal/domain/references/organization/organization.go @@ -15,6 +15,8 @@ const ( UPCLab UserPosisitionCode = "laborant" // Laboran UPCPha UserPosisitionCode = "pharmacy" // Farmasi UPCPay UserPosisitionCode = "payment" // Pembayaran + UPCHur UserPosisitionCode = "human-resource" // Sumber Daya Manusia + UPCGea UserPosisitionCode = "general-affair" // Bagian Umu UPCPav UserPosisitionCode = "payment-verificator" // Konfirmasi pembayaran UPCMan UserPosisitionCode = "management" // Manajemen UPCInt UserPosisitionCode = "specialist-intern" // PPDS diff --git a/internal/use-case/main-use-case/soapi/helper.go b/internal/use-case/main-use-case/soapi/helper.go index 504acff6..5a94848a 100644 --- a/internal/use-case/main-use-case/soapi/helper.go +++ b/internal/use-case/main-use-case/soapi/helper.go @@ -20,5 +20,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Soapi) { data.Encounter_Id = inputSrc.Encounter_Id data.Employee_Id = inputSrc.Employee_Id data.Time = inputSrc.Time + data.TypeCode = inputSrc.TypeCode data.Value = inputSrc.Value }