Merge pull request #131 from dikstub-rssa/fix/anything-moko
Fix/anything moko
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
-- Create "AuthPartner" table
|
||||
CREATE TABLE "public"."AuthPartner" (
|
||||
"Id" bigserial NOT NULL,
|
||||
"CreatedAt" timestamptz NULL,
|
||||
"UpdatedAt" timestamptz NULL,
|
||||
"DeletedAt" timestamptz NULL,
|
||||
"Code" character varying(50) NULL,
|
||||
"Name" character varying(100) NULL,
|
||||
"SecretKey" character varying(255) NULL,
|
||||
PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "uni_AuthPartner_Code" UNIQUE ("Code"),
|
||||
CONSTRAINT "uni_AuthPartner_Name" UNIQUE ("Name")
|
||||
);
|
||||
-- Create "ExtUser" table
|
||||
CREATE TABLE "public"."ExtUser" (
|
||||
"Id" bigserial NOT NULL,
|
||||
"CreatedAt" timestamptz NULL,
|
||||
"UpdatedAt" timestamptz NULL,
|
||||
"DeletedAt" timestamptz NULL,
|
||||
"Name" character varying(100) NULL,
|
||||
"AuthPartner_Code" character varying(30) NULL,
|
||||
"User_Name" character varying(50) NULL,
|
||||
PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "fk_ExtUser_AuthPartner" FOREIGN KEY ("AuthPartner_Code") REFERENCES "public"."AuthPartner" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT "fk_ExtUser_User" FOREIGN KEY ("User_Name") REFERENCES "public"."User" ("Name") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Create "UserFes" table
|
||||
CREATE TABLE "public"."UserFes" (
|
||||
"Id" bigserial NOT NULL,
|
||||
"CreatedAt" timestamptz NULL,
|
||||
"UpdatedAt" timestamptz NULL,
|
||||
"DeletedAt" timestamptz NULL,
|
||||
"Name" character varying(100) NULL,
|
||||
"AuthPartner_Code" character varying(30) NULL,
|
||||
"User_Name" character varying(50) NULL,
|
||||
PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "fk_UserFes_AuthPartner" FOREIGN KEY ("AuthPartner_Code") REFERENCES "public"."AuthPartner" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT "fk_UserFes_User" FOREIGN KEY ("User_Name") REFERENCES "public"."User" ("Name") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
);
|
||||
-- Drop "ExtUser" table
|
||||
DROP TABLE "public"."ExtUser";
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Room" table
|
||||
ALTER TABLE "public"."Room" ADD COLUMN "Infra_Coode" character varying(10) 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;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Rename a column from "Infra_Coode" to "Infra_Code"
|
||||
ALTER TABLE "public"."Room" RENAME COLUMN "Infra_Coode" TO "Infra_Code";
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Modify "Infra" table
|
||||
ALTER TABLE "public"."Infra" ADD COLUMN "Parent_Code" character varying(10) NULL, ADD COLUMN "Item_Code" character varying(50) NULL;
|
||||
-- Create index "idx_Infra_Code" to table: "Infra"
|
||||
CREATE UNIQUE INDEX "idx_Infra_Code" ON "public"."Infra" ("Code");
|
||||
-- Modify "Room" table
|
||||
ALTER TABLE "public"."Room" DROP CONSTRAINT "fk_Room_Specialist", DROP CONSTRAINT "fk_Room_Subspecialist", DROP CONSTRAINT "fk_Room_Unit", DROP COLUMN "Infra_Id", DROP COLUMN "Unit_Id", DROP COLUMN "Specialist_Id", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_Room_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Room_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Room_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Modify "Nurse" table
|
||||
ALTER TABLE "public"."Nurse" DROP CONSTRAINT "fk_Nurse_Infra";
|
||||
-- Modify "Infra" table
|
||||
ALTER TABLE "public"."Infra" DROP CONSTRAINT "uni_Infra_Code";
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Modify "Nurse" table
|
||||
ALTER TABLE "public"."Nurse" ADD CONSTRAINT "fk_Nurse_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "Room" table
|
||||
ALTER TABLE "public"."Room" ADD CONSTRAINT "fk_Room_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Item" table
|
||||
ALTER TABLE "public"."Item" ADD COLUMN "Infra_Code" character varying(10) NULL;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Modify "Device" table
|
||||
ALTER TABLE "public"."Device" ADD COLUMN "Infra_Code" character varying(10) NULL, ADD COLUMN "Item_Code" character varying(50) NULL;
|
||||
-- Modify "Material" table
|
||||
ALTER TABLE "public"."Material" ADD COLUMN "Infra_Code" character varying(10) NULL, ADD COLUMN "Item_Code" character varying(50) NULL;
|
||||
-- Modify "Medicine" table
|
||||
ALTER TABLE "public"."Medicine" ADD COLUMN "Infra_Code" character varying(10) NULL, ADD COLUMN "Item_Code" character varying(50) NULL;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Modify "Infra" table
|
||||
ALTER TABLE "public"."Infra" ALTER COLUMN "Code" SET NOT NULL;
|
||||
-- Modify "Item" table
|
||||
ALTER TABLE "public"."Item" DROP COLUMN "Infra_Id";
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Infra" table
|
||||
ALTER TABLE "public"."Infra" DROP CONSTRAINT "fk_Infra_Childrens", DROP CONSTRAINT "fk_Infra_Item", DROP COLUMN "Parent_Id", ADD CONSTRAINT "fk_Infra_Childrens" FOREIGN KEY ("Parent_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Infra_Item" FOREIGN KEY ("Item_Code") REFERENCES "public"."Item" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Infra" table
|
||||
ALTER TABLE "public"."Infra" DROP COLUMN "Item_Id";
|
||||
@@ -1,4 +1,4 @@
|
||||
h1:Jut0rnI38bZU7g1hei5bIcYGzWrt4KxfWzasGJcbwi0=
|
||||
h1:6umIsneejLUg0V9wUaB2HuCvEHD+2v/dwbxg+y23+wo=
|
||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||
@@ -75,11 +75,23 @@ h1:Jut0rnI38bZU7g1hei5bIcYGzWrt4KxfWzasGJcbwi0=
|
||||
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=
|
||||
20251106050412.sql h1:1002KYtHd8AwrQTMewbs/PPHDylHDghigE/3S7PVdMA=
|
||||
20251106063418.sql h1:jPW/gBnbFl4RO39lQ0ZMDtYA6xbhyD6CgQupT50HmaY=
|
||||
20251106071906.sql h1:leYGKxR3EQn794aOehf0sd/ZPmOnvBMZPy5/anGmRB4=
|
||||
20251106073157.sql h1:KASMzjjjk5UB7Zj8lCRtM1utc4ZnDjlnpZbtTe3vONE=
|
||||
20251106074218.sql h1:Z5q5deOvLaZDPhiVTN9st3/s56RepBa2YOyrMXBdj4A=
|
||||
20251106081846.sql h1:P+VsWwhGt60adDIZuE/Aa38JVp/yX1rnsdpXpxASodw=
|
||||
20251106082844.sql h1:Dmi5A8i9frQZvdXYPwc7f8CisZtBH8liSXq1rI6z1iM=
|
||||
20251106090021.sql h1:4JwdKgO8T46YhyWVJUxpRIwudBDlG8QN1brSOYmgQ20=
|
||||
20251106144745.sql h1:nqnQCzGrVJaq8ilOEOGXeRUL1dolj+OPWKuP8A92FRA=
|
||||
20251107012049.sql h1:Pff4UqltGS3clSlGr0qq8CQM56L29wyxY0FC/N/YAhU=
|
||||
20251107064812.sql h1:jjpcAi0B/geEOKWmmR6+1UhWMhjstWhWQcz9lUWrtTY=
|
||||
20251107064937.sql h1:1nPu0THBf+YquFIJSE4pc1dA7r3EydH92cpp26ozysw=
|
||||
20251107071420.sql h1:Q+e+OqjdiuK/sghDQ5NxjU+u2zYl+vh/eRBlUz9Idhg=
|
||||
20251107074318.sql h1:VbOWMw2rClEWgMnDSejXPqXkFoQ4odVsHn3/UAEiCYA=
|
||||
20251107075050.sql h1:ZZaKJEWXIJ94/0/2Gzzz+HXjmebEs5eP8iUIot26/c8=
|
||||
20251107080604.sql h1:aq+tINa0ULCZlJcUK2jaeGh6rRH4jJz3e2NrK47m0Ec=
|
||||
20251107081830.sql h1:Bl9kniyLWeMqd3nrvgCgiUpdcJWp8qX1F41JAM1WbiE=
|
||||
20251107091033.sql h1:ETTCaAHBT6wipXrEGXIepxLMdD2LNzprPAp99+jnW0w=
|
||||
20251107091209.sql h1:BUI9JlTzZxCdVHsrRbOye7m47AJEvXNhCaCVv/HzILs=
|
||||
20251107091541.sql h1:/tW2uXv/o0Q2E4lQzlYNgEftvDqjf3c2AQpZ83Vb6zc=
|
||||
|
||||
@@ -15,6 +15,7 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
Sort string `json:"sort"`
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
@@ -23,7 +24,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
type AuthPartner struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"size:50"`
|
||||
Name string `json:"name" gorm:"size:100"`
|
||||
Code string `json:"code" gorm:"unique;size:50"`
|
||||
Name string `json:"name" gorm:"unique;size:100"`
|
||||
SecretKey string `json:"secretKey" gorm:"size:255"`
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -32,17 +32,18 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
|
||||
@@ -14,7 +14,9 @@ type Device struct {
|
||||
Uom_Code string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" validate:"maxLength=15"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Infra_Id *uint16 `json:"-"` // for room
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" validate:"maxLength=15"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
Item_Code *string `json:"-"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Infra_Code *string `json:"infra_code"` // for room
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -32,24 +32,25 @@ type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup-code"`
|
||||
Parent_Id *uint16 `json:"parent-id"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Parent_Code *string `json:"parent-code"`
|
||||
Item_Id *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -63,10 +64,10 @@ type ResponseDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
Parent *Infra `json:"parent,omitempty"`
|
||||
Childrens []Infra `json:"childrens,omitempty"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
Rooms []erb.Basic `json:"rooms,omitempty"`
|
||||
}
|
||||
@@ -76,12 +77,12 @@ func (d Infra) ToResponse() ResponseDto {
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
InfraGroup_Code: d.InfraGroup_Code,
|
||||
Parent_Id: d.Parent_Id,
|
||||
Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
Rooms: d.Rooms,
|
||||
Parent_Code: d.Parent_Code,
|
||||
// Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
Rooms: d.Rooms,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -3,6 +3,7 @@ package infra
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ei "simrs-vx/internal/domain/main-entities/item"
|
||||
|
||||
erb "simrs-vx/internal/domain/main-entities/room/base"
|
||||
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
@@ -10,13 +11,13 @@ import (
|
||||
|
||||
type Infra struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Code string `json:"code" gorm:"uniqueIndex;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" gorm:"size:15"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent *Infra `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
||||
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
Rooms []erb.Basic `json:"rooms" gorm:"foreignKey:Infra_Id"`
|
||||
Parent_Code *string `json:"parent_code" gorm:"size:10"`
|
||||
Parent *Infra `json:"parent" gorm:"foreignKey:Parent_Code;references:Code"`
|
||||
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Code;references:Code"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Code;references:Code"`
|
||||
Rooms []erb.Basic `json:"rooms" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ type CreateDto struct {
|
||||
Name string `json:"name" validate:"maxLength=100"`
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code" validate:"maxLength=10"`
|
||||
Uom_Code *string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -27,23 +27,24 @@ type FilterDto struct {
|
||||
Name string `json:"name"`
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup-code"`
|
||||
Uom_Code *string `json:"uom-code"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -59,7 +60,7 @@ type ResponseDto struct {
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code"`
|
||||
Uom_Code *string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ func (d Item) ToResponse() ResponseDto {
|
||||
ItemGroup_Code: d.ItemGroup_Code,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Stock: d.Stock,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -14,6 +14,6 @@ type Item struct {
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code" gorm:"size:15"`
|
||||
Uom_Code *string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -24,28 +24,29 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom-code"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom-code"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -56,28 +57,28 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
}
|
||||
|
||||
func (d Material) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -14,8 +14,10 @@ type Material struct {
|
||||
Uom_Code string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ type CreateDto struct {
|
||||
MedicineMethod_Code *string `json:"medicineMethod_code" validate:"maxLength=10"`
|
||||
Uom_Code *string `json:"uom_code" validate:"maxLength=10"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -35,25 +35,26 @@ type FilterDto struct {
|
||||
MedicineMethod_Code *string `json:"medicineMethod-code"`
|
||||
Uom_Code *string `json:"uom-code"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Item_Code *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Code *uint `json:"item_code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -73,10 +74,10 @@ type ResponseDto struct {
|
||||
Uom_Code *string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *eit.Item `json:"item,omitempty"`
|
||||
}
|
||||
|
||||
@@ -91,10 +92,10 @@ func (d Medicine) ToResponse() ResponseDto {
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Dose: d.Dose,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Id: d.Item_Id,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -21,8 +21,10 @@ type Medicine struct {
|
||||
Uom *eu.Uom `json:"uom" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *eit.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,10 +22,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -49,26 +49,26 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra *ei.Infra `json:"infra,omitempty"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ei.Infra `json:"infra,omitempty"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
}
|
||||
|
||||
func (d Room) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra: d.Infra,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type Room struct {
|
||||
ebase.Basic
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id"`
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
}
|
||||
|
||||
+17
-13
@@ -1,4 +1,5 @@
|
||||
package extuser
|
||||
// FES = From External Source
|
||||
package userfes
|
||||
|
||||
import (
|
||||
// internal - domain - main-entities
|
||||
@@ -16,16 +17,19 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
Sort string `json:"sort"`
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Name *string `json:"name"`
|
||||
AuthPartner_Code *string `json:"authPartner_code"`
|
||||
User_Name *string `json:"user_name"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id uint `json:"id"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -45,27 +49,27 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Name string `json:"name"`
|
||||
AuthPartner_Code string `json:"authPartner_code"`
|
||||
AuthPartner *eap.AuthPartner `json:"authPartner,omitempty"`
|
||||
User_Name string `json:"user_name"`
|
||||
Name string `json:"name"`
|
||||
AuthPartner_Code string `json:"authPartner_code"`
|
||||
AuthPartner *eap.AuthPartner `json:"authPartner,omitempty"`
|
||||
User_Name string `json:"user_name"`
|
||||
}
|
||||
|
||||
func (d ExtUser) ToResponse() ResponseDto {
|
||||
func (d UserFes) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Name: d.Name,
|
||||
AuthPartner_Code: d.AuthPartner_Code,
|
||||
AuthPartner: d.AuthPartner,
|
||||
User_Name: d.User_Name,
|
||||
Name: d.Name,
|
||||
AuthPartner_Code: d.AuthPartner_Code,
|
||||
AuthPartner: d.AuthPartner,
|
||||
User_Name: d.User_Name,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []ExtUser) []ResponseDto {
|
||||
func ToResponseList(data []UserFes) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
package extuser
|
||||
// FES = From External Source
|
||||
package userfes
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
@@ -6,7 +7,7 @@ import (
|
||||
eau "simrs-vx/internal/domain/main-entities/user"
|
||||
)
|
||||
|
||||
type ExtUser struct {
|
||||
type UserFes struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Name string `json:"name" gorm:"size:100"`
|
||||
AuthPartner_Code string `json:"authPartner_code" gorm:"size:30"`
|
||||
@@ -25,6 +25,7 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
SCDetail SubjectCode = "detail" // Detail
|
||||
SCPrimaryComplain SubjectCode = "pri-complain" // Keluhan Utama
|
||||
SCSecComplain SubjectCode = "sec-complain" // Secondary Complaint
|
||||
SCCurrentDiseaseHistory SubjectCode = "cur-disea-hist" // Current Disease History
|
||||
@@ -35,6 +36,7 @@ const (
|
||||
SCMedicationHistory SubjectCode = "med-hist" // Medication History
|
||||
SCBloodType SubjectCode = "blood-type" // Blood Type
|
||||
|
||||
Detail ObjectCode = "detail" // Detail
|
||||
OCConsciousnessLevel ObjectCode = "consc-level" // Tingkat Kesadaran
|
||||
OCConsciousnessLevelDet ObjectCode = "consc-level-det" // Detail Tingkat Kesadaran
|
||||
OCSystolicBloodPressure ObjectCode = "syst-bp" // Tekanan Darah Systolic
|
||||
@@ -64,6 +66,7 @@ const (
|
||||
OCHeight ObjectCode = "height" // Tinggi Badan
|
||||
OCHeadToToe ObjectCode = "head-to-toe" // Kepala Sampai Kaki
|
||||
|
||||
ACDetail AssessmentCode = "detail" // Detail
|
||||
ACEarlyDiag AssessmentCode = "early-diag" // Diagnosis Awal
|
||||
ACLateDiag AssessmentCode = "late-diag" // Diagnosis Akhir
|
||||
ACSecDiag AssessmentCode = "sec-diag" // Diagnosis Sekunder
|
||||
@@ -194,7 +197,7 @@ type Soapi struct {
|
||||
|
||||
// ---------------- SUBJECT ----------------
|
||||
type SubjectSection struct {
|
||||
Note string `json:"note,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
PrimComplain string `json:"prim-compl,omitempty"`
|
||||
SecComplainQ string `json:"sec-compl,omitempty"`
|
||||
PrimaryComplain string `json:"pri-complain,omitempty"`
|
||||
@@ -210,7 +213,7 @@ type SubjectSection struct {
|
||||
|
||||
// ---------------- OBJECT ----------------
|
||||
type ObjectSection struct {
|
||||
Note string `json:"note,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
ConsciousnessLevel string `json:"consc-level,omitempty"`
|
||||
ConsciousnessLevelDet string `json:"consc-level-det,omitempty"`
|
||||
SystolicBloodPressure string `json:"syst-bp,omitempty"`
|
||||
@@ -243,9 +246,16 @@ type ObjectSection struct {
|
||||
|
||||
// ---------------- ASSESSMENT ----------------
|
||||
type AssessmentSection struct {
|
||||
EarlyDiagnosis DiagnosisDetail `json:"early-diag,omitempty"`
|
||||
LateDiagnosis DiagnosisDetail `json:"late-diag,omitempty"`
|
||||
SecondaryDiag DiagnosisDetail `json:"sec-diag,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
EarlyDiagnosis DiagnosisDetail `json:"early-diag,omitempty"`
|
||||
LateDiagnosis DiagnosisDetail `json:"late-diag,omitempty"`
|
||||
SecondaryDiag DiagnosisDetail `json:"sec-diag,omitempty"`
|
||||
EarlyDiagnosisMed DiagnosisDetail `json:"early-med-diag,omitempty"`
|
||||
LateDiagnosisMed DiagnosisDetail `json:"late-med-diag,omitempty"`
|
||||
SecondaryDiagnosisMed DiagnosisDetail `json:"sec-med-diag,omitempty"`
|
||||
EarlyDiagnosisFunc DiagnosisDetail `json:"early-func-diag,omitempty"`
|
||||
LateDiagnosisFunc DiagnosisDetail `json:"late-func-diag,omitempty"`
|
||||
SecondaryDiagnosisFunc DiagnosisDetail `json:"sec-func-diag,omitempty"`
|
||||
}
|
||||
|
||||
// nested object {note, codes}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
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) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
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) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ import (
|
||||
|
||||
/******************** actor ********************/
|
||||
|
||||
doctor "simrs-vx/internal/interface/main-handler/doctor"
|
||||
employee "simrs-vx/internal/interface/main-handler/employee"
|
||||
nurse "simrs-vx/internal/interface/main-handler/nurse"
|
||||
nutritionist "simrs-vx/internal/interface/main-handler/nutritionist"
|
||||
patient "simrs-vx/internal/interface/main-handler/patient"
|
||||
person "simrs-vx/internal/interface/main-handler/person"
|
||||
@@ -267,6 +269,8 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/person-contact", personcontact.O)
|
||||
hc.RegCrud(r, "/v1/person-insurance", personinsurance.O)
|
||||
hc.RegCrud(r, "/v1/employee", employee.O)
|
||||
hc.RegCrudByCode(r, "/v1/doctor", doctor.O)
|
||||
hc.RegCrudByCode(r, "/v1/nurse", nurse.O)
|
||||
hc.RegCrud(r, "/v1/nutritionist", nutritionist.O)
|
||||
hc.RegCrud(r, "/v1/pharmacist", pharmacist.O)
|
||||
hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{
|
||||
@@ -300,22 +304,22 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
|
||||
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/infra", infra.O)
|
||||
hc.RegCrud(r, "/v1/pharmacy-company", pharmacycompany.O)
|
||||
hc.RegCrud(r, "/v1/diagnose-src", diagnosesrc.O)
|
||||
hc.RegCrud(r, "/v1/procedure-src", proceduresrc.O)
|
||||
hc.RegCrud(r, "/v1/uom", uom.O)
|
||||
hc.RegCrud(r, "/v1/item", item.O)
|
||||
hc.RegCrudByCode(r, "/v1/item", item.O)
|
||||
hc.RegCrud(r, "/v1/item-price", itemprice.O)
|
||||
hc.RegCrud(r, "/v1/infra", infra.O)
|
||||
hc.RegCrud(r, "/v1/medicine-group", medicinegroup.O)
|
||||
hc.RegCrud(r, "/v1/medicine-method", medicinemethod.O)
|
||||
hc.RegCrud(r, "/v1/mcu-src-category", mcusrccategory.O)
|
||||
hc.RegCrud(r, "/v1/mcu-src", mcusrc.O)
|
||||
hc.RegCrud(r, "/v1/ethnic", ethnic.O)
|
||||
hc.RegCrud(r, "/v1/insurance-company", insurancecompany.O)
|
||||
hc.RegCrud(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrud(r, "/v1/device", device.O)
|
||||
hc.RegCrud(r, "/v1/material", material.O)
|
||||
hc.RegCrudByCode(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrudByCode(r, "/v1/device", device.O)
|
||||
hc.RegCrudByCode(r, "/v1/material", material.O)
|
||||
hc.RegCrud(r, "/v1/doctor-fee", doctorfee.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src", medicalactionsrc.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
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) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
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"
|
||||
authpartner "simrs-vx/internal/domain/main-entities/auth-partner"
|
||||
chemo "simrs-vx/internal/domain/main-entities/chemo"
|
||||
chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
||||
@@ -92,6 +93,7 @@ import (
|
||||
unitposition "simrs-vx/internal/domain/main-entities/unit-position"
|
||||
uom "simrs-vx/internal/domain/main-entities/uom"
|
||||
user "simrs-vx/internal/domain/main-entities/user"
|
||||
userfes "simrs-vx/internal/domain/main-entities/user-fes"
|
||||
vehicle "simrs-vx/internal/domain/main-entities/vehicle"
|
||||
vehiclehist "simrs-vx/internal/domain/main-entities/vehicle-hist"
|
||||
village "simrs-vx/internal/domain/main-entities/village"
|
||||
@@ -105,7 +107,9 @@ import (
|
||||
|
||||
func getMainEntities() []any {
|
||||
return []any{
|
||||
&authpartner.AuthPartner{},
|
||||
&user.User{},
|
||||
&userfes.UserFes{},
|
||||
&division.Division{},
|
||||
&divisionposition.DivisionPosition{},
|
||||
&installation.Installation{},
|
||||
|
||||
@@ -169,7 +169,7 @@ func ReadDetail(input e.ReadDetailDto) (*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.Device
|
||||
var err error
|
||||
|
||||
@@ -225,7 +225,7 @@ func Update(input e.UpdateDto) (*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.Device
|
||||
var err error
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Device) {
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.Uom_Code = inputSrc.Uom_Code
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -40,13 +40,13 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
Name: input.Name,
|
||||
ItemGroup_Code: ero.ITGCDevice,
|
||||
Uom_Code: &input.Uom_Code,
|
||||
Infra_Id: input.Infra_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -81,6 +81,13 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
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.First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
|
||||
@@ -52,7 +52,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM "Division" c
|
||||
WHERE c."Parent_Id" = "Division"."Id"
|
||||
WHERE c."Parent_Code" = "Division"."Code"
|
||||
)
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -38,12 +38,12 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
if input.InfraGroup_Code == ero.IFGCRoom {
|
||||
if input.Parent_Id == nil {
|
||||
if input.Parent_Code == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-create-fail",
|
||||
Detail: "parent_id is required",
|
||||
Raw: errors.New("parent_id is required"),
|
||||
Detail: "parent_code is required",
|
||||
Raw: errors.New("parent_code is required"),
|
||||
}
|
||||
return pl.SetLogError(&event, input)
|
||||
|
||||
@@ -59,7 +59,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
if input.InfraGroup_Code == ero.IFGCRoom {
|
||||
input.Infra_Id = &data.Id
|
||||
input.Infra_Code = &data.Code
|
||||
if err := createRoom(&input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Infra) {
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.InfraGroup_Code = inputSrc.InfraGroup_Code
|
||||
data.Parent_Id = inputSrc.Parent_Id
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Parent_Code = inputSrc.Parent_Code
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -42,23 +42,23 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
tmp := "unit"
|
||||
return &tmp
|
||||
}(),
|
||||
Infra_Id: input.Parent_Id,
|
||||
Infra_Code: input.Parent_Code,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
func createRoom(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
roomCreate := er.CreateDto{
|
||||
Infra_Id: input.Infra_Id,
|
||||
Unit_Id: input.Unit_Id,
|
||||
Specialist_Id: input.Specialist_Id,
|
||||
Subspecialist_Id: input.Subspecialist_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
Unit_Code: input.Unit_Code,
|
||||
Specialist_Code: input.Specialist_Code,
|
||||
Subspecialist_Code: input.Subspecialist_Code,
|
||||
}
|
||||
_, err := ur.CreateData(roomCreate, event, tx)
|
||||
if err != nil {
|
||||
|
||||
@@ -52,7 +52,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM "Infra" c
|
||||
WHERE c."Parent_Id" = "Infra"."Id"
|
||||
WHERE c."Parent_Code" = "Infra"."Code"
|
||||
)
|
||||
`)
|
||||
}
|
||||
@@ -91,6 +91,13 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", *input.Id)
|
||||
}
|
||||
|
||||
tx = tx.Preload("Parent").
|
||||
Preload("Childrens").
|
||||
Preload("Item").
|
||||
@@ -99,7 +106,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
Preload("Rooms.Subspecialist").
|
||||
Preload("Rooms.Unit")
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
@@ -119,7 +126,7 @@ func UpdateData(input e.UpdateDto, data *e.Infra, event *pl.Event, dbx ...*gorm.
|
||||
} else {
|
||||
tx = dg.I
|
||||
}
|
||||
data.Parent = nil
|
||||
// data.Parent = nil
|
||||
data.Childrens = nil
|
||||
data.Item = nil
|
||||
data.Rooms = nil
|
||||
|
||||
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*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.Item
|
||||
var err error
|
||||
|
||||
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*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.Item
|
||||
var err error
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Item) {
|
||||
data.Name = inputSrc.Name
|
||||
data.ItemGroup_Code = inputSrc.ItemGroup_Code
|
||||
data.Uom_Code = inputSrc.Uom_Code
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
data.Stock = inputSrc.Stock
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ func ReadDetail(input e.ReadDetailDto) (*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.Material
|
||||
var err error
|
||||
|
||||
@@ -225,7 +225,7 @@ func Update(input e.UpdateDto) (*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.Material
|
||||
var err error
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Material) {
|
||||
data.Name = inputSrc.Name
|
||||
data.Uom_Code = inputSrc.Uom_Code
|
||||
data.Stock = inputSrc.Stock
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -40,7 +40,7 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
Name: input.Name,
|
||||
ItemGroup_Code: ero.ITGCMaterial,
|
||||
Uom_Code: &input.Uom_Code,
|
||||
Infra_Id: input.Infra_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
Stock: input.Stock,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
@@ -48,6 +48,6 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ func ReadDetail(input e.ReadDetailDto) (*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.Medicine
|
||||
var err error
|
||||
|
||||
@@ -225,7 +225,7 @@ func Update(input e.UpdateDto) (*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.Medicine
|
||||
var err error
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Medicine) {
|
||||
data.MedicineMethod_Code = inputSrc.MedicineMethod_Code
|
||||
data.Uom_Code = inputSrc.Uom_Code
|
||||
data.Dose = inputSrc.Dose
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
data.Stock = inputSrc.Stock
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -44,7 +44,7 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
Name: input.Name,
|
||||
ItemGroup_Code: ero.ITGCMedicine,
|
||||
Uom_Code: input.Uom_Code,
|
||||
Infra_Id: input.Infra_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
Stock: input.Stock,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
@@ -52,6 +52,6 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -81,8 +81,15 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", *input.Id)
|
||||
}
|
||||
|
||||
tx = tx.Preload("Item")
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Room) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Unit_Id = inputSrc.Unit_Id
|
||||
data.Specialist_Id = inputSrc.Specialist_Id
|
||||
data.Subspecialist_Id = inputSrc.Subspecialist_Id
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
data.Unit_Code = inputSrc.Unit_Code
|
||||
data.Specialist_Code = inputSrc.Specialist_Code
|
||||
data.Subspecialist_Code = inputSrc.Subspecialist_Code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user