Merge pull request #129 from dikstub-rssa/fix/anything-moko

Fix/anything moko
This commit is contained in:
Dwi Atmoko Purbo Sakti
2025-11-06 16:02:34 +07:00
committed by GitHub
co-authored by GitHub
185 changed files with 2748 additions and 2294 deletions
@@ -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
);
@@ -0,0 +1,2 @@
-- Modify "AntibioticSrc" table
ALTER TABLE "public"."AntibioticSrc" DROP COLUMN "Item_Id";
@@ -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;
@@ -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";
@@ -0,0 +1,2 @@
-- Modify "Nurse" table
ALTER TABLE "public"."Nurse" ADD COLUMN "Unit_Code" character varying(10) NULL, ADD COLUMN "Infra_Code" character varying(10) NULL;
@@ -0,0 +1,2 @@
-- Modify "SpecialistIntern" table
ALTER TABLE "public"."SpecialistIntern" ADD COLUMN "Specialist_Code" character varying(10) NULL, ADD COLUMN "Subspecialist_Code" character varying(10) NULL;
@@ -0,0 +1,8 @@
-- Modify "Prescription" table
ALTER TABLE "public"."Prescription" ADD COLUMN "Doctor_Code" character varying(20) NULL;
-- Modify "Doctor" table
ALTER TABLE "public"."Doctor" DROP CONSTRAINT "fk_Doctor_Specialist", DROP CONSTRAINT "fk_Doctor_Subspecialist", DROP CONSTRAINT "fk_Doctor_Unit", DROP COLUMN "Unit_Id", DROP COLUMN "Specialist_Id", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_Doctor_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Doctor_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Doctor_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "Nurse" table
ALTER TABLE "public"."Nurse" DROP CONSTRAINT "fk_Nurse_Infra", DROP CONSTRAINT "fk_Nurse_Unit", DROP COLUMN "Unit_Id", DROP COLUMN "Infra_Id", ADD CONSTRAINT "fk_Nurse_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Nurse_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "SpecialistIntern" table
ALTER TABLE "public"."SpecialistIntern" DROP CONSTRAINT "fk_SpecialistIntern_Specialist", DROP CONSTRAINT "fk_SpecialistIntern_Subspecialist", DROP COLUMN "Specialist_Id", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_SpecialistIntern_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_SpecialistIntern_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,2 @@
-- Modify "Prescription" table
ALTER TABLE "public"."Prescription" DROP CONSTRAINT "fk_Prescription_Doctor", DROP COLUMN "Doctor_Id", ADD CONSTRAINT "fk_Prescription_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,8 @@
-- Modify "Specialist" table
ALTER TABLE "public"."Specialist" ADD COLUMN "Unit_Code" character varying(10) NULL;
-- Modify "SpecialistPosition" table
ALTER TABLE "public"."SpecialistPosition" ADD COLUMN "Specialist_Code" character varying(10) NULL;
-- Modify "Subspecialist" table
ALTER TABLE "public"."Subspecialist" ADD COLUMN "Specialist_Code" character varying(10) NULL;
-- Modify "SubspecialistPosition" table
ALTER TABLE "public"."SubspecialistPosition" ADD COLUMN "Subspecialist_Code" character varying(10) NULL;
@@ -0,0 +1,8 @@
-- Modify "Specialist" table
ALTER TABLE "public"."Specialist" DROP CONSTRAINT "fk_Specialist_Unit", DROP COLUMN "Unit_Id", ADD CONSTRAINT "fk_Specialist_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "SpecialistPosition" table
ALTER TABLE "public"."SpecialistPosition" DROP CONSTRAINT "fk_SpecialistPosition_Specialist", DROP COLUMN "Specialist_Id", ADD CONSTRAINT "fk_SpecialistPosition_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "Subspecialist" table
ALTER TABLE "public"."Subspecialist" DROP CONSTRAINT "fk_Subspecialist_Specialist", DROP COLUMN "Specialist_Id", ADD CONSTRAINT "fk_Subspecialist_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "SubspecialistPosition" table
ALTER TABLE "public"."SubspecialistPosition" DROP CONSTRAINT "fk_SubspecialistPosition_Subspecialist", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_SubspecialistPosition_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,4 @@
-- Modify "Division" table
ALTER TABLE "public"."Division" ADD COLUMN "Parent_Code" character varying(10) NULL;
-- Modify "DivisionPosition" table
ALTER TABLE "public"."DivisionPosition" ADD COLUMN "Division_Code" character varying(10) NULL;
@@ -0,0 +1,6 @@
-- Create index "idx_Division_Code" to table: "Division"
CREATE UNIQUE INDEX "idx_Division_Code" ON "public"."Division" ("Code");
-- Modify "Division" table
ALTER TABLE "public"."Division" DROP CONSTRAINT "uni_Division_Code", DROP CONSTRAINT "fk_Division_Childrens", DROP COLUMN "Parent_Id", ADD CONSTRAINT "fk_Division_Childrens" FOREIGN KEY ("Parent_Code") REFERENCES "public"."Division" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "DivisionPosition" table
ALTER TABLE "public"."DivisionPosition" DROP CONSTRAINT "fk_DivisionPosition_Division", DROP COLUMN "Division_Id", ADD CONSTRAINT "fk_DivisionPosition_Division" FOREIGN KEY ("Division_Code") REFERENCES "public"."Division" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,6 @@
-- Modify "InstallationPosition" table
ALTER TABLE "public"."InstallationPosition" ADD COLUMN "Installation_Code" character varying(10) NULL;
-- Modify "Unit" table
ALTER TABLE "public"."Unit" ADD COLUMN "Installation_Code" character varying(10) NULL;
-- Modify "UnitPosition" table
ALTER TABLE "public"."UnitPosition" ADD COLUMN "Unit_Code" character varying(10) NULL;
@@ -0,0 +1,6 @@
-- Modify "InstallationPosition" table
ALTER TABLE "public"."InstallationPosition" DROP CONSTRAINT "fk_InstallationPosition_Installation", DROP COLUMN "Installation_Id", ADD CONSTRAINT "fk_InstallationPosition_Installation" FOREIGN KEY ("Installation_Code") REFERENCES "public"."Installation" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "Unit" table
ALTER TABLE "public"."Unit" DROP CONSTRAINT "fk_Unit_Installation", DROP COLUMN "Installation_Id", ADD CONSTRAINT "fk_Unit_Installation" FOREIGN KEY ("Installation_Code") REFERENCES "public"."Installation" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "UnitPosition" table
ALTER TABLE "public"."UnitPosition" DROP CONSTRAINT "fk_UnitPosition_Unit", DROP COLUMN "Unit_Id", ADD CONSTRAINT "fk_UnitPosition_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
+16 -2
View File
@@ -1,4 +1,4 @@
h1:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA= h1:Jut0rnI38bZU7g1hei5bIcYGzWrt4KxfWzasGJcbwi0=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -68,4 +68,18 @@ h1:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA=
20251104042334.sql h1:7PDMWOhmJywolAPKFZ14XaDBeMvcxShaXFN2IemNtzk= 20251104042334.sql h1:7PDMWOhmJywolAPKFZ14XaDBeMvcxShaXFN2IemNtzk=
20251104043530.sql h1:qvYVp3ysPf27f1BcoRNCFGovxuVE12lg9d6Xzda6zWU= 20251104043530.sql h1:qvYVp3ysPf27f1BcoRNCFGovxuVE12lg9d6Xzda6zWU=
20251104080952.sql h1:avghpv1n3yaCDR/TA0X+hgxDGoLBQGu/GJUwj4VT/Ic= 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:oQ7BwnxPuwY2q98adIVc+lNwL/Sz1OceLJeClDo9/TI=
20251106040137.sql h1:ppcqkVoT0o9jZcjI/TN7LuaPxXhJQhnIXEJtloP/46o=
20251106041333.sql h1:2JkxyelQ/EeB+boL5bfpnzefw32ttEGKvKchtQjWmAU=
20251106042006.sql h1:ruppYa1kAJQUU3ufQBbKGMcXrGbGJJiRPclT+dNc/YQ=
20251106050412.sql h1:MiEMJ1HCFYnalKuq3Z38xJeogfBAMqsTv2sG4EF8dDw=
20251106063418.sql h1:y3veDJPjKekOWLCZek/LgQwXPRhZtOppTfUXiqoL95s=
20251106071906.sql h1:/TUZA3XpMY23qEJXdkTwlzrNMvSSl6JJniPcgAttBaw=
20251106073157.sql h1:78txeibJ602DMD7huD618ZSMt6phSRzDNPTlo0PGyrc=
20251106074218.sql h1:8Xz7WywrtUnSxOHhlal53gG9rE7r86LFUt5zBFe/mIs=
20251106081846.sql h1:jp91Bf5bxGXMiUB1VIuN6y768vb2iWwow44WfCE5J5k=
20251106082844.sql h1:RHYzRO4G1fSWwf+xc/3QezZ/Iil67cZPIgNpNz3TNhQ=
20251106090021.sql h1:dFDk6mq+zjbYWmfWIrHf9DiKvvoXHjrr0++zssMTWP8=
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
@@ -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
}
@@ -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"`
}
@@ -7,7 +7,7 @@ import (
type Basic struct { type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Division_Id *uint16 `json:"division_id"` Division_Code *string `json:"division_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
@@ -7,11 +7,11 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Division_Id *uint16 `json:"division_id"` Division_Code *string `json:"division_code"`
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -22,26 +22,27 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Division_Id *uint16 `json:"division-id"` Division_Code *string `json:"division-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus *bool `json:"head-status"` HeadStatus *bool `json:"head-status"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,23 +53,23 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Division_Id *uint16 `json:"division_id"` Division_Code *string `json:"division_code"`
Division *ed.Division `json:"division,omitempty"` Division *ed.Division `json:"division,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
} }
func (d DivisionPosition) ToResponse() ResponseDto { func (d DivisionPosition) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Division_Id: d.Division_Id, Division_Code: d.Division_Code,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
HeadStatus: d.HeadStatus, HeadStatus: d.HeadStatus,
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
if d.Division != nil { if d.Division != nil {
@@ -7,5 +7,5 @@ import (
type DivisionPosition struct { type DivisionPosition struct {
eb.Basic eb.Basic
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"` Division *ed.Division `json:"division" gorm:"foreignKey:Division_Code;references:Code"`
} }
+13 -12
View File
@@ -6,9 +6,9 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
Parent_Id *uint16 `json:"parent_id"` Parent_Code *string `json:"parent_code"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -20,25 +20,26 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Parent_Id *uint16 `json:"parent-id"` Parent_Code *string `json:"parent-code"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
Includes string `json:"includes"` Includes string `json:"includes"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -51,7 +52,7 @@ type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Parent_Id *uint16 `json:"parent_id"` Parent_Code *string `json:"parent_code"`
Parent *Division `json:"parent,omitempty"` Parent *Division `json:"parent,omitempty"`
Childrens []Division `json:"childrens,omitempty"` Childrens []Division `json:"childrens,omitempty"`
DivisionPosition []edpb.Basic `json:"divisionPositions,omitempty"` DivisionPosition []edpb.Basic `json:"divisionPositions,omitempty"`
@@ -61,7 +62,7 @@ func (d Division) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
Parent_Id: d.Parent_Id, Parent_Code: d.Parent_Code,
Parent: d.Parent, Parent: d.Parent,
Childrens: d.Childrens, Childrens: d.Childrens,
DivisionPosition: d.DivisionPositions, DivisionPosition: d.DivisionPositions,
@@ -7,10 +7,10 @@ import (
type Division struct { type Division struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"uniqueIndex;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
Parent_Id *uint16 `json:"parent_id"` Parent_Code *string `json:"parent_code" gorm:"size:10"`
Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"` Parent *Division `json:"parent" gorm:"foreignKey:Parent_Code;references:Code"`
Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Code;references:Code"` // may need references to self
DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Id;references:Id"` DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
} }
+39 -36
View File
@@ -6,16 +6,18 @@ import (
es "simrs-vx/internal/domain/main-entities/specialist" es "simrs-vx/internal/domain/main-entities/specialist"
ess "simrs-vx/internal/domain/main-entities/subspecialist" ess "simrs-vx/internal/domain/main-entities/subspecialist"
eu "simrs-vx/internal/domain/main-entities/unit" eu "simrs-vx/internal/domain/main-entities/unit"
"time"
) )
type CreateDto struct { type CreateDto struct {
Code *string `json:"code" validate:"maxLength=20"` Code *string `json:"code" validate:"maxLength=20"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"` IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"` SIP_Number *string `json:"sip_number"`
Unit_Id *uint16 `json:"unit_id"` SIP_ExpiredDate *time.Time `json:"sip_expiredDate"`
Specialist_Id *uint16 `json:"specialist_id"` Unit_Code *string `json:"unit_code"`
Subspecialist_Id *uint16 `json:"subspecialist_id"` Specialist_Code *string `json:"specialist_code"`
Subspecialist_Code *string `json:"subspecialist_code"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -25,13 +27,14 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Code *string `json:"code"` Code *string `json:"code"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"` IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
SIP_Number *string `json:"sip-number" validate:"maxLength=20"` SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
Unit_Id *uint `json:"unit-id"` SIP_ExpiredDate *string `json:"sip-expiredDate"`
Specialist_Id *uint16 `json:"specialist-id"` Unit_Code *string `json:"unit-code"`
Subspecialist_Id *uint16 `json:"subspecialist-id"` Specialist_Code *string `json:"specialist-code"`
Subspecialist_Code *string `json:"subspecialist-code"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
@@ -59,32 +62,32 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.Main ecore.Main
Code *string `json:"code"` Code *string `json:"code"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"` IHS_Number *string `json:"ihs_number"`
SIP_Number *string `json:"sip_number"` SIP_Number *string `json:"sip_number"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty"` Unit *eu.Unit `json:"unit,omitempty"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Specialist *es.Specialist `json:"specialist,omitempty" ` Specialist *es.Specialist `json:"specialist,omitempty" `
Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist_Code *string `json:"subspecialist_code"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"` Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
} }
func (d Doctor) ToResponse() ResponseDto { func (d Doctor) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Code: d.Code, Code: d.Code,
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
IHS_Number: d.IHS_Number, IHS_Number: d.IHS_Number,
SIP_Number: d.SIP_Number, SIP_Number: d.SIP_Number,
Unit_Id: d.Unit_Id, Unit_Code: d.Unit_Code,
Unit: d.Unit, Unit: d.Unit,
Specialist_Id: d.Specialist_Id, Specialist_Code: d.Specialist_Code,
Specialist: d.Specialist, Specialist: d.Specialist,
Subspecialist_Id: d.Subspecialist_Id, Subspecialist_Code: d.Subspecialist_Code,
Subspecialist: d.Subspecialist, Subspecialist: d.Subspecialist,
} }
resp.Main = d.Main resp.Main = d.Main
return resp return resp
+14 -12
View File
@@ -6,19 +6,21 @@ import (
es "simrs-vx/internal/domain/main-entities/specialist" es "simrs-vx/internal/domain/main-entities/specialist"
ess "simrs-vx/internal/domain/main-entities/subspecialist" ess "simrs-vx/internal/domain/main-entities/subspecialist"
eu "simrs-vx/internal/domain/main-entities/unit" eu "simrs-vx/internal/domain/main-entities/unit"
"time"
) )
type Doctor struct { type Doctor struct {
ecore.Main // adjust this according to the needs ecore.Main // adjust this according to the needs
Code *string `json:"code" gorm:"unique;size:20"` Code *string `json:"code" gorm:"unique;size:20"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"` IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"`
SIP_Number *string `json:"sip_number" gorm:"unique;size:20"` SIP_Number *string `json:"sip_number" gorm:"unique;size:20"`
Unit_Id *uint16 `json:"unit_id"` SIP_ExpiredDate *time.Time `json:"sip_expiredDate"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` Unit_Code *string `json:"unit_code" gorm:"size:10"`
Specialist_Id *uint16 `json:"specialist_id"` Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"` Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
Subspecialist_Id *uint16 `json:"subspecialist_id"` Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"` Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
} }
@@ -6,15 +6,17 @@ import (
eu "simrs-vx/internal/domain/main-entities/user" eu "simrs-vx/internal/domain/main-entities/user"
erc "simrs-vx/internal/domain/references/common" erc "simrs-vx/internal/domain/references/common"
erg "simrs-vx/internal/domain/references/organization" erg "simrs-vx/internal/domain/references/organization"
"time"
) )
type Employee struct { type Employee struct {
ecore.Main // adjust this according to the needs ecore.Main // adjust this according to the needs
User_Id *uint `json:"user_id"` User_Id *uint `json:"user_id"`
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"` User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"`
Person_Id *uint `json:"person_id"` Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"` Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"` Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
Number *string `json:"number" gorm:"size:20"` Number *string `json:"number" gorm:"size:20"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"` Contract_ExpiredDate *time.Time `json:"contract_expiredDate"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
} }
@@ -6,13 +6,13 @@ import (
) )
type Basic struct { type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id" gorm:"not null"` Installation_Code *string `json:"installation_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"` Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"` Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
} }
func (Basic) TableName() string { func (Basic) TableName() string {
@@ -7,11 +7,11 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Installation_Id *uint16 `json:"installation_id" validate:"required"` Installation_Code *string `json:"installation_code" validate:"required"`
Code string `json:"code" validate:"maxLength=10;required"` Code string `json:"code" validate:"maxLength=10;required"`
Name string `json:"name" validate:"maxLength=30;required"` Name string `json:"name" validate:"maxLength=30;required"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -22,26 +22,27 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Installation_Id *uint16 `json:"installation-id"` Installation_Code *string `json:"installation-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus *bool `json:"head-status"` HeadStatus *bool `json:"head-status"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,24 +53,24 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Installation_Id *uint16 `json:"installation_id"` Installation_Code *string `json:"installation_code"`
Installation *ei.Installation `json:"installation,omitempty"` Installation *ei.Installation `json:"installation,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
} }
func (d InstallationPosition) ToResponse() ResponseDto { func (d InstallationPosition) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Installation_Id: d.Installation_Id, Installation_Code: d.Installation_Code,
Installation: d.Installation, Installation: d.Installation,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
HeadStatus: d.HeadStatus, HeadStatus: d.HeadStatus,
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
return resp return resp
@@ -7,5 +7,5 @@ import (
type InstallationPosition struct { type InstallationPosition struct {
eib.Basic // adjust this according to the needs eib.Basic // adjust this according to the needs
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"` Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
} }
@@ -11,5 +11,5 @@ type Installation struct {
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"` EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"`
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Id;references:Id"` InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
} }
@@ -28,6 +28,7 @@ type CreateDto struct {
Number uint8 `json:"number"` Number uint8 `json:"number"`
Temperature float64 `json:"temperature"` Temperature float64 `json:"temperature"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"` UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"`
Scope_Code ercl.McuScopeCode `json:"scope_code"`
pa.AuthInfo pa.AuthInfo
} }
@@ -8,7 +8,6 @@ import (
ercl "simrs-vx/internal/domain/references/clinical" ercl "simrs-vx/internal/domain/references/clinical"
erc "simrs-vx/internal/domain/references/common" erc "simrs-vx/internal/domain/references/common"
ere "simrs-vx/internal/domain/references/encounter"
) )
type McuOrder struct { type McuOrder struct {
@@ -23,7 +22,7 @@ type McuOrder struct {
Number uint8 `json:"number"` Number uint8 `json:"number"`
Temperature float64 `json:"temperature"` Temperature float64 `json:"temperature"`
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code" gorm:"not null;size:15"` 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 { func (d McuOrder) IsCompleted() bool {
@@ -3,13 +3,13 @@ package division
import ( import (
ecore "simrs-vx/internal/domain/base-entities/core" 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 { type CreateDto struct {
Code string `json:"code" validate:"maxLength=20"` Code string `json:"code" validate:"maxLength=20"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
Scope_Code *ere.CheckupScopeCode `json:"scope_code" validate:"maxLength=10"` Scope_Code erc.McuScopeCode `json:"scope_code" validate:"maxLength=10"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -20,10 +20,10 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Scope_Code *ere.CheckupScopeCode `json:"scope-code"` Scope_Code *erc.McuScopeCode `json:"scope-code"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
@@ -48,9 +48,9 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Scope_Code *ere.CheckupScopeCode `json:"scope_code"` Scope_Code erc.McuScopeCode `json:"scope_code"`
} }
func (d McuSrcCategory) ToResponse() ResponseDto { func (d McuSrcCategory) ToResponse() ResponseDto {
@@ -2,12 +2,12 @@ package division
import ( import (
ecore "simrs-vx/internal/domain/base-entities/core" 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 { type McuSrcCategory struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:20"` Code string `json:"code" gorm:"unique;size:20"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
Scope_Code *ere.CheckupScopeCode `json:"scope_code" gorm:"index;size:10"` Scope_Code erc.McuScopeCode `json:"scope_code" gorm:"index;size:10"`
} }
+8 -8
View File
@@ -11,8 +11,8 @@ type CreateDto struct {
Code *string `json:"code" validate:"maxLength=20"` Code *string `json:"code" validate:"maxLength=20"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"` IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Infra_Id *uint16 `json:"infra_id"` Infra_Code *string `json:"infra_code"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -25,8 +25,8 @@ type FilterDto struct {
Code *string `json:"code"` Code *string `json:"code"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number"` IHS_Number *string `json:"ihs-number"`
Unit_Id *uint16 `json:"unit-id"` Unit_Code *string `json:"unit-code"`
Infra_Id *uint16 `json:"infra-id"` Infra_Code *string `json:"infra-code"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id uint16 `json:"id"`
@@ -56,9 +56,9 @@ type ResponseDto struct {
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"` IHS_Number *string `json:"ihs_number"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty"` Unit *eu.Unit `json:"unit,omitempty"`
Infra_Id *uint16 `json:"infra_id"` Infra_Code *string `json:"infra_code"`
Infra *ei.Infra `json:"infra,omitempty"` Infra *ei.Infra `json:"infra,omitempty"`
} }
@@ -68,9 +68,9 @@ func (d Nurse) ToResponse() ResponseDto {
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
IHS_Number: d.IHS_Number, IHS_Number: d.IHS_Number,
Unit_Id: d.Unit_Id, Unit_Code: d.Unit_Code,
Unit: d.Unit, Unit: d.Unit,
Infra_Id: d.Infra_Id, Infra_Code: d.Infra_Code,
Infra: d.Infra, Infra: d.Infra,
} }
resp.Main = d.Main resp.Main = d.Main
@@ -13,8 +13,8 @@ type Nurse struct {
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"` IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"`
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"`
Infra_Id *uint16 `json:"infra_id"` Infra_Code *string `json:"infra_code" gorm:"size:10"`
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"` Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
} }
@@ -14,7 +14,7 @@ import (
type CreateDto struct { type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"` Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"` Doctor_Code *string `json:"doctor_code"`
IssuedAt *time.Time `json:"issuedAt"` IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"` Status_Code erc.DataStatusCode `json:"status_code"`
@@ -29,7 +29,7 @@ type ReadListDto struct {
type FilterDto struct { type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"` Encounter_Id *uint `json:"encounter-id"`
Doctor_Id *uint `json:"doctor-id"` Doctor_Code *string `json:"doctor-code"`
IssuedAt *time.Time `json:"issuedAt"` IssuedAt *time.Time `json:"issuedAt"`
Status_Code *erc.DataStatusCode `json:"status-code"` Status_Code *erc.DataStatusCode `json:"status-code"`
} }
@@ -58,7 +58,7 @@ type ResponseDto struct {
ecore.Main ecore.Main
Encounter_Id *uint `json:"encounter_id"` Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"` Encounter *ee.Encounter `json:"encounter,omitempty"`
Doctor_Id *uint `json:"doctor_id"` Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty"` Doctor *ed.Doctor `json:"doctor,omitempty"`
IssuedAt *time.Time `json:"issuedAt"` IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"` Status_Code erc.DataStatusCode `json:"status_code"`
@@ -68,7 +68,7 @@ func (d Prescription) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Encounter_Id: d.Encounter_Id, Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter, Encounter: d.Encounter,
Doctor_Id: d.Doctor_Id, Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor, Doctor: d.Doctor,
IssuedAt: d.IssuedAt, IssuedAt: d.IssuedAt,
Status_Code: d.Status_Code, Status_Code: d.Status_Code,
@@ -14,8 +14,8 @@ type Prescription struct {
ecore.Main // adjust this according to the needs ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"` Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Doctor_Id *uint `json:"doctor_id"` Doctor_Code *string `json:"doctor_code" gorm:"size:20"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"` Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
IssuedAt *time.Time `json:"issuedAt"` IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"` Status_Code erc.DataStatusCode `json:"status_code"`
} }
@@ -9,10 +9,10 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Person_Id *uint `json:"person_id"` Person_Id *uint `json:"person_id"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist_Code *string `json:"subspecialist_code"`
User_Id *uint `json:"user_id"` User_Id *uint `json:"user_id"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -22,10 +22,10 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Person_Id *uint `json:"person-id"` Person_Id *uint `json:"person-id"`
Specialist_Id *uint16 `json:"specialist-id"` Specialist_Code *string `json:"specialist-code"`
Subspecialist_Id *uint16 `json:"subspecialist-id"` Subspecialist_Code *string `json:"subspecialist-code"`
User_Id *uint `json:"user-id"` User_Id *uint `json:"user-id"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
@@ -50,26 +50,26 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.Main ecore.Main
Person_Id *uint `json:"person_id"` Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty"` Person *ep.Person `json:"person,omitempty"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Specialist *es.Specialist `json:"specialist,omitempty"` Specialist *es.Specialist `json:"specialist,omitempty"`
Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist_Code *string `json:"subspecialist_code"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"` Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
User_Id *uint `json:"user_id"` User_Id *uint `json:"user_id"`
User *eu.User `json:"user,omitempty"` User *eu.User `json:"user,omitempty"`
} }
func (d SpecialistIntern) ToResponse() ResponseDto { func (d SpecialistIntern) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Person_Id: d.Person_Id, Person_Id: d.Person_Id,
Person: d.Person, Person: d.Person,
Specialist_Id: d.Specialist_Id, Specialist_Code: d.Specialist_Code,
Specialist: d.Specialist, Specialist: d.Specialist,
Subspecialist_Id: d.Subspecialist_Id, Subspecialist_Code: d.Subspecialist_Code,
Subspecialist: d.Subspecialist, Subspecialist: d.Subspecialist,
User_Id: d.User_Id, User_Id: d.User_Id,
User: d.User, User: d.User,
} }
resp.Main = d.Main resp.Main = d.Main
return resp return resp
@@ -9,13 +9,13 @@ import (
) )
type SpecialistIntern struct { type SpecialistIntern struct {
ecore.Main // adjust this according to the needs ecore.Main // adjust this according to the needs
Person_Id *uint `json:"person_id"` Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id"` Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id"`
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"` Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
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"` Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
User_Id *uint `json:"user_id"` User_Id *uint `json:"user_id"`
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id"` User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id"`
} }
@@ -7,7 +7,7 @@ import (
type Basic struct { type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"` Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"` Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"` Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
@@ -7,11 +7,11 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Specialist_Id *uint16 `json:"specialist_id" validate:"required"` Specialist_Code *string `json:"specialist_code" validate:"required"`
Code string `json:"code" validate:"maxLength=10;required"` Code string `json:"code" validate:"maxLength=10;required"`
Name string `json:"name" validate:"maxLength=30;required"` Name string `json:"name" validate:"maxLength=30;required"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -22,26 +22,27 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Specialist_Id *uint16 `json:"specialist-id"` Specialist_Code *string `json:"specialist-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus *bool `json:"head-status"` HeadStatus *bool `json:"head-status"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,24 +53,24 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Specialist *es.Specialist `json:"specialist,omitempty"` Specialist *es.Specialist `json:"specialist,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
} }
func (d SpecialistPosition) ToResponse() ResponseDto { func (d SpecialistPosition) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Specialist_Id: d.Specialist_Id, Specialist_Code: d.Specialist_Code,
Specialist: d.Specialist, Specialist: d.Specialist,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
HeadStatus: d.HeadStatus, HeadStatus: d.HeadStatus,
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
return resp return resp
@@ -7,5 +7,5 @@ import (
type SpecialistPosition struct { type SpecialistPosition struct {
esb.Basic esb.Basic
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
} }
+13 -12
View File
@@ -8,9 +8,9 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -21,25 +21,26 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Unit_Id *uint16 `json:"unit-id"` Unit_Code *string `json:"unit-code"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
Includes string `json:"includes"` Includes string `json:"includes"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,7 +53,7 @@ type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty"` Unit *eu.Unit `json:"unit,omitempty"`
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"` SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
Subspecialists []essb.Basic `json:"subspecialists,omitempty"` Subspecialists []essb.Basic `json:"subspecialists,omitempty"`
@@ -63,7 +64,7 @@ func (d Specialist) ToResponse() ResponseDto {
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
Unit: d.Unit, Unit: d.Unit,
Unit_Id: d.Unit_Id, Unit_Code: d.Unit_Code,
SpecialistPositions: d.SpecialistPositions, SpecialistPositions: d.SpecialistPositions,
Subspecialists: d.Subspecialists, Subspecialists: d.Subspecialists,
} }
@@ -11,8 +11,8 @@ type Specialist struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
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"` Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
} }
@@ -6,13 +6,13 @@ import (
) )
type Basic struct { type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"` Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"` Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"` Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
} }
func (Basic) TableName() string { func (Basic) TableName() string {
@@ -7,11 +7,11 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Subspecialist_Id *uint16 `json:"subspecialist_id" validate:"required"` Subspecialist_Code *string `json:"subspecialist_code" validate:"required"`
Code string `json:"code" validate:"maxLength=10;required"` Code string `json:"code" validate:"maxLength=10;required"`
Name string `json:"name" validate:"maxLength=30;required"` Name string `json:"name" validate:"maxLength=30;required"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -22,26 +22,27 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Subspecialist_Id *uint16 `json:"subspecialist-id"` Subspecialist_Code *string `json:"subspecialist-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus *bool `json:"head-status"` HeadStatus *bool `json:"head-status"`
Employee_Id *uint `json:"employee-id"` Employee_Id *uint `json:"employee-id"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,24 +53,24 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist_Code *string `json:"subspecialist_id"`
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty"` Subspecialist *es.Subspecialist `json:"subspecialist,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
Employee_Id *uint `json:"employee_id"` Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"` Employee *ee.Employee `json:"employee,omitempty"`
} }
func (d SubspecialistPosition) ToResponse() ResponseDto { func (d SubspecialistPosition) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Subspecialist_Id: d.Subspecialist_Id, Subspecialist_Code: d.Subspecialist_Code,
Subspecialist: d.Subspecialist, Subspecialist: d.Subspecialist,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
HeadStatus: d.HeadStatus, HeadStatus: d.HeadStatus,
Employee_Id: d.Employee_Id, Employee_Id: d.Employee_Id,
Employee: d.Employee, Employee: d.Employee,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
return resp return resp
@@ -7,5 +7,5 @@ import (
type SubspecialistPosition struct { type SubspecialistPosition struct {
esb.Basic esb.Basic
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
} }
@@ -8,7 +8,7 @@ type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
} }
func (Basic) TableName() string { func (Basic) TableName() string {
@@ -7,9 +7,9 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -20,25 +20,26 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Code *string `json:"code"` Code *string `json:"code"`
Name *string `json:"name"` Name *string `json:"name"`
Specialist_Id *uint16 `json:"specialist-id"` Specialist_Code *string `json:"specialist-code"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
Includes string `json:"includes"` Includes string `json:"includes"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -49,20 +50,20 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Specialist *es.Specialist `json:"specialist,omitempty"` Specialist *es.Specialist `json:"specialist,omitempty"`
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"` Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
} }
func (d Subspecialist) ToResponse() ResponseDto { func (d Subspecialist) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
Specialist_Id: d.Specialist_Id, Specialist_Code: d.Specialist_Code,
Specialist: d.Specialist, Specialist: d.Specialist,
Subspecialist: d.SubspecialistPositions, Subspecialist: d.SubspecialistPositions,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
return resp return resp
@@ -8,6 +8,6 @@ import (
type Subspecialist struct { type Subspecialist struct {
esb.Basic esb.Basic
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"` Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
} }
@@ -7,7 +7,7 @@ import (
type Basic struct { type Basic struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Unit_Id *uint16 `json:"unit_id" gorm:"not null"` Unit_Code *string `json:"unit_code" gorm:"size:10"`
Code string `json:"code" gorm:"unique;size:10;not null"` Code string `json:"code" gorm:"unique;size:10;not null"`
Name string `json:"name" gorm:"size:30;not null"` Name string `json:"name" gorm:"size:30;not null"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
@@ -7,7 +7,7 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Unit_Id *uint16 `json:"unit_id" validate:"required"` Unit_Code *string `json:"unit_code" validate:"required"`
Code string `json:"code" validate:"maxLength=10;required"` Code string `json:"code" validate:"maxLength=10;required"`
Name string `json:"name" validate:"maxLength=30;required"` Name string `json:"name" validate:"maxLength=30;required"`
HeadStatus bool `json:"headStatus"` HeadStatus bool `json:"headStatus"`
@@ -22,7 +22,7 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Unit_Id *uint16 `json:"unit-id"` Unit_Code *string `json:"unit-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
HeadStatus *bool `json:"head-status"` HeadStatus *bool `json:"head-status"`
@@ -31,17 +31,18 @@ type FilterDto struct {
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"` Code *string `json:"code"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -52,7 +53,7 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Unit *eu.Unit `json:"unit,omitempty"` Unit *eu.Unit `json:"unit,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
@@ -63,7 +64,7 @@ type ResponseDto struct {
func (d UnitPosition) ToResponse() ResponseDto { func (d UnitPosition) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Unit_Id: d.Unit_Id, Unit_Code: d.Unit_Code,
Unit: d.Unit, Unit: d.Unit,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
@@ -7,5 +7,5 @@ import (
type UnitPosition struct { type UnitPosition struct {
eub.Basic eub.Basic
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
} }
+23 -22
View File
@@ -7,9 +7,9 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Installation_Id *uint16 `json:"installation_id"` Installation_Code *string `json:"installation_code"`
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
} }
type ReadListDto struct { type ReadListDto struct {
@@ -20,26 +20,27 @@ type ReadListDto struct {
} }
type FilterDto struct { type FilterDto struct {
Installation_Id *uint16 `json:"installation-id"` Installation_Code *string `json:"installation-code"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Search string `json:"search" gormhelper:"searchColumns=Code,Name"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
} }
type ReadDetailDto struct { type ReadDetailDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Installation_Id *uint16 `json:"installation_id"` Installation_Code *string `json:"installation_code"`
Code *string `json:"code"` Code *string `json:"code"`
Includes string `json:"includes"` Includes string `json:"includes"`
} }
type UpdateDto struct { type UpdateDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
CreateDto CreateDto
} }
type DeleteDto struct { type DeleteDto struct {
Id uint16 `json:"id"` Id *uint16 `json:"id"`
Code *string `json:"code"`
} }
type MetaDto struct { type MetaDto struct {
@@ -50,19 +51,19 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Installation_Id *uint16 `json:"installation_id"` Installation_Code *string `json:"installation_code"`
Installation *ei.Installation `json:"installation,omitempty"` Installation *ei.Installation `json:"installation,omitempty"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"` UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
} }
func (d Unit) ToResponse() ResponseDto { func (d Unit) ToResponse() ResponseDto {
resp := ResponseDto{ resp := ResponseDto{
Installation_Id: d.Installation_Id, Installation_Code: d.Installation_Code,
Code: d.Code, Code: d.Code,
Name: d.Name, Name: d.Name,
UnitPositions: d.UnitPositions, UnitPositions: d.UnitPositions,
} }
resp.SmallMain = d.SmallMain resp.SmallMain = d.SmallMain
if d.Installation != nil { if d.Installation != nil {
+7 -7
View File
@@ -8,11 +8,11 @@ import (
) )
type Unit struct { type Unit struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Installation_Id *uint16 `json:"installation_id"` Installation_Code *string `json:"installation_code" gorm:"size:10"`
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"` Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Code;references:Code"`
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
Type_Code *ero.UnitTypeCode `json:"type_code"` Type_Code *ero.UnitTypeCode `json:"type_code"`
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
} }
+4 -4
View File
@@ -24,10 +24,10 @@ type CreateDto struct {
Employee *EmployeUpdateDto `json:"employee"` Employee *EmployeUpdateDto `json:"employee"`
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"` IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
SIP_Number *string `json:"sip_number" validate:"maxLength=20"` SIP_Number *string `json:"sip_number" validate:"maxLength=20"`
Unit_Id *uint16 `json:"unit_id"` Unit_Code *string `json:"unit_code"`
Infra_Id *uint16 `json:"infra_id"` Infra_Code *string `json:"infra_code"`
Specialist_Id *uint16 `json:"specialist_id"` Specialist_Code *string `json:"specialist_code"`
Subspecialist_Id *uint16 `json:"subspecialist_id"` Subspecialist_Code *string `json:"subspecialist_code"`
ContractPosition_Code erg.ContractPositionCode `json:"contractPosition_code" gorm:"not null;size:20"` ContractPosition_Code erg.ContractPositionCode `json:"contractPosition_code" gorm:"not null;size:20"`
} }
@@ -9,6 +9,7 @@ type (
InstructionCode string InstructionCode string
HeadToToeCode string HeadToToeCode string
McuUrgencyLevelCode string McuUrgencyLevelCode string
McuScopeCode string
SoapiTypeCode string SoapiTypeCode string
MedicalAction string MedicalAction string
VehicleTypeCode string VehicleTypeCode string
@@ -8,7 +8,6 @@ type (
PersonConditionCode string PersonConditionCode string
EmergencyClassCode string EmergencyClassCode string
OutpatientClassCode string OutpatientClassCode string
CheckupScopeCode string
AmbulatoryClassCode string AmbulatoryClassCode string
InpatientClassCode string InpatientClassCode string
UploadCode string UploadCode string
@@ -44,6 +43,7 @@ const (
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
DMCDeath DischargeMethodCode = "death" // Meninggal DMCDeath DischargeMethodCode = "death" // Meninggal
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
DMCRunAway DischargeMethodCode = "run-away" // Melarikan Diri
TCAmbulance TransportationCode = "ambulance" // Ambulans TCAmbulance TransportationCode = "ambulance" // Ambulans
TCCar TransportationCode = "car" // Mobil TCCar TransportationCode = "car" // Mobil
@@ -65,11 +65,6 @@ const (
OCCHcu OutpatientClassCode = "hcu" // HCU OCCHcu OutpatientClassCode = "hcu" // HCU
OCCVk OutpatientClassCode = "vk" // Verlos kamer 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 ACCReg AmbulatoryClassCode = "reg" // Regular
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik // ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy // ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL) sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -55,19 +55,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,7 +33,7 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
+11 -14
View File
@@ -35,9 +35,8 @@ import (
soapi "simrs-vx/internal/interface/main-handler/soapi" soapi "simrs-vx/internal/interface/main-handler/soapi"
/******************** actor ********************/ /******************** actor ********************/
doctor "simrs-vx/internal/interface/main-handler/doctor"
employee "simrs-vx/internal/interface/main-handler/employee" employee "simrs-vx/internal/interface/main-handler/employee"
nurse "simrs-vx/internal/interface/main-handler/nurse"
nutritionist "simrs-vx/internal/interface/main-handler/nutritionist" nutritionist "simrs-vx/internal/interface/main-handler/nutritionist"
patient "simrs-vx/internal/interface/main-handler/patient" patient "simrs-vx/internal/interface/main-handler/patient"
person "simrs-vx/internal/interface/main-handler/person" person "simrs-vx/internal/interface/main-handler/person"
@@ -268,8 +267,6 @@ func SetRoutes() http.Handler {
hc.RegCrud(r, "/v1/person-contact", personcontact.O) hc.RegCrud(r, "/v1/person-contact", personcontact.O)
hc.RegCrud(r, "/v1/person-insurance", personinsurance.O) hc.RegCrud(r, "/v1/person-insurance", personinsurance.O)
hc.RegCrud(r, "/v1/employee", employee.O) hc.RegCrud(r, "/v1/employee", employee.O)
hc.RegCrud(r, "/v1/doctor", doctor.O)
hc.RegCrud(r, "/v1/nurse", nurse.O)
hc.RegCrud(r, "/v1/nutritionist", nutritionist.O) hc.RegCrud(r, "/v1/nutritionist", nutritionist.O)
hc.RegCrud(r, "/v1/pharmacist", pharmacist.O) hc.RegCrud(r, "/v1/pharmacist", pharmacist.O)
hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{ hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{
@@ -293,10 +290,16 @@ func SetRoutes() http.Handler {
}) })
/******************** sources ********************/ /******************** sources ********************/
hc.RegCrud(r, "/v1/division", division.O) hc.RegCrudByCode(r, "/v1/division", division.O)
hc.RegCrud(r, "/v1/division-position", divisionposition.O) hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
hc.RegCrud(r, "/v1/installation", installation.O) hc.RegCrudByCode(r, "/v1/installation", installation.O)
hc.RegCrud(r, "/v1/unit", unit.O) hc.RegCrudByCode(r, "/v1/unit", unit.O)
hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
hc.RegCrudByCode(r, "/v1/unit-position", unitposition.O)
hc.RegCrudByCode(r, "/v1/specialist", specialist.O)
hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
hc.RegCrud(r, "/v1/pharmacy-company", pharmacycompany.O) hc.RegCrud(r, "/v1/pharmacy-company", pharmacycompany.O)
hc.RegCrud(r, "/v1/diagnose-src", diagnosesrc.O) hc.RegCrud(r, "/v1/diagnose-src", diagnosesrc.O)
hc.RegCrud(r, "/v1/procedure-src", proceduresrc.O) hc.RegCrud(r, "/v1/procedure-src", proceduresrc.O)
@@ -317,16 +320,10 @@ func SetRoutes() http.Handler {
hc.RegCrud(r, "/v1/medical-action-src", medicalactionsrc.O) hc.RegCrud(r, "/v1/medical-action-src", medicalactionsrc.O)
hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O) hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
hc.RegCrud(r, "/v1/language", language.O) hc.RegCrud(r, "/v1/language", language.O)
hc.RegCrud(r, "/v1/specialist", specialist.O)
hc.RegCrud(r, "/v1/subspecialist", subspecialist.O)
hc.RegCrud(r, "/v1/mcu-sub-src", mcusubsrc.O) hc.RegCrud(r, "/v1/mcu-sub-src", mcusubsrc.O)
hc.RegCrud(r, "/v1/vehicle", vehicle.O) hc.RegCrud(r, "/v1/vehicle", vehicle.O)
hc.RegCrud(r, "/v1/vehicle-hist", vehiclehist.O) hc.RegCrud(r, "/v1/vehicle-hist", vehiclehist.O)
hc.RegCrud(r, "/v1/edu-assessment", eduassesment.O) hc.RegCrud(r, "/v1/edu-assessment", eduassesment.O)
hc.RegCrud(r, "/v1/installation-position", installationposition.O)
hc.RegCrud(r, "/v1/unit-position", unitposition.O)
hc.RegCrud(r, "/v1/specialist-position", specialistposition.O)
hc.RegCrud(r, "/v1/subspecialist-position", subspecialistposition.O)
hc.RegCrud(r, "/v1/village", village.O) hc.RegCrud(r, "/v1/village", village.O)
hc.RegCrud(r, "/v1/district", district.O) hc.RegCrud(r, "/v1/district", district.O)
@@ -33,7 +33,7 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) id := rw.ValidateInt(w, "code", r.PathValue("code"))
if id <= 0 { if id <= 0 {
return return
} }
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL) sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -55,19 +55,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL) sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -55,19 +55,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
} }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.ReadDetailDto{} dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL) sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id) dto.Code = &code
res, err := u.ReadDetail(dto) res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) { func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
@@ -55,19 +55,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res { if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return return
} }
dto.Id = uint16(id) dto.Code = code
res, err := u.Update(dto) res, err := u.Update(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) { func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id")) code := rw.ValidateString(w, "code", r.PathValue("code"))
if id <= 0 { if code == "" {
return return
} }
dto := e.DeleteDto{} dto := e.DeleteDto{}
dto.Id = uint16(id) dto.Code = &code
res, err := u.Delete(dto) res, err := u.Delete(dto)
rw.DataResponse(w, res, err) rw.DataResponse(w, res, err)
} }
@@ -5,6 +5,8 @@ import (
admemployeehist "simrs-vx/internal/domain/main-entities/adm-employee-hist" admemployeehist "simrs-vx/internal/domain/main-entities/adm-employee-hist"
ambulancetransportreq "simrs-vx/internal/domain/main-entities/ambulance-transport-req" ambulancetransportreq "simrs-vx/internal/domain/main-entities/ambulance-transport-req"
ambulatory "simrs-vx/internal/domain/main-entities/ambulatory" 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" appointment "simrs-vx/internal/domain/main-entities/appointment"
chemo "simrs-vx/internal/domain/main-entities/chemo" chemo "simrs-vx/internal/domain/main-entities/chemo"
chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol" chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol"
@@ -175,6 +177,8 @@ func getMainEntities() []any {
&mcuorderitem.McuOrderItem{}, &mcuorderitem.McuOrderItem{},
&mcusubsrc.McuSubSrc{}, &mcusubsrc.McuSubSrc{},
&mcuordersubitem.McuOrderSubItem{}, &mcuordersubitem.McuOrderSubItem{},
&antibioticsrccategory.AntibioticSrcCategory{},
&antibioticinuse.AntibioticInUse{},
&consultation.Consultation{}, &consultation.Consultation{},
&chemo.Chemo{}, &chemo.Chemo{},
&midwife.Midwife{}, &midwife.Midwife{},
+6 -6
View File
@@ -14,12 +14,12 @@ type AuthInfo struct {
User_ContractPosition_code string User_ContractPosition_code string
Employee_Position_Code *string Employee_Position_Code *string
Employee_Id *uint Employee_Id *uint
Doctor_Id *uint Doctor_Code *string
Nurse_Id *uint Nurse_Code *string
Midwife_Id *uint Midwife_Code *string
Nutritionist_Id *uint Nutritionist_Code *string
Laborant_Id *uint Laborant_Code *string
Pharmachist_Id *uint Pharmachist_Code *string
Intern_Position_Code *string Intern_Position_Code *string
Roles []string Roles []string
// User_DivisionPositions []DivisionPosition // User_DivisionPositions []DivisionPosition
@@ -136,17 +136,17 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
if doctor.Id == 0 { if doctor.Id == 0 {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noDoctor", Message: el.GenMessage("auth-noDoctor")}} return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noDoctor", Message: el.GenMessage("auth-noDoctor")}}
} }
atClaims["doctor_id"] = doctor.Id atClaims["doctor_code"] = doctor.Code
outputData["doctor_id"] = doctor.Id outputData["doctor_code"] = doctor.Code
// specialist // specialist
if doctor.Specialist_Id != nil { if doctor.Specialist_Code != nil {
atClaims["specialist_id"] = doctor.Specialist_Id atClaims["specialist_code"] = doctor.Specialist_Code
outputData["specialist_id"] = doctor.Specialist_Id outputData["specialist_code"] = doctor.Specialist_Code
} }
if doctor.Subspecialist_Id != nil { if doctor.Subspecialist_Code != nil {
atClaims["subspecialist_id"] = doctor.Subspecialist_Id atClaims["subspecialist_code"] = doctor.Subspecialist_Code
outputData["subspecialist_id"] = doctor.Subspecialist_Id outputData["subspecialist_code"] = doctor.Subspecialist_Code
} }
case erg.EPCNur: case erg.EPCNur:
empData := en.Nurse{} empData := en.Nurse{}
@@ -154,16 +154,16 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
if empData.Id == 0 { if empData.Id == 0 {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: el.GenMessage("auth-noNurse")}} return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: el.GenMessage("auth-noNurse")}}
} }
atClaims["nurse_id"] = empData.Id atClaims["nurse_code"] = empData.Code
outputData["nurse_id"] = empData.Id outputData["nurse_code"] = empData.Code
case erg.EPCMwi: case erg.EPCMwi:
empData := em.Midwife{} empData := em.Midwife{}
dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&empData) dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&empData)
if empData.Id == 0 { if empData.Id == 0 {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: el.GenMessage("auth-noNurse")}} return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noMidwife", Message: el.GenMessage("auth-noMidwife")}}
} }
atClaims["nurse_id"] = empData.Id atClaims["midwife_code"] = empData.Code
outputData["nurse_id"] = empData.Id outputData["midwife_code"] = empData.Code
} }
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}} errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
@@ -308,12 +308,12 @@ func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err
data.User_ContractPosition_code = checkStrClaims(claims, "contractPosition_code") data.User_ContractPosition_code = checkStrClaims(claims, "contractPosition_code")
data.Employee_Position_Code = checkStrPtrClaims(claims, "employee_position_code") data.Employee_Position_Code = checkStrPtrClaims(claims, "employee_position_code")
data.Doctor_Id = checkUntPtrClaims(claims, "doctor_id") data.Doctor_Code = checkStrPtrClaims(claims, "doctor_string")
data.Nurse_Id = checkUntPtrClaims(claims, "nurse_id") data.Nurse_Code = checkStrPtrClaims(claims, "nurse_string")
data.Midwife_Id = checkUntPtrClaims(claims, "midwife_id") data.Midwife_Code = checkStrPtrClaims(claims, "midwife_string")
data.Nutritionist_Id = checkUntPtrClaims(claims, "nutritionist_id") data.Nutritionist_Code = checkStrPtrClaims(claims, "nutritionist_string")
data.Laborant_Id = checkUntPtrClaims(claims, "laborant_id") data.Laborant_Code = checkStrPtrClaims(claims, "laborant_string")
data.Pharmachist_Id = checkUntPtrClaims(claims, "pharmachist_id") data.Pharmachist_Code = checkStrPtrClaims(claims, "pharmachist_string")
data.Intern_Position_Code = checkStrPtrClaims(claims, "intern_position_code") data.Intern_Position_Code = checkStrPtrClaims(claims, "intern_position_code")
data.Employee_Id = checkUntPtrClaims(claims, "employee_id") data.Employee_Id = checkUntPtrClaims(claims, "employee_id")
return return
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
} }
func Update(input e.UpdateDto) (*d.Data, error) { func Update(input e.UpdateDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: &input.Code}
var data *e.DivisionPosition var data *e.DivisionPosition
var err error var err error
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
} }
func Delete(input e.DeleteDto) (*d.Data, error) { func Delete(input e.DeleteDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: input.Code}
var data *e.DivisionPosition var data *e.DivisionPosition
var err error var err error
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.DivisionPosition) {
inputSrc = &inputTemp.CreateDto inputSrc = &inputTemp.CreateDto
} }
data.Division_Id = inputSrc.Division_Id data.Division_Code = inputSrc.Division_Code
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.HeadStatus = inputSrc.HeadStatus data.HeadStatus = inputSrc.HeadStatus
@@ -81,7 +81,14 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
tx = dg.I tx = dg.I
} }
if err := tx.First(&data, input.Id).Error; err != nil { if input.Code != nil {
tx = tx.Where("\"Code\" = ?", *input.Code)
}
if input.Id != nil {
tx = tx.Where("\"Id\" = ?", input.Id)
}
if err := tx.First(&data).Error; err != nil {
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
return nil, processedErr return nil, processedErr
} }
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
} }
func Update(input e.UpdateDto) (*d.Data, error) { func Update(input e.UpdateDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: &input.Code}
var data *e.Division var data *e.Division
var err error var err error
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
} }
func Delete(input e.DeleteDto) (*d.Data, error) { func Delete(input e.DeleteDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: input.Code}
var data *e.Division var data *e.Division
var err error var err error
@@ -19,5 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Division) {
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.Parent_Id = inputSrc.Parent_Id data.Parent_Code = inputSrc.Parent_Code
} }
@@ -91,9 +91,16 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
tx = dg.I tx = dg.I
} }
if input.Code != nil {
tx = tx.Where("\"Code\" = ?", *input.Code)
}
if input.Id != nil {
tx = tx.Where("\"Id\" = ?", input.Id)
}
if err := tx. if err := tx.
Scopes(gh.Preload(input.Includes)). Scopes(gh.Preload(input.Includes)).
First(&data, input.Id).Error; err != nil { First(&data).Error; err != nil {
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
return nil, processedErr return nil, processedErr
} }
@@ -21,7 +21,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Doctor) {
data.Employee_Id = inputSrc.Employee_Id data.Employee_Id = inputSrc.Employee_Id
data.IHS_Number = inputSrc.IHS_Number data.IHS_Number = inputSrc.IHS_Number
data.SIP_Number = inputSrc.SIP_Number data.SIP_Number = inputSrc.SIP_Number
data.Unit_Id = inputSrc.Unit_Id data.Unit_Code = inputSrc.Unit_Code
data.Specialist_Id = inputSrc.Specialist_Id data.Specialist_Code = inputSrc.Code
data.Subspecialist_Id = inputSrc.Subspecialist_Id data.Subspecialist_Code = inputSrc.Code
} }
@@ -4,10 +4,12 @@ import (
// std // std
"errors" "errors"
ere "simrs-vx/internal/domain/references/encounter" ere "simrs-vx/internal/domain/references/encounter"
// external // external
dg "github.com/karincake/apem/db-gorm-pg" dg "github.com/karincake/apem/db-gorm-pg"
gh "github.com/karincake/getuk" gh "github.com/karincake/getuk"
"gorm.io/gorm" "gorm.io/gorm"
// pkg // pkg
plh "simrs-vx/pkg/lib-helper" plh "simrs-vx/pkg/lib-helper"
pl "simrs-vx/pkg/logger" pl "simrs-vx/pkg/logger"
@@ -56,8 +58,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
} }
tx = tx.Model(&e.Encounter{}) tx = tx.Model(&e.Encounter{})
if input.AuthInfo.Doctor_Id != nil { if input.AuthInfo.Doctor_Code != nil {
tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Id) tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Code) // TODO: fix this
} }
tx.Scopes(gh.Preload(input.Includes)). tx.Scopes(gh.Preload(input.Includes)).
@@ -175,7 +175,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
} }
func Update(input e.UpdateDto) (*d.Data, error) { func Update(input e.UpdateDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: &input.Code}
var data *e.InstallationPosition var data *e.InstallationPosition
var err error var err error
@@ -235,7 +235,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
} }
func Delete(input e.DeleteDto) (*d.Data, error) { func Delete(input e.DeleteDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: input.Code}
var data *e.InstallationPosition var data *e.InstallationPosition
var err error var err error
@@ -290,7 +290,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
func validateForeignKey(input e.CreateDto) error { func validateForeignKey(input e.CreateDto) error {
// validate installation_id // validate installation_id
if _, err := ui.ReadDetail(ei.ReadDetailDto{Id: *input.Installation_Id}); err != nil { if _, err := ui.ReadDetail(ei.ReadDetailDto{Code: input.Installation_Code}); err != nil {
return err return err
} }
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.InstallationPositio
inputSrc = &inputTemp.CreateDto inputSrc = &inputTemp.CreateDto
} }
data.Installation_Id = inputSrc.Installation_Id data.Installation_Code = inputSrc.Installation_Code
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.HeadStatus = inputSrc.HeadStatus data.HeadStatus = inputSrc.HeadStatus
@@ -83,10 +83,10 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
} }
switch { switch {
case input.Id != 0: case input.Id != nil:
getData = tx.First(&data, input.Id) getData = tx.First(&data, input.Id)
case input.Code != nil && *input.Code != "": case input.Code != nil && *input.Code != "":
getData = tx.Where("code = ?", *input.Code).First(&data) getData = tx.Where("\"Code\" = ?", *input.Code).First(&data)
default: default:
event.Status = "failed" event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{ event.ErrInfo = pl.ErrorInfo{
@@ -28,4 +28,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuOrder) {
data.Temperature = inputSrc.Temperature data.Temperature = inputSrc.Temperature
data.UrgencyLevel_Code = inputSrc.UrgencyLevel_Code data.UrgencyLevel_Code = inputSrc.UrgencyLevel_Code
data.Doctor_Id = inputSrc.Doctor_Id data.Doctor_Id = inputSrc.Doctor_Id
data.Scope_Code = inputSrc.Scope_Code
} }
@@ -20,6 +20,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Nurse) {
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Employee_Id = inputSrc.Employee_Id data.Employee_Id = inputSrc.Employee_Id
data.IHS_Number = inputSrc.IHS_Number data.IHS_Number = inputSrc.IHS_Number
data.Unit_Id = inputSrc.Unit_Id data.Unit_Code = inputSrc.Unit_Code
data.Infra_Id = inputSrc.Infra_Id data.Infra_Code = inputSrc.Infra_Code
} }
@@ -37,7 +37,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Prescription) {
} }
data.Encounter_Id = inputSrc.Encounter_Id data.Encounter_Id = inputSrc.Encounter_Id
data.Doctor_Id = inputSrc.Doctor_Id data.Doctor_Code = inputSrc.AuthInfo.Doctor_Code
data.IssuedAt = inputSrc.IssuedAt data.IssuedAt = inputSrc.IssuedAt
} }
@@ -18,7 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.SpecialistIntern) {
} }
data.Person_Id = inputSrc.Person_Id data.Person_Id = inputSrc.Person_Id
data.Specialist_Id = inputSrc.Specialist_Id data.Specialist_Code = inputSrc.Specialist_Code
data.Subspecialist_Id = inputSrc.Subspecialist_Id data.Subspecialist_Code = inputSrc.Subspecialist_Code
data.User_Id = inputSrc.User_Id data.User_Id = inputSrc.User_Id
} }
@@ -290,7 +290,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
func validateForeignKey(input e.CreateDto) error { func validateForeignKey(input e.CreateDto) error {
// validate installation_id // validate installation_id
if _, err := us.ReadDetail(es.ReadDetailDto{Id: *input.Specialist_Id}); err != nil { if _, err := us.ReadDetail(es.ReadDetailDto{Code: input.Specialist_Code}); err != nil {
return err return err
} }
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.SpecialistPosition)
inputSrc = &inputTemp.CreateDto inputSrc = &inputTemp.CreateDto
} }
data.Specialist_Id = inputSrc.Specialist_Id data.Specialist_Code = inputSrc.Specialist_Code
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.HeadStatus = inputSrc.HeadStatus data.HeadStatus = inputSrc.HeadStatus
@@ -83,7 +83,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
} }
switch { switch {
case input.Id != 0: case input.Id != nil:
getData = tx.First(&data, input.Id) getData = tx.First(&data, input.Id)
case input.Code != nil && *input.Code != "": case input.Code != nil && *input.Code != "":
getData = tx.Where("code = ?", *input.Code).First(&data) getData = tx.Where("code = ?", *input.Code).First(&data)
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
} }
func Update(input e.UpdateDto) (*d.Data, error) { func Update(input e.UpdateDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: uint16(input.Id)} rdDto := e.ReadDetailDto{Code: &input.Code}
var data *e.Specialist var data *e.Specialist
var err error var err error
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
} }
func Delete(input e.DeleteDto) (*d.Data, error) { func Delete(input e.DeleteDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: uint16(input.Id)} rdDto := e.ReadDetailDto{Code: input.Code}
var data *e.Specialist var data *e.Specialist
var err error var err error
@@ -19,5 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Specialist) {
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.Unit_Id = inputSrc.Unit_Id data.Unit_Code = inputSrc.Unit_Code
} }
@@ -175,7 +175,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
} }
func Update(input e.UpdateDto) (*d.Data, error) { func Update(input e.UpdateDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: &input.Code}
var data *e.SubspecialistPosition var data *e.SubspecialistPosition
var err error var err error
@@ -235,7 +235,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
} }
func Delete(input e.DeleteDto) (*d.Data, error) { func Delete(input e.DeleteDto) (*d.Data, error) {
rdDto := e.ReadDetailDto{Id: input.Id} rdDto := e.ReadDetailDto{Code: input.Code}
var data *e.SubspecialistPosition var data *e.SubspecialistPosition
var err error var err error
@@ -290,7 +290,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
func validateForeignKey(input e.CreateDto) error { func validateForeignKey(input e.CreateDto) error {
// validate installation_id // validate installation_id
if _, err := us.ReadDetail(es.ReadDetailDto{Id: *input.Subspecialist_Id}); err != nil { if _, err := us.ReadDetail(es.ReadDetailDto{Code: input.Subspecialist_Code}); err != nil {
return err return err
} }
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.SubspecialistPositi
inputSrc = &inputTemp.CreateDto inputSrc = &inputTemp.CreateDto
} }
data.Subspecialist_Id = inputSrc.Subspecialist_Id data.Subspecialist_Code = inputSrc.Subspecialist_Code
data.Code = inputSrc.Code data.Code = inputSrc.Code
data.Name = inputSrc.Name data.Name = inputSrc.Name
data.HeadStatus = inputSrc.HeadStatus data.HeadStatus = inputSrc.HeadStatus
@@ -83,10 +83,10 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
} }
switch { switch {
case input.Id != 0: case input.Id != nil:
getData = tx.First(&data, input.Id) getData = tx.First(&data, input.Id)
case input.Code != nil && *input.Code != "": case input.Code != nil && *input.Code != "":
getData = tx.Where("code = ?", *input.Code).First(&data) getData = tx.Where("\"Code\" = ?", *input.Code).First(&data)
default: default:
event.Status = "failed" event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{ event.ErrInfo = pl.ErrorInfo{

Some files were not shown because too many files have changed in this diff Show More