diff --git a/cmd/main-migration/migrations/20251105044629.sql b/cmd/main-migration/migrations/20251105044629.sql new file mode 100644 index 00000000..24ba9d05 --- /dev/null +++ b/cmd/main-migration/migrations/20251105044629.sql @@ -0,0 +1,38 @@ +-- Create "AntibioticSrcCategory" table +CREATE TABLE "public"."AntibioticSrcCategory" ( + "Id" serial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(20) NULL, + "Name" character varying(50) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_AntibioticSrcCategory_Code" UNIQUE ("Code") +); +-- Create "AntibioticSrc" table +CREATE TABLE "public"."AntibioticSrc" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Code" character varying(20) NULL, + "Name" character varying(50) NULL, + "AntibioticSrcCategory_Code" character varying(20) NULL, + "Item_Id" bigint NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "uni_AntibioticSrc_Code" UNIQUE ("Code"), + CONSTRAINT "fk_AntibioticSrc_AntibioticSrcCategory" FOREIGN KEY ("AntibioticSrcCategory_Code") REFERENCES "public"."AntibioticSrcCategory" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_AntibioticSrc_Item" FOREIGN KEY ("Item_Id") REFERENCES "public"."Item" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- Create "AntibioticInUse" table +CREATE TABLE "public"."AntibioticInUse" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "McuOrder_Id" bigint NULL, + "AntibioticSrc_Id" bigint NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_AntibioticInUse_AntibioticSrc" FOREIGN KEY ("AntibioticSrc_Id") REFERENCES "public"."AntibioticSrc" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_AntibioticInUse_McuOrder" FOREIGN KEY ("McuOrder_Id") REFERENCES "public"."McuOrder" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); diff --git a/cmd/main-migration/migrations/20251105121808.sql b/cmd/main-migration/migrations/20251105121808.sql new file mode 100644 index 00000000..41c1edf0 --- /dev/null +++ b/cmd/main-migration/migrations/20251105121808.sql @@ -0,0 +1,2 @@ +-- Modify "AntibioticSrc" table +ALTER TABLE "public"."AntibioticSrc" DROP COLUMN "Item_Id"; diff --git a/cmd/main-migration/migrations/20251106035305.sql b/cmd/main-migration/migrations/20251106035305.sql new file mode 100644 index 00000000..d2ab1e94 --- /dev/null +++ b/cmd/main-migration/migrations/20251106035305.sql @@ -0,0 +1,4 @@ +-- Modify "Doctor" table +ALTER TABLE "public"."Doctor" ADD COLUMN "SIP_ExpiredDate" timestamptz NULL, ADD COLUMN "Unit_Code" character varying(10) NULL, ADD COLUMN "Specialist_Code" character varying(10) NULL, ADD COLUMN "Subspecialist_Code" character varying(10) NULL, ADD CONSTRAINT "uni_Doctor_Specialist_Code" UNIQUE ("Specialist_Code"), ADD CONSTRAINT "uni_Doctor_Subspecialist_Code" UNIQUE ("Subspecialist_Code"), ADD CONSTRAINT "uni_Doctor_Unit_Code" UNIQUE ("Unit_Code"); +-- Modify "Employee" table +ALTER TABLE "public"."Employee" ADD COLUMN "Contract_ExpiredDate" timestamptz NULL; diff --git a/cmd/main-migration/migrations/20251106040137.sql b/cmd/main-migration/migrations/20251106040137.sql new file mode 100644 index 00000000..f9cb71cc --- /dev/null +++ b/cmd/main-migration/migrations/20251106040137.sql @@ -0,0 +1,2 @@ +-- Modify "Doctor" table +ALTER TABLE "public"."Doctor" DROP CONSTRAINT "uni_Doctor_Specialist_Code", DROP CONSTRAINT "uni_Doctor_Subspecialist_Code", DROP CONSTRAINT "uni_Doctor_Unit_Code"; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 40b66b02..d6b62389 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA= +h1:yLtZj2e+mxp2L0eRUjFUIrC1GID4BB3/8x6LaHS+v10= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -68,4 +68,8 @@ h1:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA= 20251104042334.sql h1:7PDMWOhmJywolAPKFZ14XaDBeMvcxShaXFN2IemNtzk= 20251104043530.sql h1:qvYVp3ysPf27f1BcoRNCFGovxuVE12lg9d6Xzda6zWU= 20251104080952.sql h1:avghpv1n3yaCDR/TA0X+hgxDGoLBQGu/GJUwj4VT/Ic= -20251104084135.sql h1:Y4coFrHgDXd/DM8ihEy+qMkOSrO8M4SI4shRCJIiBBA= +20251104084135.sql h1:rg+eRE5/5sYWR7z+Xyn0zKw8rr8P/oWxF0xhcNVnNec= +20251105044629.sql h1:4NU27HeKUNFsV82LacnwmnCSAH0pSbZR9J9/ZESRs6M= +20251105121808.sql h1:fii6LjqWYjrm/pEIqttfvJI6QEUL49gque8wYHh1+yI= +20251106035305.sql h1:hRkWZYLQvjmROqlu9xvuXrPQcBKf6yUGTTbSd0lKbmI= +20251106040137.sql h1:ifT65MV7h0sws5EGBOGefRqxSaZqapEeupuhHMJipyw= diff --git a/internal/domain/main-entities/antibiotic-in-use/dto.go b/internal/domain/main-entities/antibiotic-in-use/dto.go new file mode 100644 index 00000000..7fbce2dd --- /dev/null +++ b/internal/domain/main-entities/antibiotic-in-use/dto.go @@ -0,0 +1,76 @@ +package antibioticinuse + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eas "simrs-vx/internal/domain/main-entities/antibiotic-src" + emo "simrs-vx/internal/domain/main-entities/mcu-order" + erc "simrs-vx/internal/domain/references/common" + "time" +) + +type CreateDto struct { + McuOrder_Id *uint `json:"mcuOrder_id"` + AntibioticSrc_Id *uint `json:"antibioticSrc_id"` +} + +type ReadListDto struct { + FilterDto + Includes string `json:"includes"` + Pagination ecore.Pagination +} + +type FilterDto struct { + McuOrder_Id *uint `json:"mcu-order-id"` + AntibioticSrc_Id *uint `json:"mcu-src-id"` + Result *string `json:"result"` + Status_Code erc.DataStatusCode `json:"status-code"` +} +type ReadDetailDto struct { + Id uint `json:"id"` +} + +type UpdateDto struct { + Id uint `json:"id"` + CreateDto +} + +type DeleteDto struct { + Id uint `json:"id"` +} + +type SetScheduleDto struct { + Id uint `json:"id"` + ExaminationDate *time.Time `json:"examinationDate"` +} + +type MetaDto struct { + PageNumber int `json:"page_number"` + PageSize int `json:"page_size"` + Count int `json:"count"` +} + +type ResponseDto struct { + ecore.Main + McuOrder_Id *uint `json:"mcuOrder_id"` + McuOrder *emo.McuOrder `json:"mcuOrder,omitempty"` + AntibioticSrc_Id *uint `json:"antibioticSrc_id"` + Antibiotic *eas.CreateDto `json:"mcuSrc,omitempty"` +} + +func (d AntibioticInUse) ToResponse() ResponseDto { + resp := ResponseDto{ + McuOrder_Id: d.McuOrder_Id, + McuOrder: d.McuOrder, + AntibioticSrc_Id: d.AntibioticSrc_Id, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []AntibioticInUse) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/antibiotic-in-use/entity.go b/internal/domain/main-entities/antibiotic-in-use/entity.go new file mode 100644 index 00000000..6d924d4f --- /dev/null +++ b/internal/domain/main-entities/antibiotic-in-use/entity.go @@ -0,0 +1,15 @@ +package antibioticinuse + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + eas "simrs-vx/internal/domain/main-entities/antibiotic-src" + emo "simrs-vx/internal/domain/main-entities/mcu-order" +) + +type AntibioticInUse struct { + ecore.Main // adjust this according to the needs + McuOrder_Id *uint `json:"mcuOrder_id" gorm:"uniqueIndex:idx_order_src"` + McuOrder *emo.McuOrder `json:"mcuOrder,omitempty" gorm:"foreignKey:McuOrder_Id;references:Id"` + AntibioticSrc_Id *uint `json:"antibioticSrcSrc_id" gorm:"uniqueIndex:idx_order_src"` + AntibioticSrc *eas.AntibioticSrc `json:"antibioticSrc,omitempty" gorm:"foreignKey:AntibioticSrc_Id;references:Id"` +} diff --git a/internal/domain/main-entities/antibiotic-src-category/dto.go b/internal/domain/main-entities/antibiotic-src-category/dto.go new file mode 100644 index 00000000..90f420fb --- /dev/null +++ b/internal/domain/main-entities/antibiotic-src-category/dto.go @@ -0,0 +1,66 @@ +package antibioticsrccategory + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code" validate:"maxLength=20"` + Name string `json:"name" validate:"maxLength=50"` +} + +type ReadListDto struct { + FilterDto + Includes string `json:"includes"` + Sort string `json:"sort"` + Pagination ecore.Pagination +} + +type FilterDto struct { + Code string `json:"code"` + Name string `json:"name"` + Search string `json:"search" gormhelper:"searchColumns=Code,Name"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code *string `json:"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"` +} + +func (d AntibioticSrcCategory) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + } + resp.SmallMain = d.SmallMain + return resp +} + +func ToResponseList(data []AntibioticSrcCategory) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/antibiotic-src-category/entity.go b/internal/domain/main-entities/antibiotic-src-category/entity.go new file mode 100644 index 00000000..31169d9d --- /dev/null +++ b/internal/domain/main-entities/antibiotic-src-category/entity.go @@ -0,0 +1,11 @@ +package antibioticsrccategory + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type AntibioticSrcCategory struct { + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:20"` + Name string `json:"name" gorm:"size:50"` +} diff --git a/internal/domain/main-entities/antibiotic-src/dto.go b/internal/domain/main-entities/antibiotic-src/dto.go new file mode 100644 index 00000000..dd453ae3 --- /dev/null +++ b/internal/domain/main-entities/antibiotic-src/dto.go @@ -0,0 +1,76 @@ +package antibioticsrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ei "simrs-vx/internal/domain/main-entities/item" +) + +type CreateDto struct { + Code string `json:"code" validate:"maxLength=20"` + Name string `json:"name" validate:"maxLength=50"` + AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code" validate:"maxLength=20"` + Item_Id *uint `json:"item_id"` +} + +type ReadListDto struct { + FilterDto + Includes string `json:"includes"` + Sort string `json:"sort"` + Pagination ecore.Pagination +} + +type FilterDto struct { + Code string `json:"code"` + Name string `json:"name"` + AntibioticSrcCategory_Code *string `json:"antibiotic-src-category-code"` + Search string `json:"search" gormhelper:"searchColumns=Code,Name"` +} + +type ReadDetailDto struct { + Id uint16 `json:"id"` + Code *string `json:"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.Main + Code string `json:"code"` + Name string `json:"name"` + AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code"` + Item_Id *uint `json:"item_id"` + Item *ei.Item `json:"item,omitempty"` +} + +func (d AntibioticSrc) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + AntibioticSrcCategory_Code: d.AntibioticSrcCategory_Code, + // Item_Id: d.Item_Id, + // Item: d.Item, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(data []AntibioticSrc) []ResponseDto { + resp := make([]ResponseDto, len(data)) + for i, u := range data { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/antibiotic-src/entity.go b/internal/domain/main-entities/antibiotic-src/entity.go new file mode 100644 index 00000000..6cb8cc85 --- /dev/null +++ b/internal/domain/main-entities/antibiotic-src/entity.go @@ -0,0 +1,16 @@ +package antibioticsrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + easc "simrs-vx/internal/domain/main-entities/antibiotic-src-category" +) + +type AntibioticSrc struct { + ecore.Main // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:20"` + Name string `json:"name" gorm:"size:50"` + AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code" gorm:"size:20"` + AntibioticSrcCategory *easc.AntibioticSrcCategory `json:"antibioticSrcCategory,omitempty" gorm:"foreignKey:AntibioticSrcCategory_Code;references:Code"` + // 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/doctor/entity.go b/internal/domain/main-entities/doctor/entity.go index ec882838..014c6c17 100644 --- a/internal/domain/main-entities/doctor/entity.go +++ b/internal/domain/main-entities/doctor/entity.go @@ -6,19 +6,25 @@ import ( es "simrs-vx/internal/domain/main-entities/specialist" ess "simrs-vx/internal/domain/main-entities/subspecialist" eu "simrs-vx/internal/domain/main-entities/unit" + "time" ) type Doctor struct { - ecore.Main // adjust this according to the needs - Code *string `json:"code" gorm:"unique;size:20"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` - IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"` - SIP_Number *string `json:"sip_number" gorm:"unique;size:20"` - Unit_Id *uint16 `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"` - Subspecialist_Id *uint16 `json:"subspecialist_id"` - Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"` + ecore.Main // adjust this according to the needs + Code *string `json:"code" gorm:"unique;size:20"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"` + SIP_Number *string `json:"sip_number" gorm:"unique;size:20"` + SIP_ExpiredDate *time.Time `json:"sip_expiredDate"` + Unit_Id *uint16 `json:"unit_id"` + Unit_Code *string `json:"unit_code" gorm:"size:10"` + Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` + // Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"` + Specialist_Id *uint16 `json:"specialist_id"` + Specialist_Code *string `json:"specialist_code" gorm:"size:10"` + Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"` + Subspecialist_Id *uint16 `json:"subspecialist_id"` + Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"` + Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"` } diff --git a/internal/domain/main-entities/employee/entity.go b/internal/domain/main-entities/employee/entity.go index 7a770be0..299ae021 100644 --- a/internal/domain/main-entities/employee/entity.go +++ b/internal/domain/main-entities/employee/entity.go @@ -6,15 +6,17 @@ import ( eu "simrs-vx/internal/domain/main-entities/user" erc "simrs-vx/internal/domain/references/common" erg "simrs-vx/internal/domain/references/organization" + "time" ) type Employee struct { - ecore.Main // adjust this according to the needs - User_Id *uint `json:"user_id"` - User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"` - Person_Id *uint `json:"person_id"` - Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"` - Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"` - Number *string `json:"number" gorm:"size:20"` - Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"` + ecore.Main // adjust this according to the needs + User_Id *uint `json:"user_id"` + User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"` + Person_Id *uint `json:"person_id"` + Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"` + Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"` + Number *string `json:"number" gorm:"size:20"` + Contract_ExpiredDate *time.Time `json:"contract_expiredDate"` + Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"` } diff --git a/internal/domain/main-entities/mcu-order/dto.go b/internal/domain/main-entities/mcu-order/dto.go index 3d042c2f..e63a3e08 100644 --- a/internal/domain/main-entities/mcu-order/dto.go +++ b/internal/domain/main-entities/mcu-order/dto.go @@ -28,6 +28,7 @@ type CreateDto struct { Number uint8 `json:"number"` Temperature float64 `json:"temperature"` UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"` + Scope_Code ercl.McuScopeCode `json:"scope_code"` pa.AuthInfo } diff --git a/internal/domain/main-entities/mcu-order/entity.go b/internal/domain/main-entities/mcu-order/entity.go index d2b81e58..bf4e2e77 100644 --- a/internal/domain/main-entities/mcu-order/entity.go +++ b/internal/domain/main-entities/mcu-order/entity.go @@ -8,7 +8,6 @@ import ( ercl "simrs-vx/internal/domain/references/clinical" erc "simrs-vx/internal/domain/references/common" - ere "simrs-vx/internal/domain/references/encounter" ) type McuOrder struct { @@ -23,7 +22,7 @@ type McuOrder struct { Number uint8 `json:"number"` Temperature float64 `json:"temperature"` UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code" gorm:"not null;size:15"` - Scope_Code *ere.CheckupScopeCode `json:"scope_code" gorm:"index;size:10"` + Scope_Code ercl.McuScopeCode `json:"scope_code" gorm:"index;size:10"` } func (d McuOrder) IsCompleted() bool { diff --git a/internal/domain/main-entities/mcu-src-category/dto.go b/internal/domain/main-entities/mcu-src-category/dto.go index 278c5e5c..c1988790 100644 --- a/internal/domain/main-entities/mcu-src-category/dto.go +++ b/internal/domain/main-entities/mcu-src-category/dto.go @@ -3,13 +3,13 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" - ere "simrs-vx/internal/domain/references/encounter" + erc "simrs-vx/internal/domain/references/clinical" ) type CreateDto struct { - Code string `json:"code" validate:"maxLength=20"` - Name string `json:"name" validate:"maxLength=50"` - Scope_Code *ere.CheckupScopeCode `json:"scope_code" validate:"maxLength=10"` + Code string `json:"code" validate:"maxLength=20"` + Name string `json:"name" validate:"maxLength=50"` + Scope_Code erc.McuScopeCode `json:"scope_code" validate:"maxLength=10"` } type ReadListDto struct { @@ -20,10 +20,10 @@ type ReadListDto struct { } type FilterDto struct { - Code string `json:"code"` - Name string `json:"name"` - Scope_Code *ere.CheckupScopeCode `json:"scope-code"` - Search string `json:"search" gormhelper:"searchColumns=Code,Name"` + Code string `json:"code"` + Name string `json:"name"` + Scope_Code *erc.McuScopeCode `json:"scope-code"` + Search string `json:"search" gormhelper:"searchColumns=Code,Name"` } type ReadDetailDto struct { @@ -48,9 +48,9 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - Scope_Code *ere.CheckupScopeCode `json:"scope_code"` + Code string `json:"code"` + Name string `json:"name"` + Scope_Code erc.McuScopeCode `json:"scope_code"` } func (d McuSrcCategory) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/mcu-src-category/entity.go b/internal/domain/main-entities/mcu-src-category/entity.go index 3a0d08ca..8fc801b9 100644 --- a/internal/domain/main-entities/mcu-src-category/entity.go +++ b/internal/domain/main-entities/mcu-src-category/entity.go @@ -2,12 +2,12 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" - ere "simrs-vx/internal/domain/references/encounter" + 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 *ere.CheckupScopeCode `json:"scope_code" gorm:"index;size:10"` + 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.McuScopeCode `json:"scope_code" gorm:"index;size:10"` } diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go index 8120adb3..01d0461c 100644 --- a/internal/domain/references/clinical/clinical.go +++ b/internal/domain/references/clinical/clinical.go @@ -9,6 +9,7 @@ type ( InstructionCode string HeadToToeCode string McuUrgencyLevelCode string + McuScopeCode string SoapiTypeCode string MedicalAction string VehicleTypeCode string diff --git a/internal/domain/references/encounter/encounter.go b/internal/domain/references/encounter/encounter.go index 97eae05b..45ee8c89 100644 --- a/internal/domain/references/encounter/encounter.go +++ b/internal/domain/references/encounter/encounter.go @@ -8,7 +8,6 @@ type ( PersonConditionCode string EmergencyClassCode string OutpatientClassCode string - CheckupScopeCode string AmbulatoryClassCode string InpatientClassCode string UploadCode string @@ -44,6 +43,7 @@ const ( DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain DMCDeath DischargeMethodCode = "death" // Meninggal DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba + DMCRunAway DischargeMethodCode = "run-away" // Melarikan Diri TCAmbulance TransportationCode = "ambulance" // Ambulans TCCar TransportationCode = "car" // Mobil @@ -65,11 +65,6 @@ const ( OCCHcu OutpatientClassCode = "hcu" // HCU OCCVk OutpatientClassCode = "vk" // Verlos kamer - CSCLab CheckupScopeCode = "lab" // Laboratorium - CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium - CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium - CSCRad CheckupScopeCode = "radiology" // Radiology - ACCReg AmbulatoryClassCode = "reg" // Regular // ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik // ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy diff --git a/internal/interface/migration/main-entities.go b/internal/interface/migration/main-entities.go index 0b3a9970..af9fe034 100644 --- a/internal/interface/migration/main-entities.go +++ b/internal/interface/migration/main-entities.go @@ -5,6 +5,8 @@ import ( admemployeehist "simrs-vx/internal/domain/main-entities/adm-employee-hist" ambulancetransportreq "simrs-vx/internal/domain/main-entities/ambulance-transport-req" ambulatory "simrs-vx/internal/domain/main-entities/ambulatory" + antibioticinuse "simrs-vx/internal/domain/main-entities/antibiotic-in-use" + antibioticsrccategory "simrs-vx/internal/domain/main-entities/antibiotic-src-category" appointment "simrs-vx/internal/domain/main-entities/appointment" chemo "simrs-vx/internal/domain/main-entities/chemo" chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol" @@ -175,6 +177,8 @@ func getMainEntities() []any { &mcuorderitem.McuOrderItem{}, &mcusubsrc.McuSubSrc{}, &mcuordersubitem.McuOrderSubItem{}, + &antibioticsrccategory.AntibioticSrcCategory{}, + &antibioticinuse.AntibioticInUse{}, &consultation.Consultation{}, &chemo.Chemo{}, &midwife.Midwife{}, diff --git a/internal/use-case/main-use-case/mcu-order/helper.go b/internal/use-case/main-use-case/mcu-order/helper.go index c7d6fc6f..7c21f1f6 100644 --- a/internal/use-case/main-use-case/mcu-order/helper.go +++ b/internal/use-case/main-use-case/mcu-order/helper.go @@ -28,4 +28,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuOrder) { data.Temperature = inputSrc.Temperature data.UrgencyLevel_Code = inputSrc.UrgencyLevel_Code data.Doctor_Id = inputSrc.Doctor_Id + data.Scope_Code = inputSrc.Scope_Code } diff --git a/internal/use-case/main-use-case/prescription/helper.go b/internal/use-case/main-use-case/prescription/helper.go index 8b85884a..35c55512 100644 --- a/internal/use-case/main-use-case/prescription/helper.go +++ b/internal/use-case/main-use-case/prescription/helper.go @@ -37,7 +37,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Prescription) { } data.Encounter_Id = inputSrc.Encounter_Id - data.Doctor_Id = inputSrc.Doctor_Id + // data.Doctor_Id = inputSrc.Doctor_Id + data.Doctor_Id = inputSrc.AuthInfo.Doctor_Id data.IssuedAt = inputSrc.IssuedAt }