diff --git a/cmd/migration/migrations/20250827072230.sql b/cmd/migration/migrations/20250827072230.sql new file mode 100644 index 00000000..b2968446 --- /dev/null +++ b/cmd/migration/migrations/20250827072230.sql @@ -0,0 +1,101 @@ +-- Create "McuSrc" table +CREATE TABLE "public"."McuSrc" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(20) NULL, + "Name" character varying(50) NULL, + "CheckupCategory_Code" character varying(20) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_McuSrc_Code" UNIQUE ("Code") +); +-- Create "McuSrcCategory" table +CREATE TABLE "public"."McuSrcCategory" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(20) NULL, + "Name" character varying(50) NULL, + "Scope_Code" character varying(10) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_McuSrcCategory_Code" UNIQUE ("Code") +); +-- Create "MedicineGroup" table +CREATE TABLE "public"."MedicineGroup" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(50) NULL, + "Name" character varying(100) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_MedicineGroup_Code" UNIQUE ("Code") +); +-- Create "MedicineMethod" table +CREATE TABLE "public"."MedicineMethod" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(50) NULL, + "Name" character varying(100) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_MedicineMethod_Code" UNIQUE ("Code") +); +-- Create "Uom" table +CREATE TABLE "public"."Uom" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(10) NULL, + "Name" character varying(50) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_Uom_Code" UNIQUE ("Code") +); +-- Create "Item" table +CREATE TABLE "public"."Item" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(50) NULL, + "Name" character varying(100) NULL, + "ItemGroup_Code" character varying(10) NULL, + "Uom_Code" character varying(10) NULL, + "Infra_Id" smallint NULL, + "Stock" numeric NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_Item_Code" UNIQUE ("Code"), + CONSTRAINT "fk_Item_ItemGroup" FOREIGN KEY ("ItemGroup_Code") REFERENCES "public"."ItemGroup" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Item_Uom" FOREIGN KEY ("Uom_Code") REFERENCES "public"."Uom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "Infra" table +CREATE TABLE "public"."Infra" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(10) NULL, + "Name" character varying(50) NULL, + "InfraGroup_Code" character varying(10) NULL, + "Parent_Id" smallint NULL, + "Item_Id" bigint NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_Infra_Code" UNIQUE ("Code"), + CONSTRAINT "fk_Infra_InfraGroup" FOREIGN KEY ("InfraGroup_Code") REFERENCES "public"."InfraGroup" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Infra_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "ItemPrice" table +CREATE TABLE "public"."ItemPrice" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Item_Id" bigint NULL, + "Price" numeric NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_ItemPrice_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); diff --git a/cmd/migration/migrations/atlas.sum b/cmd/migration/migrations/atlas.sum index 46aee6d6..47331906 100644 --- a/cmd/migration/migrations/atlas.sum +++ b/cmd/migration/migrations/atlas.sum @@ -1,8 +1,9 @@ -h1:4uryCUq0L2CJ7E8H5cdmioR5WZgsBsOYyeEo78COgs0= +h1:qhTYEMOwm8TQ+FgXjr/nbT0/T/oRb7pvnXTcQSa/V7w= 20250825054027.sql h1:zRUeuuP4bDLf96Cb38D/l9ivBAQC745XRao0rxbzdVI= 20250825060522.sql h1:NiE1fVzydcg8Y8ytSHgt0DkkauQFveNXv42BoG5m+bI= 20250825102900.sql h1:OAUnj87Wz7mrHykX14idePckUmRYa5UH0LylYDL76RI= 20250825103029.sql h1:iuZFrfUjNQM5kRpEwdYR8qinSp8SIkoJc3Dr8rD8BuI= 20250827015551.sql h1:Jq/RkXSWHEWuNigLunLzIrYgiyroSVD7J0waDMvdzvg= 20250827021904.sql h1:pgjwmQS1TxZ977a1tIXKq6pZnGauPrOUxLUTclV+fE4= -20250827024311.sql h1:6Wt8nK7R2qaTUvP8dZFwwqxAMdAhHAChxFRiI8BlzQo= +20250827024311.sql h1:eTlrQYcHa/jmb3qSZxgTB+7S4IXJ8B4yklUB36iZaDw= +20250827072230.sql h1:R5H47ODPcZeINYfzLE+VMQ+l000fLwXe70MQ4BxouGw= diff --git a/internal/domain/main-entities/employee copy/entity.go b/internal/domain/main-entities/employee copy/entity.go new file mode 100644 index 00000000..55b829fa --- /dev/null +++ b/internal/domain/main-entities/employee copy/entity.go @@ -0,0 +1,19 @@ +package employee + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ed "simrs-vx/internal/domain/main-entities/division" + erc "simrs-vx/internal/domain/references/common" + ero "simrs-vx/internal/domain/references/organization" +) + +type Employee struct { + ecore.Main // adjust this according to the needs + User_Id *uint `json:"user_id"` + Person_Id *uint `json:"person_id"` + Position_Code ero.EmployeePosisitionCode `json:"position_code" gorm:"not null;size:20"` + Division_Code *string `json:"division_code"` + Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"` + Number *string `json:"number" gorm:"size:20"` + Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"` +} diff --git a/internal/domain/main-entities/employee/dto.go b/internal/domain/main-entities/employee/dto.go index 8aa9402d..ff650793 100644 --- a/internal/domain/main-entities/employee/dto.go +++ b/internal/domain/main-entities/employee/dto.go @@ -4,12 +4,13 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/division" erc "simrs-vx/internal/domain/references/common" + ero "simrs-vx/internal/domain/references/organization" ) type CreateDto struct { User_Id *uint `json:"user_id"` Person_Id *uint `json:"person_id"` - Position_Code erc.EmployeePosisitionCode `json:"position_code"` + Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` Status_Code erc.StatusCode `json:"status_code"` @@ -18,7 +19,7 @@ type CreateDto struct { type ReadListDto struct { User_Id *uint `json:"user_id"` Person_Id *uint `json:"person_id"` - Position_Code erc.EmployeePosisitionCode `json:"position_code"` + Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` Status_Code erc.StatusCode `json:"status_code"` @@ -32,7 +33,7 @@ type ReadDetailDto struct { Id uint16 `json:"id"` User_Id *uint `json:"user_id"` Person_Id *uint `json:"person_id"` - Position_Code erc.EmployeePosisitionCode `json:"position_code"` + Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` Status_Code erc.StatusCode `json:"status_code"` @@ -57,7 +58,7 @@ type ResponseDto struct { ecore.Main User_Id *uint `json:"user_id"` Person_Id *uint `json:"person_id"` - Position_Code erc.EmployeePosisitionCode `json:"position_code"` + Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Division *ed.Division `json:"division,omitempty"` Number *string `json:"number"` diff --git a/internal/domain/main-entities/employee/entity.go b/internal/domain/main-entities/employee/entity.go index 8d6df9fd..55b829fa 100644 --- a/internal/domain/main-entities/employee/entity.go +++ b/internal/domain/main-entities/employee/entity.go @@ -4,13 +4,14 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/division" erc "simrs-vx/internal/domain/references/common" + ero "simrs-vx/internal/domain/references/organization" ) type Employee struct { ecore.Main // adjust this according to the needs User_Id *uint `json:"user_id"` Person_Id *uint `json:"person_id"` - Position_Code erc.EmployeePosisitionCode `json:"position_code" gorm:"not null;size:20"` + Position_Code ero.EmployeePosisitionCode `json:"position_code" gorm:"not null;size:20"` Division_Code *string `json:"division_code"` Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"` Number *string `json:"number" gorm:"size:20"` diff --git a/internal/domain/main-entities/infra/dto.go b/internal/domain/main-entities/infra/dto.go new file mode 100644 index 00000000..801883d1 --- /dev/null +++ b/internal/domain/main-entities/infra/dto.go @@ -0,0 +1,84 @@ +package infra + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eig "simrs-vx/internal/domain/main-entities/infra-group" + ei "simrs-vx/internal/domain/main-entities/item" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + InfraGroup_Code *string `json:"infraGroup_code"` + Parent_Id *int16 `json:"parent_id"` + Item_Id *uint `json:"item_id"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + InfraGroup_Code *string `json:"infraGroup_code"` + Parent_Id *int16 `json:"parent_id"` + Item_Id *uint `json:"item_id"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + InfraGroup_Code *string `json:"infraGroup_code"` + Parent_Id *int16 `json:"parent_id"` + Item_Id *uint `json:"item_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.SmallMain + Code string `json:"code"` + Name string `json:"name"` + InfraGroup_Code *string `json:"infraGroup_code"` + InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty"` + Parent_Id *int16 `json:"parent_id"` + Item_Id *uint `json:"item_id"` + Item *ei.Item `json:"item,omitempty"` +} + +func (d Infra) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + InfraGroup_Code: d.InfraGroup_Code, + InfraGroup: d.InfraGroup, + Parent_Id: d.Parent_Id, + Item_Id: d.Item_Id, + Item: d.Item, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []Infra) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/infra/entity.go b/internal/domain/main-entities/infra/entity.go new file mode 100644 index 00000000..7cb2001e --- /dev/null +++ b/internal/domain/main-entities/infra/entity.go @@ -0,0 +1,18 @@ +package infra + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eig "simrs-vx/internal/domain/main-entities/infra-group" + ei "simrs-vx/internal/domain/main-entities/item" +) + +type Infra struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + InfraGroup_Code *string `json:"infraGroup_code" gorm:"size:10"` + InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty" gorm:"foreignKey:InfraGroup_Code;references:Code"` + Parent_Id *int16 `json:"parent_id"` + Item_Id *uint `json:"item_id"` + Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"` +} diff --git a/internal/domain/main-entities/item-price/dto.go b/internal/domain/main-entities/item-price/dto.go new file mode 100644 index 00000000..d048012b --- /dev/null +++ b/internal/domain/main-entities/item-price/dto.go @@ -0,0 +1,65 @@ +package itemprice + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ei "simrs-vx/internal/domain/main-entities/item" +) + +type CreateDto struct { + Item_Id *uint `json:"item_id"` + Price float64 `json:"price"` +} + +type ReadListDto struct { + Item_Id *uint `json:"item_id"` + Price float64 `json:"price"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Item_Id *uint `json:"item_id"` + Price float64 `json:"price"` +} + +type UpdateDto struct { + Id uint `json:"id"` + CreateDto +} + +type DeleteDto struct { + Id uint `json:"id"` +} + +type MetaDto struct { + PageNumber int `json:"page_number"` + PageSize int `json:"page_size"` + Count int `json:"count"` +} + +type ResponseDto struct { + ecore.Main + Item_Id *uint `json:"item_id"` + Item *ei.Item `json:"item,omitempty"` + Price float64 `json:"price"` +} + +func (d ItemPrice) ToResponse() ResponseDto { + resp := ResponseDto{ + Item_Id: d.Item_Id, + Price: d.Price, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []ItemPrice) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/item-price/entity.go b/internal/domain/main-entities/item-price/entity.go new file mode 100644 index 00000000..f1bf072f --- /dev/null +++ b/internal/domain/main-entities/item-price/entity.go @@ -0,0 +1,13 @@ +package itemprice + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ei "simrs-vx/internal/domain/main-entities/item" +) + +type ItemPrice struct { + ecore.Main // adjust this according to the needs + Item_Id *uint `json:"item_id"` + Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"` + Price float64 `json:"price"` +} diff --git a/internal/domain/main-entities/item/dto.go b/internal/domain/main-entities/item/dto.go new file mode 100644 index 00000000..5094e971 --- /dev/null +++ b/internal/domain/main-entities/item/dto.go @@ -0,0 +1,89 @@ +package item + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eig "simrs-vx/internal/domain/main-entities/item-group" + eu "simrs-vx/internal/domain/main-entities/uom" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + ItemGroup_Code *string `json:"itemGroup_code"` + Uom_Code *string `json:"uom_code"` + Infra_Id *int16 `json:"infra_id"` + Stock *float64 `json:"stock"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + ItemGroup_Code *string `json:"itemGroup_code"` + Uom_Code *string `json:"uom_code"` + Infra_Id *int16 `json:"infra_id"` + Stock *float64 `json:"stock"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + ItemGroup_Code *string `json:"itemGroup_code"` + Uom_Code *string `json:"uom_code"` + Infra_Id *int16 `json:"infra_id"` + Stock *float64 `json:"stock"` +} + +type UpdateDto struct { + Id uint `json:"id"` + CreateDto +} + +type DeleteDto struct { + Id uint `json:"id"` +} + +type MetaDto struct { + PageNumber int `json:"page_number"` + PageSize int `json:"page_size"` + Count int `json:"count"` +} + +type ResponseDto struct { + ecore.Main + Code string `json:"code"` + Name string `json:"name"` + ItemGroup_Code *string `json:"itemGroup_code"` + ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty"` + Uom_Code *string `json:"uom_code"` + Uom *eu.Uom `json:"uom,omitempty"` + Infra_Id *int16 `json:"infra_id"` + Stock *float64 `json:"stock"` +} + +func (d Item) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + ItemGroup_Code: d.ItemGroup_Code, + ItemGroup: d.ItemGroup, + Uom_Code: d.Uom_Code, + Uom: d.Uom, + Infra_Id: d.Infra_Id, + Stock: d.Stock, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []Item) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/item/entity.go b/internal/domain/main-entities/item/entity.go new file mode 100644 index 00000000..561da2b2 --- /dev/null +++ b/internal/domain/main-entities/item/entity.go @@ -0,0 +1,19 @@ +package item + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eig "simrs-vx/internal/domain/main-entities/item-group" + eu "simrs-vx/internal/domain/main-entities/uom" +) + +type Item struct { + ecore.Main // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:50"` + Name string `json:"name" gorm:"size:100"` + ItemGroup_Code *string `json:"itemGroup_code" gorm:"size:10"` + ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty" gorm:"foreignKey:ItemGroup_Code;references:Code"` + Uom_Code *string `json:"uom_code" gorm:"size:10"` + Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"` + Infra_Id *int16 `json:"infra_id"` + Stock *float64 `json:"stock"` +} diff --git a/internal/domain/main-entities/mcu-src-category/dto.go b/internal/domain/main-entities/mcu-src-category/dto.go new file mode 100644 index 00000000..f78eb6a9 --- /dev/null +++ b/internal/domain/main-entities/mcu-src-category/dto.go @@ -0,0 +1,69 @@ +package division + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + erc "simrs-vx/internal/domain/references/clinical" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + Scope_Code *erc.CheckupScopeCode `json:"scope_code"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + Scope_Code *erc.CheckupScopeCode `json:"scope_code"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + Scope_Code *erc.CheckupScopeCode `json:"scope_code"` +} + +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.SmallMain + Code string `json:"code"` + Name string `json:"name"` + Scope_Code *erc.CheckupScopeCode `json:"scope_code"` +} + +func (d McuSrcCategory) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + Scope_Code: d.Scope_Code, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []McuSrcCategory) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/mcu-src-category/entity.go b/internal/domain/main-entities/mcu-src-category/entity.go new file mode 100644 index 00000000..61921168 --- /dev/null +++ b/internal/domain/main-entities/mcu-src-category/entity.go @@ -0,0 +1,13 @@ +package division + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + erc "simrs-vx/internal/domain/references/clinical" +) + +type McuSrcCategory struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:20"` + Name string `json:"name" gorm:"size:50"` + Scope_Code *erc.CheckupScopeCode `json:"scope_code" gorm:"size:10"` +} diff --git a/internal/domain/main-entities/mcu-src/dto.go b/internal/domain/main-entities/mcu-src/dto.go new file mode 100644 index 00000000..f0c06a51 --- /dev/null +++ b/internal/domain/main-entities/mcu-src/dto.go @@ -0,0 +1,68 @@ +package mcusrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + CheckupCategory_Code *string `json:"checkupCategory_code"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + CheckupCategory_Code *string `json:"checkupCategory_code"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + CheckupCategory_Code *string `json:"checkupCategory_code"` +} + +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.SmallMain + Code string `json:"code"` + Name string `json:"name"` + CheckupCategory_Code *string `json:"checkupCategory_code"` +} + +func (d McuSrc) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + CheckupCategory_Code: d.CheckupCategory_Code, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []McuSrc) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/mcu-src/entity.go b/internal/domain/main-entities/mcu-src/entity.go new file mode 100644 index 00000000..bec60ac0 --- /dev/null +++ b/internal/domain/main-entities/mcu-src/entity.go @@ -0,0 +1,12 @@ +package mcusrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type McuSrc struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:20"` + Name string `json:"name" gorm:"size:50"` + CheckupCategory_Code *string `json:"checkupCategory_code" gorm:"size:20"` +} diff --git a/internal/domain/main-entities/medicine-group/dto.go b/internal/domain/main-entities/medicine-group/dto.go new file mode 100644 index 00000000..3ae439a3 --- /dev/null +++ b/internal/domain/main-entities/medicine-group/dto.go @@ -0,0 +1,63 @@ +package medicinegroup + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` +} + +type UpdateDto struct { + Id uint `json:"id"` + CreateDto +} + +type DeleteDto struct { + Id uint `json:"id"` +} + +type MetaDto struct { + PageNumber int `json:"page_number"` + PageSize int `json:"page_size"` + Count int `json:"count"` +} + +type ResponseDto struct { + ecore.SmallMain + Code string `json:"code"` + Name string `json:"name"` +} + +func (d MedicineGroup) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []MedicineGroup) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/medicine-group/entity.go b/internal/domain/main-entities/medicine-group/entity.go new file mode 100644 index 00000000..612ab3b3 --- /dev/null +++ b/internal/domain/main-entities/medicine-group/entity.go @@ -0,0 +1,11 @@ +package medicinegroup + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type MedicineGroup struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:50"` + Name string `json:"name" gorm:"size:100"` +} diff --git a/internal/domain/main-entities/medicine-method/dto.go b/internal/domain/main-entities/medicine-method/dto.go new file mode 100644 index 00000000..074f8caa --- /dev/null +++ b/internal/domain/main-entities/medicine-method/dto.go @@ -0,0 +1,63 @@ +package medicinemethod + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` +} + +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.SmallMain + Code string `json:"code"` + Name string `json:"name"` +} + +func (d MedicineMethod) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []MedicineMethod) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/medicine-method/entity.go b/internal/domain/main-entities/medicine-method/entity.go new file mode 100644 index 00000000..dde7c578 --- /dev/null +++ b/internal/domain/main-entities/medicine-method/entity.go @@ -0,0 +1,11 @@ +package medicinemethod + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type MedicineMethod struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:50"` + Name string `json:"name" gorm:"size:100"` +} diff --git a/internal/domain/main-entities/uom/dto.go b/internal/domain/main-entities/uom/dto.go new file mode 100644 index 00000000..08055c12 --- /dev/null +++ b/internal/domain/main-entities/uom/dto.go @@ -0,0 +1,63 @@ +package uom + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + + Page int `json:"page"` + PageSize int `json:"page_size"` + NoPagination int `json:"no_pagination"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` +} + +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.SmallMain + Code string `json:"code"` + Name string `json:"name"` +} + +func (d Uom) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []Uom) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/uom/entity.go b/internal/domain/main-entities/uom/entity.go new file mode 100644 index 00000000..6584311c --- /dev/null +++ b/internal/domain/main-entities/uom/entity.go @@ -0,0 +1,11 @@ +package uom + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type Uom struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` +} diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go new file mode 100644 index 00000000..13e95581 --- /dev/null +++ b/internal/domain/references/clinical/clinical.go @@ -0,0 +1,12 @@ +package clinical + +type ( + CheckupScopeCode string +) + +const ( + CSCLab CheckupScopeCode = "lab" // Laboratorium + CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium + CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium + CSCRad CheckupScopeCode = "radiology" // Radiology +) diff --git a/internal/domain/references/common/common.go b/internal/domain/references/common/common.go index dfd44baf..7f6fed2b 100644 --- a/internal/domain/references/common/common.go +++ b/internal/domain/references/common/common.go @@ -1,13 +1,12 @@ package common type ( - YaTidakCode byte - SudahBelumCode byte - AktifSimpelCode byte - AktifAdvanceCode byte - TersediaCode byte - StatusCode string - EmployeePosisitionCode string + YaTidakCode byte + SudahBelumCode byte + AktifSimpelCode byte + AktifAdvanceCode byte + TersediaCode byte + StatusCode string ) const ( @@ -42,14 +41,3 @@ const ( SCBlocked StatusCode = "blocked" SCSuspended StatusCode = "suspended" ) - -const ( - EPCDoc EmployeePosisitionCode = "doctor" - EPCNur EmployeePosisitionCode = "nurse" - EPCNut EmployeePosisitionCode = "nutritionist" - EPCLab EmployeePosisitionCode = "laborant" - EPCPha EmployeePosisitionCode = "pharmacy" - EPCPay EmployeePosisitionCode = "payment" - EPCPav EmployeePosisitionCode = "payment-verificator" - EPCMan EmployeePosisitionCode = "management" -) diff --git a/internal/domain/references/organization/organization.go b/internal/domain/references/organization/organization.go index f8c7879e..bad128d6 100644 --- a/internal/domain/references/organization/organization.go +++ b/internal/domain/references/organization/organization.go @@ -1,46 +1,16 @@ package organization type ( - PositionCode string - QueuePositionCode string + EmployeePosisitionCode string ) const ( - PosReg PositionCode = "reg" - PosDoctor PositionCode = "doc" - PosNurse PositionCode = "nur" // DEPRECATED - PosAmbulatory PositionCode = "amb" // rawat jalan - PosEmergency PositionCode = "emg" // gawat darurat - PosNEC PositionCode = "eon" // ponek, cEONc - PosInpatient PositionCode = "inp" // rawat inap - PosICU PositionCode = "icu" - PosVK PositionCode = "vlk" - PosNeonatus PositionCode = "neo" - PosMidwife PositionCode = "mwf" - PosNutrition PositionCode = "nut" - PosAnesthesia PositionCode = "ans" - PosSurgery PositionCode = "sur" - - PosPharmacy PositionCode = "pha" - PosRadiology PositionCode = "rad" - PosLab PositionCode = "lab" - PosFinance PositionCode = "fin" - PosHRD PositionCode = "hrd" - PosOperator PositionCode = "opr" - PosAdmin PositionCode = "adm" - PosSystem PositionCode = "sys" -) - -const ( - CQPCRegistration QueuePositionCode = "reg" - CQPCPayment QueuePositionCode = "pay" - CQPCExamination QueuePositionCode = "exa" - CQPCMedicine QueuePositionCode = "med" - CQPCProcedure QueuePositionCode = "pro" - CQPCFinish QueuePositionCode = "fin" - CQPCRegSkip QueuePositionCode = "reg-ski" - CQPCPaySkip QueuePositionCode = "pay-ski" - CQPCExaSkip QueuePositionCode = "exa-ski" - CQPCMedSkip QueuePositionCode = "med-ski" - CQPCReschedule QueuePositionCode = "rse" + EPCDoc EmployeePosisitionCode = "doctor" + EPCNur EmployeePosisitionCode = "nurse" + EPCNut EmployeePosisitionCode = "nutritionist" + EPCLab EmployeePosisitionCode = "laborant" + EPCPha EmployeePosisitionCode = "pharmacy" + EPCPay EmployeePosisitionCode = "payment" + EPCPav EmployeePosisitionCode = "payment-verificator" + EPCMan EmployeePosisitionCode = "management" ) diff --git a/internal/interface/migration/migration.go b/internal/interface/migration/migration.go index 3acc76cd..ed6692b2 100644 --- a/internal/interface/migration/migration.go +++ b/internal/interface/migration/migration.go @@ -12,9 +12,16 @@ import ( divisionposition "simrs-vx/internal/domain/main-entities/division-position" doctor "simrs-vx/internal/domain/main-entities/doctor" employee "simrs-vx/internal/domain/main-entities/employee" + infra "simrs-vx/internal/domain/main-entities/infra" infragroup "simrs-vx/internal/domain/main-entities/infra-group" installation "simrs-vx/internal/domain/main-entities/installation" + item "simrs-vx/internal/domain/main-entities/item" itemgroup "simrs-vx/internal/domain/main-entities/item-group" + itemprice "simrs-vx/internal/domain/main-entities/item-price" + mcusrc "simrs-vx/internal/domain/main-entities/mcu-src" + mcusrccategory "simrs-vx/internal/domain/main-entities/mcu-src-category" + medicinegroup "simrs-vx/internal/domain/main-entities/medicine-group" + medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method" nurse "simrs-vx/internal/domain/main-entities/nurse" nutritionist "simrs-vx/internal/domain/main-entities/nutritionist" person "simrs-vx/internal/domain/main-entities/person" @@ -27,6 +34,7 @@ import ( province "simrs-vx/internal/domain/main-entities/province" regency "simrs-vx/internal/domain/main-entities/regency" 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" @@ -87,6 +95,14 @@ func GetEntities() []any { &pharmacist.Pharmacist{}, &counter.Counter{}, &practiceschedule.PracticeSchedule{}, + &uom.Uom{}, + &item.Item{}, + &itemprice.ItemPrice{}, + &infra.Infra{}, + &medicinegroup.MedicineGroup{}, + &medicinemethod.MedicineMethod{}, + &mcusrccategory.McuSrcCategory{}, + &mcusrc.McuSrc{}, } }